[R] accessing members of a list

Pascal Oettli kridox at ymail.com
Fri Mar 28 06:49:24 CET 2014


Hello,

Your example leads to error. Anyway:

library(XML)
oneurl="http://www.tutiempo.net/en/Climate/FUKUSHIMA/11-2012/475950.htm"
temp.tables=readHTMLTable(oneurl, header=TRUE)

temp.tables <- temp.tables[[3]]
temp.tables <- temp.tables[1:30,]

HTH,
Pascal


On Fri, Mar 28, 2014 at 2:42 PM, Bill <william108 at gmail.com> wrote:
> 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.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan




More information about the R-help mailing list