[R] Data read as labels

David Winsemius dwinsemius at comcast.net
Mon May 14 16:39:29 CEST 2012


On May 14, 2012, at 5:33 AM, 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])
>

If dec="," then you probably need read.csv2()

(Since dec="," is the default I would remove that argument from the  
call. It seemed to succeed )

file<-read.csv2(tmp,sep=";", skip="5")
(relevant<-file[,2][1])
[1] 10716,05
496 Levels: 10323,52 10391,38 10716,05 10929,62 11051,23 11329,50  
11380,11 ... Methodik: Ab Januar 1993 einschl. der Zuschätzungen für  
nichtmelde- pflichtigen Außenhandel, die bis Dezember 1992 in den  
Ergänzungen zum Außenhandel enthalten sind.


-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list