Skip to content
Prev 295212 / 398502 Next

problem with data frame to numeric transformation

Hello,

You need to tell read.table that the table has headers.


# needed 'header=TRUE'
first <- read.table("RESIDSNEWr.csv", sep=";", quote="\"",
header=TRUE)[c(1)]
second <- read.table("RESIDSNEWr.csv", sep=";", quote="\"",
header=TRUE)[c(2)]
# see what they look like
str(first)
str(second)

is.numeric(first) ## FALSE
is.numeric(second) ## FALSE

is.numeric(first$aaa) ## TRUE
is.numeric(second$bbb) ## TRUE
# general purpose
sapply(first, is.numeric)
sapply(second, is.numeric)


And the rest works at the first try.
bbb
aaa 4.420256
Progress will be displayed every 100 iterations.
Iteration 100 
[...etc...]
Iteration 1000
[1] 0.0004995005


Hope this helps,

Rui Barradas

Ivette wrote
--
View this message in context: http://r.789695.n4.nabble.com/problem-with-data-frame-to-numeric-transformation-tp4630788p4630803.html
Sent from the R help mailing list archive at Nabble.com.