[R] Replacing values in a dataframe depending on several conditions

2013-05-10 Thread KatrinH Heimann
Dear all, I would like to replace some values in a dataframe (including the columns Action, Interval and Artificiality) depending on a combination of different conditions the command I tried is for (j in 1:nrow(data)) { if ((data[j,data$Action]=="s") & (data[j,data$Interval]=="l") & (data[j,da

[R] subsetting dataframe multiple conditions

2013-05-09 Thread KatrinH Heimann
Dear all, I would like to subset a dataframe using multiple conditions. So if I have two columns 1 and 2, I would like to EXCLUDE all rows in which the value of column 1 is "a" AND the value of column 2 is "b". I tried data[(data$column1 != "a" & data$column2 != "b"),] but that deletes me every row