Hey guys,
In my data setv ("KD") I have 4 columns
("Punkte.AG1","Punkte.AG2","Punkte.AG3","Punkte.WI") I'm interested in.
These columns contain the participants' scores of a specific task.
I computed the percentiles of the columns using this code:
pe<-apply(X=KD[,c("Punkte.AG1","Punkte.AG2","Punkte.AG3","Punkte.WI")],
MARGIN=2,
FUN=quantile,
probs=seq(0,1,by=.01),
na.rm=TRUE)
round(pe,0)
This is the output (to the 20^th percentile):
pe
Punkte.AG1 Punkte.AG2 Punkte.AG3 Punkte.WI
0%6319
1%74311
2%86312
3%87412
4%97512
5%98512
6%108512
7%108512
8%108614
9%109614
10%109615
11%1010715
12%1010715
13%1110715
14%1110816
15%1110816
16%1110816
17%1110816
18%1110816
19%1210816
20%1210816
So now I know, what percentile a person has, when she/ he scored a
certain amount of points (e.g. 6 points in "Punkte.AG1" = 0%).
Here is my problem:
I now want to write a function that assigns the percentile to the score
(for each task) and saves it in a new variable.
So every person that scored 10 in "Punkte.AG1" gets a "12" in the new
variable "Percentile.AG1".
Every person that scored 6 in "Punkte.AG1" gets a "6" in the new
variable "Percentile.AG1".
The same thing should be done for the other tasks.
I new to R, so I don't have any clue, how to solve that. It would be
awesome, if you would know how to handle that.
Thanks a lot!
Anne
--
M. Sc. Anne-Marie B. Gallrein
Technische Universität Dresden
Institut für Klinische, Diagnostische und Differentielle Psychologie
Diagnostik und Intervention
01062 Dresden
Tel. +49 351 463-34004
[email protected]
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.