Object not found error code

Trying to run a paired T-test on my data but getting this message: "Error in t.test(Nervous, Peripheral, paired = TRUE, conf.level = 0.95) :
object 'Nervous' not found"

This is the code I put in, I have not made any spelling errors so I have no idea what is going on here! Any help would be great

library(readxl)
GroupA <- read_excel("GroupA.xlsx")
View(GroupA)

t.test(Nervous,Peripheral,paired=TRUE,conf.level=0.95)

Your issue is that there is no relation/connection between the excel you read in and name as GroupA and the t.test you perform.

you either attach() the GroupA table and then use its variables freely (though this is not recommended for serious/reproducible workflows, rather for quick interactive work),
or you provide t.test with explicit knowledge that your variables are coming from GroupA

t.test(GroupA$Nervous,GroupA$Peripheral... etc.)

or you use the formula version of t.test where there is a data param you set to groupA

t.test(Nervous~ Peripheral, data = GroupA ....
2 Likes

Hello,

That worked perfectly, thank you so much!

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.