Stuck with Error in eval(m$data, parent.frame()) : object 'AssementData' not found

I am having trouble with the following, can any one help?

#Read in data#
AssementData <- read_xlsx(file.choose(AssementData.xlsx))
#Have a quick look at the data#
#How many variables are there?#
#Exploring the data#
ggplot(AssementData, aes(x/axis = Type, y/axis = PlantDiv))+
#Look at graph - what relationship is betw Type and plantdiv?#
#Use this plot to assess linear relationship assump = straight line?#
#Calculate summary statistics eg means/ standard errors for both vars#
means <- summarise(AssementData, mnplant = mean (PlantDiv),
seplant = sd(Type)/sqrt(n()),
mnpest = mean(Type),
sepest = sd(Type)/sqrt(n))
#checking normality assump#
#check whether both variables appear to be norm distrib (ie do they follow bell curve)#
ggplot(AssementData, aes(x/axis = Type, y/axis = PlantDiv))
#Spearmans rank correlation#
cor.test(~Type + PlantDiv, method = "Pearson", data = AssementData)

I get the Error
Error in eval(m$data, parent.frame()) : object 'AssementData' not found

Hello @ASN76,
welcome to the Community!

You show us a lot of code and think you ran all of it in one go. That is possible but when you encounter error messages it is often easier to run the code line by line. You can do this by selecting a line or a few lines and hit Control-Enter (in Windows at least).
When you then see the error message, you know that the error was in the part that you already did run.

Looking at the error message, I think that the AssementData was not read correctly from the csv-file. Try to execute only the read_xlsx line by selecting only that line and hitting Control-Enter.

I never use the file.choose function but I think you need to use quotes around the file-name :

If you don't specify the quotes R will look for a variable with that name.

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.