error in running R
4
0
Entering edit mode
8.5 years ago
zizigolu ★ 4.3k

Sorry,

How I can make my datasets numeric?

mim <- build.mim(mycounts,estimator="spearman")
Error in cor(dataset, method = estimator, use = "complete.obs") :
  'x' must be numeric
R software-error • 4.1k views
ADD COMMENT
1
Entering edit mode
8.3 years ago
zizigolu ★ 4.3k

I did like below

# read as matrix
as.matrix(mycounts)
# viewing mycounts class
class(mycounts)
# setting as numeric
sapply(mycounts, class)
ADD COMMENT
3
Entering edit mode
8.5 years ago
apelin20 ▴ 480
head(mycounts)

output please. Try

mim <- build.mim(as.numeric(mycounts),estimator="spearman")
ADD COMMENT
3
Entering edit mode
8.5 years ago
Shicheng Guo ★ 9.4k
mim <- build.mim(data.matrix(mycounts),estimator="spearman")
ADD COMMENT
1
Entering edit mode
8.5 years ago
ebrown1955 ▴ 320

Do you have row/column names in mycounts? If so, change these to headers and row.names.

Otherwise, try:

as.numeric(mycounts)

instead of just mycounts as suggested above.

ADD COMMENT
0
Entering edit mode

thank you,

I tried,

mycounts <- as.matrix(read.table("file.txt", sep="\t", header=TRUE))

then

res_aracne <- build.mim(mycounts,estimator = "spearman")

also

mim <- build.mim(as.numeric(mycounts),estimator="spearman")

and

mim <- build.mim(data.matrix(mycounts),estimator="spearman")
as.numeric(mycounts)

but all the same error

ADD REPLY
0
Entering edit mode

Can you provide the output of:

head(mycounts)

So we can see what R is seeing?

ADD REPLY
0
Entering edit mode

thank u

ADD REPLY
0
Entering edit mode

These values include alphanumeric characters. This function only accepts numbers. You can only input a dataset of numeric values.

ADD REPLY
0
Entering edit mode

these are rows name

ADD REPLY
0
Entering edit mode

exactly. so what's the result of

dim(my counts)
ADD REPLY

Login before adding your answer.

Traffic: 2288 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6