My first question, thanks for any help you can offer.
Problem: I want to delete all rows of a certain category if one of the rows has a certain value in another column (similar to the problems in the links below). However, the main difference is that I would like it to work only if it meets the criteria in another column.
Practice df
prac_df <- data_frame(
subj = rep(1:4, each = 4),
trial = rep(rep(1:4, each = 2), times = 2),
ias = rep(c('A', 'B'), times = 8),
fixations = c(17, 14, 0, 0, 15, 0, 8, 6, 3, 2, 3,3, 23, 2, 3,3)
)
So my data frame is as follows.
subj ias fixations
1 1 A 17
2 1 B 14
3 2 A 0
4 2 B 0
5 3 A 15
6 3 B 0
7 4 A 8
8 4 B 6
And I want to delete the whole item 2, because it has a value of 0 for the commit column in the row that has the value A. However, I want to do this without removing topic 3, because although there is 0 it is in the row where the ias column matters B.
My attempt so far.
new.df <- prac_df[with(prac_df, ave(prac_df$fixations != 0, subj, FUN = all)),]
, , A ias. , , , , , .
- df .
subj ias fixations
1 1 A 17
2 1 B 14
3 3 A 15
4 3 B 0
5 4 A 8
6 4 B 6
!
:
R:
, , R?