3
我喜歡用條件創建一個帶有條件的函數paste0的向量,如果該值大於0,則將該值粘貼到每個rownames中。在R中粘貼條件
ts <- data.frame(t2)
ts
1 1
2 1
3 0
4 0
5 0
6 2
footer <- c(paste0("There is ",ts$t2[1]," subject missing in group ",rownames(ts)[1]),
paste0("There is ",ts$t2[2]," subject missing in group ",rownames(ts)[2]),
paste0("There are ",ts$t2[6]," subjects missing in group ",rownames(ts)[6]))
footer
[1] "There is 1 subject missing in group 1" "There is 1 subject missing in group 2"
[3] "There are 2 subjects missing in group 6"
感謝您的支持。
子集,其中的變量不等於零第一行的
switch
。 – alistaire@ alistaire,謝謝,現在很容易 – BIN