Skip to content
Prev 120584 / 398498 Next

df manipulation

Hi, see below:
index value
1     1     1
2     4     6
3     7     4
4     9     5
5    11     3
6    13     2
+     index <- ifelse(x %in% df$index, df$value[which(df$index %in% x)], NA)
+     return(index)
+ }
index value
1      1     1
2      2    NA
3      3    NA
4      4     6
5      5    NA
6      6    NA
7      7     4
8      8    NA
9      9     5
10    10    NA
11    11     3
12    12    NA
13    13     2