Re: [R] How to convert factors to numbers

2012-03-24 Thread sandro
Thanks Natasha, Rainer and David. Your support allow me to solve the issue with the factor number. Sincerely Sandro -- View this message in context: http://r.789695.n4.nabble.com/How-to-convert-factors-to-numbers-tp4498828p4501727.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] How to convert factors to numbers

2012-03-24 Thread Rainer Schuermann
I guess the problem starts with setting read.table(...dec = ",", ... ). The data in your file are with decimal point. Without that, it works just fine: > f <- "http://r.789695.n4.nabble.com/file/n4498828/p_diarios.txt"; > df <- read.table( f, header = TRUE ) > log.Price <- log(df$price) > he

Re: [R] How to convert factors to numbers

2012-03-23 Thread Natasha Stavros
As.numeric(as.character(factor.level.to.convert)) On Mar 23, 2012 11:40 AM, "sandro" wrote: > Hello, I am relatively new to using R. > > The text file contains the date and price . I want to read and manipulate > the data in R. However, when I use read.table, it treats all of the data > as > "f

Re: [R] How to convert factors to numbers

2012-03-23 Thread David Winsemius
On Mar 23, 2012, at 9:38 AM, sandro wrote: Hello, I am relatively new to using R. The text file contains the date and price . I want to read and manipulate the data in R. However, when I use read.table, it treats all of the data as "factors" and I do not know how to treat the data as nu

Re: [R] How to convert factors to numbers

2012-03-23 Thread Uwe Ligges
On 23.03.2012 15:31, chuck.01 wrote: Using your posed data, the variable price was numeric: data.precios<- read.table("http://r.789695.n4.nabble.com/file/n4498828/p_diarios.txt";, header=T) str(data.precios) 'data.frame': 1996 obs. of 2 variables: $ time : int 37988 37991 37993 37994 37

Re: [R] How to convert factors to numbers

2012-03-23 Thread chuck.01
Using your posed data, the variable price was numeric: data.precios <- read.table("http://r.789695.n4.nabble.com/file/n4498828/p_diarios.txt";, header=T) str(data.precios) 'data.frame': 1996 obs. of 2 variables: $ time : int 37988 37991 37993 37994 37995 37998 37999 38000 38001 38002 ... $

[R] How to convert factors to numbers

2012-03-23 Thread sandro
Hello, I am relatively new to using R. The text file contains the date and price . I want to read and manipulate the data in R. However, when I use read.table, it treats all of the data as "factors" and I do not know how to treat the data as numbers: http://r.789695.n4.nabble.com/file/n4498828/

Re: [R] how to convert factors to numbers

2008-12-14 Thread Gabor Grothendieck
Also you might want to use read.zoo from the zoo package which will read the file in and will convert the dates at the same time into a zoo object. Something like: library(zoo) z <- read.zoo("myfile.csv", header = TRUE, sep = ",", format = "%m/%d/%Y") Or rather than creating files you may wish to

Re: [R] how to convert factors to numbers

2008-12-14 Thread Duncan Murdoch
On 14/12/2008 12:38 PM, doloop wrote: Hello, I am relatively new to using R. I am using R version 2.8.0. I have a program that downloads stock data from Yahoo! Finance and stores it to a text file on my hard drive. The text file contains the date, opening price, high price, low price, closing

[R] how to convert factors to numbers

2008-12-14 Thread doloop
Hello, I am relatively new to using R. I am using R version 2.8.0. I have a program that downloads stock data from Yahoo! Finance and stores it to a text file on my hard drive. The text file contains the date, opening price, high price, low price, closing price, volume and adjusted price (i.e.,