0
更換山坳名和行值我有一個數據幀:使用外部列表
dput(df1)
structure(list(column1 = structure(1:2, .Label = c("text1", "text3"
), class = "factor"), column2 = structure(c(2L, 1L), .Label = c("text1",
"text2"), class = "factor")), .Names = c("column1", "column2"
), class = "data.frame", row.names = c(NA, -2L))
而且我想更換電池的基礎列表中的值:
dput(df2)
structure(list(current_values = structure(1:5, .Label = c("column1",
"column2", "text1", "text2", "text3"), class = "factor"), new_values = structure(1:5, .Label = c("c1",
"c2", "t1", "t2", "t3"), class = "factor")), .Names = c("current_values",
"new_values"), class = "data.frame", row.names = c(NA, -5L))
,並有作爲最後輸出這個:
dput(finalout)
structure(list(c1 = structure(1:2, .Label = c("t1", "t3"), class = "factor"),
c2 = structure(c(2L, 1L), .Label = c("t1", "t2"), class = "factor")), .Names = c("c1",
"c2"), class = "data.frame", row.names = c(NA, -2L))
是否有可能使它也在列名?