error in running R
4
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.4k views
•
link
updated 2.3 years ago by
Ram
44k
•
written 9.1 years ago by
zizigolu
★
4.3k
I did like below
# read as matrix
as.matrix(mycounts)
# viewing mycounts class
class(mycounts)
# setting as numeric
sapply(mycounts, class)
•
link
updated 5.5 years ago by
Ram
44k
•
written 8.9 years ago by
zizigolu
★
4.3k
head(mycounts)
output please. Try
mim <- build.mim(as.numeric(mycounts),estimator="spearman")
•
link
updated 5.5 years ago by
Ram
44k
•
written 9.1 years ago by
apelin20
▴
480
mim <- build.mim(data.matrix(mycounts),estimator="spearman")
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.
•
link
updated 5.5 years ago by
Ram
44k
•
written 9.1 years ago by
ebrown1955
▴
320
Login before adding your answer.
Traffic: 1676 users visited in the last hour
thank you,
I tried,
then
also
and
but all the same error
Can you provide the output of:
So we can see what R is seeing?
thank u
These values include alphanumeric characters. This function only accepts numbers. You can only input a dataset of numeric values.
these are rows name
exactly. so what's the result of