Dear all and thanks in advance for helping me with a rather stupid question:
I imported a data set ("freqg") into R consisting of 14 variables. Now a want to compute a variable and add it in an additional column to my data frame. The value of this new variable ("condition") depends on the values of two other variables ("mat" and "flank") already included in the data frame.
For example:
if mat=1 and flank=1 -> condition=1
if mat=2 and flank=1 -> condition=2
...

What I got is this code, which doesn't really work (it results in a new column called "condition" which takes only the value "TRUE"):

freqg<-transform(freqg,condition=(mat=1)&(flank=1))

Thanks in advance and kind regards!

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to