Data read as labels
On Mon, May 14, 2012, at 02:33, barb wrote:
Hey guys, i have a strange problem reading a .csv file. Seems not to be covered by the usual read.csv techniques. The relevant data i want to use, seems to be saved as the label of the data point. Therefore i can not really use it spec<-"EU2001" part1<-"http://www.bundesbank.de/statistik/statistik_zeitreihen_download.php?func=directcsv&from=&until=&filename=bbk_" part2<-"&csvformat=de&euro=mixed&tr=" tmp<-tempfile() load<-paste(part1,spec,part2,spec,sep="") download.file(load,tmp) file<-read.csv(tmp,sep=";",dec=",", skip="5") (relevant<-file[,2][1])
It seems to me that there is a problem with conversion from data to
known type - the last two lines contains comments instead of data and
first column type is not recognized. You can supress all conversions,
remove problematic lines and then make conversion manually or import
only relevant lines and specify types. For example:
file<-read.csv(tmp, sep=";",
dec=",",skip=5,header=FALSE,nrows=495,colClasses=c("character","numeric","NULL","NULL"))
Z pozdrowieniami, Krzysztof Mitko