Re: [R] reviewer comment
Thanks John for your reply. the reviewer comment: asymmetric distribution could affect Principal Component Analysis results, symmetry of distribution should be tested. Authors should also indicate if outliers were observed and consequently excluded because they could affect factors My question: what does it mean asymmetry distribution could affect PCA ? and also outliers could affect factors? sorry for this not R-help question. Best regards M Le 15/03/13 14:05, John Kane a écrit : > No idea of what sentence. R-help strips any html and only provides a text > message so all formatting has been lost. I think the question is not really > an R-help question but if you resubmit the post you need to show the sentence > in question in another way. > > John Kane > Kingston ON Canada > > >> -Original Message- >> From: mohamed.laj...@inserm.fr >> Sent: Fri, 15 Mar 2013 11:26:45 +0100 >> To: r-help@r-project.org >> Subject: [R] reviewer comment >> >> Could someone explain me this sentence reviewer below in blod underlined, >> >> Authors should try to be more detailed in the description of analyses: >> some of the details reported in the "Principal components analysis" >> paragraph (Results) should be moved here. >> Because a highly_/*asymmetric distribution could affect Principal >> Component Analysis results, symmetry of distribution should be >> tested. Authors should also indicate if outliers were observed and >> consequently excluded because they could affect factors*/_ >> >> Any help would be greatly appreciated! >> >> Regards >> ML >> >> -- >> >> Mohamed Lajnef,IE INSERM U955 eq 15# >> P?le de Psychiatrie # >> H?pital CHENEVIER # >> 40, rue Mesly # >> 94010 CRETEIL Cedex FRANCE # >> mohamed.laj...@inserm.fr # >> tel : 01 49 81 32 79# >> Sec : 01 49 81 32 90 # >> fax : 01 49 81 30 99 # >> >> >> >> [[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. > ________ > GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at > http://www.inbox.com/smileys > Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk⢠> and most webmails > > > -- Mohamed Lajnef,IE INSERM U955 eq 15# PÂle de Psychiatrie # HÂpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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] reviewer comment
Could someone explain me this sentence reviewer below in blod underlined, Authors should try to be more detailed in the description of analyses: some of the details reported in the "Principal components analysis" paragraph (Results) should be moved here. Because a highly_/*asymmetric distribution could affect Principal Component Analysis results, symmetry of distribution should be tested. Authors should also indicate if outliers were observed and consequently excluded because they could affect factors*/_ Any help would be greatly appreciated! Regards ML -- ######## Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] p-values from lm()
Hi David, summary(res)$coefficients[,"Pr(>|z|)"] or summary(res)$coefficients[,4] M Regrads Le 14/06/12 12:44, David Studer a écrit : > Hi everyone! > > Can anyone tell me, how to obtain p.values from a linear model? > > Example: > mod1<-lm(dV~iV1+iV2) > > Now, I can get the coefficients with mod1$coef > But how can I get p-values? ($p.values seems to work with cor.test() only) > > Thank you! > > [[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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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] Draw vertical line segments between pairs of points
Dear all, How to add /*vertical*/ lines above bar graph to display p-values ( between pairs of points )? Regards ML -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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] Multicollinearty in logistic regression models
Dear All, Is there a method to diagnostic multicollinearty in logistic regression models like vif indicator in linear regression ( variance inflation Factor ...) ? Thank you in advance M -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] R packages for pathway analysis?
Hi Karena, Ask your question in bionconductor mailing list (bioconduc...@r-project.org) Regards ML Le 09/12/11 03:36, karena a écrit : > What R packages do you guys use for 'pathway analysis'? By 'pathway > analysis', I mean to check the enrichment of certain genes in KEGG | GO > pathways. > > Thank you, > > Karena > > -- > View this message in context: > http://r.789695.n4.nabble.com/R-packages-for-pathway-analysis-tp4175258p4175258.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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] Help to get fitted and residual value
Hi arunkumar; fit$residuals , fit$fitted to extract respectively residuals and fitted values Regrads Mohamed Le 07/12/11 07:20, arunkumar a écrit : > Data<- read.csv("C:/FE and RE.csv") > Formula="Y~X2+X3+X4 + X5+X6 > fit=lm(formula=Formula,data=Data) > > My sample Data > > State Year Y X2 X3 X4 X5 X6 > S2 1960 27.8 397.5 42.2 50.7 78.3 65.8 > S1 1960 29.9 413.3 38.1 52 79.2 66.9 > S2 1961 29.8 439.2 40.3 54 79.2 67.8 > S1 1961 30.8 459.7 39.5 55.3 79.2 69.6 > > Is there any way to fitted and residual for the new set of data. or should i > create formula manually and pass the values individually > > > S2 1962 31.2 492.9 37.3 54.7 77.4 68.7 > S1 1962 33.3 528.6 38.1 63.7 80.2 73.6 > S2 1963 35.6 560.3 39.3 69.8 80.4 76.3 > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Help-to-get-fitted-and-residual-value-tp4167808p4167808.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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] quick ANOVA question
Hi, Anova compare the means of more than two groups, in your case anova test H0 hypothisis H0: means(control)=mean(tread1)=mean(tread2)=mean(tread3), if there is at least one différence, you can identify the mean difference between groups by using post hoc test to testing your B suggestion. Regrads ML Le 29/11/11 11:49, syrvn a écrit : > Hello, > > > imagine the following experimental design: > > Group - Value > > control - 5 > control - 6 > control - 5 > > treated1 - 8 > treated1 - 9 > treated1 - 9 > > treated2 - 15 > treated2 - 16 > treated2 - 15 > > treated3 - 25 > treated3 - 30 > treated3 - 28 > > > What I like to know is if I apply an ANOVA to this data and choose the > control group as the reference group (using the relevel function) > what groups exactly are compared? Are only all treated groups 1, 2, 3 tested > against the control group or are all possible combinations tested? > > What is compared? > > A) Testing: control vs treated1; control vs treated2; control vs treated3; > > or > > B) Testing: control vs treated1; control vs treated2; control vs treated3; > > treated1 vs treated2; treated1 vs treated3; treated2 vs > treated3; > > > Cheers > > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/quick-ANOVA-question-tp4118724p4118724.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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] Combining histograms and distribution curve
Hi, Try lines function to get a distribution cruve: X<-c(8, 9, 7, 6, 7, 8, 5, 4, 16, 12, 11, 10, 8, 7, 9 ) > hist(X, prob=TRUE) > lines(density(X)) Regrads ML Le 29/11/11 11:04, gwanme...@aol.com a écrit : > Dear Sir, > > I am reviewing a group of patients who had a surgical procedure. The > histogram of the age frequency has a bimodal distribution. I am trying to > emphasise this by adding a distribution curve on the histogram. > > Let's say the ages are 8, 9, 7, 6, 7, 8, 5, 4, 16, 12, 11, 10, 8, 7, 9 for > example. How can I plot a histogram with a distribution curve on it? > > Your help is highly appreciated. > > Ivo > [[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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] how to get AIC BIC information using funtion lm
Hi, Try the AIC and BIC function. ?AIC for help Regrads ML Le 28/11/11 08:28, arunkumar a écrit : > Hi > how to get AIC BIC information using funtion lm ? > > Please help me > > Data<- read.csv("C:/FE and RE.csv") > Formula="Y~X2+X3+X4 > lm(formula=Formula,data=Data) > > My sample Data > > State Year Y X2 X3 X4 X5 X6 > S2 1960 27.8 397.5 42.2 50.7 78.3 65.8 > S1 1960 29.9 413.3 38.1 52 79.2 66.9 > S2 1961 29.8 439.2 40.3 54 79.2 67.8 > S1 1961 30.8 459.7 39.5 55.3 79.2 69.6 > S2 1962 31.2 492.9 37.3 54.7 77.4 68.7 > S1 1962 33.3 528.6 38.1 63.7 80.2 73.6 > S2 1963 35.6 560.3 39.3 69.8 80.4 76.3 > S1 1963 36.4 624.6 37.8 65.9 83.9 77.2 > S2 1964 36.7 666.4 38.4 64.5 85.5 78.1 > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/how-to-get-AIC-BIC-information-using-funtion-lm-tp4114401p4114401.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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] changing date format in a dataframe
Hi, If the dates are the same format and the same length you can try this : dates<-c("1/1/2009","2/1/2009","3/1/2009") dates_new<-as.Date(paste(substr(dates,1,3),substr(dates,7,8),sep="/"),format="%d/%m/%y"), you can change the format to "%m/%d/%y" Regards M Le 16/11/11 15:12, arunkumar a écrit : > Hi > > I have a data frame and i need to change the date format in it. > my dataframe > > X Date > 1 1/1/2009 > 2 2/1/2009 > 3 3/1/2009 > > I need to change it to 2009-01-01 > > > -- > View this message in context: > http://r.789695.n4.nabble.com/changing-date-format-in-a-dataframe-tp4076411p4076411.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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] determine frequencies in a matrix by row
Hi, Try apply function: apply(matrix,1,table) Regards M Le 08/06/11 08:23, the_big_kowalski a écrit : > Hi, > > I have a matrix > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] > [1,]131131123 2 > [2,]131211122 1 > [3,]122321112 1 > [4,]321113121 2 > [5,]112211311 2 > and want to determine how many times 1s, 2s, and 3s occur per each row. > I tried using 'table', but end up with frequencies for the whole matrix. > Thanks in advance for your help > > -- > View this message in context: > http://r.789695.n4.nabble.com/determine-frequencies-in-a-matrix-by-row-tp3581733p3581733.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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] write gene_id in a bed file
Hi Nanami, you do not use the same file in export, href or new_CTTS ? Regards M Le 07/06/11 14:42, ads pit a écrit : > Hi all, > I have build the following data frame > head(href) > chr tx_start tx_end g_id strand cds_start cds_end exon_count > 1 chr1 8384389 8404227 NM_001080397 + 8384389 8404073 8 > 2 chr1 16767166 16786584 NM_001145277 + 16767256 16785491 7 > 3 chr1 16767166 16786584 NM_001145278 + 16767256 16785385 8 > 4 chr1 16767166 16786584NM_018090 + 16767256 16785385 8 > 5 chr1 48998526 50489626NM_032785 - 48999844 50489468 14 > 6 chr1 33546713 33585995NM_052998 + 33547850 33585783 12 > > Now when I'm trying to export it into a bed file I did: > output_href<- write.table(new_CTTS, file="new_href.bed", quote=FALSE, sep = > "\t", na="NA", row.names=FALSE, col.names=TRUE) > > The thing is when I look at the file I only have: > head(test) >chr1 X564620 X564649 X564644 X565645 X94 X. X10 > 1 chr1 565369 565404 565371 566372 217 + 8 > 2 chr1 565463 565541 565480 566481 1214 + 15 > 3 chr1 565653 565697 565662 53 1031 + 28 > 4 chr1 565861 565922 565883 566884 316 + 12 > 5 chr1 566537 566573 566564 567565 119 + 11 > 6 chr1 567535 567579 567562 568563 2085 + 39 > > but what I want is to include the corresponding gene ID as well in a last > column. How can I do that? > > Best, > Nanami > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr# tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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] Several Regression by combinations variables
Dear All, I have 11 variables, and i would like generate combinations of those variables by fours variables i,e 330 possibility (choose(11,4)).? After that, make a regression analysis with this 330 possibility ? is there a program ( or package) to do that ? Any help would be appreciated Regards M -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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] Fwd: transpose ?
Dear All, Sorry for the previous mail,suppose this data.frame D V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22 C C C C T T G G A A C C G G C C G G T T A A A A T A T T C C G G C C C C T T G G A A C C G G C C I would translate D as follow ( just for the first line) C C T G A C G C C C T G A C G C (V8 under V7) (V9 under V10) ... Any help would be appreciated Regards M [[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] transpose ?
Dear All, Suppose this data.frame D V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22 C C C C T T G G A A C C G G C C G G T T A A A A T A T T C C G G C C C C T T G G A A C C G G C C I would translate D as follow ( just for the first line) C (V7) C (V9) T G A C G C C (V8) C (V10) T G A C G C Any help would be appreciated Regards M -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] quantile function -> I need only the quantile value itself
HI Laszlo, q<-quantile(small_df,probs=0.95) q[[1]] [1] 12.85 Regrads Le 28/03/11 11:37, Bodnar Laszlo EB_HU a écrit : > Hi, > > I am using the quantile function currently and I have just bumped into a > little problem. > > I have a very small data frame something like this: > > small_df<- > c(7,3,4,7,1,10,12,1,12,4,4,8,6,11,9,10,4,13,3,9,6,5,2,10,7,14,2,7,10,10,7,8,2,11,3,10,11,3,11,14,12,7,6,11) > small_df > > Now in the next step I would like to calculate the quantile value of the > previous data frame at the probability of 95% the following way: > quantile(small_df,probs=0.95) > > The result: >> 95% >> 12.85 > Now I need to get only the number 12.85. I do not want to present the > probability "95%" here. Is there any possible way to "tell" the program to do > so? > > Regards, > Laszlo > > Ez az e-mail és az összes hozzá tartozó csatolt melléklet titkos > és/vagy jogilag, szakmailag vagy más módon védett információt > tartalmazhat. Amennyiben nem Ã--n a levél cÃmzettje akkor a levél > tartalmának közlése, reprodukálása, másolása, vagy egyéb más úton > történÅ' terjesztése, felhasználása szigorúan tilos. Amennyiben > tévedésbÅ'l kapta meg ezt az üzenetet kérjük azonnal értesÃtse az > üzenet küldÅ'jét. Az Erste Bank Hungary Zrt. (EBH) nem vállal > felelÅ'sséget az információ teljes és pontos - cÃmzett(ek)hez történÅ' > - eljuttatásáért, valamint semmilyen késésért, kapcsolat > megszakadásból eredÅ' hibáért, vagy az információ felhasználásából > vagy annak megbÃzhatatlanságából eredÅ' kárért. > > Az üzenetek EBH-n kÃvüli küldÅ'je vagy cÃmzettje tudomásul veszi és > hozzájárul, hogy az üzenetekhez más banki alkalmazott is hozzáférhet az > EBH folytonos munkamenetének biztosÃtása érdekében. > > > This e-mail and any attached files are confidential and/...{{dropped:19}} > > > > __ > 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. -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] adding linear regression data to plot
Hi Jan, If you want to plot the fitted values of lm function, you can use abline function ? abline ( te get help) Regrads M Le 15/03/11 23:26, derek a écrit : > Hello R, > > I would like to print regression data in graph. I mean the output from: > k=lm(formula,data) > summary(k) > > Or somehow extract and print only coefficients and R-squared. > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/adding-linear-regression-data-to-plot-tp3357946p3357946.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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] create data set from selection of rows
Hi, Le 15/03/11 16:09, e-letter a écrit : > Readers, > > For a data set: > > text1,23,text2,45 > text1,23,text3,78 > text1,23,text3,56 > text1,23,text2,45 > > The following command was entered: > > datasubset<-data.frame(dataset[,3]=="text3") datasubset<-subset(dataset,dataset[,3]=="text3") > The result of > > datasubset > > is > > TRUE > TRUE > > The required result is > > text1,23,text3,78 > text1,23,text3,56 > > What is the correct command to use please? > > Thanks in advance. > Regards M > __ > 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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 32 79 # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] Plot confidence intervals
Hi Iker, matlines function to plot 956 % confidence intervals after using predict function. barplot function for errors bars. hope this help M Regards Le 23/02/11 16:00, Iker Vaquero Alba a écrit : > Hello, list: > > I'm not sure about where to send this question. I have several > repeatability calculations, together with their 95% confidence intervals, and > I would like to plot them, in a way similar to error bars. I was wondering if > there is any specific function to do this, or any method I can apply in R, as > I haven't found anything like that in the R book. > > Thank you very much > > Iker Vaquero-Alba > Centre for Ecology and Conservation > Daphne du Maurier Building > University of Exeter, Cornwall Campus > Treliever Road > TR10 9EZ Penryn > U.K. > > > > > [[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. -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 31 31 (poste 18467) # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] nrow()
Hi Sandra, What about ?is.na function ? Hope this help Regards, ML Le 22/02/11 16:11, Sandra Stankowski a écrit : > NROW(data[jan,16] != NaN) -- #### Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 31 31 (poste 18467) # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] barplot with errorbars
Hi Maria, Look at barplot function ? barplot for help Regards M Le 17/02/11 17:00, Lathouri, Maria a écrit : > Dear all > > I have six variables of the average metal concentrations > > Var1 4.77 > Var2 23.5 > Var3 5.2 > Var4 12.3 > Var5 42.1 > Var6 121.2 > > I want to plot them as a barplot with error bars. Could you help me? > > Cheers > Maria > > [[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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 31 31 (poste 18467) # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] darcs patch: Apply on data frame
Hi chen, avoid naming the function with specific expressions (:,;.) and try this code as follow Scripranksum<- function(a){ g1<- c(1, 2, 3) g2<- c(4, 5, 6, 7, 8, 9, 10, 11, 12) c<- wilcox.test(a[g1], a[g2]) return (c$p.value) } Best Mohamed Le 17/02/11 08:15, Mr rong chen a écrit : > Scrip:ranksum<- function(a){ >g1<- c(1, 2, 3) >g2<- c(4, 5, 6, 7, 8, 9, 10, 11, 12) >c<- wilcox.test(a[g1], a[g2]) >return c$p.value > } -- ######## Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 31 31 (poste 18467) # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] removing lower and upper quantiles from an arry
Thierry, you forgot ! i[! quantile(i,.25) >= i & i <= quantile(i,.75)] Best M Le 17/02/11 11:18, ONKELINX, Thierry a écrit : > You need two logical test and then combine them with& (AND) or | (OR) > > i[quantile(i,.25)>= i& i<= quantile(i,.75)] > > Best regards, > > Thierry > > > ir. Thierry Onkelinx > Instituut voor natuur- en bosonderzoek > team Biometrie& Kwaliteitszorg > Gaverstraat 4 > 9500 Geraardsbergen > Belgium > > Research Institute for Nature and Forest > team Biometrics& Quality Assurance > Gaverstraat 4 > 9500 Geraardsbergen > Belgium > > tel. + 32 54/436 185 > thierry.onkel...@inbo.be > www.inbo.be > > To call in the statistician after the experiment is done may be no more than > asking him to perform a post-mortem examination: he may be able to say what > the experiment died of. > ~ Sir Ronald Aylmer Fisher > > The plural of anecdote is not data. > ~ Roger Brinner > > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > >> -Oorspronkelijk bericht- >> Van: r-help-boun...@r-project.org >> [mailto:r-help-boun...@r-project.org] Namens Maas James Dr (MED) >> Verzonden: donderdag 17 februari 2011 11:09 >> Aan: r-help@r-project.org >> Onderwerp: [R] removing lower and upper quantiles from an arry >> >> I'm trying to work out the simplest way to remove the upper >> and lower quantiles, in this case upper and lower 25% from an >> array. I can do it in two steps but when I try it in one, it >> fails. Is there something simple missing from my syntax or >> are there other simple elegant way to accomplish this? >> >> Thanks >> >> J >> >>> i<-1:20 >>> i2<- i[i>> i3<- i[i>quantile(i,.25)] >>> i4<- i[quantile(i,.25)< i> quantile(i,.75)] >> Error: unexpected '>' in "i4<- i[quantile(i,.25)< i>" >> >> === >> Dr. Jim Maas >> University of East Anglia >> >> __ >> 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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 31 31 (poste 18467) # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] removing lower and upper quantiles from an arry
Thierry, you forgot ! i[! quantile(i,.25) >= i & i <= quantile(i,.75)] Best M Le 17/02/11 11:18, ONKELINX, Thierry a écrit : > You need two logical test and then combine them with& (AND) or | (OR) > > i[quantile(i,.25)>= i& i<= quantile(i,.75)] > > Best regards, > > Thierry > > > ir. Thierry Onkelinx > Instituut voor natuur- en bosonderzoek > team Biometrie& Kwaliteitszorg > Gaverstraat 4 > 9500 Geraardsbergen > Belgium > > Research Institute for Nature and Forest > team Biometrics& Quality Assurance > Gaverstraat 4 > 9500 Geraardsbergen > Belgium > > tel. + 32 54/436 185 > thierry.onkel...@inbo.be > www.inbo.be > > To call in the statistician after the experiment is done may be no more than > asking him to perform a post-mortem examination: he may be able to say what > the experiment died of. > ~ Sir Ronald Aylmer Fisher > > The plural of anecdote is not data. > ~ Roger Brinner > > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > >> -Oorspronkelijk bericht- >> Van: r-help-boun...@r-project.org >> [mailto:r-help-boun...@r-project.org] Namens Maas James Dr (MED) >> Verzonden: donderdag 17 februari 2011 11:09 >> Aan: r-help@r-project.org >> Onderwerp: [R] removing lower and upper quantiles from an arry >> >> I'm trying to work out the simplest way to remove the upper >> and lower quantiles, in this case upper and lower 25% from an >> array. I can do it in two steps but when I try it in one, it >> fails. Is there something simple missing from my syntax or >> are there other simple elegant way to accomplish this? >> >> Thanks >> >> J >> >>> i<-1:20 >>> i2<- i[i>> i3<- i[i>quantile(i,.25)] >>> i4<- i[quantile(i,.25)< i> quantile(i,.75)] >> Error: unexpected '>' in "i4<- i[quantile(i,.25)< i>" >> >> === >> Dr. Jim Maas >> University of East Anglia >> >> __ >> 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. > -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 31 31 (poste 18467) # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] sampling
Hi , what about split function ? ?split divided x into 2 data.frame a<-split(x,1:2) a[[1]] first data frame a[[2]] second data frame regrads M Le 17/02/11 05:35, yf a écrit : > I want to sample from the ID. For each ID, i want to have 2 set of data. I > try the sample() function but it didn't work. > >> x<-data.frame(id=c(1,1,1,2,2,2,2,3,3,3,4,4), v1=c(1:12), V2=c(12:23)) >> x > id v1 V2 > 1 1 1 12 > 2 1 2 13 > 3 1 3 14 > 4 2 4 15 > 5 2 5 16 > 6 2 6 17 > 7 2 7 18 > 8 3 8 19 > 9 3 9 20 > 10 3 10 21 > 11 4 11 22 > 12 4 12 23 -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 31 31 (poste 18467) # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] Filter data
Hi Diogenas, Try this, data<-subset(poli, poli$year>1994) Best, M Diogenas a écrit : Hello, I understand that question is probably stupid, but ... I have data (polity IV index) "country","year","democ","autoc","polity","polity2" "1","Afghanistan ",1800,1,7,-6,-6 "2","Afghanistan ",1801,1,7,-6,-6 "3","Afghanistan ",1802,1,7,-6,-6 I need to create new data sets which includes only cases after year 1995. I've tried this command: poli2<-poli[poli$year > 1994,] , however it generated this: Error in poli[poli$year > 1994, ] : incorrect number of dimensions. Any ideas how i can overcome this? Thank in advance for your help, - Diogenas -- View this message in context: http://r.789695.n4.nabble.com/Filter-data-tp3070069p3070069.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.
[R] Path analysis with logistic regression
Dear all, I would like to make a path analysis after retrieving relevant variables (continuous or binary) after logistic regression. So I try to model the dependent variable (0/1) based on the significant predictors using path analysis Could you tell me if there is a suitable package in R to do this? Any help would be appreciated Regards -- Mohamed Lajnef,IE INSERM U955 eq 15# Pôle de Psychiatrie# Hôpital CHENEVIER # 40, rue Mesly # 94010 CRETEIL Cedex FRANCE # mohamed.laj...@inserm.fr # tel : 01 49 81 31 31 (poste 18467) # Sec : 01 49 81 32 90 # fax : 01 49 81 30 99 # [[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.
Re: [R] which function
Hi Arnaud Try this l[((which(100420==l))-1):which(100420==l)] Regards Mo arnaud Gaboury a écrit : Dear group, Here is a list of elements : l <- c("100415", "100416", "100419", "100420", "100421", "100422", "100423", "100426", "100427", "100428", "100429", "100430", "100503", "100504", "100505", "100506", "100507", "100510", "100511", "100512", "100513", "100514", "100517", "100518", "100519", "100520", "100521", "100524", "100525", "100526", "100527", "100528", "100531") l[3:4] [1] "100419" "100420" #result is fine l[(which(100420==l))-1:which(100420==l)] [1] "100419" "100416" "100415" #can't understand why I do not have same result than the above line Thank You for help __ 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.
Re: [R] R eat my data
cheks the comments sent by David! M Changbin Du a écrit : > length(count.fields("/home/cdu/operon/id_name_gh5.txt")) [1] 1932 It is 1932 lines when count in R On Tue, May 25, 2010 at 8:52 AM, Mohamed Lajnef mailto:mohamed.laj...@inserm.fr>> wrote: Hi Changbin, Try to use this code in R to count the lines of your file without open it length(count.fields("id_name_gh5.txt")) Regards Mohamed Changbin Du a écrit : HI, Dear R community, My original file has 1932 lines, but when I read into R, it changed to 1068 lines, how comes? c...@nuuk:~/operon$ wc -l id_name_gh5.txt 1932 id_name_gh5.txt gene_name<-read.table("/home/cdu/operon/id_name_gh5.txt", sep="\t", skip=0, header=F, fill=T) dim(gene_name) [1] 10683 -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr <mailto:mohamed.laj...@inserm.fr> tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 -- Sincerely, Changbin -- Changbin Du DOE Joint Genome Institute Bldg 400 Rm 457 2800 Mitchell Dr Walnut Creet, CA 94598 Phone: 925-927-2856 -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] R eat my data
Hi Changbin, Try to use this code in R to count the lines of your file without open it length(count.fields("id_name_gh5.txt")) Regards Mohamed Changbin Du a écrit : HI, Dear R community, My original file has 1932 lines, but when I read into R, it changed to 1068 lines, how comes? c...@nuuk:~/operon$ wc -l id_name_gh5.txt 1932 id_name_gh5.txt gene_name<-read.table("/home/cdu/operon/id_name_gh5.txt", sep="\t", skip=0, header=F, fill=T) dim(gene_name) [1] 10683 -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] sort a data.frame
The solution given by Jim is more correct dd[order(as.numeric(substr(dd$b,4,5))),] regards M jim holtman a écrit : dd b x y z 1 chr2 A 8 1 2 chr1 D 3 1 3 chr15 A 9 1 4 chr13 C 9 2 # add column with just numbers dd$sort <- as.integer(gsub("\\D+", "", dd$b)) dd[order(dd$sort),] # notice it is a numeric, not character order b x y z sort 2 chr1 D 3 11 1 chr2 A 8 12 4 chr13 C 9 2 13 3 chr15 A 9 1 15 On Thu, May 20, 2010 at 8:28 AM, Yuan Jian wrote: Hello, I have a dataframe: dd <- data.frame(b = c("chr2", "chr1", "chr15", "chr13"), x = c("A", "D", "A", "C"), y = c(8, 3, 9, 9), z = c(1, 1, 1, 2)) dd b x y z 1 chr2 A 8 1 2 chr1 D 3 1 3 chr15 A 9 1 4 chr13 C 9 2 Now I want to sort them according column "b", but only its number is considered: b x y z 1 chr1 D 3 1 2 chr13 C 9 2 3 chr15 A 9 1 4 chr2 A 8 1 thanks jian [[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.
[R] t.test per line
Dear All, I apologize for this trivial question, I can not find the solution I try to use t.test function per line in the data.frame, But i dont'understand the error message my program is as follows group1<-gl(2,20) fun<-function(x){ m<-data.frame(group1,x) #anova(aov(x ~ group1, m)) t.est(x ~ group1,m) } ttest<- apply(data, 1, fun) Error in t.test.default(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, : data are essentially constant Any help would be appreciated ML Best -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] timing a function
Hi, ? proc.time() for more help regards Ml pdb a écrit : Hi, I want to time how long a function takes to execute. Any clues on what to search for to achieve this? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/timing-a-function-tp2126319p2126319.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.
Re: [R] apply fun to df returning a matrix
Hi Soeren Apply or aggregate functions best regards M soeren.vo...@eawag.ch a écrit : Hello, a data.frame, df, holds the numerics, x, y, and z. A function, fun, should return some arbitrary statistics about the arguments, e.g. the sum or anything else. What I want to do is to apply this function to every pair of variables in df, and the return should be a matrix as found with cov. How can I achieve that? Thanks, Sören df <- data.frame(x=1:10, y=11:20, z=21:30); fun <- function(x){ return(sum(x)); } # and now??? __ 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. -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] Find solution for an error in the condition of if
Dear Nuel, could you send the error messages in English please. Adds & between the two conditions and try again if ( (data[pa,k]== df[,j]) && (data[ch,k]==i)) Best M anderson nuel a écrit : Dear r-help, Could you help me to find a solution for this error: Il y a eu 50 avis ou plus (utilisez warnings() pour voir les 50 premiers) warnings() Messages d'avis : 1: In if ((data[pa, k] == df[, j]) & (data[ch, k] == i)) { ... : la condition a une longueur > 1 et seul le premier élément est utilisé 2: In if ((data[pa, k] == df[, j]) & (data[ch, k] == i)) { ... : la condition a une longueur > 1 et seul le premier élément est utilisé ch=3 pa=c(1,2) r=2 t=4 nb=15 ni=array(0,c( r,t)) for ( i in 1:r){ for (j in 1:t ){ for (k in 1:nb){ if ( (data[pa,k]== df[,j]) & (data[ch,k]==i)){ ni[i,j]=ni[i,j]+1 } } } } Best Regards [[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. -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] median Q?
Hi, Try this median(v2[v1==1]) Mohamed Regards Vlatka Matkovic Puljic a écrit : I have additional Q: v1 is gender (M=1 and F=2) v2 is age I want R to calculate median only for M (1), but my comand is not good :) while(v1=1){median(v2,na.rm=TRUE)} Error: unexpected '=' in "while(Q2=" 2010/4/21 Vlatka Matkovic Puljic Thank you! 2010/4/21 Joshua Wiley Hello, summary() removes NAs by default. You can get the same results using median(year, na.rm=TRUE) see ?median HTH, Josh On Wed, Apr 21, 2010 at 6:40 AM, Vlatka Matkovic Puljic wrote: Hi, I have dataset n1 and v1 (years). when i ask median(year) [1] NA but if i put summary of dataset n1: summary(n1) R produces median (together with min/max/mean) why it is so? -- ** Vlatka Matkovic Puljic 095/8618 171 [[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. -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ -- ** Vlatka Matkovic Puljic 095/8618 171 -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] sum specific rows in a data frame
Hi Arnaud, Try aggregate function regards M arnaud Gaboury a écrit : I have a data frame called "pose": DESCRIPTION QUANITY CLOSING.PRICE 1 WHEAT May/101467.75 2 WHEAT May/102467.75 3 WHEAT May/101467.75 4 WHEAT May/101467.75 5 COTTON NO.2 May/101 78.13 6 COTTON NO.2 May/103 78.13 7 COTTON NO.2 May/101 78.13 I would like to sum the quantity for each category (i.e WHEAT and COTTON),but I have no idea how to write it in a simple manner. The number or rows will change every day. TY for any help. __ 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. -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] compare multiple values with vector and return vector
Hi Joris Try Is.element function: is.element (x,y) Regards mohamed Joris Meys a écrit : Dear all, I have a vector, and for each element I want to check whether it is equal to any element from another vector. I want a vector of logical values with the length of the first one as return. In R this would be : x <- 1:10 sapply(x,function(y){any(y==c("2","3","4"))}) [1] FALSE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE It works pretty smooth, but I have the feeling there's a less complicated way of doing it. My code should be readable by programmers who are not really familiar with R, but I hate to use for-loops as I have pretty huge datasets. Anybody an idea? thank you in advance. Cheers Joris -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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.
[R] Empirical Pvalue
Dear R users, Can someone explain me the interpretation of empirical p-value ( max(t)) used to test the genetic association with PLINK? Any help will be appreciated Regards M -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] Is the aggregate function the best way to do this?
Hi Bert, apply(data,1,max) gives the max value for each row in the data M Bert Jacobs a écrit : Hi Mohamed, Thx for the answer. And what should I do if my fun function is not 'sum' but 'max'? Bert -Original Message- From: Mohamed Lajnef [mailto:mohamed.laj...@inserm.fr] Sent: 17 February 2010 10:02 To: Bert Jacobs Cc: r-help@r-project.org Subject: Re: [R] Is the aggregate function the best way to do this? Hi Bret, Try to use rowSums function Regrads M Bert Jacobs a écrit : Hi, I'm having a dataframe 'Subset1' with a number of factor variables and 160 numerical variables Now I want to make sums for all rows that have the same values for the different factor variables, except for the factor variables: VAR1,VAR2,VAR3 who may have the same values. With the formula given below this works great, but in a situation with 15000 rows and 13 factor variables the calculation takes more than 2 minutes. So my question is: Does anyone knows if there exists a faster alternative? Subset1.AGG <- as.data.frame(aggregate(Subset1[,(ncol(Subset1)-159):ncol(Subset1)], list(VAR1 = Subset1$VAR1,VAR2=Subset1$VAR2,VAR3 = Subset1$VAR3), FUN=sum) ) Thank you very much for helping me out, Bert [[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. -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] Is the aggregate function the best way to do this?
Hi Bret, Try to use rowSums function Regrads M Bert Jacobs a écrit : Hi, I'm having a dataframe 'Subset1' with a number of factor variables and 160 numerical variables Now I want to make sums for all rows that have the same values for the different factor variables, except for the factor variables: VAR1,VAR2,VAR3 who may have the same values. With the formula given below this works great, but in a situation with 15000 rows and 13 factor variables the calculation takes more than 2 minutes. So my question is: Does anyone knows if there exists a faster alternative? Subset1.AGG <- as.data.frame(aggregate(Subset1[,(ncol(Subset1)-159):ncol(Subset1)], list(VAR1 = Subset1$VAR1,VAR2=Subset1$VAR2,VAR3 = Subset1$VAR3), FUN=sum) ) Thank you very much for helping me out, Bert [[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. -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] Error of Stepwise Regression with number of rows in use has changed: remove missing values?
Hi Kum, If you look at the code step function ( by typing step in the R console), the condition (if (length(fit$residuals) != n) ) is not fulfilled, this explains the error! i hope this can help Regards M Kum-Hoe Hwang a écrit : Howdy, R Grues I have enjoyed R, but I cannot solve one problem easily. Please help my problem. When I tried the R script, I got the following Error. This error results from input data file exported through a Excel spreadsheet software. Error in step(lm(pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + : number of rows in use has changed: remove missing values? Could you direct me to solve the Error? Thanks in advance, ### outputs from R console ### pop <- step( + lm(pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) ++ as.numeric(do.grant) + as.numeric(city.grant) + as.numeric(DMZ.dist) + as.numeric(Seoul.dist), data=borderI.data, na.action = na.omit) + ) Start: AIC=494.27 pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + as.numeric(do.grant) + as.numeric(city.grant) + as.numeric(DMZ.dist) + as.numeric(Seoul.dist) Df Sum of SqRSSAIC - as.numeric(do.grant) 1 0.71 6622.9 492.28 - as.factor(policy) 1 1.21 6623.4 492.29 - as.numeric(DMZ.dist) 1 1.91 6624.1 492.30 - as.numeric(city.grant)1 5.07 6627.3 492.36 - as.numeric(nation.grant) 1 11.51 6633.7 492.47 - as.numeric(year) 1 29.58 6651.8 492.80 6622.2 494.27 - as.numeric(Seoul.dist)1673.22 7295.4 503.79 Step: AIC=492.28 pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + as.numeric(city.grant) + as.numeric(DMZ.dist) + as.numeric(Seoul.dist) Df Sum of SqRSSAIC - as.factor(policy) 1 1.99 6624.9 490.32 - as.numeric(DMZ.dist) 1 2.09 6625.0 490.32 - as.numeric(city.grant)1 7.18 6630.1 490.41 - as.numeric(nation.grant) 1 20.08 6643.0 490.64 - as.numeric(year) 1 28.89 6651.8 490.80 6622.9 492.28 - as.numeric(Seoul.dist)1697.46 7320.4 502.20 Step: AIC=490.32 pop.rate ~ as.numeric(year) + as.numeric(nation.grant) + as.numeric(city.grant) + as.numeric(DMZ.dist) + as.numeric(Seoul.dist) Df Sum of SqRSSAIC - as.numeric(DMZ.dist) 1 2.08 6627.0 488.35 - as.numeric(city.grant)1 10.65 6635.6 488.51 - as.numeric(nation.grant) 1 31.30 6656.2 488.88 - as.numeric(year) 1 31.44 6656.4 488.88 6624.9 490.32 - as.numeric(Seoul.dist)1732.88 7357.8 500.80 Step: AIC=488.35 pop.rate ~ as.numeric(year) + as.numeric(nation.grant) + as.numeric(city.grant) + as.numeric(Seoul.dist) Df Sum of SqRSSAIC - as.numeric(city.grant)1 9.86 6636.9 486.53 - as.numeric(year) 1 31.42 6658.4 486.92 - as.numeric(nation.grant) 1 33.33 6660.3 486.95 6627.0 488.35 - as.numeric(Seoul.dist)1754.40 7381.4 499.18 Error in step(lm(pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + : --- number of rows in use has changed: remove missing values? -- -- Kum-Hoe Hwang, Ph.D. Phone : 82-31-250-3516 Email : phdhw...@gmail.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. -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] binary
Hi val, Val a écrit : Hi all Assume I have a data set xx; Group: 1=group1 , 2=group2 IQ: 1= High, 0 =low fit <- glm(IQ ~group, data = xx, family = binomial()) summary(fit) Results Estimate Std. Error z value Pr(>|z|) (Intercept) -2.554560.210 -12.273 < 5e-16 *** group 0.36180 0.076 3.952 5.24e-05 *** the odd ratio = exp(0.36180 )= 1.435912 My question is that the log-odd estimate 0.3618 is it for group1 or group2? normally 1vs2, glm takes 2 as reference, in the group1 the IQ increase by 0.3618compared to group 2 What does the odd ratio 1.43359 is interpreted? in the group1 the IQ score increase by 1.43359 compared to group 2 Thanks in advance Regards ML __ 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. -- Mohamed Lajnef INSERM Unité 955. 40 rue de Mesly. 94000 Créteil. Courriel : mohamed.laj...@inserm.fr tel.: 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 Portable:06 15 60 01 62 __ 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.
Re: [R] Error in lm() function
Hi Bogaso, Try this vecnames<-names(test[,2:11]) fmla <- as.formula(paste("test[,1] ~ ", paste(vecnames, collapse= "+"))) res<-lm(fmla) Regards M Bogaso a écrit : Hi all, I wanted to have a seasonality study like whether a particular month has significant effect as compared to others. Here is my data : 0.10499 0 0 1 0 0 0 0 0 0 0 0 0.00259 0 0 0 1 0 0 0 0 0 0 0 -0.060150 0 0 0 1 0 0 0 0 0 0 0.10721 0 0 0 0 0 1 0 0 0 0 0 0.03597 0 0 0 0 0 0 1 0 0 0 0 0.10584 0 0 0 0 0 0 0 1 0 0 0 0.02063 0 0 0 0 0 0 0 0 1 0 0 -0.035090 0 0 0 0 0 0 0 0 1 0 -0.034850 0 0 0 0 0 0 0 0 0 1 0.01632 0 0 0 0 0 0 0 0 0 0 0 0.06844 1 0 0 0 0 0 0 0 0 0 0 -0.017660 1 0 0 0 0 0 0 0 0 0 0.00989 0 0 1 0 0 0 0 0 0 0 0 0.11673 0 0 0 1 0 0 0 0 0 0 0 0.01789 0 0 0 0 1 0 0 0 0 0 0 -0.003230 0 0 0 0 1 0 0 0 0 0 0.06811 0 0 0 0 0 0 1 0 0 0 0 -0.012920 0 0 0 0 0 0 1 0 0 0 -0.122440 0 0 0 0 0 0 0 1 0 0 -0.066450 0 0 0 0 0 0 0 0 1 0 -0.033550 0 0 0 0 0 0 0 0 0 1 0.02308 0 0 0 0 0 0 0 0 0 0 0 -0.117111 0 0 0 0 0 0 0 0 0 0 0.06116 0 1 0 0 0 0 0 0 0 0 0 0.02832 0 0 1 0 0 0 0 0 0 0 0 0.01441 0 0 0 1 0 0 0 0 0 0 0 -0.044120 0 0 0 1 0 0 0 0 0 0 0.05558 0 0 0 0 0 1 0 0 0 0 0 0.08363 0 0 0 0 0 0 1 0 0 0 0 -0.010630 0 0 0 0 0 0 1 0 0 0 i.e. all explanatory variables here are dichotomous. However once I run lm() i got following error : lm(dat[,1]~dat[,-1]) Error in model.frame.default(formula = dat[, 1] ~ dat[, -1], drop.unused.levels = TRUE) : invalid type (list) for variable 'dat[, -1]' Can anyone please tell me what to do? Best, -- Mohamed Lajnef INSERM Unité 955. 40 rue de Mesly. 94000 Créteil. Courriel : mohamed.laj...@inserm.fr tel.: 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 Portable:06 15 60 01 62 __ 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.
Re: [R] how to suppress the output from stepAIC?
Hi Jack, try stepAIC with trace parameter: stepAIC(...,trace=FALSE) Regards, M Jack Luo a écrit : Hi, I am now running a cross-validation using coxph coupled with stepAIC for model selection, is there anyway to suppress the output? It's too much. -Jack [[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.
Re: [R] How to sum and group data by DATE in data frame
Hi Clair, try to use this code aggregate(toto$Income,by=list((substr(toto$Date,1,7))),sum) Regards mohamed clair.crossup...@googlemail.com a écrit : Dear all, Lets say I have a data frame as follows: Date <- as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13', '2006-09-20')) Income <- c(73.79, 72.46, 76.32, 72.43, 72.62) data.frame(Date, Income) Date Income 1 2006-08-23 73.79 2 2006-08-30 72.46 3 2006-09-06 76.32 4 2006-09-13 72.43 5 2006-09-20 72.62 is there a way to group the data by month (summing the values in each month), i.e. Date Income 2006-08 146.25 2006-09 221.37 Thanks in advance, C.C. __ 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. -- Mohamed Lajnef INSERM Unité 955. 40 rue de Mesly. 94000 Créteil. Courriel : mohamed.laj...@inserm.fr tel. : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] Averaging rows if a condition is true.
Hi, Try to use aggregate function RSiteSearch ("aggregate") #for help Regards ML A Ezhil a écrit : Dear All, I have matrix (5 X 60) of subjects and their responses to a set of questions. All responses are classified into categories (500). I would like to average all subject's responses for each category. I wrote a code using a for loop but is not working. Could please tell me what's wrong with the code? I guess, there is a elegant R way of doing the same thing. Thanks in advance. Kind regards, Ezhil j <- 1; n <- dim(dat)[1]; cat <- as.character(dat[,1]); row <- matrix(nrow=nrow(dat), ncol=ncol(dat)); for(i in 1:n-1) { if(cat[i] != cat[i+1]) {row[j, ] <- dat[j, ]} else { start <- j; end <- i; } row[j, ] <- colMeans(dat[j:i, ]); j+1; } __ 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. -- Mohamed Lajnef INSERM Unité 955. 40 rue de Mesly. 94000 Créteil. Courriel : mohamed.laj...@inserm.fr tel. : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] Select top three values from data frame
Noah Silverman a écrit : I only have a few values in my example, but the real data set might have 20-100 rows with A="X". So how do I pick just the three highest ones? -N Hi, and now? df.mydata$B[order(df.mydata[df.mydata$A=="X" AND df.mydata$C < 2, ]$B)][length(df.mydata$B)-3:length(df.mydata$B)] cheers, ML On 8/26/09 2:46 AM, Ottorino-Luca Pantani wrote: df.mydata[df.mydata$A=="X" AND df.mydata$C < 2, ] will do the job ? 8rino Noah Silverman ha scritto: Hi, I'm trying to find an easy way to do this. I want to select the top three values of a specific column in a subset of rows in a data.frame. I'll demonstrate. ABC x21 x41 x32 y15 y26 y38 I want the top 3 values of B from the data.frame where A=X and C <2 I could extract all the rows where C<2, then sort by B, then take the first 3. But that seems like the wrong way around, and it also will get messy with real data of over 100 columns. Any suggestions? [[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. -- Mohamed Lajnef INSERM Unité 955. 40 rue de Mesly. 94000 Créteil. Courriel : mohamed.laj...@inserm.fr tel. : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] Select top three values from data frame
Noah Silverman a écrit : Hi, I'm trying to find an easy way to do this. I want to select the top three values of a specific column in a subset of rows in a data.frame. I'll demonstrate. Hi, did you try this? data[data$A=='x'& data$C<2,]$B # data = your data frame ABC x21 x41 x32 y15 y26 y38 I want the top 3 values of B from the data.frame where A=X and C <2 I could extract all the rows where C<2, then sort by B, then take the first 3. But that seems like the wrong way around, and it also will get messy with real data of over 100 columns. Any suggestions? regards ML __ 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. -- Mohamed Lajnef INSERM Unité 955. 40 rue de Mesly. 94000 Créteil. Courriel : mohamed.laj...@inserm.fr tel. : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ 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.
Re: [R] Package read large file
Dear Jim & Michael the file contains 1000 lines and 1.200.000 columns, txt format and i wish to read all the file with R if possible, or read a few columns? I tried without success to turn bigmemory and colbycol packages, also scan and readLines function but It takes a long time without anything. I have windows X64 bits 8 Go In advance thanks ML jim holtman a écrit : A little more detail would be appropriate. How large is "large"? What is the format of the file? What do you wnat to do with the data? Do you have to have it all in memory at once? Does it exist in a data base already? What type of system are you running on? How much memory do you have? On Wed, Aug 19, 2009 at 4:51 AM, Mohamed Lajnef wrote: Dear R-Users, I am looking for packages that could read large files in R? any suggestions are welcome. Regards, ML __ 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.
[R] Package read large file
Dear R-Users, I am looking for packages that could read large files in R? any suggestions are welcome. Regards, ML __ 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.