Hi guys,
I'm new to R and I'm really close to throwing my cpu in a lake...
I just can't seem to get the kmeans script to run on my data, using R.
I really hope you can help me on this.. I have a tab delimited text file with the first column being the nam of the genes, and the two following columns are expression data.
Ex:
TPM3 0.014 0.683
TFF1 4.5 3.567
....
While in R, i do the following:
> data<-read.table("file path to the data", row.names=1)
> datam<-as.matrix(data)
>k<-kmeans(datam, 3)
and then I have that *&/%/$ error :
Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message:
In kmeans(datam, 3) : NAs introduced by coercion
I've been searching the web for the anwser a lot, and I couldn't find how to fix it. I tried loading a .csv instead of a .txt, but nothing works. From what I have read, it seems that the problem is that there are some blank spaces in my file. But even if I do the
> datak<-na.omit(datam)
> k<-kmeans(datak, 3)
I get the same error..
Please help me!!!
Phil
I'm new to R and I'm really close to throwing my cpu in a lake...
I just can't seem to get the kmeans script to run on my data, using R.
I really hope you can help me on this.. I have a tab delimited text file with the first column being the nam of the genes, and the two following columns are expression data.
Ex:
TPM3 0.014 0.683
TFF1 4.5 3.567
....
While in R, i do the following:
> data<-read.table("file path to the data", row.names=1)
> datam<-as.matrix(data)
>k<-kmeans(datam, 3)
and then I have that *&/%/$ error :
Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message:
In kmeans(datam, 3) : NAs introduced by coercion
I've been searching the web for the anwser a lot, and I couldn't find how to fix it. I tried loading a .csv instead of a .txt, but nothing works. From what I have read, it seems that the problem is that there are some blank spaces in my file. But even if I do the
> datak<-na.omit(datam)
> k<-kmeans(datak, 3)
I get the same error..
Please help me!!!
Phil
Comment