If I understood your question

x<-data.frame(matrix(rnorm(2000,10,10),ncol=50))

sapply(1:5,function(i) summary(lm(x[,i]~x[,i+10]+x[,50])))

Weidong Gu

On Thu, Jul 14, 2011 at 2:27 PM, Jon Toledo <tintin...@hotmail.com> wrote:
>
> Hi,
> First let me thank you for the incredible help and resource that this forum 
> is.
> I am trying to compare the  repeated measurement of more than 100 analytes 
> that have been take in 70 subjects at 2 time points adjusted for the time 
> difference of sample times(TimeDifferenceDays), therefore I wanted to do it 
> with a function that allows me to do all at once. (131 is the column 
> difference that separates the two different measurements of the same anlyte)
> I have this one:
> for(i in 1:125){return(summary(lm(Data[,i] ~ Data[,(i+131)] + 
> Data$TimeDifferenceDays)))}
> But it only gives me one result
>
> I also wanted to get the p-value in a dataframe with three columns:
> Fitst column: analyte name (that愀 the name of the column)Second column: 
> pvalue of the first measure of the analte predicting the second measureThird 
> column: The effect of time
>
> I copy a samller example:
>
>
> txt <- "V1a  V2a  V3a  V1b  V2b  V3b   TimeDifferenceDays2.42  72.4 3.75 2.46 
> 55.4 4.44 6081.66 89.7 2.54 2.17 94.0 2.15 4192.45 112. 0.46 2.40 129.0 .42 
> 7142.58 55.6 5.05 2.44 135.0 5.39 7212.61 332.0 22.6 3.55 238.0 16.4 729"
> Data <- read.table(textConnection(txt), header = TRUE)
> Thank you
> Jon Toledo, MD
>
> Postdoctoral fellow
> University of Pennsylvania School of Medicine
> Center for Neurodegenerative Disease Research
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.

Reply via email to