删除数据框中的列和行时出错

时间:2015-09-26 18:22:06

标签: r null dataframe

初学者。我尝试从数据框中删除值,列或行时收到错误。实施例...

## vectors
Died.At <- c(22,40,72,41)
Writer.At <- c(16, 18, 36, 36)
First.Name <- c("John", "Edgar", "Walt", "Jane")
Second.Name <- c("Doe", "Poe", "Whitman", "Austen")
Sex <- c("MALE", "MALE", "MALE", "FEMALE")
Date.Of.Death <- c("2015-05-10", "1849-10-07", "1892-03-26","1817-07-18")

## data frame
writers_df <- data.frame(Died.At, Writer.At, First.Name, Second.Name, Sex, Date.Of.Death)   


#remove value
writers_df [1,3] <- NULL

我收到错误:[<-.factor中的错误(*tmp*,iseq,value = NULL):   替换的长度为零 另外:警告信息: 在is.na(value)中:is.na()应用于类型&#39; NULL&#39;

的非(列表或向量)

0 个答案:

没有答案