Is this the kind of thing you mean? > wData <- within(wData, { + z <- (weigth - mean(weigth))/sd(weigth) + "p-value" <- 2*pnorm(-abs(z)) ## 2-sided + rm(z) }) > wData employee_id weigth p-value 1 100 150 0.3763641 2 101 200 0.9081403 3 102 300 0.1547139 4 103 180 0.6722391
(You might want to think about the spelling of 'weigth' a bit more.) -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jd6688 Sent: Friday, 23 July 2010 8:41 AM To: r-help@r-project.org Subject: [R] p-VALUE calculation Here is my dataframe with 1000 rows: employee_id weigth p-value 100 150 101 200 102 300 103 180 ..... My question: how can I calculate the p-value in R for each employee? the distribution of the weigth will be established from the above 1000 samples. -- View this message in context: http://r.789695.n4.nabble.com/p-VALUE-calculation-tp2299497p2299497.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org 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. ______________________________________________ R-help@r-project.org 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.