PDA

View Full Version : error in loading data in R



laurencevo
06-25-2009, 07:51 AM
Hi,

I just started to work with R and I am trying to load excel data into a special R package called iTRAQPak with:
>LoadData("C:\\Laurence\\Rstatisticalanalysis.xls", mod.eval = F, sep = "\t", tags.s1 = c(113, 115, 118, 119), tags.s2 = c(114, 116, 117, 121))

Then I receive this error message:
Error in 1:dim(dat)[1] : NA/NaN argument
In addition: Warning message:
In read.table(file = file, sep = sep, header = T) :
incomplete final line found by readTableHeader on 'C:\Laurence\Rstatisticalanalysis.xls'

I looked for the meaning and solving of this error in different manuals, but I can't find anything. Could someone help me with this?

Thanks a lot!

TheEcologist
06-25-2009, 08:11 AM
Hi,

I just started to work with R and I am trying to load excel data into a special R package called iTRAQPak with:
>LoadData("C:\\Laurence\\Rstatisticalanalysis.xls", mod.eval = F, sep = "\t", tags.s1 = c(113, 115, 118, 119), tags.s2 = c(114, 116, 117, 121))

Then I receive this error message:
Error in 1:dim(dat)[1] : NA/NaN argument
In addition: Warning message:
In read.table(file = file, sep = sep, header = T) :
incomplete final line found by readTableHeader on 'C:\Laurence\Rstatisticalanalysis.xls'

I looked for the meaning and solving of this error in different manuals, but I can't find anything. Could someone help me with this?

Thanks a lot!

some common mistakes:

You have to make sure there are no empty entries. Fill them with the text 'NA'. Secondly make sure every label you have does not have any spaces in them. Example: if you have a column name like this 'UTM coordinate x' it will work fine in excel but not in the more precise R. You will need to change this to 'UTM.coordinate.x' or similar.

then copy paste your data field and then type this in R.

mydataname=read.table('clipboard',header=T)

or save your datasheet as a .csv file and type:

mydataname=read.csv(file.choose())

or depending on if you are from the states or not:

mydataname=read.csv2(file.choose()) #this is when csv files are semicolon seperated.

good luck,