> for( frame in ls(env=mydfs) ) {
+ mydfs[[frame]]$ResultValue <- as.numeric( mydfs[[frame]]$ResultValue )
+ }
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Sarah Henderson
Sent: Thursday, July 28, 2011 5:09 PM
To: R List
On 29/07/11 11:09, Sarah Henderson wrote:
Greetings to all --
I am having a silly problem that I just can't solve. Someone has given me
an .RData file will hundreds of data frames. Each data frame has a column
named ResultValue, currently character when it should be numeric. I want to
loop th
Thanks for the explainable, Denes. Your solution worked a charm. I should
have seen things more clearly, but sometimes I just get stuck in a rut.
The help of this list is always appreciated -- such a fantastic resource.
Cheers,
Sarah
2011/7/28 "Dénes TÃTH"
>
> Sorry, I was wrong. Of cou
Sorry, I was wrong. Of course you can assign a variable to itself, but it
does not make much sense...
What you misunderstood was that in the assignment you assign the data
frame (e.g. "df1") to itself. You do not modify the frame object which
remains a character string.
>
> The problem is that y
The problem is that you can not assign a variable to itself.
rm(list=ls())
df1 <- data.frame(ResultValue=as.character(1:5))
df2 <- data.frame(ResultValue=as.character(1:10))
frames = ls()
for (frame in frames){
temp <- get(frame)
temp[,"ResultValue"] = as.numeric(temp[,"ResultValue"])
Greetings to all --
I am having a silly problem that I just can't solve. Someone has given me
an .RData file will hundreds of data frames. Each data frame has a column
named ResultValue, currently character when it should be numeric. I want to
loop through all of the data frames to change the v
6 matches
Mail list logo