我正在努力完成这项理应很简单的任务:
updated df:个 我有这个数据框:
df<- structure(list(Species = c("setosa", "not_setosa", "setosa",
"setosa", "setosa", "setosa"), index = c(4L, 3L, 2L, 5L, 1L,
3L)), class = "data.frame", row.names = c("1", "2", "3", "4",
"5", "6"))
Species index
1 setosa 4
2 not_setosa 3
3 setosa 2
4 setosa 5
5 setosa 1
6 setosa 3
这个向量是:
my_vector <- c("one", "two", "three", "four", "five", "six")
[1] "one" "two" "three" "four" "five" "six"
一百零二
预期输出:
Species index
1 setosa four
2 not_setosa three
3 setosa two
4 setosa five
5 setosa one
6 setosa three
我try 了which
和match
的许多变化,但没有结束.我也try 了一些因素,但没有成功.