Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205399

How to perform a one-sample t-test for each row in just one column in R?

$
0
0

In my dataset I have 14 columnes and originally 48 rows. I reduced row size to 2, because working on problems on R is much easier for me, like this. The first column consists of a participants number, the 14th column is an already aggregated mean of each participant called "dprime_mean".

names(signal_table)
 [1] "vpn""t_hit""t_miss""t_correj""t_false"    
 [6] "at_hit""at_miss""at_correj""at_false""t_dprime"   
[11] "t_crit""at_dprime""at_crit""dprime_mean"

I want to perform an one-sample, one sided t-test on each participants "dprime_mean" against mu = .15 and alternative = "greater". Without typing the same test down 48 (well for the moment twice) times.

I already tried:

pValues <- apply(signal_table, 1, function(x) t.test(x[14],
                            mu=0.15, alternative = "greater")$p.value)

But get the following error:

Error in t.test.default(x[14], mu = 0.15, alternative = "greater") : 
  not enough 'x' observations

What can I do? Can someone please help me and please be kind, I tried my best with this post :)


Viewing all articles
Browse latest Browse all 205399

Trending Articles