How to organize scores that belong to same condition in R -


i've been searching hours solution problem, since i'm new r , programming, haven't got terminology down enough search online help.

below simplified version of data working with. in full data there close 200 different items, , 24 subjects.

i need able work data in terms of "item" scores belong with. example, able perform basic functions such calculate means first scores on item 3, or second scores item 2 etc.

how should approach this? thanks!

subject item    first score     second score    1      1         0.92         0.58       1      2         1.00         1.00       1      3         1.00         0.69       2      1         0.90         0.58       2      2         0.95         0.90       2      3         1.00         0.92 

you use split()

firstscore <- c(0.92,1.00,1.00,0.90,0.95,1.00) item <- rep(1:3,2) firstscorebyitem <- split(firstscore, as.factor(item)) 

to access scores each item, use

firstscorebyitem[1] 

to calculate mean, use

mean(firstscorebyitem[1]) 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -