[R] read dataset in R language.

Phil Spector spector at stat.berkeley.edu
Tue Dec 15 23:05:14 CET 2009


Nancy -
    The separator in these files is the comma, not the semicolon.
Try

train = read.csv('trainingset.txt',check.names=FALSE)
test = read.csv('testset.txt',check.names=FALSE)

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu



On Tue, 15 Dec 2009, Nancy Adam wrote:

>
>
> Hi all,Thanks for your reply. Sorry I did not send sufficient information about my problem…I attach the two datasets that I’m trying to read and these are my attempts to read them:1)#train <- read.table("trainingset.txt", header=TRUE, sep=";" ,fill=TRUE) #test <- read.table("testset.txt", header=TRUE, sep=";" , fill=TRUE)its error message is:
> “ undefined columns selected”2)train <- scan("trainingset.txt",  sep=";" ,fill=TRUE) test <- scan("testset.txt", sep=";" , fill=TRUE)
>
> its error message is:
> “  'names' attribute [172] must be the same length as the vector [152]”
>
> many thanks,
> Nancy
> _________________________________________________________________
>
>


More information about the R-help mailing list