[R] Extracting arithmetic mean for specific values from multiple .txt-files

vimmster superdodge at gmx.net
Wed Jul 11 00:56:29 CEST 2012


Dear Rui,

1) With test subject I mean each file (I have posted three similar files
above (2, 50 and 1112), but each test subject has one exact file (which
differs of course! --> 2, 50 an 1112 are the same file but I renamed it for
the problem described ans solved above). In this file the vpNum is always
the same (for each test subject of course; example: for test subject 44 it
is always vpNum = 44). The examples above (2, 50 and 1112) are in fact all
the second test subject's file (vpNum always "2").

2) With "trials" or "trialCount" I mean the number of trials (149 in your
example, and 151 in the examples 2, 50 and 1112). But the number of trials
differs between subjects, because in the examples below (vpNum = 3, 43 and
63) it is 152 (for vpNum = 3), 150 (for vpNum = 43) and 157 (for vpNum =
63).

http://r.789695.n4.nabble.com/file/n4636074/Fluencyflanker_3.txt
Fluencyflanker_3.txt 
http://r.789695.n4.nabble.com/file/n4636074/Fluencyflanker_43.txt
Fluencyflanker_43.txt 
http://r.789695.n4.nabble.com/file/n4636074/Fluencyflanker_63.txt
Fluencyflanker_63.txt 

3) I mean the number of correct answers given per test subject (for example
for test subject 3 in the previous example (5 rows above) we have 152 trials
and 4 trials that are not correct, which means 148 correct trials (with the
categorical value "1")). So in R this would be the ratio of:
> 148/152
[1] 0.9736842

The wanted output should (if possible) look like this (here only for vpNum =
3 !!!):
vpNum	trial OR trialCount	correct (reactions)	ratio (which means: number
correct / trialCount)
3	        152			                148			                 0.9736842

The final output should look like this:
vpNum	trial OR trialCount	correct (reactions)	ratio (which means: number
correct / trialCount)
1	         n			                 n			                 x
2	         n			                 n			                 x
3	         152			         148			         0.9736842
and so on until vpNum = 65 (In my question before I forgot to ask for the
column "vpNum", sorry about that!).

I hope this makes it more clear!

Thanks for your time and help!

Kind regards

--
View this message in context: http://r.789695.n4.nabble.com/Extracting-arithmetic-mean-for-specific-values-from-multiple-txt-files-tp4635809p4636074.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list