I would prefer version 1.
Version to creates a global variable R which you do not really need
since it contains the same values as d$r.
In option 2, you should probably remove the variable r itself
after it has been appended to d.
On 4/18/2010 5:23 PM, Laura Ferrero-Miliani wrote:
> Thanks for co
Thank you so much all!
How a simple problem can get complicated by not having enough
knowledge, but hopefully I am learning
Have a great Sunday!
L
On Sun, Apr 18, 2010 at 4:56 PM, jim holtman wrote:
> You are working with a matrix, so the "$" operator is not allowed (e.g.,
> d$c).
>
> Also in
Hey Laura,
Just to add a cautionary note, in
> a <- c(1:4)
> b <- c("meep", "foo", "meep", "foo")
> d <- cbind(a, b)
d is a matrix and will only be one type of matrix. Since you have
both integer (a) and character (b) data, it has to be at the character
level. From the help for cbind:
"The t
You are working with a matrix, so the "$" operator is not allowed (e.g.,
d$c).
Also in your test, you have to test against the second column (e.g., d[i,
2])
try this:
> a <- c(1:4)
> b <- c("meep", "foo", "meep", "foo")
> d <- cbind(a, b)
>
>
> for(i in seq(along=d[,2])) {if (d[i,2]=="meep") { p
Hello,
I am very new to R and data analysis in general.
I am trying to generate values to append to my data frame using
conditional statements.
I am playing with this simple example:
a <- c(1:4)
b <- c("meep", "foo", "meep", "foo")
d <- cbind(a, b)
now what I want to do is , each time there is a
5 matches
Mail list logo