There are two ways to do it.
To use the formula approach requires restructuring your data so as to have a grouping variable
my_data<- tibble::tribble(
~Plot,~Shaded,~Exposed,
1, 64, 321,
2, 16, 147,
3, 47, 380,
4, 10, 415,
5, 22, 130,
6, 54, 271
)
ttest_a <- t.test(x=my_data$Exposed , y=my_data$Shaded,
mu = 0,
alternative ="two.sided",
conf = 0.95,
var.eq = F,
paired = F)
# for formula need different data structure
my_data2 <- pivot_longer(my_data,
cols=c(Shaded,Exposed),
names_to = "groupname")
ttest_b <- t.test(value~groupname,data=my_data2)
#compare the results
ttest_a
ttest_b