[R] reading data from a web

Alemu Tadesse alemu.tadesse at gmail.com
Wed Oct 29 20:20:59 CET 2014


Dear All,

I have data of the format shown in the link
http://www.data.jma.go.jp/gmd/env/data/radiation/data/geppo/201004/DR201004_sap.txt
 that I need to read. I have downloaded all the data from the link and I
have it on my computer. I used the following script (got it from web) and
was able to read the data. But, it is not in the format that I wanted it to
be. I want it a data frame and clean numbers.
asNumeric <- function(x) as.numeric(as.character(x))
factorsNumeric <- function(data) modifyList(data, lapply(data[,
sapply(data, is.logical)],asNumeric))

data=read.fwf(filename, widths=c(c1),skip=18, header=FALSE)
data$V2<-as.numeric(gsub(" ","", as.character(data$V2) , fixed=TRUE))
f <- factorsNumeric(data)

Any help is appreciated.

Best,

Alemu

	[[alternative HTML version deleted]]



More information about the R-help mailing list