Re: [R] about R install
Yang Jie [EMAIL PROTECTED] writes: Dear Sir: I am a chinese researcher who interested in miRNA, and I want to use R to analysis my data.I have download R-2.4.0-win32.exe and install it smoothly on my computer,but when I want to use this software, error occurs,it shows R for windows GUI front-end meet some problems and the interface closese automatically, I don't know what happen. My computer is Windows XP operating system and hard disk space is enough for me to run this software.Can you give me a help? Thanks a lot! Best Regards. Jie Yang Is your computer speaking Chinese? If so, you can either set the language to English (see installation and administration manual), or install the current patch version, available from CRAN. (Apparently, some translations were using the wrong encoding. It was unfortunate that this slipped into the release, but since there are no Chinese speakers in R core, we rely entirely on people checking the alpha and beta releases, and noone did...) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch 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] question about function gls in library nlme
library(nlme) fm1 - gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary, +correlation = corARMA(form = ~ 1 | Mare, p = 2)) summary(fm1) Generalized least squares fit by REML Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time) Data: Ovary AIC BIClogLik 1561.995 1584.317 -774.9976 Correlation Structure: ARMA(2,0) Formula: ~1 | Mare Parameter estimate(s): Phi1 Phi2 0.5991803 0.2028649 Coefficients: Value Std.Error t-value p-value (Intercept)12.110836 0.7633842 15.864667 0. sin(2 * pi * Time) -2.825762 0.5773713 -4.894185 0. cos(2 * pi * Time) -0.838151 0.6432846 -1.302924 0.1936 Correlation: (Intr) s(*p*T sin(2 * pi * Time) 0.000 cos(2 * pi * Time) -0.276 0.000 Standardized residuals: Min Q1 Med Q3 Max -2.39970879 -0.73304443 -0.02229811 0.64429618 3.19313563 Residual standard error: 4.607767 Degrees of freedom: 308 total; 305 residual coef(fm1$modelStruct, unconstrained = FALSE) corStruct.Phi1 corStruct.Phi2 0.5991803 0.2028649 Best, Renaud 2006/11/6, yyan liu [EMAIL PROTECTED]: Hi: The gls function I used in my code is the following fm-gls(y~x,correlation=corARMA(p=2) ) My question is how to extact the AR(2) parameters from fm. The object fm is the following. How can I extract the correlation parameters Phi1 and Phi2 from fm? These two parametrs is not in the coef componenet of fm. Thanks a lot! liu -- fm Generalized least squares fit by REML Model: y ~ x Data: NULL Log-restricted-likelihood: -1634.588 Coefficients: (Intercept) x 16.0728672 0.2917921 Correlation Structure: ARMA(2,0) Formula: ~1 Parameter estimate(s): Phi1 Phi2 1.3368230 -0.4539957 Degrees of freedom: 480 total; 478 residual Residual standard error: 20.80244 -- - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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. -- Renaud LANCELOT Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD Directeur adjoint chargé des affaires scientifiques CIRAD, Animal Production and Veterinary Medicine Department Deputy director for scientific affairs Campus international de Baillarguet TA 30 / B (Bât. B, Bur. 214) 34398 Montpellier Cedex 5 - France Tél +33 (0)4 67 59 37 17 Secr. +33 (0)4 67 59 39 04 Fax +33 (0)4 67 59 37 95 __ R-help@stat.math.ethz.ch 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] Colour-coded Editor for R Code
Do any of you know any simple programming editors for R scripts which offer basic colour-coding and bracket-matching facilities? Dregging through scripts to find a missing comma or parentheses is something I'd rather do less of... Jon Minton [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Hmisc, latex cdec not as expected
Hello all. I have encountered at problem when using the Hmisc package to generate latex-tabels. I can't seem to control the number of digits in the latex-file. I have used the Design and Hmisc packages for a while without this problem, but after upgrading to R-2.4.0 the problem has occured. I have mad a clean installation where I uninstalled all earliere version of R, and I re-installed all packages. Below is a simple example, where the output has 15 digits after the decimal-point. I have then tried to use the 'digits'-option, but that gives an error. R version 2.4.0 (2006-10-03) Copyright (C) 2006 The R Foundation for Statistical Computing ISBN 3-900051-07-0 library(Design) tmp - data.frame(x=c(1.0002, 2.013), y=c(1,2)) tabel - summary(x~y, data=tmp) latex(tabel, cdec=3) latex(tabel, digits=3) Error in format.df(object, dcolumn = dcolumn, na.blank = na.blank, numeric.dollar = numeric.dollar, : only one of digits, dec, rdec, cdec may be given I hope someone can help. With kind regards Henrik __ Henrik F. Thomsen Msc, PhD, statistician [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Colour-coded Editor for R Code
Tinn-R From: [EMAIL PROTECTED] on behalf of Jon Minton Sent: Mon 06/11/2006 9:11 AM To: R-help@stat.math.ethz.ch Subject: [R] Colour-coded Editor for R Code Do any of you know any simple programming editors for R scripts which offer basic colour-coding and bracket-matching facilities? Dregging through scripts to find a missing comma or parentheses is something I'd rather do less of... Jon Minton [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] solution to a regression with multiple independent variable
Hello John, you can derive these estimators by considering a step-wise approach: 1) Derive the estimators by evaluating a model with demeaned variables, i.e. consider (\tilde{X}'\tilde{x})^-1 \tilde{x}'\tilde{y}, where \tilde{...} refers to the demeaned variables. 2) Obtain the estimate of the intercept, by utilising the Schwerpunkteigenschaft of the OLS estimator. HTH, Bernhard Please forgive a statistics question. I know that a simple bivariate linear regression, y=f(x) or in R parlance lm(y~x) can be solved using the variance-covariance matrix: beta(x)=covariance(x,y)/variance(x). I also know that a linear regression with multiple independent variables, for example y=f(x,z) can also be solved using the variance-covariance matrix, but I don't know how to do this. Can someone help me go from the variance-covariance matrix to the solution of a regression with multiple independent variables? It is not clear how one applies the matrix solution b= (x'x)-1*x'y to the elements of the variance-covariance matrix, i.e. how one gets the required values from the variance-covariance matrix. Any help, or suggestions would be appreciated. Thanks, John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC, University of Maryland School of Medicine Claude D. Pepper OAIC, University of Maryland Clinical Nutrition Research Unit, and Baltimore VA Center Stroke of Excellence University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) [EMAIL PROTECTED] Confidentiality Statement: This email message, including any attachments, is for the so...{{dropped}} __ R-help@stat.math.ethz.ch 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. * Confidentiality Note: The information contained in this mess...{{dropped}} __ R-help@stat.math.ethz.ch 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] problem with survreg and anova function
Hi, I make a weibull survival regression using suvreg function. Bu when I try to get the P values from anova, it give me NAs: I'm using R 2.4.0 and survival 2.29 Look: m - survreg(Surv(tempo,censor)~grupo*peso) anova(m) Df Deviance Resid. Df-2*LL P(|Chi|) NULL NA NA 148 966.6416NA grupo -2 25.6334407 146 941.0081NA peso -1 0.7088892 145 940.2992NA grupo:peso -2 1.0731248 143 939.2261NA Older version of survival dont have this problem, look this printed result: anova(glex8.m1) -2LL DfDeviance Resid. Df P(|Chi|) NULL NA NA 2 966.6416 NA grupo 2 25.6334408 4 941.0081 2.714995e-06 peso1 0.7088892 5 940.2992 3.998128e-01 grupo:peso 2 1.07312487 939.2261 5.847550e-01 This a bug or a change in package? The data from crawley book: structure(list(tempo = c(20, 34, 1, 2, 3, 3, 50, 26, 1, 50, 21, 3, 13, 11, 22, 50, 50, 1, 50, 9, 50, 1, 13, 50, 50, 1, 6, 50, 50, 50, 36, 3, 46, 10, 50, 1, 18, 3, 36, 37, 50, 7, 1, 1, 7, 24, 4, 50, 12, 17, 1, 1, 1, 21, 50, 50, 1, 46, 50, 1, 8, 2, 12, 3, 2, 1, 5, 50, 1, 2, 2, 4, 17, 5, 1, 11, 8, 1, 5, 2, 41, 5, 21, 1, 38, 50, 3, 19, 4, 7, 1, 46, 2, 5, 40, 4, 50, 2, 1, 17, 7, 1, 5, 1, 1, 5, 6, 2, 24, 1, 1, 1, 1, 7, 13, 6, 11, 46, 5, 14, 2, 1, 20, 2, 20, 1, 23, 11, 1, 1, 20, 9, 1, 1, 1, 1, 7, 11, 1, 3, 1, 5, 9, 21, 10, 11, 30, 1, 1, 17), censor = c(1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), peso = c(5.385, 7.413, 9.266, 6.228, 5.229, 9.699, 1.973, 5.838, 2.088, 0.237, 6.814, 5.502, 1.137, 6.323, 7.384, 8.713, 7.458, 1.424, 1.312, 5.162, 7.187, 4.677, 6.548, 5.903, 2.113, 7.617, 3.737, 8.972, 6.523, 2.165, 4.895, 6.538, 1.674, 6.726, 2.671, 4.949, 4.819, 5.08, 3.532, 4.406, 6.286, 5.529, 2.27, 5.245, 9.675, 5.61, 4.297, 3.179, 6.776, 0.466, 0.626, 1.221, 0.124, 0.32, 2.282, 0.287, 3.468, 7.314, 4.901, 5.418, 6.344, 1.163, 12.126, 11.561, 8.333, 0.055, 10.583, 9.534, 13.182, 10.156, 16.881, 15.452, 16.831, 18.947, 19.099, 19, 9.652, 1.544, 10.786, 4.13, 2.2, 7.567, 14.581, 26.259, 0.44, 18.188, 6.789, 16.669, 38.177, 29.154, 14.578, 1.569, 0.345, 33.929, 28.958, 38.139, 26.822, 39.501, 9.264, 22.88, 27.48, 35.069, 4.974, 41.521, 42.09, 25.037, 9.509, 23.682, 0.352, 19.589, 7.426, 7.913, 2.37, 5.533, 18.8, 18.508, 3.343, 26.926, 2.388, 21.567, 5.594, 17.15, 15.986, 1.588, 2.055, 16.074, 12.086, 20.524, 6.493, 7.258, 16.635, 10.324, 5.228, 0.784, 5.587, 5.011, 7.441, 3.69, 4.708, 9.207, 1.4, 6.309, 1.784, 0.767, 1.993, 1.03, 2.875, 1.82, 0.974, 0.1), grupo = structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), .Label = c(g1, g2, g3), class = factor)), .Names = c(tempo, censor, peso, grupo), class = data.frame, row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150)) Thanks Inte Ronaldo -- O cigarro disse ao fumante: Hoje você me acende, amanhã eu te apago. -- Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. Ecologia Evolutiva | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8190 | [EMAIL PROTECTED] | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@stat.math.ethz.ch 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,
Re: [R] Colour-coded Editor for R Code
Jon, are you using Windows? If so, try WinEdt with library(RWinEdt). It has all the features you want and need. For Linux/Unix use EMACS. There is a section on CRAN about editors. Cheers, Dan Bebber Department of Plant Sciences University of Oxford __ R-help@stat.math.ethz.ch 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] Ridge for logistic regression
Prof Brian Ripley wrote: On Fri, 3 Nov 2006, Zheng Yuan wrote: Dear all experts, Does anyone know if there is a R function which can perform Ridge regression for logistic models? multinom and nnet in the package of that name. You can also use the lrm function in the Design package, which makes it relatively easy to specify penalization patterns by type of model term (e.g., to obtain more penalization for interaction or nonlinear terms). -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch 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] neg-bin clustered analysis in R?
Dear All, I'm analysing a negative binomial dataset from a population-based study. Many covariates were determined on household level, so all members of a household have the same value for those covariates. In STATA, there seems to be an option for 'clustered analysis' for neg-bin regression. Does an equivalent exist for R(MASS)'s glm.nb or a comparable function? Many thanks for all help! Lutz -- Lutz Ph. Breitling, Marie Curie EST Research Fellow Integrative Comparative Biology (Irene Manton 8.93e) University of Leeds, LS2 9JT Leeds/UK __ R-help@stat.math.ethz.ch 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] Colour-coded Editor for R Code
Hello, You have a rather large list of editor that support R syntax highlighting listed in: http://www.sciviews.org/_rgui/projects/Editors.html. Best, Philippe Grosjean Dan Bebber wrote: Jon, are you using Windows? If so, try WinEdt with library(RWinEdt). It has all the features you want and need. For Linux/Unix use EMACS. There is a section on CRAN about editors. Cheers, Dan Bebber Department of Plant Sciences University of Oxford __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Hmisc, latex cdec not as expected - again
Hello all. Sorry for reposting this message, but I accedently sent it in HTML-format the first time. I have encountered at problem when using the Hmisc package to generate latex-tabels. I can't seem to control the number of digits in the latex-file. I have used the Design and Hmisc packages for a while without this problem, but after upgrading to R-2.4.0 the problem has occured. I have made a clean installation where I uninstalled all earliere version of R, and I re-installed all packages. Below is a simple example, where the output has 15 digits after the decimal-point. I have then tried to use the 'digits'-option, but that gives an error. R version 2.4.0 (2006-10-03) Copyright (C) 2006 The R Foundation for Statistical Computing ISBN 3-900051-07-0 library(Design) tmp - data.frame(x=c(1.0002, 2.013), y=c(1,2)) tabel - summary(x~y, data=tmp) latex(tabel, cdec=3) latex(tabel, digits=3) Error in format.df(object, dcolumn = dcolumn, na.blank = na.blank, numeric.dollar = numeric.dollar, : only one of digits, dec, rdec, cdec may be given I hope someone can help. With kind regards Henrik __ R-help@stat.math.ethz.ch 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] Colour-coded Editor for R Code
Emacs and ESS for both Unix and Windows. emacs for Windows from ftp://ftp.gnu.org/pub/gnu/emacs/windows/emacs-21.3-fullbin-i386.tar.gz emacs for Unix from ftp://ftp.gnu.org/pub/gnu/emacs/emacs-21.4a.tar.gz ESS from http://ess.r-project.org/ Click on Source for the package itself. Other items on the page give documentation. __ R-help@stat.math.ethz.ch 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] neg-bin clustered analysis in R?
I'm not certain, but I think you should be able to use the robcov function in the Design package in conjunction with glm.nb, perhaps with a bit of tweaking. Another alternative might be to use the quasi family in lmer. On 06/11/06, Lutz Ph. Breitling [EMAIL PROTECTED] wrote: Dear All, I'm analysing a negative binomial dataset from a population-based study. Many covariates were determined on household level, so all members of a household have the same value for those covariates. In STATA, there seems to be an option for 'clustered analysis' for neg-bin regression. Does an equivalent exist for R(MASS)'s glm.nb or a comparable function? Many thanks for all help! Lutz -- Lutz Ph. Breitling, Marie Curie EST Research Fellow Integrative Comparative Biology (Irene Manton 8.93e) University of Leeds, LS2 9JT Leeds/UK __ R-help@stat.math.ethz.ch 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. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch 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] Ridge for logistic regression
Also check out the package glmpath which can incorporate both ridge (L2) and lasso (L1) type penalties. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Frank E Harrell Jr Sent: Monday, November 06, 2006 7:41 AM To: Prof Brian Ripley Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Ridge for logistic regression Prof Brian Ripley wrote: On Fri, 3 Nov 2006, Zheng Yuan wrote: Dear all experts, Does anyone know if there is a R function which can perform Ridge regression for logistic models? multinom and nnet in the package of that name. You can also use the lrm function in the Design package, which makes it relatively easy to specify penalization patterns by type of model term (e.g., to obtain more penalization for interaction or nonlinear terms). -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] lme4 install error
On 11/5/06, Shravan Vasishth [EMAIL PROTECTED] wrote: I'm trying to install lme4 (after having installed R 2.4.0 from source, and having installed the latest Matrix package). lme4 fails with the following message: pedigree.o definition of _lme4_xSym in section (__DATA,__common) pedigree.o definition of _lme4_ySym in section (__DATA,__common) make: *** [lme4.so] Error 1 ERROR: compilation failed for package 'lme4' ** Removing '/Library/Frameworks/R.framework/Versions/2.4/Resources/library/lme4' Others have apparently also had this problem, but their error message appeared to signal a missing or unfindable Matrix header file. This does not seem to be the case here. What is likely to be the problem? This install is on a Mac OS 10.3.9. I've done R upgrades many times before; this is the first time I''ve had a problem. The full error message for lme4 can be seen at: http://www.ling.uni-potsdam.de/~vasishth/screen.txt Thank you for the report and for making the full transcript available. It appears that I have neglected an extern when moving some code from the Matrix package to lme4. The compilers used for Mac OS X 10.4.x don't object to the multiple defintiions as long as they are consistent but compilers for older versions of Mac OS X do. I'll upload a fixed version of lme4 later today. One other unusual thing was that there were many warning messages during the Matrix install. ... Warning in matchSignature(signature, fdef, where) : in the method signature for function coerce no definition for class: matrix.csr Warning in matchSignature(signature, fdef, where) : in the method signature for function coerce no definition for class: matrix.csr Warning in matchSignature(signature, fdef, where) : in the method signature for function coerce no definition for class: matrix.csc ... Those warnings are to be expected. In the Matrix package we have utility functions to convert sparse Matrix objects from the SparseM package to sparse matrix objects for the Matrix package. We do not have the Matrix package depend on the SparseM package as it would be, for the most part, redundant. The warnings simply indicate that classes from the SparseM package are used in the signatures of methods but are not visible at the time that the Matrix package is compiled. to be loaded when the I have put the entire history of that install here: http://www.ling.uni-potsdam.de/~vasishth/screen2.txt Thanks, -- Shravan Vasishth,Empirical Methods in Syntax Juniorprofessor, Institute for Linguistics, Potsdam Tel: +49-(0)331-977-2016, -2457 Fax: -2087 http://www.ling.uni-potsdam.de/~vasishth [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Composition like classes functions
Gregor Gorjanc gregor.gorjanc at bfro.uni-lj.si writes: Hello! I am working on breed composition of animals in my project. Say I have an animal 1 with parents 2 (father) and 3 (mother). If father is of breed A and mother of breed B, then their descendant is of breed AB or 50 % of A and 50 % of B. I would like to have a general way to represent this kind of data. I was thinking about list structure i.e. ... However, I would like to ask if there is anything like this already in R or contributed packages. Replying myself. There is a package compositions at CRAN. I should have done homework before asking here. Gregor __ R-help@stat.math.ethz.ch 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] Hmisc, latex cdec not as expected - again
Henrik Frederik Thomsen HFTH at DCE.AU.DK writes: I have encountered at problem when using the Hmisc package to generate latex-tabels. I can't seem to control the number of digits in the latex-file. I have used the Design and Hmisc packages for a while without this problem, but after upgrading to R-2.4.0 the problem has occured. ... This bug has been confirmed by Frank Harrell and Thomas Dupont on October 25. They are working on it. Dieter __ R-help@stat.math.ethz.ch 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] goodness of fitting for a mixed distribution
Hi all! i have done a fitting of experimental data using optim function and setting up my mixed distribution logliklehood (it is a linear combination of a normal and a weibull distribution). How can i test the goodness of fit? I want to be able to say that my distribution fit the data at 90%, 95% or so on thanks in advance, nelson __ R-help@stat.math.ethz.ch 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] diag()- in Matrix?
Jerome == Jerome Goudet [EMAIL PROTECTED] on Sun, 05 Nov 2006 16:08:33 +0100 writes: Jerome Dear all, Jerome I am trying to use the Matrix package to do some calculations on rather Jerome large and sparse matrices. An example of such a matrix is given below. Jerome mig-0.2 Jerome side-10 Jerome np-side^2 Jerome mig.mat-matrix(0,np,np) Jerome diag(mig.mat[1:(np-side),(side+1):np])-mig/4 Jerome diag(mig.mat[(side+1):np,1:(np-side)])-mig/4 Jerome diag(mig.mat[-np,-1])-mig/4 Jerome nomig-which(1:(side^2-1)%%side==0) Jerome diag(mig.mat[-np,-1])[nomig]-0 Jerome diag(mig.mat[-1,-np])-mig/4 Jerome diag(mig.mat[-1,-np])[nomig]-0 Jerome diag(mig.mat)-1-apply(mig.mat,2,sum) Jerome Here, side is set to 10, but ideally, I'd like it to be 500. Jerome I tried to simply replace matrix by Matrix in the code above, but Jerome obviously, it did not work... ^ Jerome The error came from the line below: Jerome diag(mig.mat[1:(np-side),(side+1):np])-mig/4 Jerome the diag part is ok, but it seems that I cannot assign values to this Jerome vector. Yes, diag-, the function which is called for this, does not work for 'Matrix' matrices, actually for two reasons : 1) it has check which is not appropriate for 'Matrix' matrices 2) it is based on M[ cbind(i,j) ] - value the famous not-well-enough-known other way of indexing in S and R, but this way of indexing and index-assignment has been on our TODO list, but has not yet been implemented for 'Matrix' matrices. Your use-case is a good incentive for Doug Bates and me (the 'Matrix' authors) to implement it -- for a next version of the Matrix package { BTW: your version 0.9975-3 is outdated anyway, and you *should* update.packages() } Because of the above, I'll probably also be able to help you in a short while with a workaround before this works out-of-the-box, but please do upgrade to the latest released version of Matrix (0.9975-5), in any case. Jerome I would be very glad for any help on this, or on pointers on how to Jerome construct Matrices. Jerome As I am not on the list, please could you answer to Jerome [EMAIL PROTECTED] Jerome Many thanks in advance. you're welcome: Martin Maechler, ETH Zurich Jerome R 2.4.0 Jerome Windows XP Jerome Matrix package version 0.9975-3 __ R-help@stat.math.ethz.ch 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] Colour-coded Editor for R Code
But in Win you could try Tinn-R which is quite good!! Mihai Nica 170 East Griffith St. G5 Jackson, MS 39201 601-914-0361 - Original Message From: Richard M. Heiberger [EMAIL PROTECTED] To: Jon Minton [EMAIL PROTECTED]; R-help@stat.math.ethz.ch Sent: Monday, November 6, 2006 7:45:54 AM Subject: Re: [R] Colour-coded Editor for R Code Emacs and ESS for both Unix and Windows. emacs for Windows from ftp://ftp.gnu.org/pub/gnu/emacs/windows/emacs-21.3-fullbin-i386.tar.gz emacs for Unix from ftp://ftp.gnu.org/pub/gnu/emacs/emacs-21.4a.tar.gz ESS from http://ess.r-project.org/ Click on Source for the package itself. Other items on the page give documentation. __ R-help@stat.math.ethz.ch 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. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] plots questions?
Dear friends, I have three variables ,x,y and z, and i want to get two plots: 1.three-dimensionel plot: z is the vertical axis, x and y is on the same horizontal plane; 2.contour plot:x is the horizontal axis, and y is vertical axis, and z is used to plot the contour line. I can't finish it ,anybody can help me ? Thanks in advance. -- With Kind Regards, Zhi Jie,Zhang [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] rJava: java.lang.OutOfMemoryError
Hy, In my case I just invoked as root (on a linux box) the command R CMD javareconf and checked if my system and root vm did match the version of the user vm. After this the command .jinit(parameters=c(-Xmx512m,-Xmx128m)) could be executed without errors. I got this information from http://www.rosuda.org/JGR/down.shtml -- Hi, Has anybody encountered the following problem? TIA, Gregoire library(rJava) .jinit() Error occurred during initialization of VM java.lang.OutOfMemoryError: unable to create new native thread This would not help: .jinit(parameters=c(-Xmx512m,-Xmx128m)) R and rJava versions are: installed.packages()[rJava,] Package LibPath Version rJava/home/user/lib/R 0.4-3 Priority BundleContains NA NA NA DependsSuggests Imports R (= 2.0.0), methods NA NA Built 2.3.1 R.Version() $platform [...] $system [1] i686, linux-gnu [...] $version.string [1] Version 2.3.1 (2006-06-01) __ R-help@stat.math.ethz.ch 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] Install RMySQL with R 2.4.0
I noticed that RMySQL is now at version 0.5-10, but the libMySQL.dll and RMySQL.dll files that are required for Windows are missing from the distribution. These files were present in previous versions of RMySQL, and the installation instructions still state they are needed. I have an older version of RMySQL working with R-2.3.0 on Windows XP, but when I try to run RMySQL_0.5-10 with R-2.4.0 I get the following error message: library (RMySQL); Error in library(RMySQL) : 'RMySQL' is not a valid package -- installed 2.0.0? This is after updating the DBI package and installing RMySQL on R-2.4.0. Of course I wouldn't expect RMySQL_0.5-10 to work since the DLLs have not been included in the distribution. Does anyone have an updated email address for David A. James, the maintainer for RMySQL? The address included in the distribution appears to be no longer valid. Thanks, Frank -- Frank McCown Old Dominion University http://www.cs.odu.edu/~fmccown/ __ R-help@stat.math.ethz.ch 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] neg-bin clustered analysis in R?
The R-package glmmADMB (not on CRAN) can do negative binomial response with one level of Gaussian random effects. It also allows zero inflation. Download site: http://otter-rsch.com/admbre/examples/glmmadmb/glmmADMB.html Regards, hans Dear All, I'm analysing a negative binomial dataset from a population-based study. Many covariates were determined on household level, so all members of a household have the same value for those covariates. In STATA, there seems to be an option for 'clustered analysis' for neg-bin regression. Does an equivalent exist for R(MASS)'s glm.nb or a comparable function? Many thanks for all help! Lutz [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] How can you get N replicates of a multi-screen, multivariate time series plot?
Hello All. I would like to repeat a multi-screen, multivariate time series plot across multiple units. Consider the following data: r-help@stat.math.ethz.ch UNIT TRIAL Y1Y2 Y3 Y4 Y5 Y6 1109 1 NANA NA 13718 3655 15240 2109 2 15000 6000 3 13057 6198 21962 3109 3 1 1 2 8356 12929 27992 4109 4 1 1 2 12642 10978 34843 5109 5 2 2 4 10335 25754 64060 6109 6 2 2 4 4591 23706 30256 7109 7 2 2 4 5743 29107 43887 8109 82000 2 220007800 17717 35294 I want to structure this graph to present 3 screens that each represent 2 time series over TRIAL. The following code gives me just what I'm looking for. library(zoo) library(lattice) z - zoo(data.matrix(ii_df[,3:8]), ii_df[,2]) xyplot(z, screens = c(1, 2, 3, 1, 2, 3), col = 1:6, pch = 1:6, type = b) This works great. Now, I'd like to repeat this basic graph for 100 levels of UNIT. I have two questions. First, I've tried to replicate this method using a trellis graph without much success. Is there a way to replicate this plot across UNITS using a trellis graph? Second, the trellis graphs I have been able to make result in plots that are too small to read. How could I loop this graphing routine to yield the graph I get above in my zoo code for each of the 100 distinct units? Thanks in advance, Rick -- Rick DeShon 306 Psychology Building Department of Psychology Michigan State University East Lansing, MI 48824-1116 Prediction is very difficult, especially if it's about the future. --Nils Bohr, [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Colour-coded Editor for R Code
And Mac: emacs for the Mac native environment http://aquamacs.org/ At 8:45 AM -0500 11/6/06, Richard M. Heiberger wrote: Emacs and ESS for both Unix and Windows. emacs for Windows from ftp://ftp.gnu.org/pub/gnu/emacs/windows/emacs-21.3-fullbin-i386.tar.gz emacs for Unix from ftp://ftp.gnu.org/pub/gnu/emacs/emacs-21.4a.tar.gz ESS from http://ess.r-project.org/ Click on Source for the package itself. Other items on the page give documentation. __ R-help@stat.math.ethz.ch 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. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ R-help@stat.math.ethz.ch 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] CPU or memory
Hi R users Having both a faster CPU and more memory will boost computing power. I was wondering if only adding more memory (1GB - 2GB) will significantly reduce R computation time? Taka, _ Get FREE company branded e-mail accounts and business Web site from Microsoft Office Live __ R-help@stat.math.ethz.ch 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] goodness of fitting for a mixed distribution
Nelson, I do not know of any formal hypothesis testing mechanism, but I recommend a QQ plot regardless. Venables and Ripley (2002, 4th edition MASS) have a detailed example for the mixed normal case (see page 440 in particular) that could be adapted for your normal + weibull case. Or you could construct the model quantile portion yourself. Hope that helps, Bill --- Bill Pikounis, PhD Nonclinical Statistics Centocor, Inc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of nelson - Sent: Monday, November 06, 2006 9:58 AM To: r-help@stat.math.ethz.ch Subject: [R] goodness of fitting for a mixed distribution Hi all! i have done a fitting of experimental data using optim function and setting up my mixed distribution logliklehood (it is a linear combination of a normal and a weibull distribution). How can i test the goodness of fit? I want to be able to say that my distribution fit the data at 90%, 95% or so on thanks in advance, nelson __ R-help@stat.math.ethz.ch 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. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] goodness of fitting for a mixed distribution
Thanks, i wonder if I can use a kolmogorov smirnov test or a similar test (but what test?). I use QQ-plot but the people i'm working to asked me numbers... :) and not sum of square error. The told about chi-square test and Kolmogorov Smirnov Test... I produce QQ- plots, but they doesn't like them... while i see theme very descriptive... any advice? They only want to say oh, my mixed distribution fits data at 90% :( nelson __ R-help@stat.math.ethz.ch 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] numerical overflow/underflow in log-linear models
Hi, I've written some MCMC algorithms that repeatedly evaluate exp(Xb) where X is a design matrix and b a parameter vector. For certain combinations of X and b I get numerical overflow, and would like a way of rescaling the columns of X so that the range of exp(Xb) is maximised without overflowing. I can get approximate ranges for the parameter vector b using ML (X is fixed) and was wondering whether general solutions exist for this problem, and if they had been implemented in R. Cheers, Jarrod __ R-help@stat.math.ethz.ch 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] CPU or memory
Taka Matzmoto wrote: Hi R users Having both a faster CPU and more memory will boost computing power. I was wondering if only adding more memory (1GB - 2GB) will significantly reduce R computation time? If your computations consume just a few Mb, it won't make it faster, if it consumes a lot of memory, you will prevent swapping and make it much faster. Uwe Ligges Taka, _ Get FREE company branded e-mail accounts and business Web site from Microsoft Office Live __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Subset and levels
Hi, I've got a very simple problem but cannot find the solution. I'm using two data frames (say X and Y) and I want to get a subset of one according to the different levels of a variable code of the other data frame. I tried something like Z-subset(X, code==levels(Y$code))(1) but it does not work. I do not want to do something like Z-subset(X,code==level1 | code==level2...) because length(levels(Y$code)) is 130. So what's wrong with (1)? Thanks __ R-help@stat.math.ethz.ch 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] Data frames in files - and - SQL with data frames
Since the databases that I handle with are very large, I need answers to some questions: 1) Can I work with R data frames like databases in SAS, that is, storing data frames in files instead of in memory? 2) Can I use SQL codes to work with R data frames? Note that I ask for the direct use, with no need to use a “channel” or to export data frames to a DBMS. Thanks. __ R-help@stat.math.ethz.ch 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] Announcement: Annals of Applied Statistics, a new Journal from IMS
Dear Readers, The Annals of Applied Statistics, newest journal from the Institute of Mathematical Statistics, began accepting papers on November 1, 2006. Computational statistics is an area of particular interest. Please visit the journal website at http://www.imstat.org/aoas to learn more. Thank you. --- Balasubramanian Narasimhan Department of Statistics Stanford University Stanford, CA 94305 __ R-help@stat.math.ethz.ch 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] Subset and levels
Hi Florent, A simple example with the expected output would help. If I understood correctly what you want, perhaps the following would work: X[ X$code %in% levels(Y$code), ] assuming Y$code is a factor. If not, you can used instead unique(Y$code) in the above. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Florent Bresson Sent: Monday, November 06, 2006 12:15 PM To: R-help Subject: [R] Subset and levels Hi, I've got a very simple problem but cannot find the solution. I'm using two data frames (say X and Y) and I want to get a subset of one according to the different levels of a variable code of the other data frame. I tried something like Z-subset(X, code==levels(Y$code))(1) but it does not work. I do not want to do something like Z-subset(X,code==level1 | code==level2...) because length(levels(Y$code)) is 130. So what's wrong with (1)? Thanks __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] line width (all elements) in Trellis
Dear All, I am hoping to implement a barchart using trellis graphics where all elements have a line width of 2. Using trellis.par.set(), I am able to make most elements lwd=2, but not all. In particular, the top of the box (above the upper most strip) and the left y-axis remain one point. Code with a barchart() example is below. Any advice would be greatly appreciated. Thanks for your time, Dan note: I am using R 2.4.0 on a windows platform. windows(width=6, height=4, record=TRUE) tpar1=trellis.par.get(add.line) tpar1$lwd=2 trellis.par.set(add.line, tpar1) tpar2=trellis.par.get(plot.polygon) tpar2$lwd=2 trellis.par.set(plot.polygon, tpar2) tpar3=trellis.par.get(plot.line) tpar3$lwd=2 trellis.par.set(plot.line, tpar3) tpar4=trellis.par.get(superpose.polygon) tpar4$lwd=c(rep(2,7)) trellis.par.set(superpose.polygon, tpar4) tpar5=trellis.par.get(superpose.line) tpar5$lwd=c(rep(2,7)) trellis.par.set(superpose.line, tpar5) tpar6=trellis.par.get(axis.line) tpar6$lwd=c(rep(2,7)) trellis.par.set(axis.line, tpar6) tpar7=trellis.par.get(box.3d) tpar7$lwd=2 trellis.par.set(box.3d, tpar7) tpar8=trellis.par.get(box.rectangle) tpar8$lwd=2 trellis.par.set(box.rectangle, tpar8) tpar9=trellis.par.get(box.umbrella) tpar9$lwd=2 trellis.par.set(box.umbrella, tpar9) tpar10=trellis.par.get(dot.line) tpar10$lwd=2 trellis.par.set(dot.line, tpar10) tpar11=trellis.par.get(strip.border) tpar11$lwd=c(rep(2,7)) trellis.par.set(strip.border, tpar11) tpar12=trellis.par.get(reference.line) tpar12$lwd=c(rep(2,7)) trellis.par.set(reference.line, tpar12) barchart(yield ~ variety | site, data = barley, groups = year, layout = c(1, 6), ylab = Barley Yield (bushels/acre), scales = list(x = list(abbreviate = TRUE, minlength = 5))) -- Daniel E. Bunker BioMERGE Associate Director Post-Doctoral Research Scientist Columbia University Department of Ecology, Evolution and Environmental Biology 1200 Amsterdam Avenue New York, NY 10027-5557 deb37ATcolumbiaDOTedu 212-851-1888 phone 212-854-8188 fax __ R-help@stat.math.ethz.ch 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-help in Newsreader?
Matthias Voigt [EMAIL PROTECTED] writes: Dear list, I am new to this all and therefore have following Newbie question: How can I receive and read R-help mailings in a newsreader like thunderbird? Use gmane.comp.lang.r.general on gmane.org HTH, Jens __ R-help@stat.math.ethz.ch 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] line width (all elements) in Trellis
On 11/6/06, Daniel E. Bunker [EMAIL PROTECTED] wrote: Dear All, I am hoping to implement a barchart using trellis graphics where all elements have a line width of 2. Using trellis.par.set(), I am able to make most elements lwd=2, but not all. In particular, the top of the box (above the upper most strip) and the left y-axis remain one point. Actually, those are lwd=2 too, but half of the lines are getting clipped (this should happen on the right/bottom too, and does in PDF output, for example. Not sure why it's not as clear on screen devices). Anyway, you can add trellis.par.set(clip, list(panel = off, strip = off)) and see if that helps you. I can't decide yet if the current behaviour is desirable, so it might change in future. -Deepayan Code with a barchart() example is below. Any advice would be greatly appreciated. Thanks for your time, Dan note: I am using R 2.4.0 on a windows platform. windows(width=6, height=4, record=TRUE) tpar1=trellis.par.get(add.line) tpar1$lwd=2 trellis.par.set(add.line, tpar1) tpar2=trellis.par.get(plot.polygon) tpar2$lwd=2 trellis.par.set(plot.polygon, tpar2) tpar3=trellis.par.get(plot.line) tpar3$lwd=2 trellis.par.set(plot.line, tpar3) tpar4=trellis.par.get(superpose.polygon) tpar4$lwd=c(rep(2,7)) trellis.par.set(superpose.polygon, tpar4) tpar5=trellis.par.get(superpose.line) tpar5$lwd=c(rep(2,7)) trellis.par.set(superpose.line, tpar5) tpar6=trellis.par.get(axis.line) tpar6$lwd=c(rep(2,7)) trellis.par.set(axis.line, tpar6) tpar7=trellis.par.get(box.3d) tpar7$lwd=2 trellis.par.set(box.3d, tpar7) tpar8=trellis.par.get(box.rectangle) tpar8$lwd=2 trellis.par.set(box.rectangle, tpar8) tpar9=trellis.par.get(box.umbrella) tpar9$lwd=2 trellis.par.set(box.umbrella, tpar9) tpar10=trellis.par.get(dot.line) tpar10$lwd=2 trellis.par.set(dot.line, tpar10) tpar11=trellis.par.get(strip.border) tpar11$lwd=c(rep(2,7)) trellis.par.set(strip.border, tpar11) tpar12=trellis.par.get(reference.line) tpar12$lwd=c(rep(2,7)) trellis.par.set(reference.line, tpar12) barchart(yield ~ variety | site, data = barley, groups = year, layout = c(1, 6), ylab = Barley Yield (bushels/acre), scales = list(x = list(abbreviate = TRUE, minlength = 5))) __ R-help@stat.math.ethz.ch 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] comparing 2 dataframes
Hi, I''ve a question about comparing 2 dataframes: RRC_db1 and RRC_db2 of different length. For example: RRC_db1: CUSTOMER_ID CUSTOMER_RR 1 1000786BR 5+ 2 1002047BR4 3 10127BR 5+ 4 1004166834BR2 5 1004310897BRX 6 1006180BR4 710064798BR4 8 1007311BR 5+ 9 1007621BR4 101008195BR 4- 11 10126BR 5+ 12 95323994BR4 RRC_db2: CUSTOMER_ID CUSTOMER_RR 1 1200786BR 6+ 2 1802047BR4 3 1027BR 1+ 4 10166834BR2 5 107BR X 6 100BR4 7164798BR4 81008195BR 4- 9 10126BR 5+ I want to pick the CUSTOMER_ID of RRC_db1 which also exist in RRC_db2: third - merge(RRC_db1, RRC_db2) or third -subset(RRC_db1, CUSTOMER_ID%in% RRC_db2$CUSTOMER_ID) But I also want to check if the CUSTOMER_RR is correct. I had tried this: test - function(RRC_db1,RRC_db2) + { + noteq - c() + for( i in 1:length(RRC_db1$CUSTOMER_ID)){ + for( j in 1:length(RRC_db2$CUSTOMER_ID)){ + if(RRC_db1$CUSTOMER_ID[i] == RRC_db2$CUSTOMER_ID[j]){ + if(RRC_db1$CUSTOMER_RR[i] != RRC_db2$CUSTOMER_RR[j]){ + noteq - c(noteq,RRC_db1$CUSTOMER_ID[i]); + } + } + } + } + noteq; + } test(RRC_db1, RRC_db2) Error in Ops.factor(RRC_db1$CUSTOMER_ID[i], RRC_db2$CUSTOMER_ID[j]) : level sets of factors are different But then I got this error. I don't only want the CUSTOMER_ID to be the same but also the CUSTOMER_RR. Can you please help me? Thanks in advance. Regards, Priya [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] line width (all elements) in Trellis
Hi Deepayan Sarkar wrote: On 11/6/06, Daniel E. Bunker [EMAIL PROTECTED] wrote: Dear All, I am hoping to implement a barchart using trellis graphics where all elements have a line width of 2. Using trellis.par.set(), I am able to make most elements lwd=2, but not all. In particular, the top of the box (above the upper most strip) and the left y-axis remain one point. Actually, those are lwd=2 too, but half of the lines are getting clipped (this should happen on the right/bottom too, and does in PDF output, for example. Not sure why it's not as clear on screen devices). Anyway, you can add trellis.par.set(clip, list(panel = off, strip = off)) and see if that helps you. And instead of all those 'lwd=2' settings, you could just use 'lex=2', as in ... library(grid) library(lattice) windows(width=6, height=4, record=TRUE) trellis.par.set(clip, list(panel = off, strip = off)) pushViewport(viewport(gp=gpar(lex=2))) print(barchart(yield ~ variety | site, data = barley, groups = year, layout = c(1, 6), ylab = Barley Yield (bushels/acre), scales = list(x = list(abbreviate = TRUE, minlength = 5))), newpage=FALSE) upViewport() Paul I can't decide yet if the current behaviour is desirable, so it might change in future. -Deepayan Code with a barchart() example is below. Any advice would be greatly appreciated. Thanks for your time, Dan note: I am using R 2.4.0 on a windows platform. windows(width=6, height=4, record=TRUE) tpar1=trellis.par.get(add.line) tpar1$lwd=2 trellis.par.set(add.line, tpar1) tpar2=trellis.par.get(plot.polygon) tpar2$lwd=2 trellis.par.set(plot.polygon, tpar2) tpar3=trellis.par.get(plot.line) tpar3$lwd=2 trellis.par.set(plot.line, tpar3) tpar4=trellis.par.get(superpose.polygon) tpar4$lwd=c(rep(2,7)) trellis.par.set(superpose.polygon, tpar4) tpar5=trellis.par.get(superpose.line) tpar5$lwd=c(rep(2,7)) trellis.par.set(superpose.line, tpar5) tpar6=trellis.par.get(axis.line) tpar6$lwd=c(rep(2,7)) trellis.par.set(axis.line, tpar6) tpar7=trellis.par.get(box.3d) tpar7$lwd=2 trellis.par.set(box.3d, tpar7) tpar8=trellis.par.get(box.rectangle) tpar8$lwd=2 trellis.par.set(box.rectangle, tpar8) tpar9=trellis.par.get(box.umbrella) tpar9$lwd=2 trellis.par.set(box.umbrella, tpar9) tpar10=trellis.par.get(dot.line) tpar10$lwd=2 trellis.par.set(dot.line, tpar10) tpar11=trellis.par.get(strip.border) tpar11$lwd=c(rep(2,7)) trellis.par.set(strip.border, tpar11) tpar12=trellis.par.get(reference.line) tpar12$lwd=c(rep(2,7)) trellis.par.set(reference.line, tpar12) barchart(yield ~ variety | site, data = barley, groups = year, layout = c(1, 6), ylab = Barley Yield (bushels/acre), scales = list(x = list(abbreviate = TRUE, minlength = 5))) __ R-help@stat.math.ethz.ch 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. -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ R-help@stat.math.ethz.ch 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] Correlated ROC curves
Hi, Is there any package or code to compare and display correlated ROC curves in R? Thanks, Reza [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] line width (all elements) in Trellis
On 11/6/06, Paul Murrell [EMAIL PROTECTED] wrote: Hi Deepayan Sarkar wrote: On 11/6/06, Daniel E. Bunker [EMAIL PROTECTED] wrote: Dear All, I am hoping to implement a barchart using trellis graphics where all elements have a line width of 2. Using trellis.par.set(), I am able to make most elements lwd=2, but not all. In particular, the top of the box (above the upper most strip) and the left y-axis remain one point. Actually, those are lwd=2 too, but half of the lines are getting clipped (this should happen on the right/bottom too, and does in PDF output, for example. Not sure why it's not as clear on screen devices). Anyway, you can add trellis.par.set(clip, list(panel = off, strip = off)) and see if that helps you. And instead of all those 'lwd=2' settings, you could just use 'lex=2', as in ... library(grid) library(lattice) windows(width=6, height=4, record=TRUE) trellis.par.set(clip, list(panel = off, strip = off)) pushViewport(viewport(gp=gpar(lex=2))) print(barchart(yield ~ variety | site, data = barley, groups = year, layout = c(1, 6), ylab = Barley Yield (bushels/acre), scales = list(x = list(abbreviate = TRUE, minlength = 5))), newpage=FALSE) upViewport() Cool! There's also the grid.pars trellis.par now for things like this, so you could also do trellis.par.set(clip, list(panel = off, strip = off)) trellis.par.set(grid.pars, list(lex = 2)) barchart(yield ~ variety | site, data = barley, groups = year, layout = c(1, 6), ylab = Barley Yield (bushels/acre), scales = list(x = list(abbreviate = TRUE, minlength = 5))) -Deepayan __ R-help@stat.math.ethz.ch 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] neg-bin clustered analysis in R?
Lutz-- In addition to the previous suggestions, you might also have a look at the following paper: Kelvin K. W. Yau, Kui Wang and Andy H. Lee. Zero-Inflated Negative Binomial Mixed Regression Modeling of Over-Dispersed Count Data with Extra Zeros. Biometrical Journal 45 (2003) 4, 437–452 The authors have written R/Splus code (available from them). Although the article is focused on ZINB models with random-effects, the code will fit a NegBin with random-effects (if memory serves). Hope that helps. cheers, Dave -- Dave Atkins, PhD Assistant Professor in Clinical Psychology Fuller Graduate School of Psychology Email: [EMAIL PROTECTED] Phone: 626.584.5554 __ R-help@stat.math.ethz.ch 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] alist()
In trying to get NULL members into a list, I found out about alist(). x-alist() x$one-1 x$two-NULL but x$two doesn't exist. It seems, though, that an alist is just a list. How can one put NULL members into a list? __ R-help@stat.math.ethz.ch 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] Correlated ROC curves
one of the newsletters ( about a year ago ) has something about an ROC package but I don't remember which one it is. If you do a search for ROC on the search thing in www.project.org, I'm sure you will find something about it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Seyed Reza Jafarzadeh Sent: Monday, November 06, 2006 3:30 PM To: R-help; R-sig-Epi Subject: [R] Correlated ROC curves Hi, Is there any package or code to compare and display correlated ROC curves in R? Thanks, Reza [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch 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] alist()
On 11/6/2006 3:36 PM, Glen Herrmannsfeldt wrote: In trying to get NULL members into a list, I found out about alist(). x-alist() x$one-1 x$two-NULL but x$two doesn't exist. It seems, though, that an alist is just a list. How can one put NULL members into a list? x - c(x, list(two=NULL)) Duncan Murdoch __ R-help@stat.math.ethz.ch 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] goodness of fitting for a mixed distribution
Nelson, I did a quick Google search on the phrase goodness of fit mixture models and found this thread. There seems to be some good info in there: http://www.biostat.wustl.edu/archives/html/s-news/2000-07/msg00166.html Hope that helps, Bill --- Bill Pikounis, PhD Nonclinical Statistics Centocor, Inc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of nelson - Sent: Monday, November 06, 2006 11:20 AM To: r-help@stat.math.ethz.ch Subject: Re: [R] goodness of fitting for a mixed distribution Thanks, i wonder if I can use a kolmogorov smirnov test or a similar test (but what test?). I use QQ-plot but the people i'm working to asked me numbers... :) and not sum of square error. The told about chi-square test and Kolmogorov Smirnov Test... I produce QQ- plots, but they doesn't like them... while i see theme very descriptive... any advice? They only want to say oh, my mixed distribution fits data at 90% :( nelson __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] alist()
Glen Herrmannsfeldt [EMAIL PROTECTED] writes: In trying to get NULL members into a list, I found out about alist(). x-alist() (that is the same as x - list(). I don't think alist() is relevant.) x$one-1 x$two-NULL but x$two doesn't exist. It seems, though, that an alist is just a list. How can one put NULL members into a list? Like this: x[two] - list(NULL) x $two NULL or just put it there with x - list(two=NULL) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch 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] Correlated ROC curves
Seyed Reza Jafarzadeh wrote: Hi, Is there any package or code to compare and display correlated ROC curves in R? Thanks, Reza There are ways to compare ROC areas. This will not have very good power. The Hmisc package's rcorrp.cens function provides a test that deals with pairs of pairs of predictions and observed outcomes that I feel has much more power. It tests whether one predictor is 'more concordant' with the outcome than another. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch 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] alist()
You need to start by first allocating the list. The problem is that you cannot reference a list member that does not exist yet (as in x$two): x - vector(list, 10) x List x has 10 NULL elements by default. You can then assign values to these as needed. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Glen Herrmannsfeldt Sent: Monday, November 06, 2006 3:37 PM To: r-help@stat.math.ethz.ch Subject: [R] alist() In trying to get NULL members into a list, I found out about alist(). x-alist() x$one-1 x$two-NULL but x$two doesn't exist. It seems, though, that an alist is just a list. How can one put NULL members into a list? __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] simple random cluster sampling - bootstrapping
Hello all, I have 300 clusters of fixed size 2 and I need to do resampling with replacement to run some regression models. I've searched through the archive and the only thing I found was that I could use 'boot()' function. but it's not clear to me how I can do this. Has anyone done it? I would very much appreciate your help, kelly - KyungAh (Kelly) Im Epidemiology Data Center Graduate School of Public Health Department of Epidemiology University of Pittsburgh PA 15261 PHONE:(412) 624- 4612 FAX: (412) 624- 3775 Email: [EMAIL PROTECTED] http://www.edc.gsph.pitt.edu [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Competing risk nomogram
Dear R Users, Do you have a sample code for developing a nomogram with competing-risks? Any help is appreciated. Kind regards, ND Nguyen __ R-help@stat.math.ethz.ch 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] alist()
Peter Dalgaard [EMAIL PROTECTED] wrote: (regarding adding NULL elements to a list) x[two] - list(NULL) This seems to work. In the actual case, it is assigning from a variable that may or may not be null, for example: two-NULL x[two]-list(two) It seems to work, and not do what it looks like, add a list of length one. I suppose I should realize by now that scalars are just like lists of length one, but this still wasn't obvious. thanks, -- glen __ R-help@stat.math.ethz.ch 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] alist()
[EMAIL PROTECTED] writes: Peter Dalgaard [EMAIL PROTECTED] wrote: (regarding adding NULL elements to a list) x[two] - list(NULL) This seems to work. In the actual case, it is assigning from a variable that may or may not be null, for example: two-NULL x[two]-list(two) It seems to work, and not do what it looks like, add a list of length one. I suppose I should realize by now that scalars are just like lists of length one, but this still wasn't obvious. Actually, it is a bit more subtle: The key point is that the left hand side of the assignment is a list. This is the difference between indexing with [] rather than [[]] or $. Scalars are not equivalent to lists. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch 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] line width (all elements) in Trellis
Great! Thanks to both Paul and Deepayan for these efficient approaches! -Dan Deepayan Sarkar wrote: On 11/6/06, Paul Murrell [EMAIL PROTECTED] wrote: Hi Deepayan Sarkar wrote: On 11/6/06, Daniel E. Bunker [EMAIL PROTECTED] wrote: Dear All, I am hoping to implement a barchart using trellis graphics where all elements have a line width of 2. Using trellis.par.set(), I am able to make most elements lwd=2, but not all. In particular, the top of the box (above the upper most strip) and the left y-axis remain one point. Actually, those are lwd=2 too, but half of the lines are getting clipped (this should happen on the right/bottom too, and does in PDF output, for example. Not sure why it's not as clear on screen devices). Anyway, you can add trellis.par.set(clip, list(panel = off, strip = off)) and see if that helps you. And instead of all those 'lwd=2' settings, you could just use 'lex=2', as in ... library(grid) library(lattice) windows(width=6, height=4, record=TRUE) trellis.par.set(clip, list(panel = off, strip = off)) pushViewport(viewport(gp=gpar(lex=2))) print(barchart(yield ~ variety | site, data = barley, groups = year, layout = c(1, 6), ylab = Barley Yield (bushels/acre), scales = list(x = list(abbreviate = TRUE, minlength = 5))), newpage=FALSE) upViewport() Cool! There's also the grid.pars trellis.par now for things like this, so you could also do trellis.par.set(clip, list(panel = off, strip = off)) trellis.par.set(grid.pars, list(lex = 2)) barchart(yield ~ variety | site, data = barley, groups = year, layout = c(1, 6), ylab = Barley Yield (bushels/acre), scales = list(x = list(abbreviate = TRUE, minlength = 5))) -Deepayan -- Daniel E. Bunker BioMERGE Associate Director Post-Doctoral Research Scientist Columbia University Department of Ecology, Evolution and Environmental Biology 1200 Amsterdam Avenue New York, NY 10027-5557 deb37ATcolumbiaDOTedu 212-851-1888 phone 212-854-8188 fax __ R-help@stat.math.ethz.ch 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] colnames and get means for the columns with the same names
hi, I have a conversion table for colnames like this: Probe_ID HUMAN_LLID 1 AF106325_PROBE1 7052 2 NM_019386_PROBE1 7052 3 NM_012907_PROBE1339 4 AW917796_PROBE1 84196 5L27651_PROBE1 10864 The Probe_ID contains a list of colnames for another data.frame, say x1. I need to convert such colnames to another ID's system, HUMAN_LLID by using the table. The colnames of x1 with the same names (in HUMAN_LLID) need to be averaged. Is there a good way to do it? I also put this question in bioconductor since I believe it might be solved by some package. thanks. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch 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] [BioC] colnames and get means for the columns with the same names
Hi, Weiwei. You probably want to look at a combination of merge() to combine your data with your conversion table followed by aggregate(). Read up on the help for those two functions and that should do it, if I understand what you want to do. However, keep in mind that averaging the probesets representing the same gene may not represent the best solution. Also, if you search the archive a bit, I know this question has come up before. Sean -Original Message- From: Weiwei Shi [mailto:[EMAIL PROTECTED] Sent: Mon 11/6/2006 4:53 PM To: r-help Cc: bioconductor Subject: [BioC] colnames and get means for the columns with the same names hi, I have a conversion table for colnames like this: Probe_ID HUMAN_LLID 1 AF106325_PROBE1 7052 2 NM_019386_PROBE1 7052 3 NM_012907_PROBE1339 4 AW917796_PROBE1 84196 5L27651_PROBE1 10864 The Probe_ID contains a list of colnames for another data.frame, say x1. I need to convert such colnames to another ID's system, HUMAN_LLID by using the table. The colnames of x1 with the same names (in HUMAN_LLID) need to be averaged. Is there a good way to do it? I also put this question in bioconductor since I believe it might be solved by some package. thanks. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III ___ Bioconductor mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor __ R-help@stat.math.ethz.ch 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] grep searching for sequence of 3 consecutive upper case letters
Hello, I need to identify all elements which have a sequence of 3 consecutive upper case letters, anywhere in the string. I tested my grep expression on this site: http://regexlib.com/RETester.aspx But when I try it in R, it does not filter anything. str -c(AGH, this WOUld be good, Not Good at All) str[grep('[A-Z]{3}',str)] #looking for a sequence of 3 consecutive upper case letters [1] AGHthis WOUld be good Not Good at All Any idea? Pierre ** AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}} __ R-help@stat.math.ethz.ch 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] grep searching for sequence of 3 consecutive upper case letters
Try str[grep('[[:upper:]]{3}',str)] On 06/11/06, Lapointe, Pierre [EMAIL PROTECTED] wrote: Hello, I need to identify all elements which have a sequence of 3 consecutive upper case letters, anywhere in the string. I tested my grep expression on this site: http://regexlib.com/RETester.aspx But when I try it in R, it does not filter anything. str -c(AGH, this WOUld be good, Not Good at All) str[grep('[A-Z]{3}',str)] #looking for a sequence of 3 consecutive upper case letters [1] AGHthis WOUld be good Not Good at All Any idea? Pierre ** AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}} __ R-help@stat.math.ethz.ch 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. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch 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] [BioC] colnames and get means for the columns with the same names
hi, I played around with these two functions but did not get what i want. So I wrote a function by using a loop to do it and it is done in a reasonable time: system.time(t3 - iconix.convert(processed, 9, 7486, probes2llid.genego[,c(2,5)])) [1] 12.356 4.494 16.836 0.000 0.000 dim(t3) [1] 129 4255 I am more interested in the approach instead of averaging. I will look into the archive since it is a very common problem Microarray analysis has. I post my function here in case someone needs it in the future. iconix.convert - function(orig, st=9, ed=7486, c.table){ t1 - orig[, st:ed] # treat missing t1 - sapply(t1, function(x){ x[is.na(x)]-0; x}) x0 - unique(c.table[,2]) out - matrix(0, dim(t1)[1], length(x0)) j = 1 for (i in x0){ avg.col - c.table[c.table[,2]==i, 1] if (length(avg.col) 1){ # has 1:multiple ids t2 - apply(t1[, avg.col], 1, mean) } else{ t2 - t1[, avg.col] } out[,j] - t2 j - j + 1 } out - as.data.frame(out) colnames(out) - x0 out2 - cbind(orig[, c(1:(st-1))], out, orig[,c((ed+1):dim(orig)[2])]) colnames(out2)[dim(out2)[2]] - Group out2 } On 11/6/06, Davis, Sean (NIH/NCI) [E] [EMAIL PROTECTED] wrote: Hi, Weiwei. You probably want to look at a combination of merge() to combine your data with your conversion table followed by aggregate(). Read up on the help for those two functions and that should do it, if I understand what you want to do. However, keep in mind that averaging the probesets representing the same gene may not represent the best solution. Also, if you search the archive a bit, I know this question has come up before. Sean -Original Message- From: Weiwei Shi [mailto:[EMAIL PROTECTED] Sent: Mon 11/6/2006 4:53 PM To: r-help Cc: bioconductor Subject: [BioC] colnames and get means for the columns with the same names hi, I have a conversion table for colnames like this: Probe_ID HUMAN_LLID 1 AF106325_PROBE1 7052 2 NM_019386_PROBE1 7052 3 NM_012907_PROBE1339 4 AW917796_PROBE1 84196 5L27651_PROBE1 10864 The Probe_ID contains a list of colnames for another data.frame, say x1. I need to convert such colnames to another ID's system, HUMAN_LLID by using the table. The colnames of x1 with the same names (in HUMAN_LLID) need to be averaged. Is there a good way to do it? I also put this question in bioconductor since I believe it might be solved by some package. thanks. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III ___ Bioconductor mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch 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] grep searching for sequence of 3 consecutive upper case letters
Quoting David Barron [EMAIL PROTECTED]: Try str[grep('[[:upper:]]{3}',str)] or more efficiently : grep('[[:upper:]]{3}', str, value = TRUE) On 06/11/06, Lapointe, Pierre [EMAIL PROTECTED] wrote: Hello, I need to identify all elements which have a sequence of 3 consecutive upper case letters, anywhere in the string. I tested my grep expression on this site: http://regexlib.com/RETester.aspx But when I try it in R, it does not filter anything. str -c(AGH, this WOUld be good, Not Good at All) str[grep('[A-Z]{3}',str)] #looking for a sequence of 3 consecutive upper case letters [1] AGHthis WOUld be good Not Good at All Any idea? Pierre ** AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}} __ R-help@stat.math.ethz.ch 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. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Look for a R Package to locate peak data point in one dimensional data set
Hi, I am working with one array of data point. The value of the data points fluctuate and I tried to locate the peak point in this array. It is like you are going through the valleys and mountains, and I want to identify all the mountain peak location. I assume this is a very common problem to discover peaks and/or segregate peak shoulders one dimensional data sets. So is there any packages that I can plug in to do the computation? Thanks much in advance. -- Waverley @ Palo Alto [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] grep searching for sequence of 3 consecutive upper case letters
Lapointe, Pierre [EMAIL PROTECTED] writes: Hello, I need to identify all elements which have a sequence of 3 consecutive upper case letters, anywhere in the string. I tested my grep expression on this site: http://regexlib.com/RETester.aspx But when I try it in R, it does not filter anything. str -c(AGH, this WOUld be good, Not Good at All) str[grep('[A-Z]{3}',str)] #looking for a sequence of 3 consecutive upper case letters [1] AGHthis WOUld be good Not Good at All Any idea? There are multiple versions of RE's, and fine details resolve in different ways. Don't expect the RETester to hold the Final Truth; it seems to relate to a particular programming environment, which is not R. grep('[A-Z]{3}', str, perl=TRUE) [1] 1 2 Not only that, but grep('[ABCDEFGHIJKLMNOPQRSTUVWXYZ]{3}', str) [1] 1 2 Hint: What is your collating sequence? Sys.setlocale(LC_COLLATE, C) [1] C grep('[A-Z]{3}', str) [1] 1 2 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch 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] Competing risk nomogram
Try some of the threads at RSiteSearch(nomogram). Cheers, Francisco Nguyen Dinh Nguyen wrote: Dear R Users, Do you have a sample code for developing a nomogram with competing-risks? Any help is appreciated. Kind regards, ND Nguyen __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] alist()
Peter Dalgaard [EMAIL PROTECTED] wrote: x[two] - list(NULL) This seems to work. In the actual case, it is assigning from a variable that may or may not be null, for example: two-NULL x[two]-list(two) It seems to work, and not do what it looks like, add a list of length one. I suppose I should realize by now that scalars are just like lists of length one, but this still wasn't obvious. Actually, it is a bit more subtle: The key point is that the left hand side of the assignment is a list. This is the difference between indexing with [] rather than [[]] or $. Well, that and the list() on the right: Yes, it is subtle. I tried it out with: x-list() two-2 x[two]-list(two) typeof(x$two) and it comes out double, not list Even more interesting: x[two]-list(two,two) Warning message: number of items to replace is not a multiple of replacement length Instead of a two element list in x[two] like I might have thought. x[[two]]-list(two,two) does generate the list of list form, though. thanks, -- glen __ R-help@stat.math.ethz.ch 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] Install RMySQL with R 2.4.0
Dan Rie wrote: I had a very similar problem installing RMySQL with R 2.4.0 on Windows XP. I beleive that the cause may have been that the RMySQL build used a slightly older version of the MySQL compiled library functions than was installed on my machine (I updated both MySQL, DBI, and RMySQL to latest versions prior to attempting the install). Since RMySQL links to the compiled MySQL library, slight differences could affect the linked references. I do not know that this is the source of the problem, but it was one obvious point of fraility. The solution, suggested by Prof. Brian Ripley on the r-sig-db list, was to rebuild the RMySQL library from source prior to doing the install. After completing the recompilation of the RMySQL package, the install worked as it should. I believe that the binaries for RMySQL may have been updated since I had those problems, so you might also want to make sure that you have the latest version of all the packages. What do you do if you are accessing the Mysql server remotely from the machine that R is install upon. No MYsql libraries or other files are stored on either of my computers. Thank you Date: Sat, 04 Nov 2006 23:53:11 -0600 From: Joe W. Byers [EMAIL PROTECTED] Subject: Re: [R] Install RMySQL with R 2.4.0 To: r-help@stat.math.ethz.ch Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed Seth Falcon wrote: Joe W. Byers [EMAIL PROTECTED] writes: I am having trouble as well with the new version of R 2.4. I downloaded the gz file from the cran website, followed the instructions in the README.win file and installed RMySQL. I have mysql installed under c:\mysql not the program files directory which is the only difference. I get the following error when I attempt to connect to the MySQL Db ## open a connection to a MySQL database con - dbConnect(dbDriver(MySQL),host='localhost', + username='',dbname = 'StorageSims'); Error in function (classes, fdef, mtable) : unable to find an inherited method for function dbConnect, for signature MySQLDriver Any help will be appreciated. I would like to note that there are no problems with RMySQL on my linux system, only on XP's. Just to make sure: Before trying the code you posted, you did library(RMySQL), right? YES Also, what versions of DBI and RMySQL are you using? RMySQL from http://cran.r-project.org/src/contrib/Descriptions/RMySQL.html DBI Version 0.1-10 according to the NEWS file in ../R/library __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] level sets
Hi, Can anyone suggest a good way to draw level curves of a function with R? I am thinking of something analogous to curve. If there is a package I should be looking at for this kind of mathematical stuff, I'd like to know too... cheers d __ R-help@stat.math.ethz.ch 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] configure error: --with-readline
Thanks. I do have readline.so. I just did not paste that part. Look. [EMAIL PROTECTED] myuserid]$ slocate readline.so /home/scratch/myuserid/usr/local/lib/python2.4/lib-dynload/readline.so /home/scratch/myuserid/usr/local/lib/python2.4/libreadline.so.4 /home/scratch/myuserid/usr/local/lib/python2.4/libreadline.so.4.1 /home/scratch/myuserid/usr/local/lib/python2.4/libreadline.so.4.2 /home/scratch/myuserid/usr/local/lib/python2.4/libreadline.so.4.3 /usr/lib/python2.3/lib-dynload/readline.so /lib/libreadline.so.4 /lib/libreadline.so.4.1 /lib/libreadline.so.4.2 /lib/libreadline.so.4.3 So, I did export LD_LIBRARY_PATH=/home/scratch/myuserid/usr/local/lib/python2.4/lib-dynload/readline.so It still does not work. Didn't you suggest that we do CFLAGS at the following forum? http://tolstoy.newcastle.edu.au/R/devel/06/02/4026.html Thanks. Prof Brian Ripley [EMAIL PROTECTED] wrote: On Sun, 5 Nov 2006, Anthony Liu wrote: I am trying to install R2.4 in a non-standard folder on a mandrake 10 system. I did this: ./configure --prefix=/the/dir/where/I/want/r/to/go and I got the following error: configure: error: --with-readline=yes (default) and headers/libs are not available I know that I can do --with-readline=no But, I do want this readline feature. I have a whole bunch of readline libraries: /lib/libreadline.so.4 /lib/libreadline.so.4.1 /lib/libreadline.so.4.2 /lib/libreadline.so.4.3 But apparently not readline.so, which is what it is looking for. You are missing the readline-devel (or some such name) RPM: see the R-admin manual for further details. [...] -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] histogram bin width
hi all : i have the data below and then below that, i call the hist function three times using the Scott method for the widths of the bins. the bin width is different for the three histograms but I would like it to always be 0.05 regfardless of the data set being histogrammed. I'm sure there must be a manual way to do this which is fine with me. i tried breaks=0.05 but it wasn't happy with that because it wanted more than one value. maybe rep of some kind ? thanks for any ideas. #--- -- x-c(0.0128502370392525, -0.0406114936107649, 0.0502596250677279, 0.0336802928825541, -0.0284365582306378, -0.0123162652859499, 0, 0.0988440771231502, 0.000457303014833599, 0.0438008457360972, -0.0295225689345813, 0.0326340659976054, 0.0114081996557935, -0.00274027837328106, -0.103925054753873, 0.057782563686537, -0.0215841904671166, 0.0403475083316174, -0.0488552849688517, 0.052027860619841, 0.0073670290205996, 0.0536279975936971, 0.0567555433505618, 0.069535452508962, -0.055240239022325, 0.0480899757183906, -0.0390747482838627, -0.110381259381231, -0.0611602607279771, -0.027247284290155, 0.00201215051465198, 0.0351015849923364, 0.000912458332802402, -0.0356188783818823, -0.0151349715427074, -0.0107357188203316, 0.00429507140617957, 0.0214550838644634, -0.00532586292427695, -0.058472751173344, -0.00320685840140555, -0.0132752028606298, 0.0798134030713271, 0.00639570209042262, 0.00733180515837262, -0.00643049849253785, 0.00715640319484123, -0.0829161706061399, -0.0534037801206644, 0.0153327381386070, 0.0284004808796645, -0.0315058522597944, -0.0095737042330235, -0.0296729617912384, -0.0030465605855845, -0.0748614641468137, 0.0166842475362472, 0.037246992858897, 0.0450648619736427, 0.0469533676324296, 0.00783221961935254, -0.0475450625769369, 0.00992104302435237, -0.018607163516, 0.00955266971311985, 0.0228995009757149, -0.0511257997087178, 0.0147078908099729, 0.0488245426407907, 0.0302791426006976, -0.00975113705994346, 0.0292954447679072, -0.042853724755787, 0.0129855494898301, 0.0958562428873933, -0.00294441161212688, 0.0898281173073556, -0.0126756100307546, -0.0453902698039244, -0.00321585444229555, 0.0356899179770664, 0.031308484621384, -0.0215662741815947, 0.000354673443325737, -0.00130449103652452) y-c(0.127113797014822, -0.0527132197083446, -0.0230934065523769, -0.00631932875867491, 0.0446227417141287, -0.0218546858530289, 0.0487408833245162, 0.109421316066438, -0.00927640783636718, -0.0247026288074714, 0.0432817808698083, -0.0630453038775514, 0.27744216866, -0.00307369805856439, -0.0418170289885111, -0.00356492258806185, 0.0227847721326668, 0.0401574349545797, -0.0886738669484188, -0.0098704333226, 0.0033899536306059, -0.0424711414981793, -0.0202601011768166, 0.0484301472245541, 0.0626136210973627, 0.0643242186097126, -0.0980071359648171, 0.126367348457546, 0.0153346351584815, -0.109692817544893, -0.00235925185982921, 0.0769184869215955, -0.00409180113276619, -0.00445306007899049, -0.0149701697632842, 0.0502466501891341, 0.0282876823353817, 0.0534793377936715, -0.0308185450547782, 0.00544008331235801, -0.0572797488928245, 0.0367878245006281, -0.0497845822930998, -0.0570171933564012, -0.00516582291671952, -0.000716222071872608, -0.00358170037682015, 0.0480195527640781, 0.0060224851272217, 0.00254638667742668, 0.00637450199416634, 0.104503303131143, 0.061429306685934, -0.0138576193376316, 0.064563814226215, 0.0460330593686997, 0.0149459277962727, 0.0404914176123761, -0.0412218530692954, -0.0593371756266947, -0.0397570408328995, 0.0163026336202243, -0.0180931721866173, -0.0456516784920424, -0.0288938746995981, -0.0295499885442752, -0.0141674163828931, 0.00892686014042354, 0.0237862041138293, 0.0731246180484035, -0.0313725492769201, -0.00209224717817591, -0.0169734460274462, 0.0171007097211628, -0.285112534969834, 0.0100838247329094, -0.00228181664212457, 0.000140945419602190, 0.00768223483573749, 0.0230504071513593, 0.0371397775679405, -0.0361881281642162, 0.0106234928019866, -0.0236259310807618, -0.0246891741169541) z-c(-0.00171047888493092, -0.00301867047713955, 0.0086865879136866, -0.0537115412882372, -0.0195420954038461, -0.00524512203767813, 0.0325249089459412, 0.98630164910, 0.0178528236729925, 0.0413402809899210, 0.116349808290739, 0.0512011287258751, -0.0218604390330945, 0.0153390225896111, 0.0464780076971039, -0.00214304848649149, -0.0153031714176244, -0.0285204376796244, 0.0241676523094370, 0.0611006871014119, -0.0572726170836368, 0.0220219962936419, 0.0137447455739625, 0.0125743870835748, 0.0439863214467984, -0.0420126985937408, 0.05572139447656, 0.00531169310349355, 0.313720718069366, 0.0332787636253329, -0.00312721372228708, -0.0245639367960848, 0.00206131023752221, 0.055022414930228, 0.0388274126407850, -0.00751548727553342, -0.000859029039457226, 0.0276388031815955,
Re: [R] histogram bin width
There are several ways to do this, probably the easiest is to use truehist from MASS. i.e require(MASS) par(mfrow=c(3,1)) #3 rows of histograms, one column truehist(x,h=.05) truehist(y,h=.05) truehist(z,h=.05) I hope this helps, Francisco -- Dr. Francisco J. Zagmutt College of Veterinary Medicine and Biomedical Sciences Colorado State University Leeds, Mark (IED) wrote: hi all : i have the data below and then below that, i call the hist function three times using the Scott method for the widths of the bins. the bin width is different for the three histograms but I would like it to always be 0.05 regfardless of the data set being histogrammed. I'm sure there must be a manual way to do this which is fine with me. i tried breaks=0.05 but it wasn't happy with that because it wanted more than one value. maybe rep of some kind ? thanks for any ideas. #--- -- x-c(0.0128502370392525, -0.0406114936107649, 0.0502596250677279, 0.0336802928825541, -0.0284365582306378, -0.0123162652859499, 0, 0.0988440771231502, 0.000457303014833599, 0.0438008457360972, -0.0295225689345813, 0.0326340659976054, 0.0114081996557935, -0.00274027837328106, -0.103925054753873, 0.057782563686537, -0.0215841904671166, 0.0403475083316174, -0.0488552849688517, 0.052027860619841, 0.0073670290205996, 0.0536279975936971, 0.0567555433505618, 0.069535452508962, -0.055240239022325, 0.0480899757183906, -0.0390747482838627, -0.110381259381231, -0.0611602607279771, -0.027247284290155, 0.00201215051465198, 0.0351015849923364, 0.000912458332802402, -0.0356188783818823, -0.0151349715427074, -0.0107357188203316, 0.00429507140617957, 0.0214550838644634, -0.00532586292427695, -0.058472751173344, -0.00320685840140555, -0.0132752028606298, 0.0798134030713271, 0.00639570209042262, 0.00733180515837262, -0.00643049849253785, 0.00715640319484123, -0.0829161706061399, -0.0534037801206644, 0.0153327381386070, 0.0284004808796645, -0.0315058522597944, -0.0095737042330235, -0.0296729617912384, -0.0030465605855845, -0.0748614641468137, 0.0166842475362472, 0.037246992858897, 0.0450648619736427, 0.0469533676324296, 0.00783221961935254, -0.0475450625769369, 0.00992104302435237, -0.018607163516, 0.00955266971311985, 0.0228995009757149, -0.0511257997087178, 0.0147078908099729, 0.0488245426407907, 0.0302791426006976, -0.00975113705994346, 0.0292954447679072, -0.042853724755787, 0.0129855494898301, 0.0958562428873933, -0.00294441161212688, 0.0898281173073556, -0.0126756100307546, -0.0453902698039244, -0.00321585444229555, 0.0356899179770664, 0.031308484621384, -0.0215662741815947, 0.000354673443325737, -0.00130449103652452) y-c(0.127113797014822, -0.0527132197083446, -0.0230934065523769, -0.00631932875867491, 0.0446227417141287, -0.0218546858530289, 0.0487408833245162, 0.109421316066438, -0.00927640783636718, -0.0247026288074714, 0.0432817808698083, -0.0630453038775514, 0.27744216866, -0.00307369805856439, -0.0418170289885111, -0.00356492258806185, 0.0227847721326668, 0.0401574349545797, -0.0886738669484188, -0.0098704333226, 0.0033899536306059, -0.0424711414981793, -0.0202601011768166, 0.0484301472245541, 0.0626136210973627, 0.0643242186097126, -0.0980071359648171, 0.126367348457546, 0.0153346351584815, -0.109692817544893, -0.00235925185982921, 0.0769184869215955, -0.00409180113276619, -0.00445306007899049, -0.0149701697632842, 0.0502466501891341, 0.0282876823353817, 0.0534793377936715, -0.0308185450547782, 0.00544008331235801, -0.0572797488928245, 0.0367878245006281, -0.0497845822930998, -0.0570171933564012, -0.00516582291671952, -0.000716222071872608, -0.00358170037682015, 0.0480195527640781, 0.0060224851272217, 0.00254638667742668, 0.00637450199416634, 0.104503303131143, 0.061429306685934, -0.0138576193376316, 0.064563814226215, 0.0460330593686997, 0.0149459277962727, 0.0404914176123761, -0.0412218530692954, -0.0593371756266947, -0.0397570408328995, 0.0163026336202243, -0.0180931721866173, -0.0456516784920424, -0.0288938746995981, -0.0295499885442752, -0.0141674163828931, 0.00892686014042354, 0.0237862041138293, 0.0731246180484035, -0.0313725492769201, -0.00209224717817591, -0.0169734460274462, 0.0171007097211628, -0.285112534969834, 0.0100838247329094, -0.00228181664212457, 0.000140945419602190, 0.00768223483573749, 0.0230504071513593, 0.0371397775679405, -0.0361881281642162, 0.0106234928019866, -0.0236259310807618, -0.0246891741169541) z-c(-0.00171047888493092, -0.00301867047713955, 0.0086865879136866, -0.0537115412882372, -0.0195420954038461, -0.00524512203767813, 0.0325249089459412, 0.98630164910, 0.0178528236729925, 0.0413402809899210, 0.116349808290739, 0.0512011287258751, -0.0218604390330945, 0.0153390225896111, 0.0464780076971039, -0.00214304848649149,
[R] Comparing models in multiple regression and hierarchical linear regression
I don’t know if this question properly belongs on this list, but I’ll ask it here because I’ve been using R to run linear regression models, and it is only in using R (after switching from using SPSS) that I have discovered the process of fitting a linear model. However, after reading Crowley (2002), Fox (2002), Verzani (2004), Dalgaard (2002) and of course searching the R-help archives I cannot find an answer to my question. I have 5 explanatory variables (NR, NS, PA, KINDERWR, WM) and one response variable (G1L1WR). A simple main effects model finds that only PA is statistically significant, and an anova comparison between a 5-variable main effects model and a 1-variable main effects model finds no difference between the models. So it is possible to simplify the model to just G1L1WR ~ PA. This leaves me with a residual standard error of 0.3026 on 35 degrees of freedom and an adjusted R2 of 0.552. I also decided, following Crawley’s (2002) advice, to create a maximal model, G1L1WR ~ NR*NS*PA*KINDERWR*WM. This full model is not a good fit, but a stepAIC through the model revealed the model which had a maximal fit: maximal.fit=lm(formula = G1L1WR ~ NR + KINDERWR + NS + WM + PA + NR:KINDERWR + NR:NS + KINDERWR:NS + NR:WM + KINDERWR:WM + NS:WM + NR:PA + + KINDERWR:PA + NS:PA + WM:PA + NR:KINDERWR:NS + NR:KINDERWR:WM + NR:NS:WM + KINDERWR:NS:WM + NR:NS:PA + KINDERWR:NS:PA + KINDERWR:WM:PA + NR:KINDERWR:NS:WM, data = lafrance.NoNA) All of the terms of this model have statistical t-tests, the residual standard error has gone down to 0.2102, and the adjusted R2 has increased to 0.7839. An anova shows a clear difference between the simplified model and the maximal fit model. My question is, should I really pick the maximal fit over the simple model when it is really so much harder to understand? I guess there’s really no easy answer to that, but if that’s so, then my question is—would there be anything wrong with me saying that sometimes you might value parsimony and ease of understanding over best fit? Because I don’t really know what the maximal fit model buys you. It seems unintelligible to me. All of the terms are involved in interactions to some extent, but there are 4-way interactions and 3-way interactions and 2-way interactions and I’m not sure even how to understand it. A nice tree model showed that at higher levels of PA, KINDERWR and NS affected scores. That I can understand, but that is not reflected in this model. An auxiliary question, probably easier to answer, is how could I do hierarchical linear regression? The authors knew that PA would be the largest contributor to the response variable because of previous research, and their research question was whether PA would contribute anything AFTER the other 4 variables had already eaten their piece of the response variable pie. I know how to do a hierarchical regression in SPSS, and want to show in parallel how to do this in R. I did search R-help archives and didn’t find quite anything that would just plain tell me how to do hierarchical linear regression. Thanks in advance for any help. Dr. Jenifer Larson-Hall Assistant Professor of Linguistics University of North Texas __ R-help@stat.math.ethz.ch 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] question on multilevel modeling
Hi, I am trying to run a multilevel model with time nested in people and people nested in dyads (3 levels of nesting) by initially running a series of models to test whether the slope/intercept should be fixed or random. The problem that I am experiencing appears to arise between the random intercept, fixed slope equation AND. (syntax: rint-lme(BDIAFTER~BDI+WEEK+CORUMTO, random=~1|DYADID/PARTICIP, data=new) summary(rint)) the random slope, random intercept model (syntax: rslint-lme(BDIAFTER~BDI+WEEK+CORUMTO, random=~CORUMTO|DYADID/PARTICIP, data=new) summary(rslint)) at which point I obtain the exact same results for each model suggesting that one of the model is not properly specifying the slope or intercept. Or, I receive the following error message when I try to run the random slope/random intercept model. Error in solve.default(pdMatrix(a, fact = TRUE)) : system is computationally singular: reciprocal condition number = 6.77073e-017 (whether I receive an error message or the same results depends on the specific variables in the model). It has been suggested that I may need to change the default starting values in the model because I may be approaching a boundary-is this a plausible explanation for my difficulties? If so, how do I do this in R and can you refer me to a source that might highlight what would be reasonable starting values? If this does not seem like the problem, any idea what the problem may be and how I might fix it? Thank you so much for your assistance, Christine Calmes Christine A. Calmes, MA Dept of Psychology University at Buffalo: The State University of New York Park Hall 216 Buffalo, NY 14260 [EMAIL PROTECTED] (716) 645-3650 x578 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Rprofile.site
How to make it correct? [1] Error in parse(file, n = -1, NULL, ?) : syntax error at 1: {\ #source('c:/Documents and Settings/xxx/My Documents/Archives/R/test.r') #source(c:\\Documents and Settings\\xxx\\My Documents\\Archives\\R\\test.r) [2] Error in file(file, r, encoding = encoding) : unable to open connection In addition: Warning message: cannot open file 'c:Documents and Settings bkcjsvMy DocumentsArchivesH606R est.r', reason 'Invalid argument' #source(c:\Documents and Settings\xxx\My Documents\Archives\R\test.r) - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] multivariate splines
Hi, I am looking for an R package that would calculate multivarite (mostly 2d and 3d, tensor) cubic interpolating splines, so that I could evaluate these splines (and their derivatives) at many points (unkown at the time of calculating the spline polynomials) repeatedly. To make things concrete, I have an array V with dim(V) = k and gridpoint vectors grid=list(...), length(grid[[i]])==k[i], and would like to get some representation of the spline convenient for subsequent calculations. I have looked at a few spline packages in R, but didn't find what I was looking for. Could somebody please point me in the right direction? Thanks, Tamas __ R-help@stat.math.ethz.ch 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 a circle with a given radius in an existing map
I have drawn a map in which the X and Y axes are latitude and longitude. Now I need to draw one circle on the map - the center is a point with specific latitude and longitude, but the challenge is that the radius is in miles. Is there a way to do this? I'd very much appreciate your response. XM __ R-help@stat.math.ethz.ch 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] R help
*I am a very new user of R. I've spent several hours trying to import data, I am successful in importing data from Excel. After having the data on R console, I am not understanding how to make a file for imported data,so I feel okay asking the list for help. * *I have used save workspace option from file menu. but when i have to use that saved workspace in extReme toolkit using read data option from file menu I am getting the following messages* ** *Error in read.table(C:/Program Files/R/R-2.4.0/Rainfall Data/lahore, : more columns than column names In addition: Warning message: incomplete final line found by readTableHeader on 'C:/Program Files/R/R- 2.4.0/Rainfall Data/lahore' Error in parse(file, n = -1, NULL, ?) : syntax error* ** *I request you to please guide to me.* *Regards *AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Re : R help
specify is the first row containts variables names by h=T (header=T), and the column separator symbol. In Excel save your file as Text File with tab separator and then sep=\t Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. - Message d'origine De : amna khan [EMAIL PROTECTED] À : R-help@stat.math.ethz.ch Envoyé le : Mardi, 7 Novembre 2006, 6h44mn 48s Objet : [R] R help *I am a very new user of R. I've spent several hours trying to import data, I am successful in importing data from Excel. After having the data on R console, I am not understanding how to make a file for imported data,so I feel okay asking the list for help. * *I have used save workspace option from file menu. but when i have to use that saved workspace in extReme toolkit using read data option from file menu I am getting the following messages* ** *Error in read.table(C:/Program Files/R/R-2.4.0/Rainfall Data/lahore, : more columns than column names In addition: Warning message: incomplete final line found by readTableHeader on 'C:/Program Files/R/R- 2.4.0/Rainfall Data/lahore' Error in parse(file, n = -1, NULL, ?) : syntax error* ** *I request you to please guide to me.* *Regards *AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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. ___ interface révolutionnaire. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Re : Draw a circle with a given radius in an existing map
Try this : it-seq(0,2*pi, l=100) xt-r*cos(it) yt-r*sin(it) points(xt,yt,type=l,col=blue) a circle of radium r is define by xt=r*cos(t) yt=r*sin(t) Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. - Message d'origine De : Xiaomei Ma [EMAIL PROTECTED] À : R-help@stat.math.ethz.ch Envoyé le : Mardi, 7 Novembre 2006, 6h11mn 27s Objet : [R] Draw a circle with a given radius in an existing map I have drawn a map in which the X and Y axes are latitude and longitude. Now I need to draw one circle on the map - the center is a point with specific latitude and longitude, but the challenge is that the radius is in miles. Is there a way to do this? I'd very much appreciate your response. XM __ R-help@stat.math.ethz.ch 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. ___ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internaut [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Re : Look for a R Package to locate peak data point in one dimensional data set
this have been discuss try RSiteSearch(peak) Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. - Message d'origine De : Waverley [EMAIL PROTECTED] À : r-help R-help@stat.math.ethz.ch Envoyé le : Lundi, 6 Novembre 2006, 23h57mn 33s Objet : [R] Look for a R Package to locate peak data point in one dimensional data set Hi, I am working with one array of data point. The value of the data points fluctuate and I tried to locate the peak point in this array. It is like you are going through the valleys and mountains, and I want to identify all the mountain peak location. I assume this is a very common problem to discover peaks and/or segregate peak shoulders one dimensional data sets. So is there any packages that I can plug in to do the computation? Thanks much in advance. -- Waverley @ Palo Alto [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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. ___ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internaut [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Comparison between GARCH and ARMA
Dear all R user, Please forgive me if my problem is too simple. Actually my problem is basically Statistical rather directly R related. Suppose I have return series ret with mean zero. And I want to fit a Garch(1,1) on this. my is r[t] = h[i]*z[t] h[t] = w + alpha*r[t-1]^2 + beta*h[t-1] I want to estimate the three parameters here; the R syntax is as follows: # download data: data(EuStockMarkets) r - diff(log(EuStockMarkets))[,DAX] r = r - mean(r) # fit a garch(1,1) on this: library(tseries) garch(r) The estimated parameters are given below: * ESTIMATION WITH ANALYTICAL GRADIENT * Call: garch(x = r) Coefficient(s): a0 a1 b1 4.746e-06 6.837e-02 8.877e-01 Now it is straightforward to transform Garch(1,1) to a ARMA like this: r[t]^2 = w + (alpha+beta)*r[t-1]^2 + beta*(h[t-1] - r[t-1]^2) - (h[t] - r[t]^2) = w + (alpha+beta)*r[t-1]^2 + beta*theta[t-1] + theta[t] So if I fit a ARMA(1,1) on r[t]^2 I am getting following result; arma(r^2, order=c(1,1)) Call: arma(x = r^2, order = c(1, 1)) Coefficient(s): ar1 ma1 intercept 9.157e-01 -8.398e-01 9.033e-06 Therefore if the above derivation is correct then I should get a same intercept term for both Garch and ARMA case. But here I am not getting it. Can anyone explain why? Any input will be highly appreciated. Thanks and regards, Megh Sponsored Link Degrees online in as fast as 1 Yr - MBA, Bachelor's, Master's, Associate Click now to apply http://yahoo.degrees.info __ R-help@stat.math.ethz.ch 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] Re : Draw a circle with a given radius in an existing map
On Tue, 7 Nov 2006, justin bem wrote: Try this : it-seq(0,2*pi, l=100) xt-r*cos(it) yt-r*sin(it) points(xt,yt,type=l,col=blue) a circle of radium r is define by xt=r*cos(t) yt=r*sin(t) Isn't this suggestion on the plane, when the question was about finding the coordinates on the surface of the sphere (globe) in degrees of longitude and latitute that are x miles from the centre? If the area is not large, then projecting the centre point to a suitable planar projection, making the circle on the plane as above, and inverse projecting back to geographical coordinates should work (function project() in package rgdal). If the radius is in thousands of miles, the projection distortion would be considerable, though. Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. - Message d'origine De : Xiaomei Ma [EMAIL PROTECTED] À : R-help@stat.math.ethz.ch Envoyé le : Mardi, 7 Novembre 2006, 6h11mn 27s Objet : [R] Draw a circle with a given radius in an existing map I have drawn a map in which the X and Y axes are latitude and longitude. Now I need to draw one circle on the map - the center is a point with specific latitude and longitude, but the challenge is that the radius is in miles. Is there a way to do this? I'd very much appreciate your response. XM __ R-help@stat.math.ethz.ch 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. ___ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internaut [[alternative HTML version deleted]] -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch 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] plot questions?
Dear Rusers, I want to know which function in R can perform the following tasks: 1.surface-data grid(x,y,z) #which could be done in splus, the name was from splus's options of graph 2. contourplot(x,y,z) #which could be done in splus By the way, where can i find some useful materials to learn to plot 3-dimensionel graphs? Thanks! -- With Kind Regards, oooO: (..): :\.(:::Oooo:: ::\_)::(..):: :::)./::: ::(_/ : [***] Zhi Jie,Zhang ,PHD Tel:86-21-54237149 [EMAIL PROTECTED] Dept. of Epidemiology,school of public health,Fudan University Address:No. 138 Yi Xue Yuan Road,Shanghai,China Postcode:200032 [***] oooO: (..): :\.(:::Oooo:: ::\_)::(..):: :::)./::: ::(_/ : [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] comparing 2 dataframes
Hi Maybe this example can help you to find your solution: dat1 - data.frame(CUSTOMER_ID = c(1000786BR, 1002047BR, 10127BR, 1004166834BR, 1004310897BR, 1006180BR, 10064798BR, 1007311BR, 1007621BR, 1008195BR, 10126BR, 95323994BR), CUSTOMER_RR = c(5+, 4, 5+, 2, X, 4, 4, 5+, 4, 4-, 5+, 4)) dat2 - data.frame(CUSTOMER_ID = c(1200786BR, 1802047BR, 1027BR, 10166834BR, 107BR, 100BR, 164798BR, 1008195BR, 10126BR), CUSTOMER_RR = c(6+, 4, 1+, 2, X, 4, 4, 4, 5+)) ## Merge, but only by CUSTOMER_ID datM - merge(dat1, dat2, by = CUSTOMER_ID) datM ## Select only cases that have a similar CUSTOMER_RR datM1 - datM[as.character(datM[, CUSTOMER_RR.x]) %in% as.character(datM[,CUSTOMER_RR.y]), ] datM1 Regards, Christoph -- Credit and Surety PML study: visit our web page www.cs-pml.org -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH Zurich 8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ -- Priya Kanhai writes: Hi, I''ve a question about comparing 2 dataframes: RRC_db1 and RRC_db2 of different length. For example: RRC_db1: CUSTOMER_ID CUSTOMER_RR 1 1000786BR 5+ 2 1002047BR4 3 10127BR 5+ 4 1004166834BR2 5 1004310897BRX 6 1006180BR4 710064798BR4 8 1007311BR 5+ 9 1007621BR4 101008195BR 4- 11 10126BR 5+ 12 95323994BR4 RRC_db2: CUSTOMER_ID CUSTOMER_RR 1 1200786BR 6+ 2 1802047BR4 3 1027BR 1+ 4 10166834BR2 5 107BR X 6 100BR4 7164798BR4 81008195BR 4- 9 10126BR 5+ I want to pick the CUSTOMER_ID of RRC_db1 which also exist in RRC_db2: third - merge(RRC_db1, RRC_db2) or third -subset(RRC_db1, CUSTOMER_ID%in% RRC_db2$CUSTOMER_ID) But I also want to check if the CUSTOMER_RR is correct. I had tried this: test - function(RRC_db1,RRC_db2) + { + noteq - c() + for( i in 1:length(RRC_db1$CUSTOMER_ID)){ + for( j in 1:length(RRC_db2$CUSTOMER_ID)){ + if(RRC_db1$CUSTOMER_ID[i] == RRC_db2$CUSTOMER_ID[j]){ + if(RRC_db1$CUSTOMER_RR[i] != RRC_db2$CUSTOMER_RR[j]){ + noteq - c(noteq,RRC_db1$CUSTOMER_ID[i]); + } + } + } + } + noteq; + } test(RRC_db1, RRC_db2) Error in Ops.factor(RRC_db1$CUSTOMER_ID[i], RRC_db2$CUSTOMER_ID[j]) : level sets of factors are different But then I got this error. I don't only want the CUSTOMER_ID to be the same but also the CUSTOMER_RR. Can you please help me? Thanks in advance. Regards, Priya [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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.