Trying to Run a T Test

Hi! I am new to R and I've run into problems when trying to run a t test on my data. I am trying to determine if there is significance between my independent and dependent variable under these conditions, I inputted this:

library(tidyverse)
attach(D_D_Sacc_Bottle_Data_stats_in)
select(PCB Treatment, Average .75%)%>%
filter(PCB Treatment == "A" | PCB Treatment == "B") %>%
t.test(data = df, Average .75%~PCB Treatment)

and was met with this error:

Error in UseMethod("select_") :
no applicable method for 'select_' applied to an object of class "character"

What does this mean and how do I fix it?

Thank you!

I believe the problem is that select is seeing PCB Treatment as the .data argument because it is in the first position. Try changing the select to

select(D_D_Sacc_Bottle_Data_stats_in, `PCB Treatment`, `Average .75%`)

You should store the result of the select and filter calls in a data frame named df and then separately call the t.test. The code you posted tries to use the pipe to send the data into t.test() but then you call t.test with data = df and df does not exist.
Also, I would suggest changing the column names so they do not have spaces. It is a needless source of trouble.

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