Object not found after reading into R

seed_set <- read_excel("seed_set.xlsx")

#seed_set <- as.data.frame(unclass(seed_set),
#stringsAsFactors = TRUE)

class("species")#not found? why
length("species")#not found? why
unique(full) # not found ? why

unique(full)

Error in unique(full) : object 'full' not found

Instead of referencing the column names directly, reference them in relation to the dataframe itself.

class(seed_set$species)
length(seed_set$species)
unique(seed_set$full)

Hope this helps!

Thank you so much! It worked. Why do I need to do that in order for it to read those variables properly?

The column names don't exist in R outside of their relation to the dataframe they are a part of. The dataframe itself is a variable, but it's columns are not, so they cannot be referenced in R functions. You could set the columns to be their own variables by doing something like this.

species <- seed_set$species
full <- seed_set$full

But in order to keep things concise and avoid an excess amount of variables, I'd recommend referencing the dataframe each time you need to reference the column.

Thank you so much! I appreciate your help.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.