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
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.
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
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)],
-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
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
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
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
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
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
10 matches
Mail list logo