[R] accessing members of a list

Rui Barradas ruipbarradas at sapo.pt
Fri Mar 28 12:36:34 CET 2014


Sorry, that should be

temp.tables <- temp.tables[-(31:32),]

Rui Barradas

Em 28-03-2014 10:58, Rui Barradas escreveu:
> Hello,
>
> Maybe the following will help.
>
>
>
> library(XML)
> oneurl="http://www.tutiempo.net/en/Climate/FUKUSHIMA/11-2012/475950.htm"
> temp.tables=readHTMLTable(oneurl, which = 3)
>
> str(temp.tables)
>
> temp.tables <- temp.tables[-31,]
> temp.tables[,1:10] <- lapply(temp.tables[,1:10], function(x)
> as.numeric(as.character(x)))
>
> str(temp.tables)
>
>
> Hope this helps,
>
> Rui Barradas
>
> Em 28-03-2014 05:42, Bill escreveu:
>> Hi. I ran some code and I am trying to access the table with the data in
>> it. I want in particular to delete the 31st row for example
>> Monthly means and totals: <NA> <NA> <NA>   <NA> <NA>  <NA> <NA> <NA> <NA>
>> <NA> <NA> <NA> <NA>
>> or remove the names of the columns (or change them). Day    T   TM   Tm
>>   SLP    H    PP   VV    V   VM   VG   RA   SN   TS
>>
>> I tried all sorts of things but they don't give me access:
>>
>> library(XML)
>> oneurl="http://www.tutiempo.net/en/Climate/FUKUSHIMA/11-2012/475950.htm"
>> allFuku=data.frame() #need to initialize it with column names
>> temp.tables=readHTMLTable(url)
>>
>> temp.tables[3][2]
>> temp.tables[3]
>> temp.tables[3][3]
>> temp.tables[3][2,]
>> str(temp.tables[3])
>> temp.tables[3][2,2]
>> dim(temp.tables[3])
>> temp.tables[3]$SN
>> temp.tables[3][1]
>> temp.tables[3][1][2,]
>> str(temp.tables[3][1])
>> temp.tables[3][1]$SN
>>   temp.tables[3][1][1][2,]
>>
>>     [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at 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.
>>
>
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list