1
現有列我與R工作組,並在這裏對數據幀的新列是我的數據框[R創建基於,使用R
Died.At <- c(22,40,72,41)
Writer.At <- c(16, 18, 36, 36)
First.Name <- c("John", "John", "Walt", "Walt")
Second.Name <- c("Doe", "Poe", "Whitman", "Austen")
Sex <- c("MALE", "MALE", "MALE", "MALE")
writers_df <- data.frame(Died.At, Writer.At, First.Name, Second.Name, Sex)
我想補充一個根據名字叫做id新列,所以約翰和沃爾特在這種情況下,我知道我可以很容易地通過
id<-c("1","1","2","2")
做到這一點,但我有一個大的數據集處理,另外,名稱將不會再次出現之後,所以將不再約翰時,華特,任何人都可以幫我這個請
啊,那工作!謝謝! – on9jai