[R] how to find and use specific column after spliting dataframe
Dear all: I am a new R-user and I have 2 questions about it. 1) I need to find specific sub-dataframe, and then use specific column to calculate. For example, after splitting dataframe, I find specific the sub-dataframe, such as “A.split [1]”. But, I don’t know how to find “time” and “concentration” columns of “A.split [1]”. 2) The equation used to sub-dataframe is (time[i]-time[i-1])*(concentration[i]- concentration[i-1])*1/2. I don’t know how to calculate it. How can I find the specific column and use it to calculate ? x-rep(c(1.2,6.8),4) y-rep(c(1, 2),4) z-rep(c(1,2),4) t-rep(c(0,1,2,3),length.out=8) c-rep(c(0,0.5,1,2),length.out=8) df-data.frame(pH=x, formulation=y, subject=z, time=t, concentration=c) A.split-split(df, list(df$pH ,df$formulation, df$subject) ) A.split [1] Best regards, Hsin-Ya Lee __ 怎樣減少垃圾信?只要看到垃圾信,立即按下「這是垃圾信」按鈕。http://tw.promo.yahoo.com/antispam/index.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How can I read the actual value (?) defined by set.seed(?) earlier?
Hi all I need to get the seed value that has been set by set.seed() earlier. I only do have the workfile *.Rdata so I can not simply look to the code. Thanx for any help, J Mag. Johannes Reichl Abteilung Energiewirtschaft Energieinstitut an der Johannes Kepler Universität Linz Altenberger Straße 69 A-4040 Linz * Tel.: +43-732-2468-5652 Fax: +43-732-2468-5651 Email: [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] normalised Voigt random numbers
Waterman, DG (David) wrote: Dear list, I would like to generate random numbers from a Voigt distribution, hopefully in a way as simple as getting random numbers from a normal distribution with 'rnorm'. Is there any package to do this? Speed is an issue in this application. Or, as the Voigt distribution is a convolution of a Gaussian and a Lorentzian, can I simply combine random numbers from rnorm and rcauchy in some way (I'm not sure about the maths of this)? I spent a while with the wikipedia entry on the Voigt distribution, which gives an expression for the pdf that I don't understand ... but the answer to your question appears very simple. rvoight - function(n,sigma,gamma) { rnorm(n,sd=sigma)+rcauchy(n,scale=1/gamma) } at least according to the formulas on the wikipedia page. Ben Bolker -- View this message in context: http://www.nabble.com/normalised-Voigt-random-numbers-tf4849610.html#a13886025 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] if condition and for cycles
Thanks. It did solve the problem. Luis -- View this message in context: http://www.nabble.com/if-condition-and-for-cycles-tf4882403.html#a13982960 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] windows vista
Hello there Im suzuky Pinto from Mexico. And Im buying a new computer and this have windows vista. Could I have any problem using R on it? thabks Suzuky** Comparte video en la ventana de tus mensajes (y también tus fotos de Flickr). Usa el nuevo Yahoo! Messenger versión Beta. http://mx.beta.messenger.yahoo.com/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Print Summary
Dear All, I am currently working on a project involving a rather redundant task. I have 11 files that I will be generating anova tables and plots for. I am contemplating writing a for loop to process each file, create an anova table, the appropriate plots, and save them to my hard drive. I've included pseudo-code below. files = c(,..,..,...,...) for (i in 1:10){ read.csv(files[i]) plot(.) bitmap(..) #or one of the many other plot saving functions model = lm(.) anova(model) This is where I am stuck. I'd like to have the anova table from all of my respective models print to one nice file. I know methods exist for extracting coefficients and the like from an anova-data.frame-class object, however is it possible to save the exact print-out without having to copy and paste 12 times? Any help is greatly appreciate. It seems like a lot of work for saving a few minutes, but i'll be leaving the script for another in our lab (who may or may not know R too well) when I leave. Best, Dave Mitchell Student University of Illinois-Champaign Urbana [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fortran Code to R Code
How do you convert Fortran Code to R Code to use and execute in R? Or how do you take Fortran code and make it run in R? So what I'm getting at is, I have some code in fortran and I want to be able to run that same code for R. Please email me back and let me know how to do that, thanks. Bryan Email: [EMAIL PROTECTED] - [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] GAM with constraints
Simon Wood-4 wrote: Are you interested in equality constraints or inequality constraints? No, I am interested in 2 kinds of inequality constraints: 1) monotonic splines 2) positive coefficients of the variables, which are not splines. It seems that pcls should be able to deal with both of them, if smoothing parameters are given, should it not? Simon Wood-4 wrote: `pcls' is really useful for the inequality constraint case (e.g. when you want shape preserving smooths). For fixed smoothing parameters you can embed this in an IRLS loop for gam fitting also, but convergence can be tricky, and smoothing parameter selection not so straightforward. The question here is how one can obtain smoothing parameters, given inequality constraints. I've read your article Monotonic smoothing splines fitted by cross-validation, where you explain how the penalties are calculated. Is there a routine in R that can do it? I want to build a GAM regression with constraints using performance iteration, which updates the penalties taking the constraints in account. Do you think this would improve the model compared to one where penalties are generated without constraints, and then the coefficients are calculated using pcls() with all the constraints? Luba P.S. Thank you for your detailed answer. -- View this message in context: http://www.nabble.com/GAM-with-constraints-tf4869470.html#a13987796 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with plotting table
On Tue, 2007-11-27 at 13:01 -0500, Carlos Gershenson wrote: Hi all, Let us have: x-1:10 y-x/2 plot(table(x), type=p) points(table(y), pch=2) Why does the last command plots the values of table(y) using the x coordinates of table(x)??? Am I doing something wrong? What would be a way of plotting the points of table(y) on their place? #this problem also occurs with: plot(table(y), type=p) points(table(x), pch=2) Thank you very much, Carlos Hi Carlos In your command plot(table(y), type=p), you plot a numeric part of table(y), in this case: y 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 1 1 1 1 1 1 1 1 1 1 So you plot the number 1 always. Same for table (x). Have two possible solutions: plot(as.numeric(names(table(x))), type=p) points(as.numeric(names(table(y))), pch=2) OR x-1:10 y-x/2 plot(x, type=p) points(y, pch=2) If you need more help send a mail -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How can I read the actual value (?) defined by set.seed(?) earlier?
On Wed, 28 Nov 2007, Johannes Reichl wrote: I need to get the seed value that has been set by set.seed() earlier. I only do have the workfile *.Rdata so I can not simply look to the code. You cannot: it is not stored at the time. set.seed() sets .Random.seed, and you can save/restore that. However, the workspace will only contain the current value, not the initial value. Normally the history is saved when you save the workspace: perhaps you do still have that and can search it for your call to set.seed (if there is one: there need not be). -- 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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] windows vista
On Tue, 27 Nov 2007, Suzuky Pinto wrote: Hello there Im suzuky Pinto from Mexico. And Im buying a new computer and this have windows vista. Could I have any problem using R on it? Not from R itself. See the rw-FAQ at http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Does-R-run-under-Windows-Vista_003f for a discussion of this. (People new to Vista often have trouble with installing/administering software, and some of their mistakes can be seen by searching the archives of this list.) thabks Suzuky** Comparte video en la ventana de tus mensajes (y también tus fotos de Flickr). Usa el nuevo Yahoo! Messenger versión Beta. http://mx.beta.messenger.yahoo.com/ [[alternative HTML version deleted]] -- 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__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Order observations in a dataframe
Dear All, Suppose I have the following dataframe: country;weight;group bul;10;1 cze;12;1 grc;12;1 hun;12;1 prt;12;1 rom14;1 fra;29;2 ita;29;2 gbr;29;2 aut;10;3 bel;12;3 The group variable denotes the id-number of a group of countries. How can I re-label the groups in the descending order of their cumulative weight, which wound be: country;weight;group fra;29;1 ita;29;1 gbr;29;1 bul;10;2 cze;12;2 grc;12;2 hun;12;2 prt;12;2 rom14;2 aut;10;3 bel;12;3 The first group has the largest sum of weights, the second, with the second largest, and so on. Thanks for your help, Serguei Kaniovski Austrian Institute of Economic Research (WIFO) P.O.Box 91 Tel.: +43-1-7982601-231 1103 Vienna, AustriaFax: +43-1-7989386 Mail: [EMAIL PROTECTED] http://www.wifo.ac.at/Serguei.Kaniovski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Odp: windows vista
AFAIK No. At home I use R on Vista too. You just need to understand and follow Vista's protection and rights policy. Petr [EMAIL PROTECTED] [EMAIL PROTECTED] napsal dne 27.11.2007 22:40:31: Hello there Im suzuky Pinto from Mexico. And Im buying a new computer and this have windows vista. Could I have any problem using R on it? thabks Suzuky** Comparte video en la ventana de tus mensajes (y también tus fotos de Flickr). Usa el nuevo Yahoo! Messenger versión Beta. http://mx.beta.messenger.yahoo.com/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Different value between R variance and definition ofvariance
Hi! maybe because sample variance has N-1 at the denominator (say degrees of freedom)? so all.equal((sum(x^2) - 100*mean(x)^2)/99, var(x)) ## TRUE but (sum(x^2) - 100*mean(x)^2)/100 # == your value Stef On Wed, Nov 28, 2007 at 09:56:58AM +0100, Tine wrote: TineHi! Tine TineLet us define random variable: Tine x = seq(0,1,length=100) Tine TineIf we calculate variance following definition E[(x-E(x))^2] we get: Tine mean( (x - mean(x))^2 ) # == mean(x^2) - mean(x)^2 Tine0.08501684 Tine TineAnd if we use internal R function var: Tine var(x) Tine0.08587559 Tine TineCan anyone tells me why the difference? Tine Tine__ TineR-help@r-project.org mailing list Tinehttps://stat.ethz.ch/mailman/listinfo/r-help TinePLEASE do read the posting guide http://www.R-project.org/posting-guide.html Tineand provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Different value between R variance and definition of variance
Hi! Let us define random variable: x = seq(0,1,length=100) If we calculate variance following definition E[(x-E(x))^2] we get: mean( (x - mean(x))^2 ) # == mean(x^2) - mean(x)^2 0.08501684 And if we use internal R function var: var(x) 0.08587559 Can anyone tells me why the difference? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] fit linear regression with multiple predictor and constrained intercept
Hi group, I have this type of data x(predictor), y(response), factor (grouping x into many groups, with 6-20 obs/group) I want to fit a linear regression with one common intercept. 'factor' should only modify the slopes, not the intercept. The intercept is expected to be 0. If I use y~ x + factor, I get a different intercept for each factor level, but one slope only if I use y~ x * factor, I get the interaction term I want, but the intercept is not kept constant. Also, if I constrain teh intercept in the regression model (y~a+x*factor), I get estimates both for slope and intercept of each factor level. Robert -- NIVAs hovedkontor har flyttet til nye lokaler i CIENS - Forskningssenter for miljø og samfunn; Gaustadalléen 21, 0349 Oslo. Meld deg på vårt nyhetsbrev på www.niva.no __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] fit linear regression with multiple predictor and constrained intercept
[EMAIL PROTECTED] wrote: Hi group, I have this type of data x(predictor), y(response), factor (grouping x into many groups, with 6-20 obs/group) I want to fit a linear regression with one common intercept. 'factor' should only modify the slopes, not the intercept. The intercept is expected to be 0. If I use y~ x + factor, I get a different intercept for each factor level, but one slope only if I use y~ x * factor, I get the interaction term I want, but the intercept is not kept constant. Also, if I constrain teh intercept in the regression model (y~a+x*factor), I get estimates both for slope and intercept of each factor level. Robert You seem to be looking for the colon operator. In R, unlike certain other statistical packages, the star implies inclusion of main effects: a*b is a + b + a:b. There is some trickery about when you get factors contrast coded in interaction terms (as far as I remember x:factor and x+x:factor are two different parametrizations of the same model), but you should be able to find that out by a little experimenting. -- 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] fit linear regression with multiple predictor and constrained intercept
I think you are looking for y ~ x + x:factor E.g. library(car) lm(repwt ~ repht + repht:sex, data=Davis) Coefficients: (Intercept)repht repht:sexM -59.30865 0.71412 0.05694 where the third term is the difference in slope between males and females. lm(repwt ~ repht:sex, data=Davis) Coefficients: (Intercept) repht:sexF repht:sexM -59.3086 0.7141 0.7711 for separately reported slopes. If you want to constrain the intercept, fit with and without and take the better fit (or look into package nnls, but that would be overkill here). On Wed, 28 Nov 2007, [EMAIL PROTECTED] wrote: Hi group, I have this type of data x(predictor), y(response), factor (grouping x into many groups, with 6-20 obs/group) I want to fit a linear regression with one common intercept. 'factor' should only modify the slopes, not the intercept. The intercept is expected to be 0. If I use y~ x + factor, I get a different intercept for each factor level, but one slope only if I use y~ x * factor, I get the interaction term I want, but the intercept is not kept constant. Also, if I constrain teh intercept in the regression model (y~a+x*factor), I get estimates both for slope and intercept of each factor level. Robert -- NIVAs hovedkontor har flyttet til nye lokaler i CIENS - Forskningssenter for miljø og samfunn; Gaustadalléen 21, 0349 Oslo. Meld deg på vårt nyhetsbrev på www.niva.no __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plotting Vector Fields
Plotting vector fields as we know it from Wolfram Mathematica's PlotVectorField[{f1(x1), f2(x2)}, {x1, min, max}, {x2, ymin, ymax}, PlotPoints - ...] ### FUNCTION DEFINITION #! Outer product with vector function ### # expand.outer joins functionality of expand.grid and outer, so that # a vector function can be applied, values of which are then stored in collumns. # Combinations of x and y are expanded into vectors of length n*m, where # n = length(x), m = length(y) and this ordering is preserved also in 'values'. # Matrix of values (list item 'values') and expanded variables (list items 'x','y') are returned. expand.outer - function(x, y, vecfun) { xy.pairs - expand.grid(x=x, y=y, KEEP.OUT.ATTRS = FALSE) x.exp - xy.pairs$x y.exp - xy.pairs$y list(values=matrix(vecfun(x.exp,y.exp), nrow=2, byrow=TRUE), x=x.exp, y=y.exp) } #! vector field plot function # grid.points can be defined for both axes at once or separately plotVectorField - function(vecfun, xlim, ylim, grid.points) { gp - if(length(grid.points)1) grid.points else rep(grid.points,2) maxlength - c(diff(xlim),diff(ylim))/(gp-1)*0.9 #prepare data x0 - seq(xlim[1], xlim[2], length=gp[1]) y0 - seq(ylim[1], ylim[2], length=gp[2]) xy.data - expand.outer(x0, y0, vecfun) x0 - xy.data$x y0 - xy.data$y dx - xy.data$values[1,] dy - xy.data$values[2,] #scale k - min( maxlength / c(max(abs(dx)),max(abs(dy))) ) x1 - x0 + k*dx y1 - y0 + k*dy #plot plot.default(range(x0,x1), range(y0,y1), main=Vector field, xlab=, ylab=, type=n, frame.plot=F) arrows(x0,y0,x1,y1,length = 0.08, angle = 20, code = 2) } ### FUNCTION CALL plotVectorField(function(x1,x2) c(x2,-x1), c(-1,1), c(-1,1), 9) Tomas Bacigal ---Original message From: [EMAIL PROTECTED] Date: Fri 25 Jul 2003 - 10:47:03 EST Message-id: [EMAIL PROTECTED] Dear R List, Is there a function to plot vector fields in R? I'm looking for something similar to PlotVectorField in Mathematica (see below), e.g. given functions f(x) and f(y), I would like to plot the resulting field of vectors (f(x),f(y)) over some range of x and y. PlotVectorField[{f(x), f(y)}, {x, xmin, xmax}, {y, ymin, ymax}] Thanks for your help, Brian __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Print Summary
Perhaps: ?capture.output ?sink On 28/11/2007, dave mitchell [EMAIL PROTECTED] wrote: Dear All, I am currently working on a project involving a rather redundant task. I have 11 files that I will be generating anova tables and plots for. I am contemplating writing a for loop to process each file, create an anova table, the appropriate plots, and save them to my hard drive. I've included pseudo-code below. files = c(,..,..,...,...) for (i in 1:10){ read.csv(files[i]) plot(.) bitmap(..) #or one of the many other plot saving functions model = lm(.) anova(model) This is where I am stuck. I'd like to have the anova table from all of my respective models print to one nice file. I know methods exist for extracting coefficients and the like from an anova-data.frame-classobject, however is it possible to save the exact print-out without having to copy and paste 12 times? Any help is greatly appreciate. It seems like a lot of work for saving a few minutes, but i'll be leaving the script for another in our lab (who may or may not know R too well) when I leave. Best, Dave Mitchell Student University of Illinois-Champaign Urbana [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Vacancy: UC Merced
University of California Merced Merced, CA Programmer Analyst II/III (Research Assistant) Job Code SSNRI723A Open until filled. In the Sierra Nevada Research Institute at UC Merced, act in support of research in applied climatology and statistical modeling for wildfire, energy and water resource management applications and assist the Principle Investigator with the development of software, management of data sets and design, modification, and implementation of systems for modeling and analysis. Develop software libraries for the R statistical project for publication and use in the classroom environment. Requires experience and demonstrated expertise in programming and data visualization. Relevant programming experience includes R, Fortran and/or C. HTML is also desired; background in statistics, physics, climatology, hydrology, fire ecology or a similar field (Masters preferred); strong problem solving; demonstrated written communication and programming skills. A UC Merced job application, resume and cover letter are requested. For more information and to apply call 1-866-669-JOBS or visit http:// jobs.ucmerced.edu/n/staff/position.jsf?positionId=723. EOE Anthony Westerling School of Engineering School of Social Sciences, Humanities, and Arts University of California, Merced http://tenaya.ucsd.edu/~westerli/westerling.html [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Order observations in a dataframe
Try this: df$group - factor(df$group) levels(df$group)- names(sort(tapply(df$weight, df$group, sum), decreasing=T)) On 28/11/2007, Serguei Kaniovski [EMAIL PROTECTED] wrote: Dear All, Suppose I have the following dataframe: country;weight;group bul;10;1 cze;12;1 grc;12;1 hun;12;1 prt;12;1 rom14;1 fra;29;2 ita;29;2 gbr;29;2 aut;10;3 bel;12;3 The group variable denotes the id-number of a group of countries. How can I re-label the groups in the descending order of their cumulative weight, which wound be: country;weight;group fra;29;1 ita;29;1 gbr;29;1 bul;10;2 cze;12;2 grc;12;2 hun;12;2 prt;12;2 rom14;2 aut;10;3 bel;12;3 The first group has the largest sum of weights, the second, with the second largest, and so on. Thanks for your help, Serguei Kaniovski Austrian Institute of Economic Research (WIFO) P.O.Box 91 Tel.: +43-1-7982601-231 1103 Vienna, AustriaFax: +43-1-7989386 Mail: [EMAIL PROTECTED] http://www.wifo.ac.at/Serguei.Kaniovski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fortran Code to R Code
help.start(), then Writing R extensions. You can link fortran subroutines to R by compiling them in a shared library (.so or .dll depending on your system) by the command: R CMD SHLIB file1.f file2.f -o myfortransubroutines.so and then from R you first dyn.load(myfortransubroutines.so) and then you use the .Fortran function to call the fortran subroutines with the right arguments. Pleas read the manual to have details of implementations and variables types. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] interaction of continuous terms
Hi all! this is a rather statistical question: is it meaningful to consider an interaction effect between 2 continuous covariates? for example: lm(y~x1+x2+x1:x2) Should one of continuous x1, x2 be transformed to a categorical variable, i.e. be classified into groups? Is it easier to interpret the effect if 1 or both are centered to the mean or z-transformed? Thank you! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] interaction of continuous terms
It's meaningful, but not under the name 'interaction'. The model is the same as y ~ x1 + x2 + I(x1*x2) that is, 'including a product term'. However, needing product terms often indicates a missed transformation of y (e.g. it might be better to use log(y)). On Wed, 28 Nov 2007, Irene Mantzouni wrote: Hi all! this is a rather statistical question: is it meaningful to consider an interaction effect between 2 continuous covariates? for example: lm(y~x1+x2+x1:x2) Should one of continuous x1, x2 be transformed to a categorical variable, i.e. be classified into groups? Is it easier to interpret the effect if 1 or both are centered to the mean or z-transformed? Depends on the context, but usually not. -- 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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Http_proxy settings with autoproxy.php
Just installed R on a new machine which is on a server. I am trying to download packages but seem to have trouble with our proxy settings. I have read the 2.19 section in R for Windows and tried what was suggested (setting http_proxy) but that did not help (still cannot connect). I think my problem is that we do not have a fixed port but use instead autoproxy. Has anyone encountered this problem and if so how can it be fixed? Thanks, David Dr. David Lusseau Lecturer in Marine Populations University of Aberdeen School of Biological Sciences Zoology Bldg, Tillydrone Avenue Aberdeen, AB24 2TZ, UK Phone: (0)1224 272843 Website: http://www.lusseau.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Http_proxy settings with autoproxy.php
On Wed, 28 Nov 2007, Lusseau, David wrote: Just installed R on a new machine which is on a server. I am trying to Under Windows, I infer. download packages but seem to have trouble with our proxy settings. I have read the 2.19 section in R for Windows and tried what was suggested (setting http_proxy) but that did not help (still cannot connect). I think my problem is that we do not have a fixed port but use instead autoproxy. Has anyone encountered this problem and if so how can it be fixed? Have you tried --internet2? In most cases if Internet Explorer works with your proxy, so will Rgui --internet2. Otherwise you need to ask the people who inflicted the proxy on you how to make use of it. ('autoproxy' is not a well-defined term, BTW, as it has several meanings.) -- 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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] question about warning message in nlme model
I am writing to inquire about a warning message that I receive when trying to model a random slope and intercept at the second level of a 3-level model. Specifically, I am testing a 3-level model in which time (WEEK) is nested in participants (PARTICIP) and participants are nested in dyads (DYADID). The goal is to examine how an interpersonal style (CORUMTO) one week predicts changes in depression the following week (BDIAFTER) controlling for levels of depression (BDI) from the previous week. I have approximately 80 dyads and approximately 160 participants. When modeling a random slope and intercept at the second level (the participant or person level), I receive output, and I also receive the following error message. Warning message Fewer observations than random effects in all level 2 groups I was wondering what this error message means and if it may be suggesting that the results after the summary statement are incorrect. I also want to verify that the following syntax is appropriate for modeling a random intercept and slope on the variable CORUMTO at the participant level and a random intercept and fixed slope at the dyad level. intercept-lme(BDIAFTER~BDI+WEEK+CORUMTO, random=list(DYADID=~1, PARTICIP=~CORUMTO), data=weeklydata) Any help you can give would be much appreciated. Thank you for your time. Sincerely, Christine Calmes Christine Calmes, M.A. Doctoral Candidate, Clinical Psychology University at Buffalo: The State University at New York Department of Psychology; Park Hall North Campus Buffalo NY, 14260 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] windows vista
If the administrator account does not exist, this info provided for another software program I use may be helpful: Some Windows Vista installations may have the Administrator account turned off. If so, it is easy to turn the true Administrator account on. To do so, open the Control Panel and open the User Accounts applet. If you do not see any accounts named Administrator, this account is disabled. To enable the Administrator account, do the following: * Click Start, type cmd into the search pane, wait until the system displays the cmd.exe item at the top. * Right click the item and choose Run as administrator. * In the opened command prompt, type net user administrator /active:yes and click Enter, then log off. * There will now be an Administrator account enabled. * Log in as the Administrator to install and to activate Manifold. From: http://www.manifold.net/tech/vista_admin.shtml http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Does-R-run-under-Windows-Vista_003f Suzuky Pinto wrote: Hello there Im suzuky Pinto from Mexico. And Im buying a new computer and this have windows vista. Could I have any problem using R on it? thabks Suzuky** Comparte video en la ventana de tus mensajes (y también tus fotos de Flickr). Usa el nuevo Yahoo! Messenger versión Beta. http://mx.beta.messenger.yahoo.com/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/windows-vista-tf4887031.html#a13993446 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Antwort: Re: Order observations in a dataframe
How can I re-label the groups in the descending order of their cumulative weight, foo = data.frame(country=c(bul, cze, grc, hun, prt, rom, fra, ita, gbr, aut, bel), weight=c(10,12,12,12,12,4,29,29,29,10,12), group=c(1,1,1,1,1,1,2,2,2,3,3)) #Find the cumulative weights by group cumweights = with(foo, tapply(weight, group, sum) #Incorporate the weights into the data frame foo$cumweights = numeric(nrow(foo)) for(i in 1:nrow(foo)) foo$cumweights[i] = cumweights[as.character(foo$group[i])==names(cumweights)] #Sort by cumweight ooo = with(foo, order(cumweights, country, decreasing=TRUE)) foo = foo[ooo,] Thanks Richard, but how do you renumerate the group variable accordingly? Try this: sizeofgroups = summary(as.factor(foo$group)) orderofgroups = order(cumweights, decreasing=TRUE) foo$newgroup = rep(orderofgroups, times=sizeofgroups) Regards, Richie. Mathematical Sciences Unit HSL ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fail to open R 2.6.1
R-help, I opened an R session ( R 2.6.0 on Windows) and got the following pop-up window: This application has failed to start because tk84.dll was not found. Re-installing the application may fix the problem I have now upgraded to R 2.6.1 but the same fatal error comes up. Can someone let me know what is going on? Thanks in advance. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fail to open R 2.6.1 - additional information
This is additional information to my previous email (pasted below) ## I opened an R session ( R 2.6.0 on Windows) and got the following pop-up window: ## This application has failed to start because tk84.dll was not found. Re-installing the application may fix the problem ## I have now upgraded to R 2.6.1 but the same fatal error comes up. ## Can someone let me know what is going on? I have started an empty R session and tried to load the workspace I can't open (above) I get the error message: load(E:\\WORKSPACE_I CANNOT OPEN) Loading Tcl/Tk interface ...Error in dyn.load(file, ...) : unable to load shared library 'C:/PROGRA~1/R/R-26~1.1/library/tcltk/libs/tcltk.dll': LoadLibrary failure: The specified module could not be found. Error: .onLoad failed in 'loadNamespace' for 'tcltk' How can I fix it? Thanks in advance version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 6.1 year 2007 month 11 day26 svn rev43537 language R version.string R version 2.6.1 (2007-11-26) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Replacing values job
Hallo, I have two vectors of different lengths which contain the same set of values: X -c(2,6,1,7,4,3,5) Y - c(1,1,6,4,6,1,4,1,2,3,6,6,1,2,4,4,5,4,1,7,6,6,4,4,7,1,2) How can I replace the values in Y with the index (!) of the corresponding values in X. So 2 appears in X in the first coordinate, so all 2âs in Y should be replaced by 1, etc. Thank you for your help, Serguei Austrian Institute of Economic Research (WIFO) P.O.Box 91 Tel.: +43-1-7982601-231 1103 Vienna, AustriaFax: +43-1-7989386 Mail: [EMAIL PROTECTED] http://www.wifo.ac.at/Serguei.Kaniovski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] using names with functions..
Dear all, I have the following (rather) strange problem.. For some reasons, I finally work with a variable whose name includes an R function, a.log(z), say. And that is a problem when I call it in a formula, for instance: myname-a.log(z) dd-data.frame(a.log(z)=1:10,y=rnorm(10)) o-lm(y~1,data=dd) fo-as.formula(paste(.~.+,paste(myname, collapse = +))) fo . ~ . + a.log(z) update(o,formula=fo) Error in eval(expr, envir, enclos) : could not find function a.log How can fit the model? namely how can I use a.log(z) in the example above? Many thanks, vito -- Vito M.R. Muggeo Dip.to Sc Statist e Matem `Vianelli' Università di Palermo viale delle Scienze, edificio 13 90128 Palermo - ITALY tel: 091 6626240 fax: 091 485726/485612 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] windows vista
R works on Vista provided you have learned enough about Vista to get around the enhanced security model. Microsoft One Care software and the overall better security of Vista is, in my opinion, much superior to Norton/Symantec/XP. Many people use Skype these days and Skype is not officially supported on Vista so if you want to use that it may or may not work. My Vista system crashed shortly after I tried Skype and reverted back to a prior checkpoint at which point I lost several programs I had installed including Skype although I did not lose any files that I had created myself. It may have been a driver issue and not Skype, per se, though the fact that Skype is not officially supported makes Skype a prime suspect. My Vista system had never crashed before that nor has it crashed since then. If you search the net you see some people having problems with Skype on Vista whereas others say they have run it daily with no problem. There are significant changes in Microsoft Office 2007 including new XML based file formats rather than the old formats (although you can read and write the old formats too), substantial changes in Office user interfaces and a focus on .Net in place of COM although COM is still supported enough in Office 2007 to run old software. R packages supporting .Net, similar to the R packages rcom and RDCOMClient for COM, would be nice to properly support Vista but I don't think such R packages exist yet. Other than the lack of Skype support I do like Vista and have been able to get rid of numerous small utilities that I used under XP since Vista has many of these facilities built in. On Nov 27, 2007 4:40 PM, Suzuky Pinto [EMAIL PROTECTED] wrote: Hello there Im suzuky Pinto from Mexico. And Im buying a new computer and this have windows vista. Could I have any problem using R on it? thabks Suzuky** Comparte video en la ventana de tus mensajes (y también tus fotos de Flickr). Usa el nuevo Yahoo! Messenger versión Beta. http://mx.beta.messenger.yahoo.com/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Clustering
Hello all! I am performingsome clustering analysis on microarray data using agnes{cluster} and I have created my own dissimilarity matrix according to a distance measure different from euclidean or manhattan etc. My question is, if I choose for example method=complete, how are the distances between the elements calculated? Are they taken form the dissimilarity matrix I have provided as the first argument? clust.complete.agnes-agnes(as.dist(D),diss=TRUE,method=complete) Thank you very much, Eleni [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] simulating a 2-parameter integrated ornstein-uhlenbeck process?
hello everyone, i'm trying to simulate a 2-parameter integrated ornstein-uhlenbeck (IOU) process, but i'm not sure exactly where to start (which package, which function). the motivation is the paper by taylor et. al. (JASA 1994) a stochastic model for the analysis of longitudinal aids data. the model they suggest consists of a combination of fixed and random effects, a stochastic process, and measurement error. the 2-parameter IOU process they suggest has cov[W(s), W(t)] = (sigma^2/(2alpha^3)[2alpha min(s,t)+exp(-alpha* t) +exp(-alpha* s)-1 -exp(alpha*|t-s|)). any insight into either fitting the model or simulating a 2-parameter IOU process would be appreciated. thanks, farzad Be a better sports nut! Let your teams follow you [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Questions on RWeka classifiers?
Li Li lilycai2007 at gmail.com writes: Hi, I am using some classifiers in RWeka packages and met a couple problems. (1) J48 implements C45 classifier, the C45 should be able to handle missing values in both training set and test set. But I found the J48 classifier can not be evaluated on test set with missing values--it just ignore them. Why don't you ask this question on the WEKA mailing list at, for instance, http://news.gmane.org/gmane.comp.ai.weka ! If I remember correctly, C4.5 is smart enough to simply drop examples with missing values, while C5.0 will handle them more intelligently. It will also address numerical attributes more sensible than C4.5 or CART. Unfortunately, C5.0 is commercial software, but you can get a 2-weeks demo from Quinlan's site. (2) The ensemble classifiers in RWeka such as bagging and boosting: there is a control argument as W to describe which base classifier should be used. I use W=J48 to boost C45 tree, but I am not sure how to down size the tree to be a weak learner. Based on what I observed, the default boosted J48 tree gets worse performance. This is difficult to answer without any concrete data. From my own experince I can say that in many cases results have distinctively improved when applying Adaboost. Thanks for any discussion and help, Li Regards, Hans Werner Borchers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fail to open R 2.6.1 - additional information
On 11/28/2007 9:41 AM, Luis Ridao Cruz wrote: This is additional information to my previous email (pasted below) ## I opened an R session ( R 2.6.0 on Windows) and got the following pop-up window: ## This application has failed to start because tk84.dll was not found. Re-installing the application may fix the problem ## I have now upgraded to R 2.6.1 but the same fatal error comes up. ## Can someone let me know what is going on? I have started an empty R session and tried to load the workspace I can't open (above) I get the error message: load(E:\\WORKSPACE_I CANNOT OPEN) Loading Tcl/Tk interface ...Error in dyn.load(file, ...) : unable to load shared library 'C:/PROGRA~1/R/R-26~1.1/library/tcltk/libs/tcltk.dll': LoadLibrary failure: The specified module could not be found. Error: .onLoad failed in 'loadNamespace' for 'tcltk' How can I fix it? I suspect you installed R without Support files for TCLTK. Your workspace appears to have something in it that refers to the tcltk package, and it needs TCLTK installed to work. Duncan Murdoch Thanks in advance version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 6.1 year 2007 month 11 day26 svn rev43537 language R version.string R version 2.6.1 (2007-11-26) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing values job
does this do what you want? sapply(y,function(y){which(y==x)}) hth, Ingmar On 28 Nov 2007, at 15:53, Serguei Kaniovski wrote: Hallo, I have two vectors of different lengths which contain the same set of values: X -c(2,6,1,7,4,3,5) Y - c(1,1,6,4,6,1,4,1,2,3,6,6,1,2,4,4,5,4,1,7,6,6,4,4,7,1,2) How can I replace the values in Y with the index (!) of the corresponding values in X. So 2 appears in X in the first coordinate, so all 2s in Y should be replaced by 1, etc. Thank you for your help, Serguei Austrian Institute of Economic Research (WIFO) P.O.Box 91 Tel.: +43-1-7982601-231 1103 Vienna, AustriaFax: +43-1-7989386 Mail: [EMAIL PROTECTED] http://www.wifo.ac.at/Serguei.Kaniovski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Ingmar Visser Department of Psychology, University of Amsterdam Roetersstraat 15 1018 WB Amsterdam The Netherlands t: +31-20-5256723 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Simulate an AR(1) process via distributions? (without specifying a model specification)
Dear All, Is it possible to simulate an AR(1) process via a distribution? I have simulated an AR(1) process the usual way (that is, using a model specification and using the random deviates in the error), and used the generated time series to estimate 3- and 4-parameter distributions (for instance, GLD). However, the random deviates generated from these distributions do not follow the specified AR process. Any comment and feedback will be more than welcome. Thanks for your time. Pedro N. Rodriguez [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing values job
From: Serguei Kaniovski [EMAIL PROTECTED] Date: 2007/11/28 Wed AM 08:53:34 CST To: [EMAIL PROTECTED] Subject: [R] Replacing values job newY-sapply(1:length(Y), function(.element) match(Y[.element],X)) i hope it helps you. Hallo, I have two vectors of different lengths which contain the same set of values: X -c(2,6,1,7,4,3,5) Y - c(1,1,6,4,6,1,4,1,2,3,6,6,1,2,4,4,5,4,1,7,6,6,4,4,7,1,2) How can I replace the values in Y with the index (!) of the corresponding values in X. So 2 appears in X in the first coordinate, so all 2âÂÂs in Y should be replaced by 1, etc. Thank you for your help, Serguei Austrian Institute of Economic Research (WIFO) P.O.Box 91 Tel.: +43-1-7982601-231 1103 Vienna, AustriaFax: +43-1-7989386 Mail: [EMAIL PROTECTED] http://www.wifo.ac.at/Serguei.Kaniovski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] windows vista
Dear Suzuky, basically you can run R on Vista like you can on Windows XP. However, there is one issue about installing additional packages : When launching R under Vista, by default you won't launch as administrator, and in consequence you can't install additional packages (i.e. installing conveniently from within R) in the path where the other packages are located (since this is usually in Program Files). Note that you still CAN install and run the packages but (in this case) you'll be installing the packages in a new folder in Contacts/Documents/ , which is -in my opinion- not the best place to store them (and they won't be available for other users on the same PC). So, if you know you'll be installing I suggest you to launch R with a right click and select as administrator and then you can install new packages in proper way. Wolfgang Suzuky Pinto a écrit : Hello there Im suzuky Pinto from Mexico. And Im buying a new computer and this have windows vista. Could I have any problem using R on it? thabks Suzuky** Comparte video en la ventana de tus mensajes (y también tus fotos de Flickr). Usa el nuevo Yahoo! Messenger versión Beta. http://mx.beta.messenger.yahoo.com/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Wolfgang Raffelsberger, PhD Laboratoire de BioInformatique et Génomique Intégratives CNRS UMR7104, IGBMC 1 rue Laurent Fries, 67404 Illkirch Strasbourg, France Tel (+33) 388 65 3300 Fax (+33) 388 65 3276 [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing values job
?match X [1] 2 6 1 7 4 3 5 Y [1] 1 1 6 4 6 1 4 1 2 3 6 6 1 2 4 4 5 4 1 7 6 6 4 4 7 1 2 match(Y,X) [1] 3 3 2 5 2 3 5 3 1 6 2 2 3 1 5 5 7 5 3 4 2 2 5 5 4 3 1 On Nov 28, 2007 9:53 AM, Serguei Kaniovski [EMAIL PROTECTED] wrote: Hallo, I have two vectors of different lengths which contain the same set of values: X -c(2,6,1,7,4,3,5) Y - c(1,1,6,4,6,1,4,1,2,3,6,6,1,2,4,4,5,4,1,7,6,6,4,4,7,1,2) How can I replace the values in Y with the index (!) of the corresponding values in X. So 2 appears in X in the first coordinate, so all 2's in Y should be replaced by 1, etc. Thank you for your help, Serguei Austrian Institute of Economic Research (WIFO) P.O.Box 91 Tel.: +43-1-7982601-231 1103 Vienna, AustriaFax: +43-1-7989386 Mail: [EMAIL PROTECTED] http://www.wifo.ac.at/Serguei.Kaniovski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using names with functions..
Names not conforming to the usual R syntax can be placed in backquotes: `log(x)` - 1:10 lm(`log(x)` ~ 1) Call: lm(formula = `log(x)` ~ 1) Coefficients: (Intercept) 5.5 On Nov 28, 2007 9:52 AM, vito muggeo [EMAIL PROTECTED] wrote: Dear all, I have the following (rather) strange problem.. For some reasons, I finally work with a variable whose name includes an R function, a.log(z), say. And that is a problem when I call it in a formula, for instance: myname-a.log(z) dd-data.frame(a.log(z)=1:10,y=rnorm(10)) o-lm(y~1,data=dd) fo-as.formula(paste(.~.+,paste(myname, collapse = +))) fo . ~ . + a.log(z) update(o,formula=fo) Error in eval(expr, envir, enclos) : could not find function a.log How can fit the model? namely how can I use a.log(z) in the example above? Many thanks, vito -- Vito M.R. Muggeo Dip.to Sc Statist e Matem `Vianelli' Università di Palermo viale delle Scienze, edificio 13 90128 Palermo - ITALY tel: 091 6626240 fax: 091 485726/485612 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using names with functions..
On 11/28/2007 9:52 AM, vito muggeo wrote: Dear all, I have the following (rather) strange problem.. For some reasons, I finally work with a variable whose name includes an R function, a.log(z), say. And that is a problem when I call it in a formula, for instance: myname-a.log(z) dd-data.frame(a.log(z)=1:10,y=rnorm(10)) o-lm(y~1,data=dd) fo-as.formula(paste(.~.+,paste(myname, collapse = +))) fo . ~ . + a.log(z) update(o,formula=fo) Error in eval(expr, envir, enclos) : could not find function a.log How can fit the model? namely how can I use a.log(z) in the example above? You can make just about anything into a name by quoting in in backticks, e.g. `a.log(z)` should always be seen as a name. However, there is a fair bit of code in contributed packages that converts things to character vectors and then reparses it (like your example above!), and that code may well get confused by such a name. For example, deparse(quote(`a.log(z)`)) [1] a.log(z) The package writer could avoid this by using deparse(quote(`a.log(z)`), backtick=T) [1] `a.log(z)` You also need to worry about the fact that by default, data.frame() will convert the name of the first column to a.log.z. So you could get everything you want with this variation on your example: myname-`a.log(z)` dd-data.frame(a.log(z)=1:10,y=rnorm(10), check.names=FALSE) o-lm(y~1,data=dd) fo-as.formula(paste(.~.+,paste(myname, collapse = +))) fo . ~ . + `a.log(z)` update(o,formula=fo) Call: lm(formula = y ~ `a.log(z)`, data = dd) Coefficients: (Intercept) `a.log(z)` -0.3931 0.0753 However, I'd suggest avoiding the use of such a name. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing values job
Ingmar Visser wrote: does this do what you want? sapply(y,function(y){which(y==x)}) Maybe, but match(Y,X) would be more to the point. hth, Ingmar On 28 Nov 2007, at 15:53, Serguei Kaniovski wrote: Hallo, I have two vectors of different lengths which contain the same set of values: X -c(2,6,1,7,4,3,5) Y - c(1,1,6,4,6,1,4,1,2,3,6,6,1,2,4,4,5,4,1,7,6,6,4,4,7,1,2) How can I replace the values in Y with the index (!) of the corresponding values in X. So 2 appears in X in the first coordinate, so all 2�s in Y should be replaced by 1, etc. Thank you for your help, Serguei Austrian Institute of Economic Research (WIFO) P.O.Box 91 Tel.: +43-1-7982601-231 1103 Vienna, AustriaFax: +43-1-7989386 Mail: [EMAIL PROTECTED] http://www.wifo.ac.at/Serguei.Kaniovski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Ingmar Visser Department of Psychology, University of Amsterdam Roetersstraat 15 1018 WB Amsterdam The Netherlands t: +31-20-5256723 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using names with functions..
vito muggeo wrote: Dear all, I have the following (rather) strange problem.. For some reasons, I finally work with a variable whose name includes an R function, a.log(z), say. And that is a problem when I call it in a formula, for instance: myname-a.log(z) dd-data.frame(a.log(z)=1:10,y=rnorm(10)) o-lm(y~1,data=dd) fo-as.formula(paste(.~.+,paste(myname, collapse = +))) fo . ~ . + a.log(z) update(o,formula=fo) Error in eval(expr, envir, enclos) : could not find function a.log How can fit the model? namely how can I use a.log(z) in the example above? Many thanks, vito Use backquotes as in `a.log(z)`, I think. myname-a.log(z) o-lm(y~1,data=dd) dd-data.frame(a.log(z)=1:10,y=rnorm(10),check.names=F) fo-as.formula(paste(.~.+,paste(deparse(as.name(myname), backtick=T), collapse = +))) update(o,formula=fo) or, actually nicer, use fo - bquote(. ~ . + .(as.name(myname))) -- 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Different value between R variance and definition of variance
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tine Sent: Wednesday, November 28, 2007 12:57 AM To: r-help@r-project.org Subject: [R] Different value between R variance and definition of variance Hi! Let us define random variable: x = seq(0,1,length=100) If we calculate variance following definition E[(x-E(x))^2] we get: mean( (x - mean(x))^2 ) # == mean(x^2) - mean(x)^2 0.08501684 And if we use internal R function var: var(x) 0.08587559 Can anyone tells me why the difference? I haven't seen a response, so I will chime in. R calculates an unbiased estimate of the population variance from which your x is assumed to be a simple random sample of size n (in your case n=100). See any basic book on statistics. So, using your formula, R in effect calculates mean((x-mean(x)^2) * n/(n-1) Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Clustering
Hello Eleni, as far as I understood and used agnes() the method argument determines only the clustering method. If you use diss=TRUE the distances should be taken from the distance matrix. Birgit Am 28.11.2007 um 12:18 schrieb Eleni Christodoulou: Hello all! I am performingsome clustering analysis on microarray data using agnes{cluster} and I have created my own dissimilarity matrix according to a distance measure different from euclidean or manhattan etc. My question is, if I choose for example method=complete, how are the distances between the elements calculated? Are they taken form the dissimilarity matrix I have provided as the first argument? clust.complete.agnes-agnes(as.dist(D),diss=TRUE,method=complete) Thank you very much, Eleni [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing values job
jim holtman wrote: ?match X [1] 2 6 1 7 4 3 5 Y [1] 1 1 6 4 6 1 4 1 2 3 6 6 1 2 4 4 5 4 1 7 6 6 4 4 7 1 2 match(Y,X) [1] 3 3 2 5 2 3 5 3 1 6 2 2 3 1 5 5 7 5 3 4 2 2 5 5 4 3 1 I quite like this solution: X[X[X[X[X[X[X[X[X[X[X]][Y] [1] 3 3 2 5 2 3 5 3 1 6 2 2 3 1 5 5 7 5 3 4 2 2 5 5 4 3 1 but somehow I don't think its general enough... Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [OT] putting URLs in Latex
Edna Bell [EMAIL PROTECTED] wrote: Hi R Gurus! This is definitely off topic, but I thought I'd try: what is the way to put in url's into a Latex file, please? In future, you might want to post such questions in group comp.text.tex Mike -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Clustering
Eleni, The method= argument is in reference to how clusters are constructed, not how the dissimilarity or distance is calculated. If you pass agnes diss=TRUE then it will use the distances you have calculated by whatever means. method=complete means that clusters are evaluated by the maximum distance of a candidate sample to the set of samples in the cluster, rather than the average. Yo can find descriptions of these algorithms in most any text on clustering. Dave Roberts Eleni Christodoulou wrote: Hello all! I am performingsome clustering analysis on microarray data using agnes{cluster} and I have created my own dissimilarity matrix according to a distance measure different from euclidean or manhattan etc. My question is, if I choose for example method=complete, how are the distances between the elements calculated? Are they taken form the dissimilarity matrix I have provided as the first argument? clust.complete.agnes-agnes(as.dist(D),diss=TRUE,method=complete) Thank you very much, Eleni [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simulate an AR(1) process via distributions? (without specifying a model specification)
On Wed, 28 Nov 2007, [EMAIL PROTECTED] wrote: Is it possible to simulate an AR(1) process via a distribution? Any distribution *of errors*, yes. Of the process values, not in general. I have simulated an AR(1) process the usual way (that is, using a model specification and using the random deviates in the error), and used the generated time series to estimate 3- and 4-parameter distributions (for instance, GLD). However, the random deviates generated from these distributions do not follow the specified AR process. How do you know that? Please give us the reproducible example we asked for (in the posting guide, at the bottom of every message), and we should be able to explain it to you. -- 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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Can't make affylmGUI work
Hi, Can anyone help me of the affylmGUI package, I can't get it work and searched for google but can't find any proper solutions. I get the error information each time when I load my cells files, which are shown in the following links. - http://clarezoe.googlepages.com/1.png http://clarezoe.googlepages.com/2.png http://clarezoe.googlepages.com/3.png - Errors also show in the terminal as below, - Error: no function to return from, jumping to top level In addition: Warning messages: 1: read.phenoData is deprecated, use read.AnnotatedDataFrame instead 2: The phenoData class is deprecated, use AnnotatedDataFrame (with ExpressionSet) instead Error in exprs(RawAffyData) : no function to return from, jumping to top level -- I'm running R version 2.6.1 under Linux Ubuntu 7.10 -- My sessionInfo is shown below, -- sessionInfo() R version 2.6.1 (2007-11-26) i486-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] tools tcltk stats graphics grDevices utils datasets [8] methods base other attached packages: [1] affylmGUI_1.12.0 affy_1.12.2 affyio_1.6.1 Biobase_1.16.1 [5] limma_2.12.0 loaded via a namespace (and not attached): [1] rcompgen_0.1-17 Can anyone help me with that? I really need it to work ASAP. Thanks a lot! Sincerely Feifei __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] alternatives to traditional least squares method in linear regression ?
You could use the weights= argument of lm or if these points represent a different factor you could add a dummy variable which is one for those points and 0 otherwise. Also check out quantile regression in the quantreg package. On Nov 28, 2007 11:14 AM, Wolfgang Raffelsberger [EMAIL PROTECTED] wrote: Dear list, I have encountered a special case for searching a linear regression where I'm not satisfied with the results obtained using the traditional least squares method (sometimes called OLS) for estimating/optimizing the residues to the regression line (see code below). Basically, a group of my x-y data are a bit off the diagonal line (in my case the diagonal represents the ideal or theoretical fit between x and y, which are in the same scale) and thus these points have sufficient power to impose a slope deviating (too much) from the diagonal. Using rlm() didn't help since this is not a problem of rare outliers. From a pragmatic point of view using a linear regression approach does fit very well the nature of the data comparison I'd like to perform, so that's why I'd like to stay with something linear. Has anybody already implemented a function or package in R allowing to modify the exponent (of the least squares method) or more general allowing to define the model to be used for estimating/optimizing the residues ? Thank's in advance Wolfgang Raffelsberger plot(x,y)# x and y are my data regr - lm(y~x) abline(regr) # I'm not satisfied with the line since there is one group of points following very well the diagonal but the regression is deviated by another group of points ... sessionInfo() R version 2.6.0 (2007-10-03) i386-pc-mingw32 locale: LC_COLLATE=French_France.1252;LC_CTYPE=French_France.1252;LC_MONETARY=French_France.1252;LC_NUMERIC=C;LC_TIME=French_France.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods [8] base other attached packages: [1] svSocket_0.9-5 svIO_0.9-5 R2HTML_1.58svMisc_0.9-5 svIDE_0.9-5 loaded via a namespace (and not attached): [1] tools_2.6.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Wolfgang Raffelsberger, PhD Laboratoire de BioInformatique et Génomique Intégratives CNRS UMR7104, IGBMC 1 rue Laurent Fries, 67404 Illkirch Strasbourg, France Tel (+33) 388 65 3300 Fax (+33) 388 65 3276 [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simulating a 2-parameter integrated ornstein-uhlenbeck process?
You may want to check the package sde that can simulate from a number of different stochastic differential equations, including the OU process. 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 Farzad Noubary Sent: Wednesday, November 28, 2007 7:58 AM To: r-help@r-project.org Subject: [R] simulating a 2-parameter integrated ornstein-uhlenbeck process? hello everyone, i'm trying to simulate a 2-parameter integrated ornstein-uhlenbeck (IOU) process, but i'm not sure exactly where to start (which package, which function). the motivation is the paper by taylor et. al. (JASA 1994) a stochastic model for the analysis of longitudinal aids data. the model they suggest consists of a combination of fixed and random effects, a stochastic process, and measurement error. the 2-parameter IOU process they suggest has cov[W(s), W(t)] = (sigma^2/(2alpha^3)[2alpha min(s,t)+exp(-alpha* t) +exp(-alpha* s)-1 -exp(alpha*|t-s|)). any insight into either fitting the model or simulating a 2-parameter IOU process would be appreciated. thanks, farzad Be a better sports nut! Let your teams follow you [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fortran Code to R Code
Bryan, The previous responses will point you in the right direction. I have found, however, that it takes a while to get used to the requirements, and there are many possible sources of error. 1) You have to convert the main program to a subroutine. Any arrays declared in the main program or any nested subroutine have to created in R before the subroutine is called, and passed to the subroutine. On the other hand, this provides the advantage of allocatable array size in FORTRAN 77. 2) You have to make sure that you are very careful about storage. I have reluctantly decided that attempting minimize storage by using integer*2 and real*4 is not worth it, and I now use just integer and double precision to minimize problems with R. 3) Consider casting every variable passed in the .Fortran() call. Many of them would be correct by default possibly, but it is easier to simply cast them all, e.g. as.integer() for all integers, as.double() for real numbers. These get the storage right, and strip of any attributes besides he actual values. Fortunately, R and FORTRAN agree about storage order in arrays and you don't have to micro-manage that. 4) When you get it wrong, the probability of a seg fault and hard crash is very high. So, every time you modify the R function that calls the .Fortran you have written, do a save.image() before you try the code. Otherwise you lose all your changes. If you have the luxury of working in linux (and presumably other *nixes), you can use write(6,*) whatever debug statements in your code and the output goes to your R session. In Windows, you have to use the specific debug routines described in the R manuals. 5) Managing the returned values has to handled in the .Fortran() call by giving the argument a name. Then, that name can be used as the component name of the returned object. Just below is an example from labdsv that converts any dissimilarity or distance matrix to the nearest euclidean distance object. The PACKAGE= argument is used when the routine is pat of a package; it's not necessary for ad hoc functions. euclidify - function (x,upper=FALSE,diag=FALSE) { x - as.dist(x) tmp - .Fortran(euclid, x=as.matrix(x), as.integer(attr(x,Size)), PACKAGE='labdsv') tmp2 - as.dist(tmp$x) attr(tmp2, Labels) - dimnames(x)[[1]] attr(tmp2, Diag) - diag attr(tmp2, Upper) - upper attr(tmp2, method) - paste(euclidify, attr(x, method)) attr(tmp2, call) - match.call() tmp2 } Dave Roberts Bryan Klingaman wrote: How do you convert Fortran Code to R Code to use and execute in R? Or how do you take Fortran code and make it run in R? So what I'm getting at is, I have some code in fortran and I want to be able to run that same code for R. Please email me back and let me know how to do that, thanks. Bryan Email: [EMAIL PROTECTED] - [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Graphics after invoking R from the command line
I've tried running graphics commands like plot by invoking R at the command line but the graphics window does not appear. I'm using R-2.6.0 on Windows XP and am using the cmd shell. Here's a sample session: R --slave --save --file=- x-c(1,2,3,4) plot(x,x) This leads to nothing. I've found a way around it, but the graph window is frozen and commands to it have to be sent twice for the data to appear. R --slave --save --file=- x-c(1,2,3,4) windows() plot(x,x) plot(x,x) Am I doing something wrong here? It would be nice if I could display a graphics window which isn't frozen. Regards, Mithun __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] PCA with NA
Hello, unfortunately I can not find the pcaMethods package. Birgit Am 26.11.2007 um 16:26 schrieb Kevin Wright: The pcaMethods package offers a collection of different algorithms for PCA, some of which (NIPALS and others) can be used on data that have missing values. Kevin Wright On Nov 24, 2007 4:59 PM, Hartmut Oldenbürger [EMAIL PROTECTED] wrote: Hi Birgit, and All Possibly you should not consider the case completed ;-) There is an important alternative to imputing means, or estimates from first or second order regression (Frane, Psychometrica, BMDP): partial-least-squares (Wold), which uses as much information from the data as possible to estimate the principal components, or the missing data. Stephane Dray, also from Lyon, provides 'nipals' here: http://biomserv.univ-lyon1.fr/~dray/software.php There is also an interesting paper. - In case, you use PLS to estimate and impute, set the number of factors as high as reasonably possible, e.g. m-1, when m is the number of variables. best - Hartmut Oldenbürger --- [EMAIL PROTECTED] http://www.wipaed.wiso.uni-goettingen.de/~holdenb1 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing values job
Barry Rowlingson wrote: jim holtman wrote: ?match X [1] 2 6 1 7 4 3 5 Y [1] 1 1 6 4 6 1 4 1 2 3 6 6 1 2 4 4 5 4 1 7 6 6 4 4 7 1 2 match(Y,X) [1] 3 3 2 5 2 3 5 3 1 6 2 2 3 1 5 5 7 5 3 4 2 2 5 5 4 3 1 I quite like this solution: X[X[X[X[X[X[X[X[X[X[X]][Y] [1] 3 3 2 5 2 3 5 3 1 6 2 2 3 1 5 5 7 5 3 4 2 2 5 5 4 3 1 but somehow I don't think its general enough... !! Grin order(X)[Y] is a little more general. Still only works when X is a permutation of 1:N, of course. Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with plotting table
Thank you very much Duncan, that did the works. Thank you also Gavin and Bernardo for your feedback. Best regards, Carlos __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Graphics after invoking R from the command line
On 11/28/2007 12:05 PM, Mithun Jacob wrote: I've tried running graphics commands like plot by invoking R at the command line but the graphics window does not appear. I'm using R-2.6.0 on Windows XP and am using the cmd shell. Here's a sample session: R --slave --save --file=- x-c(1,2,3,4) plot(x,x) This leads to nothing. I've found a way around it, but the graph window is frozen and commands to it have to be sent twice for the data to appear. R --slave --save --file=- x-c(1,2,3,4) windows() plot(x,x) plot(x,x) Am I doing something wrong here? It would be nice if I could display a graphics window which isn't frozen. Do you really need to run R --slave? R is assuming it is running non-interactively, and won't leave any time free to handle events and update the window. If you just used R or Rterm as your command, you'd get an interactive command-line version of R running, and everything should work. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] PCA with NA
Hello, It's on bioconductor. Try changing the repository when installing packages Best Paul -=-=-=-=-=-=-=-=-=-=-=-= Paul Hewson Lecturer in Statistics School of Mathematics and Statistics University of Plymouth Drake Circus Plymouth PL4 8AA tel (01752) 232778 (Campus) tel (01752) 764437 (Tamar Science Park) fax (01752) 232780 email: [EMAIL PROTECTED] web: http://www.plymouth.ac.uk/staff/phewson -=-=-=-=-=-=-=-=-=-=-=-= -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Birgit Lemcke Sent: 28 November 2007 17:05 To: Kevin Wright Cc: R Hilfe Subject: Re: [R] PCA with NA Hello, unfortunately I can not find the pcaMethods package. Birgit Am 26.11.2007 um 16:26 schrieb Kevin Wright: The pcaMethods package offers a collection of different algorithms for PCA, some of which (NIPALS and others) can be used on data that have missing values. Kevin Wright On Nov 24, 2007 4:59 PM, Hartmut Oldenbürger [EMAIL PROTECTED] wrote: Hi Birgit, and All Possibly you should not consider the case completed ;-) There is an important alternative to imputing means, or estimates from first or second order regression (Frane, Psychometrica, BMDP): partial-least-squares (Wold), which uses as much information from the data as possible to estimate the principal components, or the missing data. Stephane Dray, also from Lyon, provides 'nipals' here: http://biomserv.univ-lyon1.fr/~dray/software.php There is also an interesting paper. - In case, you use PLS to estimate and impute, set the number of factors as high as reasonably possible, e.g. m-1, when m is the number of variables. best - Hartmut Oldenbürger --- [EMAIL PROTECTED] http://www.wipaed.wiso.uni-goettingen.de/~holdenb1 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Graphics after invoking R from the command line
On Wed, 28 Nov 2007, Mithun Jacob wrote: I've tried running graphics commands like plot by invoking R at the command line but the graphics window does not appear. I'm using R-2.6.0 on Windows XP and am using the cmd shell. Here's a sample session: R --slave --save --file=- x-c(1,2,3,4) plot(x,x) This leads to nothing. I've found a way around it, but the graph window is frozen and commands to it have to be sent twice for the data to appear. R --slave --save --file=- x-c(1,2,3,4) windows() plot(x,x) plot(x,x) Am I doing something wrong here? It would be nice if I could display a graphics window which isn't frozen. So use R interactively, rather than in batch mode typing at stdin. (Using --file puts you into batch mode.) Only in interactive use does the event loop give time to windows such as the screen device, pagers, data frame viewers I have no idea where you got the idea of 'R --slave --save --file=-' from: the way to use R 'at the command line' on Windows is to use Rterm. 'Rterm --slave --save' would do the same without the freezing, but most people do find prompts useful. -- 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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Graphics after invoking R from the command line
On Wed, 28 Nov 2007, Mithun Jacob wrote: Duncan Murdoch I wish to run R with Visual C++ as a front end. So I was hoping to run a file such as graph.r in the following manner: R --slave --save --file=graph.r But when the plot function runs, it does not display the graph. Prof Brian Ripley: Eh, that's not me you are quoting! So would I be correct to assume that it's not possible to run graphics in batch mode? Running the on-screen device is not intended to be done in batch mode, no. (It would be useless as it would disappear at the end of the computations.) You can pipe to stdin and use --ess to force R to behave interactively. Better, you could use an embedded R via (D)COM or Rserve or otherwise (see `Writing R Extensions'). In future, please consider posing your real problem rather than asking about a solution to an unstated problem that few of us would have contemplated. AND mention 'Windows' in your subject line, as all this is specific to Windows. Thanks for all the help! Regards, Mithun On 11/28/07, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Wed, 28 Nov 2007, Mithun Jacob wrote: I've tried running graphics commands like plot by invoking R at the command line but the graphics window does not appear. I'm using R-2.6.0 on Windows XP and am using the cmd shell. Here's a sample session: R --slave --save --file=- x-c(1,2,3,4) plot(x,x) This leads to nothing. I've found a way around it, but the graph window is frozen and commands to it have to be sent twice for the data to appear. R --slave --save --file=- x-c(1,2,3,4) windows() plot(x,x) plot(x,x) Am I doing something wrong here? It would be nice if I could display a graphics window which isn't frozen. So use R interactively, rather than in batch mode typing at stdin. (Using --file puts you into batch mode.) Only in interactive use does the event loop give time to windows such as the screen device, pagers, data frame viewers I have no idea where you got the idea of 'R --slave --save --file=-' from: the way to use R 'at the command line' on Windows is to use Rterm. 'Rterm --slave --save' would do the same without the freezing, but most people do find prompts useful. -- 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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Graphics after invoking R from the command line
On 11/28/2007 12:52 PM, Mithun Jacob wrote: I wish to run R with Visual C++ as a front end. So I was hoping to run a file such as graph.r in the following manner: R --slave --save --file=graph.r I'd set things up to save the graphics to a file, and get your C++ program to display the file. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to create data frame from data with unequal length
tom soyer wrote: Hi, I have two sets of data that I would like to put into a data frame. But since they have different length, I am not sure how to do this. Here is an example of my data: data set one: date growth 1/1/2007 10 1/2/2007 10.2 1/3/2007 10.4 1/4/2007 10.6 data set two: date growth 1/1/2007 22 1/2/2007 22.5 1/4/2007 22.4 I would like to combine the two data sets and create a data frame like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/3/2007 10.4 NA 1/4/2007 10.6 22.4 Or skipping the missing data point all together, like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/4/2007 10.6 22.4 Right now I am doing this by hand, and it is really time consuming. I am wondering if there is an easier way of creating data frames from unequal length data using existing R functions. Is there a way to create data with equal length based on the date column? I would appreciate any help from the group. Thanks, I'd have a look at merge() if I were you. -- 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ggplot2 melt function value
Hi:I recently started using the melt function and found that it is very useful and powerful,however I can't seem to find the way to change the default column header value to my custom column name. Does anyone know how to go about this? any suggestions are very appreciated. Thanks Felipe D. Carrillo Fishery Biologist US Fish Wildlife Service California, USA Never miss a thing. Make Yahoo your home page. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to create data frame from data with unequal length
Hi, I have two sets of data that I would like to put into a data frame. But since they have different length, I am not sure how to do this. Here is an example of my data: data set one: date growth 1/1/2007 10 1/2/2007 10.2 1/3/2007 10.4 1/4/2007 10.6 data set two: date growth 1/1/2007 22 1/2/2007 22.5 1/4/2007 22.4 I would like to combine the two data sets and create a data frame like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/3/2007 10.4 NA 1/4/2007 10.6 22.4 Or skipping the missing data point all together, like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/4/2007 10.6 22.4 Right now I am doing this by hand, and it is really time consuming. I am wondering if there is an easier way of creating data frames from unequal length data using existing R functions. Is there a way to create data with equal length based on the date column? I would appreciate any help from the group. Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to create data frame from data with unequal length
Merge worked! Thanks!!! On 11/28/07, Matthew Keller [EMAIL PROTECTED] wrote: Tom, Check out ?merge. Does exactly what you need Matt On Nov 28, 2007 11:27 AM, tom soyer [EMAIL PROTECTED] wrote: Hi, I have two sets of data that I would like to put into a data frame. But since they have different length, I am not sure how to do this. Here is an example of my data: data set one: date growth 1/1/2007 10 1/2/2007 10.2 1/3/2007 10.4 1/4/2007 10.6 data set two: date growth 1/1/2007 22 1/2/2007 22.5 1/4/2007 22.4 I would like to combine the two data sets and create a data frame like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/3/2007 10.4 NA 1/4/2007 10.6 22.4 Or skipping the missing data point all together, like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/4/2007 10.6 22.4 Right now I am doing this by hand, and it is really time consuming. I am wondering if there is an easier way of creating data frames from unequal length data using existing R functions. Is there a way to create data with equal length based on the date column? I would appreciate any help from the group. Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthew C Keller Asst. Professor of Psychology University of Colorado at Boulder www.matthewckeller.com -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to create data frame from data with unequal length
Try this: merge(df1, df2, by.y=1, by.x=1, all=T) merge(df1, df2, by.y=1, by.x=1) On 28/11/2007, tom soyer [EMAIL PROTECTED] wrote: Hi, I have two sets of data that I would like to put into a data frame. But since they have different length, I am not sure how to do this. Here is an example of my data: data set one: date growth 1/1/2007 10 1/2/2007 10.2 1/3/2007 10.4 1/4/2007 10.6 data set two: date growth 1/1/2007 22 1/2/2007 22.5 1/4/2007 22.4 I would like to combine the two data sets and create a data frame like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/3/2007 10.4 NA 1/4/2007 10.6 22.4 Or skipping the missing data point all together, like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/4/2007 10.6 22.4 Right now I am doing this by hand, and it is really time consuming. I am wondering if there is an easier way of creating data frames from unequal length data using existing R functions. Is there a way to create data with equal length based on the date column? I would appreciate any help from the group. Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to create data frame from data with unequal length
Tom, Check out ?merge. Does exactly what you need Matt On Nov 28, 2007 11:27 AM, tom soyer [EMAIL PROTECTED] wrote: Hi, I have two sets of data that I would like to put into a data frame. But since they have different length, I am not sure how to do this. Here is an example of my data: data set one: date growth 1/1/2007 10 1/2/2007 10.2 1/3/2007 10.4 1/4/2007 10.6 data set two: date growth 1/1/2007 22 1/2/2007 22.5 1/4/2007 22.4 I would like to combine the two data sets and create a data frame like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/3/2007 10.4 NA 1/4/2007 10.6 22.4 Or skipping the missing data point all together, like this: date growthAgrowthB 1/1/2007 1022 1/2/2007 10.2 22.5 1/4/2007 10.6 22.4 Right now I am doing this by hand, and it is really time consuming. I am wondering if there is an easier way of creating data frames from unequal length data using existing R functions. Is there a way to create data with equal length based on the date column? I would appreciate any help from the group. Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthew C Keller Asst. Professor of Psychology University of Colorado at Boulder www.matthewckeller.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can't make affylmGUI work
Feifei -- Ask on the Bioconductor mailing list http://bioconductor.org. Update your Bioc packages following instructions on the 'install - how to' page linked from the main bioconductor page -- your affy is out of date. Best, Martin Feifei [EMAIL PROTECTED] writes: Hi, Can anyone help me of the affylmGUI package, I can't get it work and searched for google but can't find any proper solutions. I get the error information each time when I load my cells files, which are shown in the following links. - http://clarezoe.googlepages.com/1.png http://clarezoe.googlepages.com/2.png http://clarezoe.googlepages.com/3.png - Errors also show in the terminal as below, - Error: no function to return from, jumping to top level In addition: Warning messages: 1: read.phenoData is deprecated, use read.AnnotatedDataFrame instead 2: The phenoData class is deprecated, use AnnotatedDataFrame (with ExpressionSet) instead Error in exprs(RawAffyData) : no function to return from, jumping to top level -- I'm running R version 2.6.1 under Linux Ubuntu 7.10 -- My sessionInfo is shown below, -- sessionInfo() R version 2.6.1 (2007-11-26) i486-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] tools tcltk stats graphics grDevices utils datasets [8] methods base other attached packages: [1] affylmGUI_1.12.0 affy_1.12.2 affyio_1.6.1 Biobase_1.16.1 [5] limma_2.12.0 loaded via a namespace (and not attached): [1] rcompgen_0.1-17 Can anyone help me with that? I really need it to work ASAP. Thanks a lot! Sincerely Feifei __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] visualizing nucleotide sequence properties
Hi there, I am looking for R-packages that can help me visualize properties on nucleotide sequences. I want to display sequences in the 1-100K base range as lines and plot features above and below those lines. Any ideas would be welcome. Thanks, Bernd Hi Bernd, not sure to understand what you mean by properties. Let's say the property you are interested in is the GC-skew. You can try something along these lines: # # Load DNA sequence data: # library(seqinr) myseq - read.fasta(as.string = TRUE) # # Define a function to compute the GC skew: # gcskew - function(x) { if (!is.character(x) || length(x) 1) stop(single string expected) tmp - tolower(s2c(x)) nC - sum(tmp == c) nG - sum(tmp == g) if (nC + nG == 0) return(NA) return(100 * (nC - nG)/(nC + nG)) } # # Moving window along the sequence: # step - 1 wsize - 1 starts - seq(from = 1, to = nchar(myseq), by = step) starts - starts[-length(starts)] n - length(starts) result - numeric(n) for (i in seq_len(n)) { result[i] - gcskew(substr(myseq, starts[i], starts[i] + wsize - 1)) } # # Plot the result: # xx - starts/1000 # in Kbp yy - result n - length(result) hline - 0 plot(yy ~ xx, type = n, axes = FALSE, ann = FALSE) polygon(c(xx[1], xx, xx[n]), c(min(yy), yy, min(yy)), col = black, border = NA) usr - par(usr) rect(usr[1], usr[3], usr[2], hline, col = white, border = NA) lines(xx, yy) abline(h = hline) box() axis(1, at = seq(0, 1000, by = 200)) axis(2, las = 1) title(xlab = position (Kbp), ylab = (C-G)/(C+G) [percent], main = expression(paste(GC skew in , italic(Chlamydia~trachomatis arrows(800, 5.5, 720, 0.5, length = 0.1, lwd = 2) text(800, 5.5, origin of\nreplication, pos = 4) HTH, Jean -- Jean R. Lobry([EMAIL PROTECTED]) Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I, 43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE allo : +33 472 43 27 56 fax: +33 472 43 13 88 http://pbil.univ-lyon1.fr/members/lobry/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rmpi : openmpi and mpi.spawn.Rslaves
Hello, I'm using R on a 10 blade dual quad core Rocks Cluster, and trying to use Rpmi and snow. I basically wondered if at the moment I ought to install Rmpi against another form of mpi (not openmpi) and wondered whether anyone could pass on any experience. I'm mainly worried about (a) the R server taking up 100% cpu time (I think this is a known issue with Rmpi and openmpi) and (b) checking that my slaves are running on separate nodes rather than all piling onto the same nodes (on the server). Some very crude experiments in snow imply that slave processes might well be getting passed on to separate nodes beyond the server. However, it's a little harder convincing myself which nodes are doing what. When looking directly in Rmpi, lamhosts() reports all the hosts correctly, unfortunately mpi.universe.size reports 1 node (I think this is as documented). More importantly, I have the issue with mpi.spawn.Rslaves() freezing. This has been mentioned before: http://tolstoy.newcastle.edu.au/R/e2/help/07/06/18573.html I wondered if anyone would mind supplying pointers. I'm specifically wondering if I need to check the version of openmpi, and whether at the moment it would be better to use another flavour of mpi. I would be extremely grateful for any advice. Thanks Paul -=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Paul Hewson Lecturer in Statistics University of Plymouth Drake Circus Plymouth PL4 8AA tel ++44(0)1752 232778 email [EMAIL PROTECTED] web http://www.plymouth.ac.uk/staff/phewson __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem using Tobit models in R (Testing and controlling for distributional assumptions and endogeneity)
Dear R-Community, I am currently using Tobit models (survreg in the survival package). 1a) Does R provide a straight-forward way to test distributional assumptions for tobit models? 1b) If not: I tried to apply the Hausman-test proposed in Newey (1987), Journal of Econometrics, on the Tobit estimator and the symmetrically censored least squares estimator proposed by Powell (1986) (quantreg package). Unfortunately, quantreg only provides covariance matrices based on the bootstrap which are not positive semi-definite, therefore the hausman test statistic based on the difference between both covariance matrices can be negative. Newey proposes 2 ways to calculate positive semi-definite covariance matrices: Is there a way to implement any of these without manually coding (or adapting) the tobit and SCLS estimation procedures to extract the necessary information needed for the estimation (first derivative of loglik w.r.t. theta, etc.)? 2) I apply the test for endogeneity proposed by Smith and Blundell (1986), Econometrica, and one of my variables turns out to be endogenous. Does R have a package for simultaneous equations with censored dependent variables? As far as I know, the sem package does estimate these types of equations. Thanks in advance Malte __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] voronoi/Delaunay/Dirichlet tessellation on sphere in R or S?
Hi Jan, In case you don't know it already, the reference book for Voronoi diagrams and co. is : Spatial Tessellations: Concepts and Applications of Voronoi Diagrams by Okabe et al. (Ed. Wiley). It's a bit old now ... but it's 'a' good reference. HTH, Best regards, François - Original Message - From: Galkowski, Jan [EMAIL PROTECTED] To: r-help@r-project.org Sent: Tuesday, November 27, 2007 5:51 PM Subject: [R] voronoi/Delaunay/Dirichlet tessellation on sphere in R or S? There's Renka's STRIPACK, and TRIPACK, respectively, ACM TOMS Algorithms 772 and 751, and there's the R package deldir which does the Delaunay for a plane, but does anyone have or know of the tessellation in R for a sphere? Also, is there a standard indexing scheme for Delaunay facets, and perhaps of edges in such facets? I'd expect that to be a publication reference, or even textbook. TIA, - Jan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem using Tobit models in R (Testing and controlling for distributional assumptions and endogeneity)
url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox: 217-333-4558University of Illinois fax: 217-244-6678Champaign, IL 61820 On Nov 28, 2007, at 2:45 PM, Malte Brockmann wrote: Dear R-Community, I am currently using Tobit models (survreg in the survival package). 1a) Does R provide a straight-forward way to test distributional assumptions for tobit models? 1b) If not: I tried to apply the Hausman-test proposed in Newey (1987), Journal of Econometrics, on the Tobit estimator and the symmetrically censored least squares estimator proposed by Powell (1986) (quantreg package). This symmetrically censored least squares estimator is NOT what is computed by the quantreg package. What is computed is the Powell quantile regression estimator. Unfortunately, quantreg only provides covariance matrices based on the bootstrap which are not positive semi-definite, The bootstrapped covariance provided by quantreg is the usual sample covariance matrix of the bootstrapped realizations and is therefore necessarily positive semi-definite. Perhaps what you meant to say was that the difference between the two covariance matrices that you have computed was not psd; this could easily happen. Nothing ensures that the Powell QR estimate is less efficient than the usual (normal theory) tobit estimator, indeed there are very plausible conditions under which this is not the case. therefore the hausman test statistic based on the difference between both covariance matrices can be negative. Newey proposes 2 ways to calculate positive semi-definite covariance matrices: Is there a way to implement any of these without manually coding (or adapting) the tobit and SCLS estimation procedures to extract the necessary information needed for the estimation (first derivative of loglik w.r.t. theta, etc.)? 2) I apply the test for endogeneity proposed by Smith and Blundell (1986), Econometrica, and one of my variables turns out to be endogenous. Does R have a package for simultaneous equations with censored dependent variables? As far as I know, the sem package does estimate these types of equations. Thanks in advance Malte __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Dates in R
Hi, I have dates in the following format: 4/8/2006 (MM/DD/). I need to have R compare date A to date B to figure out which one is more recent. Is there a way to do that? Simply using the '' or '' signs doesn't seem to work. I think in this case R treats '/' as a division sign and gives me erroneous results. Thanks a lot for your help. Irina Never miss a thing. Make Yahoo your home page. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Power Spectral Sensity
I am working with a dissolved oxygen dataset. continuous readings are taken at 15 minute intervals and we have been recording these data at 12 stations along the savannah river for two years now. The longest set of readings that are continuous without interuption is 53 days. I would like to look at the power spectral density at each of these sites (most likely one day will be the overridding trend due to photosynthesis and respiration). I would also like to look at the cross spectrums between to contiguous site to look for advective transport from the upstream sections.I have used spectrum to get a periodogram. This I don't believe is the power spectral density. If it is I am unsure how to determine the # in the span argument to smooth the periodogram. I imagine that I am overlooking something- I appreciate all of your help. stephen -- Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Dates in R
Convert to Date and then compare; x - as.Date(4/8/2006, %m/%d/%Y) y - as.Date(5/10/2007, %m/%d/%Y) xy [1] FALSE On Nov 28, 2007 2:44 PM, Irina Burmenko [EMAIL PROTECTED] wrote: Hi, I have dates in the following format: 4/8/2006 (MM/DD/). I need to have R compare date A to date B to figure out which one is more recent. Is there a way to do that? Simply using the '' or '' signs doesn't seem to work. I think in this case R treats '/' as a division sign and gives me erroneous results. Thanks a lot for your help. Irina Never miss a thing. Make Yahoo your home page. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Heatmap or Heatmap.2---hclust
Hi list, I used heatmap() and heatmap.2() to draw the dendrogram and got error messages for both. They were: heatmap(as.matrix(y3),col=rainbow(256),scale = column);dev.off(); Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) Does anybody know how to correct this? I do see some NAs in the dataset. Thanks a lot! Allen [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ftable as latex (with Hmisc?)
I think this does what you are asking for. It should be relatively easy to write a method latex.ftable() based on this. One or two row.vars and one or two col.vars should be straightforward (with n.rgroup and n.cgroup used for the second row and column). Rich start here df = data.frame(drug=sample(c(P,V),100,TRUE), Hist1=sample(c(Pos,Neg),100,TRUE), Hist2=sample(c(Pos,Neg),100,TRUE)) ft.df - ftable(drug~Hist1+Hist2,data=df) str(ft.df) tmp - unclass(ft.df)[,] dimnames(tmp) - list(rep(attr(ft.df, row.vars)[[2]], 2), attr(ft.df, col.vars)[[1]]) ft.latex - latex(tmp, rgroup=attr(ft.df, row.vars)[[1]], n.rgroup=c(2,2), cgroup=names(attr(ft.df, col.vars))[1]) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Dates in R
Irina, you must have them in character format. You need to convert to Date type. mydates = as.Date(mydates, %m/%d/%Y) HTH. Horace -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Irina Burmenko Sent: Wednesday, November 28, 2007 11:44 AM To: Horace Tso; r-help@r-project.org Subject: [R] Dates in R Hi, I have dates in the following format: 4/8/2006 (MM/DD/). I need to have R compare date A to date B to figure out which one is more recent. Is there a way to do that? Simply using the '' or '' signs doesn't seem to work. I think in this case R treats '/' as a division sign and gives me erroneous results. Thanks a lot for your help. Irina Never miss a thing. Make Yahoo your home page. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] trouble for building R package in Windows
Dear All, I think I have followed everything for building my first R package (Downloading Rtools, necessary files in necessary locations, no space in path and...). But when in command Prompt I write Rcmd check mypackage the first few steps are OK but then it gives the following error: checking whether package roots can be installed.ERROR installation failed see roots.Rcheck/00install.out for details and this is the contents of the file: installing R.css in c:/removethis/R/R2.6.1/bin/roots.Rcheck -- Making package roots adding build stamp to DESCRIPTION making DLL ... making fifrt.d from fifrt.c gcc-sjlj -std=gnu99 -Ic:/removethis/R/R2.6.1/include -O3 -Wall -c fifrt.c -o fifrt.o windres --preprocessor=gcc-sjlj -E -xc -DRC_INVOKED -I c:/removethis/R/R2.6.1/include -i roots_res.rc -o roots_res.o gcc-sjlj -std=gnu99 -shared -s -o roots.dll roots.def fifrt.o roots_res.o -Lc:/removethis/R/R2.6.1/bin-lR ... DLL made installing DLL installing R files installing man source files rm: failed to get attributes of `/': No such file or directory make[2]: *** [c:/removethis/R/R2.6.1/bin/roots.Rcheck/roots/man/roots.Rd.gz] Error 1 make[1]: *** [all] Error 2 make: *** [pkg-roots] Error 2 *** Installation of roots failed *** Removing 'c:/removethis/R/R2.6.1/bin/roots.Rcheck/roots' I appreciate any suggestion. Thank you, Amin Zollanvari Genomic Signal Processing Lab. Texas AM University, College Station, Texas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Designs with many periods
Dear R-helpers, Jones Kenward (2003)¶ discuss balanced designs with many periods (p). It is my impression the algorithmic design packages (AlgDesign, crossdes, conf.design) in R do not handle cases in which the number of treatments (t) is p. Am I mistaken? To be concrete: I am designing an experiment with t = 12 in a factorial design (3x4) with p = [12,18] (we have our subjects for an hour, which allows us about 18 blocks). We can run in the ballpark of 30 subjects. Pointers welcome. ___ ¶ @BOOK{JonesKenward2003, title = {Design and analysis of cross-over trial}, publisher = {Chapman \ Hall/CRC}, year = {2003}, address = {Boca Raton, FL, USA}, edition = {2nd}, author = {Byron Jones and Michael G. Kenward} } _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] boxplot with datapoint
Hi, I'm using boxplot in R to show box-whiskers plots for about 15 categories of data. I'd like to display ALL of the data points--not just the outliers. Does anyone know if there's a parameter setting that will accomplish this with boxplot? Other options would be to overlay the plotted points on top of the boxes? Thanks a lot! Yupu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Power model in R
Dear all, How can I fit a power model in R. Thanks in advance, miltinho para armazenamento! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to read in a txt file with some blanks
Hi list, Is there a way to read in a txt file with some blanks? The ideal way could be to replace blanks with NAs. Thanks a lot! Allen [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Power model in R
Dear all, How can I fit a power model in R. Thanks in advance, miltinho para armazenamento! [[alternative HTML version deleted]] Try the approach below with the lognormal distribution for the data. The data is real. Rubén y-c(2841,1151,1579,1491,1306,2294,1781,1472,2709,1845,1882,2113,3683,2852,794,1965,3417,4478,3523, 2414,2769,5216,3590,4057,2770,3171,3208,6265,4411,2319,3044,1771,3472,4394,3169,4225,4934,3916,4120, 5168,4461,5980,5670,5806,5479,3644,5529,5011,7826,3964,6942,4285,4301,4696,4288,4921,7138, 9881,5025,5181,7110,5413,8279,7803,4652,5114,3127,5798,4048,7459,4741,5798,6738,3562,6235,8015, 5140,5852,4634,5006,5937,5014,9608,2134,7649,7649,6634,5028,5943,4732,7782,7035,8147,6583,5085, 5743,10932,6935,5716,5716,5839,6356,10398,9709,11937,5955,9385,17764,15560,13834,20396,20961) x-c(8.0,8.5,8.5,9.0,9.0,9.0,10.0,10.8,11.0,11.0,11.2,11.5,11.5,11.5,11.6,12.0,12.0,12.0,12.0,12.5,12.5,12.6, 12.8,12.8,12.9,13.0,13.0,13.5,13.5,13.5,13.7,14.0,14.0,14.0,14.0,14.2,14.5,14.5,14.5,14.8,15.0,15.0,15.5,15.5, 15.5,15.5,15.9,16.0,16.0,16.0,16.0,16.0,16.0,16.5,16.5,16.5,16.5,16.5,16.5,16.5,16.5,16.5,16.5,16.5,16.6,17.0, 17.0,17.0,17.0,17.0,17.0,17.0,17.0,17.5,17.5,17.5,17.5,17.5,17.5,17.5,17.7,18.0,18.0,18.0,18.0,18.0,18.0,18.0, 18.0,18.5,18.5,19.0,19.0,19.0,19.0,19.0,19.5,19.5,19.5,19.5,19.5,19.5,20.0,20.5,21.0,22.0,24.5,26.5,26.5,26.8, 28.0,30.0) f1=2 #starting value for parameter f0=20 #starting value for parameter y.mod-f0*(x)^f1 plot(x,y) lines(x,y.mod) fn-function(p){ y.mod-p[1]*x^p[2]; squdiff-(log(y)-log(y.mod))^2; lik=(length(y)/2)*log(sum(squdiff)/length(y)) #lognormal } y.lik-nlm(fn,p=c(20,2),hessian=TRUE) y.lik f0-y.lik$estimate[1] f1-y.lik$estimate[2] covmat-solve(y.lik$hessian) #estimated covariance matrix covmat sef0-sqrt(covmat[1,1]) #standard error sef1-sqrt(covmat[2,2]) #standard error covf0f1-covmat[1,2] sef0 sef1 y.fit-f0*x^f1 plot(x,y,pch=19,xlab=,ylab=) lines(x,y.fit,lwd=par(3)) text(x=10,y=2,expression(paste(y=,19.9*x^1.98))) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to read in a txt file with some blanks
If the data is fixed field, then read.fwf. Else blanks are normally allowed delimiters. How do you want to interprete blanks? There are number of ways, none of which you have specified. On Nov 28, 2007 6:46 PM, affy snp [EMAIL PROTECTED] wrote: Hi list, Is there a way to read in a txt file with some blanks? The ideal way could be to replace blanks with NAs. Thanks a lot! Allen [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Survreg(), Surv() and interval-censored data
Can anybody give me a neat example of interval censored data analysis codes in R? Given that suvreg(Surv(c(1,1,NA,3),c(2,NA,2,3),type=interval2)~1) works why does survreg(Surv(data[,1],data[,2],type=interval2)~1) not work where data is : T.1 T.2 Status 1 0.000 0.62873036 1 2 0.000 2.07039068 1 3 0.000 1.40297214 1 4 0.000 0.09112871 1 5 0.000 0.75115280 1 6 0.000 2.36476839 1 7 0.000 2.47483937 1 8 0.000 1.16913097 1 9 0.000 0.21498251 1 10 0.000 1.89557501 1 11 0.9286723 1.09883334 1 12 0.3428920 1.16436088 1 13 0.5924055 2.20572832 1 14 0.7985962 1.73894982 1 15 1.7493239 999. 0 16 0.8653470 999. 0 17 0.6917203 999. 0 18 1.1452119 999. 0 19 2.2587688 999. 0 20 0.7854710 999. 0 21 1.5986105 999. 0 22 2.2189803 999. 0 23 0.7905505 999. 0 24 1.3111472 999. 0 25 2.3394220 999. 0 26 1.3667469 999. 0 27 0.3094596 999. 0 28 1.6855216 999. 0 29 1.7934033 999. 0 Thanks in advance. Ehsan Re: [R] Survreg(), Surv() and interval-censored data This message: [ Message body ] [ More options ] Related messages: [ Next message ] [ Previous message ] [ In reply to ] [ Re: [R] Survreg(), Surv() and interval-censored data ] From: Thomas Lumley tlumley_at_u.washington.edu Date: Thu 16 Feb 2006 - 07:58:26 EST On Mon, 13 Feb 2006, Stephen Richards wrote: Can survreg() handle interval-censored data like the documentation says? I ask because the command: survreg(Surv(start, stop, event) ~ 1, data = heart) fails with the error message Invalid survival type yet the documentation for Surv() states: Presently, the only methods allowing interval censored data are the parametric models computed by 'survreg' Any pointers as to what I'm missing? You are specifying left-truncated, right-censored data, not interval-censored. You need the type= argument, eg Surv(c(1,1,NA,3),c(2,NA,2,3),type=interval2) [1] [1, 2] 1+ 2- 3 specifies interval censoring at [1,2], right-censoring at 1, left-censoring at 2, and an observed event at 3. -thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] convert an S plus file to R?
hi! i send again my question because there was a problem earlier that someone did not see my attached file. If you really can't download it, this is the attached file. Please help me how to convert this S plus file to R. Is there a quick method to do it? I don't have an S plus installer here. --- # Computes a possible choice for the optimal k value # of the Hill estimator by minimizing estimates of # the asumptotic mean squared error (Section 4.7ii) # # Estimates can be based on the estimates of the second # order parameters gamma, b and beta obtained with the # function Hill.2oQV # # If addtoHill=TRUE then the optimal k value is added to # the plot of the Hill estimates (given the plot is available) # # If plot=TRUE then the estimates of the AMSE are plotted # as a function of k and the optimal k value is added to it Hill.AMSE.kopt - function(Hill.2oQV, addtoHill=FALSE, plot=FALSE, ...) { K - Hill.2oQV$k gamma - Hill.2oQV$gamma b - Hill.2oQV$b beta - Hill.2oQV$beta AMSE.Hill - (gamma^2)/K + (b/(1+beta))^2 AMSE.Hill.min - min(AMSE.Hill, na.rm = T) kopt - K[AMSE.Hill==AMSE.Hill.min] ### plots if TRUE if ( addtoHill ) { ### add optimal k value to Hill-plot abline(v=kopt,lty=3,col=4) } if ( plot ){ ### plot estimates of AMSE as function of k plot(K, AMSE.Hill, type=l, ylab=AMSE gamma, xlab=k, main=AMSE estimates of extreme value index, ...) abline(v=kopt,lty=3,col=4) } ### output list with values of k, corresponding ### estimates of AMSE Hill and optimal k value kopt list(K=K, AMSE.Hill=AMSE.Hill, kopt=kopt) } Thanks for the help. Filame - __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help!!!
Hi, I want to ask a question about expression for object. In the example parts, I saw trig.exp - expression(sin(cos(x + y^2))) D(trig.exp, c(x, y)) Now, I want to define a complex function in expression, for example, f1(x)=... f2(y)=.. final f=f2(f1(x)+4) may I define such expression with many statements? thanks. regards, wei -- Wei Guo Department of Statistics The Ohio State University Columbus, Ohio 43210 Tel: 001-614-292-4713(o) e-mail: [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] boxplot with datapoint
On Nov 28, 2007, at 5:59 PM, Yupu Liang wrote: Hi, I'm using boxplot in R to show box-whiskers plots for about 15 categories of data. I'd like to display ALL of the data points--not just the outliers. Does anyone know if there's a parameter setting that will accomplish this with boxplot? Other options would be to overlay the plotted points on top of the boxes? I think you will want to overlay the points. E.g.: x-rnorm(30) y-factor(rep(4:6,10), labels=LETTERS[1:3]) boxplot(x~y) points(y,x) Thanks a lot! Yupu Haris Skiadas Department of Mathematics and Computer Science Hanover College __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] convert an S plus file to R?
Hi, The function you show below performs relatively simple S language stuff, and looks as if it will run as is in R. Looks like you'll need an output object Hill.2oQV (I'm guessing from a function of the same name). That Hill.2oQV() function may need some work, but the Hill.AMSE.kopt() function below should work as is. Best Steve McKinney -Original Message- From: [EMAIL PROTECTED] on behalf of filame uyaco Sent: Wed 11/28/2007 6:51 PM To: [EMAIL PROTECTED] Subject: [R] convert an S plus file to R? hi! i send again my question because there was a problem earlier that someone did not see my attached file. If you really can't download it, this is the attached file. Please help me how to convert this S plus file to R. Is there a quick method to do it? I don't have an S plus installer here. --- # Computes a possible choice for the optimal k value # of the Hill estimator by minimizing estimates of # the asumptotic mean squared error (Section 4.7ii) # # Estimates can be based on the estimates of the second # order parameters gamma, b and beta obtained with the # function Hill.2oQV # # If addtoHill=TRUE then the optimal k value is added to # the plot of the Hill estimates (given the plot is available) # # If plot=TRUE then the estimates of the AMSE are plotted # as a function of k and the optimal k value is added to it Hill.AMSE.kopt - function(Hill.2oQV, addtoHill=FALSE, plot=FALSE, ...) { K - Hill.2oQV$k gamma - Hill.2oQV$gamma b - Hill.2oQV$b beta - Hill.2oQV$beta AMSE.Hill - (gamma^2)/K + (b/(1+beta))^2 AMSE.Hill.min - min(AMSE.Hill, na.rm = T) kopt - K[AMSE.Hill==AMSE.Hill.min] ### plots if TRUE if ( addtoHill ) { ### add optimal k value to Hill-plot abline(v=kopt,lty=3,col=4) } if ( plot ){ ### plot estimates of AMSE as function of k plot(K, AMSE.Hill, type=l, ylab=AMSE gamma, xlab=k, main=AMSE estimates of extreme value index, ...) abline(v=kopt,lty=3,col=4) } ### output list with values of k, corresponding ### estimates of AMSE Hill and optimal k value kopt list(K=K, AMSE.Hill=AMSE.Hill, kopt=kopt) } Thanks for the help. Filame __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to read in a txt file with some blanks
The question is what do the 'blanks' mean? I assume that they are separating the variables since that is the default for read.table. So what is the difference between: 1) 1 2 one blank 2) 1 2 two blanks 3) 1 2 three blanks 4) How are these different conditions supposed to be interpreted? Now you replace the blanks with commas and that might do it for you. This would mean that 1 2 (which would be two variables where there are 2 blanks) would now be 1,,2 which would be three variables. So you need to define what is supposed to happen in these cases. On Nov 28, 2007 8:21 PM, affy snp [EMAIL PROTECTED] wrote: Hi Jim, Thanks a lot! I would like the blanks to be read as NAs. I tried cgh-read.table(file= WM115A.txt,header = TRUE,fill = TRUE,na.strings = NA) but the blanks were just filled by their flanking columns. Best, Allen On Nov 28, 2007 7:42 PM, jim holtman [EMAIL PROTECTED] wrote: If the data is fixed field, then read.fwf. Else blanks are normally allowed delimiters. How do you want to interprete blanks? There are number of ways, none of which you have specified. On Nov 28, 2007 6:46 PM, affy snp [EMAIL PROTECTED] wrote: Hi list, Is there a way to read in a txt file with some blanks? The ideal way could be to replace blanks with NAs. Thanks a lot! Allen [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to read in a txt file with some blanks
Hi Jim, Thanks a lot! I would like the blanks to be read as NAs. I tried cgh-read.table(file=WM115A.txt,header = TRUE,fill = TRUE,na.strings = NA) but the blanks were just filled by their flanking columns. Best, Allen On Nov 28, 2007 7:42 PM, jim holtman [EMAIL PROTECTED] wrote: If the data is fixed field, then read.fwf. Else blanks are normally allowed delimiters. How do you want to interprete blanks? There are number of ways, none of which you have specified. On Nov 28, 2007 6:46 PM, affy snp [EMAIL PROTECTED] wrote: Hi list, Is there a way to read in a txt file with some blanks? The ideal way could be to replace blanks with NAs. Thanks a lot! Allen [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to find and use specific column after spliting dataframe
Dear Dallazuanna: Thanks for your reply. It really has solved my problems. However, I have another question. How can I do, if I need to calculate such equation in all sub-dataframe? I try to use A.split[] to catch all sub-dataframe, but it seems can not catch the columns of all sub-dataframe. In other words, if the dataframe can split into 2 sub-dataframe, I need calculate the equation in these 2 sub-dataframe. x-rep(c(1.2,6.8),4) y-rep(c(1, 2),4) z-rep(c(1,2),4) t-rep(c(0,1,2,3),length.out=8) c-rep(c(0,0.5,1,2),length.out=8) df-data.frame(pH=x, formulation=y, subject=z, time=t, concentration=c) A.split-split(df, list(df$pH ,df$formulation, df$subject) ) A.split [] Best regards, Hsin-Ya Lee Henrique Dallazuanna wrote: Try this: A.split[[1]][time] A.split[[1]][[concentration]] test - NULL for(i in 2:4){ test[i] - (A.split[[1]][[time]][i] - A.split[[1]][[time]][i-1]) * (A.split[[1]][[concentration]][i] - A.split[[1]][[concentration]][i-1]) * 0.5 } On 28/11/2007, leeznar [EMAIL PROTECTED] wrote: Dear all: I am a new R-user and I have 2 questions about it. 1) I need to find specific sub-dataframe, and then use specific column to calculate. For example, after splitting dataframe, I find specific the sub-dataframe, such as A.split [1]. But, I don't know how to find time and concentration columns of A.split [1]. 2) The equation used to sub-dataframe is (time[i]-time[i-1])*(concentration[i]- concentration[i-1])*1/2. I don't know how to calculate it. How can I find the specific column and use it to calculate ? x-rep(c(1.2,6.8),4) y-rep(c(1, 2),4) z-rep(c(1,2),4) t-rep(c(0,1,2,3),length.out=8) c-rep(c(0,0.5,1,2),length.out=8) df-data.frame(pH=x, formulation=y, subject=z, time=t, concentration=c) A.split-split(df, list(df$pH ,df$formulation, df$subject) ) A.split [1] Best regards, Hsin-Ya Lee __ [EMAIL PROTECTED] http://tw.promo.yahoo.com/antispam/index.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paran¨¢-Brasil 25¡ã 25' 40 S 49¡ã 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/how-to-find-and-use-specific-column-after-spliting-dataframe-tf4886948.html#a14019176 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.