> -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Nancy Adam > Sent: Tuesday, December 15, 2009 1:24 PM > To: r-help@r-project.org > Subject: Re: [R] read dataset in R language. > > > > 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
Nancy, I took a quick look at your training set data file and I see a couple of problems. 1. You have some name fields that aren't legal names in the header. 2. It appears that you have more variable names in your header than you have data fields on each line. These issues will need to be cleaned up before you can read the file. Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.