Reputation: 11
This code was working the other day, now it spits out these object not found errors for the names of the columns I'm trying to pull. All of the columns exist in the CSV I'm importing. Any suggestions?
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))
Upvotes: 1
Views: 6365
Reputation: 341
You didn't specify the dataframe on which you apply the select.
Try this :
DF <- select(DF,Type,Source,Destination)
or
DF <- DF %>% select(Type,Source,Destination)
Upvotes: 2