Re: [R] as.integer

2010-06-08 Thread aledanda
probelm solved: data - read.table(pdvspt.txt, header = T, dec = ,) It was the coma, now I have everything in numeric. Thanks a lot for the support! Ale -- View this message in context: http://r.789695.n4.nabble.com/as-integer-tp2245987p2246989.html Sent from the R help mailing list archive

Re: [R] as.integer

2010-06-08 Thread aledanda
Hi, thanks for your reply. I attached the example. I tried your suggestion: data[is.factor(data)] - lapply(data[is.factor(data)], function(x) as.numeric(as.character(x))) But I still have the var as factors. I'm thinking now, in the txt file the decimals numbers are separated with a coma.

[R] as.integer

2010-06-07 Thread aledanda
Hi, Is there a way to recursively change the variables imported with read.table(..) - and then attached with attach(..) - from as.factor to as.integer? I have about 9 variables that are now recognized as factors but I need to do statistics on them so I need to change them in as.integer. It

Re: [R] as.integer

2010-06-07 Thread Erik Iverson
1) Give us a reproducible example. 2) You probably don't want to use attach. 3) Yes there is a way, but without an example, it's hard to say what will work. Assume a data.frame called df, maybe something like the following, which is untested... df[is.factor(df)] - lapply(df[is.factor(df)],

Re: [R] as.integer

2010-06-07 Thread Greg Snow
-help@r-project.org Subject: [R] as.integer Hi, Is there a way to recursively change the variables imported with read.table(..) - and then attached with attach(..) - from as.factor to as.integer? I have about 9 variables that are now recognized as factors but I need to do statistics

[R] as.integer and indexes error

2010-03-11 Thread Lilia Leticia Ramírez Ramírez
Hello All, I would like to report the following bug or maybe you can explain if I am wrong. I am sampling from two different populations with weights. The two populations have the same age groups and I want to distinguish where I am sampling from. That is why I am using a matrix such as: matrix

Re: [R] as.integer and indexes error

2010-03-11 Thread jim holtman
FAQ 7.31 2010/3/11 Lilia Leticia Ramírez Ramírez llramirezrami...@gmail.com Hello All, I would like to report the following bug or maybe you can explain if I am wrong. I am sampling from two different populations with weights. The two populations have the same age groups and I want to

Re: [R] as.integer and indexes error

2010-03-11 Thread jim holtman
another way: x - c(1.1,2.1,3.1,4.1,5.1) as.integer((x - round(x)) * 10) [1] 1 1 1 0 0 as.integer((10 * x - round(10 * x, -1))) [1] 1 1 1 1 1 2010/3/11 Lilia Leticia Ramírez Ramírez llramirezrami...@gmail.com Hello All, I would like to report the following bug or maybe you can explain if

Re: [R] as.integer question

2008-01-17 Thread Erin Hodgess
Thanks to all! This is really helpful! Sincerely, Erin On Jan 17, 2008 12:00 PM, Marc Schwartz [EMAIL PROTECTED] wrote: Erin Hodgess wrote: Hi R People: I'm reading Statistical Computing with R, by Maria Rizzo, and it's really good. Anyhow, I have a question about something in

Re: [R] as.integer question

2008-01-17 Thread Marc Schwartz
Erin Hodgess wrote: Hi R People: I'm reading Statistical Computing with R, by Maria Rizzo, and it's really good. Anyhow, I have a question about something in there. u- runif(5) u [1] 0.1177041 0.4271790 0.4601597 0.2204846 0.4051473 #in the book sum(as.integer(u 0.4)) [1] 3 #what I