這段代碼在其他日子裏工作,現在它吐出這些對象未找到錯誤,我想要拉列的名稱。所有列都存在於我正在導入的CSV中。有什麼建議麼?選擇函數返回對象沒有找到
DF <- read.csv2("FILE PATHWAY", header=TRUE, sep = ",", stringsAsFactors =
F, skip=1)
DF <- DF[DF$Type=="AHREF",]
DF <- select(Type,Source,Destination)
# Error occurs here with this: Error in select(Type, Source, Destination) : object 'Type' not found
DF <- as.data.frame(sapply(DF,gsub,pattern="#URL DELETED",replacement=""))
DF <- as.data.frame(sapply(DF,gsub,pattern="#URL DELETED",replacement=""))
DF <- as.data.frame(sapply(DF,gsub,pattern="\"",replacement=""))
DF <- subset(DF, !grepl("^https", DF$Source))
DF <- subset(DF, !grepl("^https", DF$Destination))
colnames(DF) <- c("From","To")
rownames(DF) <- NULL
graphObject = graph.data.frame(DF, directed = TRUE)
graphObject = simplify(as.undirected(graphObject))
這是什麼行後'DF'? 'DF < - DF [DF $ Type ==「AHREF」,]'如果是這樣的話,你可能在某個地方有一個「附加(DF)」或「帶有」的地方,而這正是之前爲你工作的地方。 – Masoud
歡迎來到StackOverflow。請閱讀[如何在R中創建一個很好的重現示例](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example),使您的問題更可能得到答案。另外,您可能需要[tour](https://stackoverflow.com/tour)並閱讀[如何提問?](https://stackoverflow.com/help/how-to-ask) – Masoud