Re: [R] accessing members of a list

2014-03-28 Thread Rui Barradas
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) st

Re: [R] accessing members of a list

2014-03-28 Thread Rui Barradas
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

Re: [R] accessing members of a list

2014-03-28 Thread Pascal Oettli
Hello, You are right, the "which" option avoid the selection in my example. Also, I think ?"[[" might be helpful for you. Regards. Pascal On Fri, Mar 28, 2014 at 3:02 PM, Bill wrote: > Hi. I found that this works: > tt=readHTMLTable(url,header=TRUE, as.data.frame=TRUE,which=c(3)) > tt[1,] > I

Re: [R] accessing members of a list

2014-03-27 Thread Pascal Oettli
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

[R] accessing members of a list

2014-03-27 Thread Bill
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: or remove the names of the columns (or change them). DayT TM Tm SLPHPP VVV VM VG RA SN TS

Re: [R] accessing members from a data frame

2011-02-10 Thread Phil Spector
Try my.data.frame[my.data.frame$Buy==1 | my.data.frame$Sell ==1, ] or subset(my.data.frame,buy == 1 | sell == 1) Then take a look at the help page for || i.e., help("||") to see what you did wrong. - Phil Spector

[R] accessing members from a data frame

2011-02-10 Thread Kushan Thakkar
I have a data frame with the following columns: Date Price Buy Sell The Buy and Sell variables are binary. They are either zero or 1. Additionally, they are mutually exclusive. Either Buy is 1, Sell is 1 or they are both 0. But they are never both 1 for a given observation. I want to see observa

Re: [R] Accessing members

2009-12-28 Thread Nick Torenvliet
Thanks everyone... the as.character(fileLines[1][1]) solution worked well... Factors??? the treatment is so far away from what I know. Cool though... On Mon, Dec 28, 2009 at 8:55 PM, David Winsemius wrote: > > On Dec 28, 2009, at 5:14 PM, Nick Torenvliet wrote: > > Consider the following

Re: [R] Accessing members

2009-12-28 Thread David Winsemius
On Dec 28, 2009, at 5:14 PM, Nick Torenvliet wrote: Consider the following fileLines V1 V2V3V4 V5 V6V7 V8 1 AB 20091224 156.0 156.0 154.00 154.0055 1198 2 AB.C 20091224 156.0 156.0 156.00 156.00 0 0 3 ABF10 20091224 156.0 156.0 156

Re: [R] Accessing members

2009-12-28 Thread GlenB
This is a result of how R treats factors. There's more than one way to do what I think you're asking for. I've constructed a smaller version of your data frame to illustrate one quick way if that's all you need: > smdat<- > data.frame(V1=c("AB","AB.C","ABF10"),V2=rep("20091224",3),V3=rep(156.0

Re: [R] accessing members of a data.frame

2009-12-28 Thread jim holtman
?read.csv On Mon, Dec 28, 2009 at 5:31 PM, Nick Torenvliet wrote: > I have the following code > > fileList <-list.files(path = ".", pattern = "[^a-z].txt$", all.files = > FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE) > for (x in 1:length(fileList)){ >fileLines <- data.fra

Re: [R] Accessing members

2009-12-28 Thread Thomas S. Dye
Hi Nick, Your first column is being stored as a factor. You can either take care when creating the matrix to keep the values in this column as characters, or you might want to convert the result using as.character(). HTH, Tom On Dec 28, 2009, at 1:14 PM, Nick Torenvliet wrote: Conside

[R] Accessing members

2009-12-28 Thread Nick Torenvliet
Consider the following > fileLines V1 V2V3V4 V5 V6V7 V8 1 AB 20091224 156.0 156.0 154.00 154.0055 1198 2 AB.C 20091224 156.0 156.0 156.00 156.00 0 0 3 ABF10 20091224 156.0 156.0 156.00 156.0055444 4 ABH10 20091224 156.0 156.0 1

[R] accessing members of a data.frame

2009-12-28 Thread Nick Torenvliet
I have the following code fileList <-list.files(path = ".", pattern = "[^a-z].txt$", all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE) for (x in 1:length(fileList)){ fileLines <- data.frame(read.table(fileList[x])) print(string) } the lines of the file all hav