Don't use the names of R functions as variable names (was [R] what does this multinom (actually model.frame) error mean?)
Note that is a *model.frame* error, not a multinom one. Don't use the names of R functions as variable names! I am sure that is in the introductory documentation, and it is certainly stressed in my books. Although I cannot be sure it seems very likely (perhaps because of the scoping induced by namespaces) that your `rep' is being matched to the function. On Thu, 13 Nov 2003, Paul E. Johnson wrote: I have RedHat linux 9 with R 1.8. I'm estimating models with multinom with a dependent variable that has 3 different values. Sometimes the models run fine and I can understand the results. Sometimes when I put in another variable, I see an indication that the estimation did work, but then I can't get the summary method to work. It's like this: votemn1 - multinom(vote~V023022+rep+V023027+ V023131,data=nes2002) # weights: 18 (10 variable) initial value 914.045424 iter 10 value 474.831205 iter 20 value 449.612637 iter 20 value 449.612636 iter 20 value 449.612636 final value 449.612636 converged summary(votemn1) Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : invalid variable type In this model, rep is a dichotomous (0,1) variable indicating if a person is a republican or not. If I drop that variable, the model does run and the summary method produces estimates standard errors. votemn2 - multinom(vote~V023022+V023027+ V023131,data=nes2002) # weights: 15 (8 variable) initial value 917.341261 iter 10 value 529.137064 final value 527.178682 converged summary(votemn2) Call: multinom(formula = vote ~ V023022 + V023027 + V023131, data = nes2002) Coefficients: (Intercept)V023022V023027 V023131 3 -2.2033403 0.9227144 -0.3835378 0.017960208 5 -0.8411559 -0.1853416 -0.2174085 0.005808468 Std. Errors: (Intercept)V023022 V023027V023131 3 0.5883961 0.07054401 0.0894393 0.05655965 5 1.2438595 0.14582161 0.1963035 0.12453307 Residual Deviance: 1054.357 AIC: 1070.357 ... -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Plotting lm() attributes
On Wed, 12 Nov 2003, Tony Plate wrote: I believe this is the sort of things that the functions resid() and predict(), in conjunction with na.exclude, are designed for. E.g.: data - data.frame(x=c(1:5), y=c(1,3,2,NA,4)) m - lm(y~x, data=data, na.action=na.exclude) predict(m) 12345 1.40 2.028571 2.657143 NA 3.914286 resid(m) 1 2 3 4 5 -0.4000 0.97142857 -0.65714286 NA 0.08571429 Note that NA's are not reintroduced if na.action=na.omit, which is the default (unless you have options(na.action) set otherwise). Also, note that this technique produces a NA fitted value where a non-NA one could be produced (use predict(m, newdata=data) to get those values.) More accurately, where a non-NA prediction could be produced. There never was a fitted value for those cases, so NA is correct. That predict gives what people expect with NA values is a new feature in 1.8.0. And please, please, folks use the extractor functions and not the components (NOT attributes) directly. hope this helps, Tony Plate At Thursday 11:40 AM 11/13/2003 +1300, Murray Jorgensen wrote: Suppose you fit a linear model model.1 ~ lm(v1 ~ ..., data=myframe) and v2 is some other column of myframe typically not in the model. You will often want to try plot(v2, model.1$residuals) but this will fail if there are NAs in the response v1 as model.1$residuals has length equal to the number of nonmissing values in v1. I suppose plot(v2[!is.na(v1)], model.1$residuals) does the job, but it seems irritating that model.1$residuals, does not have length agreeing with the number of rows in the data frame. It would be even more irritating for model.1$fitted.values, where the removed elements would often have nonmissing values. Murray -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: [EMAIL PROTECTED]Fax 7 838 4155 Phone +64 7 838 4773 wk+64 7 849 6486 homeMobile 021 1395 862 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Tony Plate [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Using tcltk language with R system
On Wed, Nov 12, 2003 at 04:41:21PM -0300, [EMAIL PROTECTED] wrote: Hello, Does anybody know how can i call a R function in a tcltk file? I made a tcltk file, but I need call functions in R. i.e: in R I can put .Tcl(tcltk statement). There are a same command to call R in a tcltk file? I want to make a R Gui using tcltk language, do you recommend use a tcltk or a R pack tcltk and don't use tcltk language? Thanks for your attention. Marcos Cerqueira J?nior Alagoas University - Brazil - This mail sent through IMP: http://horde.org/imp/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help in tcltk file you can use tcl command R_eval ... (... - any valid R statement). __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: Subject: RE: [R] Time plot question.
The following is an example of a dataframe containing times, plus some numeric data. foo - c(12:39:26,12:40:22,12:41:19) bar - data.frame(foo,1:3,11:13) Note that the times are of class 'factor' (their class changes in this case, as they go into the dataframe). To convert this dataframe to an 'its', do the following: library(its) its.format(%H:%M:%S) its(x=as.matrix(bar[,2:3]),dates=as.POSIXct(x=strptime(as.character(bar[[1]] ),format=its.format( Incidentally, since these types of question come up from time to time on the R-help ist, I intend to expand the 'its' documentation with some more examples and illustrations, in a 'vignette'. - Giles -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 12 November 2003 18:09 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Subject: RE: [R] Time plot question. Hello, Thank you for your reply. I am missing an intermediate step as plot( strptime( Time, format = %H:%M:%S), FreeMemory) Error in strptime(Time, format = %H:%M:%S) : invalid `x' argument plot( strptime( c(Time), format = %H:%M:%S), FreeMemory) Error in strptime(c(Time), format = %H:%M:%S) : invalid `x' argument does not work. My Time data is part of a data.frame. Do I need to as.POSIXlt this in some way, and if so, how? I will continue to work on this, and buy a suitable book on R so as not to plague this excellent news group with such questions. I could generate a sequence of ISODates similar to my data, but I would like to use the actual Time coordinates instead. Here is my Time data below: Time [1] 12:39:26 12:40:22 12:41:19 12:42:15 12:43:11 12:44:08 12:45:04 12:46:00 [9] 12:46:57 12:47:53 12:48:49 12:49:46 12:50:42 12:51:38 12:52:35 12:53:31 [17] 12:54:27 12:55:24 12:56:20 12:57:16 12:58:13 12:59:09 13:00:05 13:01:01 [25] 13:01:58 13:02:54 13:03:50 13:04:47 13:05:43 13:06:39 13:07:36 13:08:32 [33] 13:09:28 13:10:25 13:11:21 13:12:17 13:13:14 13:14:10 13:15:06 13:16:03 [41] 13:16:59 13:17:55 13:18:52 13:19:48 13:20:44 13:21:41 13:22:37 13:23:33 [49] 13:24:30 13:25:26 13:26:22 13:27:19 13:28:15 13:29:11 13:30:07 13:31:04 [57] 13:32:00 13:32:56 13:33:53 13:34:49 13:35:46 13:36:42 13:37:39 13:38:35 [65] 13:39:32 13:40:28 13:41:24 13:42:21 13:43:17 13:44:13 13:45:10 13:46:06 [73] 13:47:02 13:47:59 13:48:55 13:49:51 13:50:48 13:51:44 13:52:40 13:53:37 [81] 13:54:33 13:55:29 13:56:26 13:57:22 13:58:19 13:59:15 14:00:11 14:01:08 [89] 14:02:05 14:03:01 14:03:57 14:04:54 14:05:50 14:06:46 14:07:42 14:08:39 [97] 14:09:35 14:10:31 14:11:28 14:12:24 14:13:20 14:14:17 14:15:13 14:16:09 [105] 14:17:06 14:18:02 14:18:58 14:19:55 14:20:51 14:21:47 14:22:44 14:23:40 [113] 14:24:36 14:25:32 14:26:29 14:27:25 14:28:21 14:29:18 14:30:14 14:31:10 120 Levels: 12:39:26 12:40:22 12:41:19 12:42:15 12:43:11 12:44:08 ... 14:31:10 Enjoying a little R and R, John __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help ** This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Running R-program as queue jobs
Hi! On Thu, Nov 13, 2003 at 09:59:48AM +, Arne Gjuvsland wrote: I have a problem with running my R programs as queue jobs. When I try to submit a batch file to the queue with qsub I get the following error message: /home/gjuvslan/kluster/R-1.7.1/bin/R.bin: error while loading shared libraries: libpcre.so.0: cannot load shared object file: No such file or directory When executed from the command prompt the batch file does its job. Did you run the script on the same machine in both cases? I got burnt a couple of times with different machines running different versions of the OS, non-identical versions of shared libraries etc... cu Philipp -- Dr. Philipp PagelTel. +49-89-3187-3675 Institute for Bioinformatics / MIPS Fax. +49-89-3187-3585 GSF - National Research Center for Environment and Health Ingolstaedter Landstrasse 1 85764 Neuherberg, Germany __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] xlims of barplot
I'd recommend you read the code for barplot (it's all in R; just type barplot.default at the prompt) then emulate the xlim calculation prior to starting your series of plots, calling each plot with the same xlim. Reading the base package coding is always VERY instructive. Takes time, but it's worth it. -Original Message- From: Paul Sorenson [mailto:[EMAIL PROTECTED] Sent: 13 November 2003 05:54 To: [EMAIL PROTECTED] Subject: [R] xlims of barplot I would like to create a family of barplots with the same xlimits. Is there a way to read the xlimits from the first graph so I can apply it to the subsequent ones? Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 69 Fax: +44 (0) 1379 65 email: [EMAIL PROTECTED] web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] postscript device: horizontal=F
The postscript device behaves strangely - is this possibly a bug? case 1) postscript(gfx-%d.ps,width=8 , height=5, paper=special, horizontal=F, onefile=FALSE); some plots here dev.off() The first plot is in portrait orientation The second and all the following plots are in landscape orientation case 2) postscript(gfx-%d.ps,width=8 , height=5, paper=special, horizontal=T, onefile=FALSE); some plots here dev.off() Now, all plots are in portrait... So it seems that the orientation of the *first* plot is not affected by horizontal=T/F. Pascal __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Running R-program as queue jobs
Jason Turner [EMAIL PROTECTED] writes: Philipp Pagel wrote: Hi! On Thu, Nov 13, 2003 at 09:59:48AM +, Arne Gjuvsland wrote: I have a problem with running my R programs as queue jobs. When I try to submit a batch file to the queue with qsub I get the following error message: /home/gjuvslan/kluster/R-1.7.1/bin/R.bin: error while loading shared libraries: libpcre.so.0: cannot load shared object file: No such file or directory When executed from the command prompt the batch file does its job. Did you run the script on the same machine in both cases? I got burnt a couple of times with different machines running different versions of the OS, non-identical versions of shared libraries etc... In addition to Philipp's good sugestion, I've been burnt on the same machine, but with the batch job running as a different user. When environment variables are needed, or private libraries need to be loaded, things go bad very quickly. Also, environment variables may be set differently between interactive and batch shells. E.g. my crontab file looks like this CVS_RSH=ssh 35 0 * * * $HOME/scripts/r-bugs-commit /dev/null ... for a reason. In Arne's case, I'd suspect the setting of LD_LIBRARY_PATH. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] (no subject)
On Wednesday 12 November 2003 10:24 pm, Stefan Wagner wrote: Hi all, I am looking for a clever way to create the following graph using R: I got information on the shares of some subgroups over time (summing up to 1 in each year). The graph I want to create should display the development of the individual shares over time by shading rectangulars for each share in a different color. Is there a clever of doing this? I don't know whether this will help, but here is a function that draws a rectangle specified by the position arguments with a color gradient specified by either endpoints for red, green and blue, or vectors of red, green and blue values in either 0-1 or 0-255. The gradient will be a linear sequence if only the extremes of the bar are specified, or can be explicitly specified by passing a vector of x values for horizontal shading or y values for vertical shading. Useful for doing barplots where you would like to illustrate critical areas (e.g. risk levels of a concentration - I've included a fake example) in a series of observed values. It's a bit messy, as there isn't a lot of error checking, but it may be useful. Jim rgb.to.hex-function(rgb) { if(length(rgb) != 3) stop(rgb must be an rgb triplet) if(any(rgb 0) || any(rgb 255)) stop(all rgb must be between 0 and 255) # if it looks like a 0-1 value, get the 0-255 equivalent if(all(rgb = 1)) rgb-rgb*255 hexdigit-c(0:9,letters[1:6]) return(paste(#,hexdigit[rgb[1]%/%16+1],hexdigit[rgb[1]%%16+1], hexdigit[rgb[2]%/%16+1],hexdigit[rgb[2]%%16+1], hexdigit[rgb[3]%/%16+1],hexdigit[rgb[3]%%16+1], sep=,collapse=)) } gradient.rect-function(xleft,ybottom,xright,ytop,reds,greens,blues, nslices=20,gradient=x) { maxncol-max(c(length(reds),length(greens),length(blues))) if(maxncol 2) stop(Must specify at least two values for one color) if(maxncol 2 || maxncol nslices) nslices-maxncol if(length(reds) == 2) { # assume they are endpoints and calculate linear gradient if(reds[1] 0 || reds[2] 1) { reds[1]-ifelse(reds[1] 0,0,reds[1]) reds[2]-ifelse(reds[2] 1,1,reds[2]) } reds-seq(reds[1],reds[2],length=nslices) } if(length(greens) == 2) { # assume they are endpoints and calculate linear gradient if(greens[1] 0 || greens[2] 1) { greens[1]-ifelse(greens[1] 0,0,greens[1]) greens[2]-ifelse(greens[2] 1,1,greens[2]) } greens-seq(greens[1],greens[2],length=nslices) } if(length(blues) == 2) { # assume they are endpoints and calculate linear gradient if(blues[1] 0 || blues[2] 1) { blues[1]-ifelse(blues[1] 0,0,blues[1]) blues[2]-ifelse(blues[2] 1,1,blues[2]) } blues-seq(blues[1],blues[2],length=nslices) } colormatrix-cbind(reds,greens,blues) colvec-apply(colormatrix,1,rgb.to.hex) if(gradient == x) { if(length(xleft) == 1) { xinc-(xright-xleft)/(nslices-1) xlefts-seq(xleft,xright-xinc,length=nslices) xrights-xlefts+xinc } else { xlefts-xleft xrights-xright } rect(xlefts,ybottom,xrights,ytop,col=colvec,lty=0) } else { if(length(ybottom) == 1) { yinc-(ytop-ybottom)/(nslices-1) ybottoms-seq(ybottom,ytop-yinc,length=nslices) ytops-ybottoms+yinc } else { ybottoms-ybottom ytops-ytop } rect(xleft,ybottoms,xright,ytops,col=colvec,lty=0) } } arsenic.red-c(seq(0,1,length=50),rep(1,50)) arsenic.green-c(seq(1,0,length=50),rep(0,50)) arsenic.blue-rep(0,100) dioxin.red-c(seq(0,1,length=20),rep(1,80)) dioxin.green-c(seq(1,0,length=20),rep(0,80)) dioxin.blue-rep(0,100) plot(0:5,seq(0,100,by=20),axes=F,type=n,main=Cancer risk,xlab=Carcinogen, ylab=Concentration (ppb)) box() axis(2) mtext(c(Arsenic,Dioxin),1,at=c(1.5,3.5)) gradient.rect(1,-5,2,105,arsenic.red,arsenic.green,arsenic.blue,gradient=y) gradient.rect(3,-5,4,105,dioxin.red,dioxin.green,dioxin.blue,gradient=y) legend(4.1,50,legend=c(High,Low),fill=c(red,green)) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] identify function with postscript output?
Hello, I want to select some points in a plot using 'identify' function and also want the identified points to be saved in a postscript file? Any help in how to do it? A better question might have been, how do i pipe the screen output to a postscript file? Thanks and Regards Ramakrishna __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Running R-program as queue jobs
On 13 Nov 2003, Peter Dalgaard wrote: Jason Turner [EMAIL PROTECTED] writes: Philipp Pagel wrote: Hi! On Thu, Nov 13, 2003 at 09:59:48AM +, Arne Gjuvsland wrote: I have a problem with running my R programs as queue jobs. When I try to submit a batch file to the queue with qsub I get the following error message: /home/gjuvslan/kluster/R-1.7.1/bin/R.bin: error while loading shared libraries: libpcre.so.0: cannot load shared object file: No such file or directory When executed from the command prompt the batch file does its job. Did you run the script on the same machine in both cases? I got burnt a couple of times with different machines running different versions of the OS, non-identical versions of shared libraries etc... In addition to Philipp's good sugestion, I've been burnt on the same machine, but with the batch job running as a different user. When environment variables are needed, or private libraries need to be loaded, things go bad very quickly. Also, environment variables may be set differently between interactive and batch shells. E.g. my crontab file looks like this CVS_RSH=ssh 35 0 * * * $HOME/scripts/r-bugs-commit /dev/null ... for a reason. In Arne's case, I'd suspect the setting of LD_LIBRARY_PATH. (The R script will include in R_LD_LIBRARY_PATH the settings used at configure time, so we do try to workaround that one. For example my 64-bit Solaris build has sparcv9 library paths in.) As an aside, from the next non-patch release PCRE, BZLIB and ZLIB will be statically linked into R in a vanilla configuration to help avoid such problems. (For some reason my RH8.0 system has a dynamic pcreposix but only a static pcre, although the current PCRE default build makes both versions of each.) -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Problem with parser and if/else
Dear r-help people, could you confirm that this is correct behaviour for R? I am using RH9. the code: x1 - 1:6 t1 - 5 if (length(x1) = t1) { cat(in the if \n) } else { cat(in the else\n) } runs fine: source(test_if_else.R) in the if but the code: x1 - 1:6 t1 - 5 if (length(x1) = t1) { cat(in the if 2\n) } else { cat(in the else\n) } fails with the error: source(test_if_else2.R) Error in parse(file, n, text, prompt) : syntax error on line 6 Could someone explain this to me please? Thanks, Simon. -- Dr. Simon Brown Climate extremes research manager [EMAIL PROTECTED]http://www.hadleycentre.com Telephone: +44 (0)1392 886879 Fax: +44 (0)870 900 5050 Met Office Hadley Centre, FitzRoy Road, EXETER, EX1 3PB, U.K __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] newbie's additional (probably to some extent OT) questions
At 07.11.2003 (00:24), Thomas W Blackwell wrote: JB and Michael - But I will guess that the data come from a high school physics experiment on gravitational acceleration which drops a weight dragging a paper tape through a buzzer with a piece of carbon paper in it. This prints periodic marks on the paper tape. The data x are the distances traveled at successive time points following time zero. No. It is a body (slider?) that is sliding down an inclined plane on an air cushion. we can determine the position of the slider pretty exactly (the error should be less than 0.01m). The clock starts when we release the body and it stops when the body passes a photo cell. There are two data sets as we experimented with two different angles between plane table. The measurement of the angles is probably a bit less exact than the measurement of the position. Here are the two data sets: The positions are in the dx-list and are the same in both experiments: dx-list = c( 1.60, 1.55,1.50,...,0.70) (19 values). The corresponding dt-lists are dt-list1 = c(6.44,6.29,6.1,6.09,6.02,5.87,5.68,5.65,5.52,5.43,5.30,5.20,5.01,4.88,4.74,4.61,4.44,4.36,4.12) dt-list2 = c(3.98,3.86,3.78,3.72,3.65,3.59,3.51,3.45,3.37,3.28,3.22,3.14,3.07,2.96,2.89,2.81,2.74,2.61,2.55) During the first series of measurements, tha body bumped against a boundary that was fixed on the inclined plane. By bumping against this boundray, the inclined plane, that has a much bigger mass than the body, was slightly pushed and after 15 measurements the position of this boundary changed by 0.01m: A--B---C Here B should be a fixed position and A should be changed. According to our mistake B was changed a bit too. C is a boundary that stops the body from leavinf the air cushion (as those sliding bodies are expensive). Then, when we took the second series of measurements, I ordered a pupil to stop tha body with his hand before bumping against C. And really, it seems to me that the second series is more precise. I think it's DYNAMITE that you're actually doing this data analysis. Why? I always do this, but this year I started to involve a bit more statistics. I told about how the method of least squares was an unbiased estimate and that also some hypothesis testing is done (when I check whether the points lie on a parabola). The pupils are 16 to 18 years old. They have to draw dx against (dt)^2 as their homework and have to fit in a straight line. This is the way we do linear regression. It's what I always wanted to do as a high school student, but didn't have the technical background then to carry out. In fact ... come to think of it ... I'm pretty sure I STILL HAVE my high school ticker tapes folded up among my high school papers somewhere, 35 years later, still waiting to be properly analyzed ! From your explanations which follow this point, I do not understand a single word (the termini technici are all unknown to me) but I suspect that I pretty much would like to understand them. Sigh. Probably, I should have to read some work on statistics thoroughly (which I cannot do at the moment). Thank you for your help, anyway. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Running R-program as queue jobs
A search on Google shows that libpcre.so.0 is a Perl-compatible regular expression library. Does R use that, or is it the queue script? Have you checked /usr/lib for that library? Maybe you need to install the library or rerun ldconfig. You can get info about shared libraries with the ldd command. That was some ideas, but no shrink wrapped solutions! Hilsen Jesper -Original Message- From: Arne Gjuvsland [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 5:00 AM To: [EMAIL PROTECTED] Subject: [R] Running R-program as queue jobs I have a problem with running my R programs as queue jobs. When I try to submit a batch file to the queue with qsub I get the following error message: /home/gjuvslan/kluster/R-1.7.1/bin/R.bin: error while loading shared libraries: libpcre.so.0: cannot load shared object file: No such file or directory When executed from the command prompt the batch file does its job. Any ideas? Arne __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Running R-program as queue jobs - problem solved
At 11:56 13.11.2003 +, Prof Brian Ripley wrote: On 13 Nov 2003, Peter Dalgaard wrote: Jason Turner [EMAIL PROTECTED] writes: Philipp Pagel wrote: Hi! On Thu, Nov 13, 2003 at 09:59:48AM +, Arne Gjuvsland wrote: I have a problem with running my R programs as queue jobs. When I try to submit a batch file to the queue with qsub I get the following error message: /home/gjuvslan/kluster/R-1.7.1/bin/R.bin: error while loading shared libraries: libpcre.so.0: cannot load shared object file: No such file or directory When executed from the command prompt the batch file does its job. Did you run the script on the same machine in both cases? I got burnt a couple of times with different machines running different versions of the OS, non-identical versions of shared libraries etc... In addition to Philipp's good sugestion, I've been burnt on the same machine, but with the batch job running as a different user. When environment variables are needed, or private libraries need to be loaded, things go bad very quickly. Also, environment variables may be set differently between interactive and batch shells. E.g. my crontab file looks like this CVS_RSH=ssh 35 0 * * * $HOME/scripts/r-bugs-commit /dev/null ... for a reason. In Arne's case, I'd suspect the setting of LD_LIBRARY_PATH. (The R script will include in R_LD_LIBRARY_PATH the settings used at configure time, so we do try to workaround that one. For example my 64-bit Solaris build has sparcv9 library paths in.) As an aside, from the next non-patch release PCRE, BZLIB and ZLIB will be statically linked into R in a vanilla configuration to help avoid such problems. (For some reason my RH8.0 system has a dynamic pcreposix but only a static pcre, although the current PCRE default build makes both versions of each.) -- 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 Thanks for helpful advice, the R_LD_LIBRARY_PATH in the R script did not contain the path of the library. Now the script is in the queue, waiting for some quality CPU-time. Arne __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problem with parser and if/else
In the second case, R stops when it has a syntactically complete clause: if (...) { ... } is complete since an else{} clause is not required. R evaluates it, then moves onto else { ... } which is a syntax error (since it doesn't have an if {} in front of it, since that has already been evaluated) One way to see this illustrated is to enter these commands a line at a time in interactive mode. I don't know exactly where this appears in the documentation, probably someone will point to it in another message. On Thu, 13 Nov 2003, Brown, Simon wrote: Dear r-help people, could you confirm that this is correct behaviour for R? I am using RH9. the code: x1 - 1:6 t1 - 5 if (length(x1) = t1) { cat(in the if \n) } else { cat(in the else\n) } runs fine: source(test_if_else.R) in the if but the code: x1 - 1:6 t1 - 5 if (length(x1) = t1) { cat(in the if 2\n) } else { cat(in the else\n) } fails with the error: source(test_if_else2.R) Error in parse(file, n, text, prompt) : syntax error on line 6 Could someone explain this to me please? Thanks, Simon. -- 620B Bartram Hall[EMAIL PROTECTED] Zoology Department, University of Floridahttp://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] conf int mixed effects
Hi, I have a linear mixed-effects model object and want to extract the 95% confidence intervals for the fixed and random effects, respectively. I found the function intervals() for confidence intervals for the fixed effects but no corresponding function for the random effects. Does it exist or do I have to calculate the confidence intervals for the random effects myself? Greetings, joerg __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] xlims of barplot
On Wed, 2003-11-12 at 23:54, Paul Sorenson wrote: I would like to create a family of barplots with the same xlimits. Is there a way to read the xlimits from the first graph so I can apply it to the subsequent ones? I have tried just taking the min and max of the x data and the plot doesn't show. cheers A point of clarification: When you say x axis limits, are you referring to the bar heights in a horizontal barplot or are you referring to the range of the x axis with vertical bars? A critical difference. In the former situation, you can explicitly set the x axis limits using the 'xlim' argument to include the range of values in your various sets of data. Thus, you can use: # Get the maximum x value in the datasets # Presumes that 'MyData' contains all values max.x - max(MyData) # Now use this format for EACH barplot barplot(, horiz = TRUE, xlim = c(0, max.x)) That will result in the x axis being the same in each plot. You might want to use something like 'xlim = c(0, max.x * 1.25)', which will give you some additional space above the bars (ie. for a legend, etc.). Note that if you use the range of x values (instead of 0 and max) and set xlim to that min/max pair, you will get a funny result. For example: barplot(1:5, horiz = TRUE, xlim = c(1, 5)) Since par(xpd) is set to TRUE by default in barplot(), the bases of the bars will actually appear beyond the left side of the plot region. You can eliminate that effect by using: barplot(1:5, horiz = TRUE, xlim = c(1, 5), xpd = FALSE) However, you will not see a bar for your minimum value. If you are talking about a vertical barplot, then the x axis range will be the same for each barplot under the following conditions, without having to set it: 1. You have the same number of bars in each plot 2. You do not change the values of 'space', 'width' or 'beside' across the plots. Also, keep in mind that the bars are NOT centered over integer values on the respective axis. You can get the bar center positions by using: mp - barplot(...) where 'mp' will contain the bar midpoints, which is useful for subsequent annotation, etc. See ?barplot for more help and examples. HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problem with parser and if/else
On Thu, 13 Nov 2003, Ben Bolker wrote: In the second case, R stops when it has a syntactically complete clause: if (...) { ... } is complete since an else{} clause is not required. R evaluates it, then moves onto else { ... } which is a syntax error (since it doesn't have an if {} in front of it, since that has already been evaluated) One way to see this illustrated is to enter these commands a line at a time in interactive mode. I don't know exactly where this appears in the documentation, probably someone will point to it in another message. help(if), for example (the most obvious place to look?) MASS4, p.58 On Thu, 13 Nov 2003, Brown, Simon wrote: Dear r-help people, could you confirm that this is correct behaviour for R? I am using RH9. the code: x1 - 1:6 t1 - 5 if (length(x1) = t1) { cat(in the if \n) } else { cat(in the else\n) } runs fine: source(test_if_else.R) in the if but the code: x1 - 1:6 t1 - 5 if (length(x1) = t1) { cat(in the if 2\n) } else { cat(in the else\n) } fails with the error: source(test_if_else2.R) Error in parse(file, n, text, prompt) : syntax error on line 6 Could someone explain this to me please? Thanks, Simon. -- 620B Bartram Hall[EMAIL PROTECTED] Zoology Department, University of Floridahttp://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- 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 272860 (secr) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problem with parser and if/else
Brown, Simon [EMAIL PROTECTED] writes: Dear r-help people, could you confirm that this is correct behaviour for R? I am using RH9. the code: x1 - 1:6 t1 - 5 if (length(x1) = t1) { cat(in the if \n) } else { cat(in the else\n) } runs fine: source(test_if_else.R) in the if but the code: x1 - 1:6 t1 - 5 if (length(x1) = t1) { cat(in the if 2\n) } else { cat(in the else\n) } fails with the error: source(test_if_else2.R) Error in parse(file, n, text, prompt) : syntax error on line 6 Could someone explain this to me please? Again? This has been hashed over several times before. The basic issue is whether a statement can be assumed to be syntactically complete at the end of a line. It is fairly obvious what happens when you type the same expressions at an interactive prompt: x1 - 1:6 t1 - 5 if (length(x1) = t1) { + cat(in the if 2\n) + } in the if 2 else { Error: syntax error cat(in the else\n) in the else } Error: syntax error Notice that the first right curly brace is seen as terminating the if construct. Otherwise, R would need to wait and check whether the *next* line starts with an else which would certainly be confusing in interactive use. So R assumes the expression is finished and evaluates it. Then it gets an else keyword that it doesn't know what to do with and barfs. Files that are source()'ed are subject to the same restrictions as code given as input. This is a fairly useful consistency requirement. [Come to think of it, it is not entirely obvious that we couldn't have else ... working like if (TRUE) ... or if (FALSE) ... depending on the result of a previous if(). I suppose the issue is how to make sure that there actually is a matching if.] -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] I receiv an error when try to run a function...
Marcelo Luiz de Laia wrote: Hi All, I use R 1.8.0 and Bioconductor packages in Windows 2000 professional. When I try to run one function, I will receive one dialog box with this message: Rgui.exe has generate errors and will be closed by Windows. You will need to restart the program. An error log is being created. I look in for in my system for the error log, but nothing... I search in microsoft KB database, but nothing, too. I do not search in R-help archieves. Do someone already see this problem? If the crash is reproducible, you should send a bug report to the maintainer of the corresponding package that function is in. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] identify function with postscript output?
U.Ramakrishna wrote: Hello, I want to select some points in a plot using 'identify' function and also want the identified points to be saved in a postscript file? Any help in how to do it? A better question might have been, how do i pipe the screen output to a postscript file? Thanks and Regards Ramakrishna See ?dev.copy Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postscript device: horizontal=F
Pascal A. Niklaus wrote: The postscript device behaves strangely - is this possibly a bug? case 1) postscript(gfx-%d.ps,width=8 , height=5, paper=special, horizontal=F, onefile=FALSE); some plots here dev.off() The first plot is in portrait orientation The second and all the following plots are in landscape orientation case 2) postscript(gfx-%d.ps,width=8 , height=5, paper=special, horizontal=T, onefile=FALSE); some plots here dev.off() Now, all plots are in portrait... So it seems that the orientation of the *first* plot is not affected by horizontal=T/F. Works for me (R-1.8.1alpha, WinNT4.0). Which version of R are you using? Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] identify function with postscript output?
Uwe Ligges [EMAIL PROTECTED] writes: U.Ramakrishna wrote: Hello, I want to select some points in a plot using 'identify' function and also want the identified points to be saved in a postscript file? Any help in how to do it? A better question might have been, how do i pipe the screen output to a postscript file? Thanks and Regards Ramakrishna See ?dev.copy Specifically dev.copy2eps(). In some applications you want to make sure that the dimensions of the two devices match (or at least that height/pointsize and width/pointsize are the same). -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Chron, as.POSIXct problem
From: Brian Beckage [EMAIL PROTECTED] Thanks to all who responded to my posting. At 11:39 AM -0500 11/12/03, Gabor Grothendieck wrote: You are being hit by a timezone problem. Its not really shifting the days by one. Its working in the GMT timezone, not yours. If you can accept a date format that chron supports then this is the easiest solution since chron does not support timezones and so can't give you such problems in the first place. For example, the following stays in chron the whole time: format(datesTest, format=m/day/year) [1] Oct/01/1952 Oct/02/1952 Oct/03/1952 If you must convert to POSIXt to take advantage of a format only supported by POSIXt then use POSIXlt and specify the timezone explictly: format(as.POSIXlt(datesTest,tz=GMT), %m/%d/%Y) [1] 10/01/1952 10/02/1952 10/03/1952 This solved the problem using as.POSIXlt(). I guess the tz argument doesn't solve the problem using as.POSIXct(). In any case, I'm able to use as.POSIXlt() in my current application. You can use POSIXct but its a bit trickier. Assuming datesTest is a chron vector, as before you can do this. format(as.POSIXct(datesTest), %m/%d/%Y, tz=GMT) # right Note that in this case you have to use the tz parameter on format, NOT on as.POSIXct: format(as.POSIXct(datesTest, tz=GMT), %m/%d/%Y) # wrong __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] conf int mixed effects
OK, I am convinced that CI for random effects might not really be meaningful. By the way, the article I mentioned does indeed only cover the 2-way model (one fixed effect, one random effect), I think. But talking about CI of the variance components. How do I extract those? In the summary function something like snip Random effects: Formula: ~1 | s (Intercept) Residual StdDev:2.633981 8.583093 snip is displayed which are the square roots of the variance components, I suppose. However, I did not manage to access them directly (at least the intercept part, the residual part is accessible via the 'sigma' parameter of the summary function). greetings, joerg Liaw, Andy wrote: I'm by no mean expert in this, but... Are you referring to confidence intervals for variance components, instead of random effects? As Prof. Bates said, computing CI on random effects is a bit strange philosophically, because random effects are sort of estimates of random quantities, unlike fixed effects, which are estimates of some population constants. The definition of CI is that with certain probability, when the data generation and model fitting is repeated infinite number of times, the computed CI will cover the true population constant. There's no true population constant for random effects, but there is for a variance component. HTH, Andy -Original Message- From: Joerg Schaber [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 10:50 AM To: Douglas Bates; [EMAIL PROTECTED] Subject: Re: [R] conf int mixed effects I naively thought when I can give estimates of the random effects I should also be able to calculate confidence levels of these estimates (that's what statistics is about, isn't it?) For example, similar to the fixed case, I can calculate a variance-covariance matrix (C) for the random effects (e.g. following Hemmerle and Hartley,TECHNOMETRICS 15 (4): 819-831 1973) and using the t-value for the given confidence level and degrees of freedom (t), I can estimate confidence intervals for random effect i (r[i]) as something like r[i] +- t*sqrt(C[i][i]). What does the statistician say? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Fitting to strange function
You could use nls() or optimize(). -roger JB wrote: I have some data int the variabley y (response variable) and x, and I suspect the formula y = A*x^2 +sqrt(0.08*A)*x. How can I fit my data to this curve? TIA, Janos Blazi __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problem with parser and if/else
On Thu, 13 Nov 2003, Ben Bolker wrote: With all due respect to BDR and you, I think this behavior is not obvious to casual/new users (using the R search page with if else as the search string turns up nearly identical queries from 1998, 2001, and 2002). There's a philosophical issue here, of course, about how much we need to hold people's hands/fill the help files with details about behavior that is clearly defined but not obvious to beginners. (And the fact that some people don't read help pages anyway ...) I don't have the new edition of MASS (shame on me), but looking at both p. 93 of MASS 3d ed. and at help(if) in R 1.8.0, I don't see this problem clearly highlighted (yes, reading the syntax Well, do take a look at MASS4 p.58 as it is completely different from that citation. A little care is needed when entering \sfn{if ... else} statements to ensure that the input is not syntactically complete before the \sfn{else} clause, and braces can help with achieving this. That is exactly the point. -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] I receiv an error when try to run a function...
On Thu, 13 Nov 2003, Marcelo Luiz de Laia wrote: Three or four days ago I install in my windows 2000 professional 3 (three) latest windows 2000 hotfix. Now, any function provoke errors and the next message will be prompted. Rgui.exe has generate errors and will be closed by Windows. You will need to restart the program. An error log is being created. I suppose that this bring up to date in my system is the cause of this errors. You mean you have just installed Microsoft's latest set of bugs? I re-install R, but the errors continue... Thanks for any tip Uninstall the not-so-hot fix and report to Microsoft. -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Problems about Heatmap
Dear all: Recently, I am using heatmap function to perform 2-Dimension hierarchical clustering for gene expression profile. The number of gene and condition are 6370 and 994 respectively. However, I got the error massage after running the heatmap function. Please see below: heatmap(int.dat, col=col.map) Error in match.fun(FUN) : evaluation is nested too deeply: infinite recursion? Error: evaluation is nested too deeply: infinite recursion? Besides, my computer OS is Mandrake9.1 and R version is 1.8.0. Would you please tell me how to deal with this problem? Thank you for the kind reply. Your truly, Shih-Te Shih-Te Yang, Ph.D. student Bioinformatics Research Center Institute of Biochemistry School of Life Science National Yang-Ming University Tel:+886-2-28267000*5666 Fax:+886-2-81461062 E-mail:[EMAIL PROTECTED] MyWeb: http://binfo.ym.edu.tw/styang/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] identify function with postscript output?
U.Ramakrishna wrote: Hello, I want to select some points in a plot using 'identify' function and also want the identified points to be saved in a postscript file? Any help in how to do it? A better question might have been, how do i pipe the screen output to a postscript file? You may want to look at the pos argument to identify and text. Specifying pos=TRUE as an argument to identify makes it add a pos component to its return value. This can be passed as an argument text to place the labels in new plots just as they appear in the on-screen version. E.g. # Onscreen y = rnorm(10) plot(y) id = identify(y,pos=TRUE) # Later, for hardcopy postscript() plot(y) text(1:length(y)[id$ind], y[id$ind], labels=id$ind, pos=id$pos) dev.off() That way you can capture the essential state of your on-screen plot, but make revisions to the way in which its drawn. -- Ross Ihaka Email: [EMAIL PROTECTED] Department of Statistics Phone: (64-9) 373-7599 x 85054 University of Auckland Fax:(64-9) 373-7018 Private Bag 92019, Auckland New Zealand __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Installing packages
Running under Redhat 7.3 Linux I have installed R Version 1.8.0 (2003-10-08) from a binary download using the rpm manager. Using packageStatus(), I am attempted to upgrade several packages. This is unsuccessful with the following error messages: * Installing *source* package 'MASS' ... ** libs gcc -I/usr/lib/R/include -I/usr/local/include -D__NO_MATH_INLINES -mieee-fp -fPIC -O2 -m486 -fno-strength-reduce -g -c MASS.c -o MASS.o gcc: installation problem, cannot exec `cpp0': No such file or directory make: *** [MASS.o] Error 1 ERROR: compilation failed for package 'MASS' gcc version 2.96 2731 (Red Hat Linux 7.3 2.96-113) is installed. I have checked the R archives and FAQ and admin manual for help. My knowledge of c compiling is limited. Any pointers for debugging this problem would be appreciated. Nathan Nathan Leon Pace, MD, MStat Work:[EMAIL PROTECTED] Department of AnesthesiologyHome:[EMAIL PROTECTED] University of Utah Work:801.581.6393 Salt Lake City, UtahHome:801.467.2925 Fax:801.581.4367 Cell:801.558.3987 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] comparing k-means and hierarchical clustering
Hi, We have implemented hierarchical and k-means clustering using R . We are trying to find any methodology in R which would allow us to compare the two clustering techniques.Could any one please help us with that. Thanking you, Sreedevi Gopalan Graduate student, University of Alabama at Birmingham. [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Fitting to strange function
At 13.11.2003 (17:17), Roger D. Peng wrote: You could use nls() or optimize(). -roger Well, thx. This is very complicated. In Mupad I simply say: r:=stats::reg(t_list,x_list,a/2*t^2+sqrt(0.08*a)*t,[t],[a]) and get the (right) answer. How would the same command in R go? TIA, jb __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Help: Strange MDS behavior
Hi! I have a dissimilarity matrix X and try to compare it with X' = dist(cmdscsale(X,k)). If I increase k, I should expect that the error (or fit) should monotonically decrease, right. Here is a sample code; library(mva) set.seed(12345) x - as.matrix(dist(matrix(rnorm(100),ncol=10,byrow=T))) # x[1,2]-x[2,1]-1000 ## --** 1 # x[5,6]-x[6,5]-1000 ## --** 2 fit - NULL for(k in 1:9) { mds - cmdscale(x,k,add=T) xprime - as.matrix(dist(mds$points)) fit[k] - sum((x-xprime)^2)/sum(x^2) } plot(fit) When I run this example, it gives a nice good plot. However, with those two commented lines added, the plot is opposite, that is, the fit is increasing as k grows! I really don't understand this behavior. The reason why I added those two lines is because my real input data is not an Euclidean distance matrix, but a dissimilarity matrix calculated from my own metric. So, does this mean that the matrix X *must* be an Euclidean distance matrix in this example? Thanks in advance. - Youngser __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Program Saving
Hi, I have a very simple question. If a want to save a whole program (say more than 5 command lines), how can I proceed without each time using the command history (that allow me to recall previously saved command, but which is to long if you want to recall more than 5 command lines), or without saving to a text file and use copy/paste when I open a new R session (but in fact this doesn't work since when you copy your program to a text file, you copy the or the + , and when you paste it back to a new R command sheet, you get syntax error since you now have double () and double + (++) at each line. Do they have something simple like in any other program, that consist of saving the command sheet under say Program X. Program X will become a simple file that I can reopened any time I want and each time I open it, I will have in front of me all the previous saved command, (including error, I don't care), in order that I don't have to recall anything when the program X is opened. Thanks Marc-Antoine Vaillant Actuarial Analyst Les Services actuariels SAI inc. [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] (no subject)
Hello All, I hope you can help me. I'm trying to put error bars in a xyplot trellis graph (see below). I know there is a function for this, larrows, but for the life of me I can't figure out how to use it. I've been using the default panel function (which is I haven't specified any panel function) and this produces the plot that I like. I've tried defining a panel function based on some of the examples in the panel.* functions in lattice, but without much success. I would appreciate any help that anyone can give me with this problem. I can provide the data as an attached e-mail if needed. Thanks, xyplot(log10(Females+1)+log10(BG+1)~Trap.Type|Species,trap.agg,allow.multiple=T,type='b',as.table=T,auto.key=T) Wes McCardle phone: (301) 504-8328 fax: (301) 504-6580 [EMAIL PROTECTED] _ Concerned that messages may bounce because your Hotmail account is over limit? Get Hotmail Extra Storage! http://join.msn.com/?PAGE=features/es __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Program Saving
Hi, On Thu, 13 Nov 2003, Marc-Antoine Vaillant wrote: I have a very simple question. If a want to save a whole program (say more than 5 command lines), how can I proceed without each time using the command history (that allow me to recall previously saved command, but which is to long if you want to recall more than 5 command lines), or without saving to a text file and use copy/paste when I open a new R session (but in fact this doesn't work since when you copy your program to a text file, you copy the or the + , and when you paste it back to a new R command sheet, you get syntax error since you now have double () and double + (++) at each line. Please wrap your text to something like 80 character per line... Copy/paste works very well. Instead of copying from your R session over to a text editor, why don't you do it the other way round? i.e. type your R codes in your favourite editor, THEN copy/paste into R. That way you don't get any syntax error, and you have all your R codes saved into one file. There are several good tools. (X)Emacs/ESS is one of them (and it's the one I prefer). For beginners there is RWinEdt (a plugin, written by Uwe Ligges, for WinEdt). Both allows direct communication from the editor to R HTH. -- Cheers, Kevin --- Try not. Do, do! Or do not. There is no try Jedi Master Yoda Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Test for new page: thanks
Thank you Paul, Marc, and Ray for helping. Alas: there seems to be no way to test for a new page. In my simple case it is no big problem since I can just count the number of plots made on the page so far. Ray: yes I could probably write the header after every plot, effectively writing on top of old header (which in my case has both text and a legend). I was just looking for a neater way... Thank you all! Aleksey put the same header on each page On Tuesday 11 November 2003 06:27 pm, Ray Brownrigg wrote: Marc Schwartz [EMAIL PROTECTED] wrote: On Tue, 2003-11-11 at 16:49, Paul Murrell wrote: Hi Aleksey Naumov wrote: Dear R experts, I am writing a multi-page PDF file and would like to put a header on each page. Is there a way to test a graphic device to see if a new page is started (so that I know when to write the header)? Sorry. Not that I can think of. Paul I could simply count the plots made (each page has the same number of plots), but wanted to see if a more general solution is available. I was trying to think of a way but could not either. It's not clear what you want as the header, but if it is the same on each page, then using mtext(Header, outer=TRUE) (after a suitable par(oma=c(0, 0, 1, 0))), you can just write the header after every plot. Ray -- Aleksey Naumov GIS Analyst Center for Health and Social Research Buffalo State College __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Fitting to strange function
Is there some reason that the simple obvious does not work or is in some way not adequate? data - data.frame(x=c(1:5), y=c(1,3,2,NA,4)) nls(y ~ A*x^2 +sqrt(0.08*A)*x, data=data, start=list(A=0)) Nonlinear regression model model: y ~ A * x^2 + sqrt(0.08 * A) * x data: data A 0.1577584 residual sum-of-squares: 5.445525 At Thursday 07:54 PM 11/13/2003 +0100, JB wrote: At 13.11.2003 (17:17), Roger D. Peng wrote: You could use nls() or optimize(). -roger Well, thx. This is very complicated. In Mupad I simply say: r:=stats::reg(t_list,x_list,a/2*t^2+sqrt(0.08*a)*t,[t],[a]) and get the (right) answer. How would the same command in R go? TIA, jb __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] install.packages() for a local file
Hello ... I see that on Windows one can specify a filename as the pkgs argument and then set CRAN=NULL when calling install.packages() for a local file. Is there a way to do this on unix? It doesn't appear to be possible, but perhaps I am missing something here. Also, if indeed there is no method to do this on unix, is there a reason behind it or has it just never been implemented? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] xlims of barplot
-Original Message- From: Marc Schwartz [mailto:[EMAIL PROTECTED] Sent: Friday, 14 November 2003 12:49 AM To: Paul Sorenson Cc: [EMAIL PROTECTED] Subject: Re: [R] xlims of barplot On Wed, 2003-11-12 at 23:54, Paul Sorenson wrote: I would like to create a family of barplots with the same xlimits. Is there a way to read the xlimits from the first graph so I can apply it to the subsequent ones? I have tried just taking the min and max of the x data and the plot doesn't show. cheers A point of clarification: When you say x axis limits, are you referring to the bar heights in a horizontal barplot or are you referring to the range of the x axis with vertical bars? A critical difference. ... If you are talking about a vertical barplot, then the x axis range will be the same for each barplot under the following conditions, without having to set it: 1. You have the same number of bars in each plot 2. You do not change the values of 'space', 'width' or 'beside' across the plots. Also, keep in mind that the bars are NOT centered over integer values on the respective axis. You can get the bar center positions by using: Sorry for being vague, it is the latter case, vertical bars. The data doesn't satisfy condition 1. The family of 6 plots is datestamped data, the first plot showing all defects, then each subsequent plot showing defects of each severity level we define. The min and max of each of the subsequent datasets is in general a subset of the full dataset. I can easily plot them but it would be nice to keep the same x limits on each graph. The x data is POSIXct although I suspect that is not relevant. [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Panel Data Analysis
Hi, I have been having hard time trying to find out commands to conduct panel data analysis such as random effect, fixed effect, within effect, and specification tests for these panel data models. Could anyone please tell me where I can find commands and examples for panel data analysis? Thank you Soyoko __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] stop further sourcing of an R file
Thankyou, but i *donot* want the R session to quit. Someone suggested writing functions with return kept at the locations. I wanted to ask if there was another way. Regards Ramakrishna On Thu, 13 Nov 2003, Giovanni Petris wrote: q() Date: Thu, 13 Nov 2003 13:52:16 -0700 (MST) From: U.Ramakrishna [EMAIL PROTECTED] Sender: [EMAIL PROTECTED] Precedence: list Hello, Thanks to people who responded to previous mail! Is there a way in which we can stop further sourcing of an R file? i.e., i am sourcing an R file and keep an equivalent of 'exit' in it and run the code till that point? Thanks again Regards Ramakrishna __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- __ [ ] [ Giovanni Petris [EMAIL PROTECTED] ] [ Department of Mathematical Sciences ] [ University of Arkansas - Fayetteville, AR 72701 ] [ Ph: (479) 575-6324, 575-8630 (fax) ] [ http://definetti.uark.edu/~gpetris/ ] [__] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] xlims of barplot
On Thu, 2003-11-13 at 15:53, Paul Sorenson wrote: SNIP Sorry for being vague, it is the latter case, vertical bars. The data doesn't satisfy condition 1. The family of 6 plots is datestamped data, the first plot showing all defects, then each subsequent plot showing defects of each severity level we define. The min and max of each of the subsequent datasets is in general a subset of the full dataset. I can easily plot them but it would be nice to keep the same x limits on each graph. The x data is POSIXct although I suspect that is not relevant. OK...I think I understand what you are doing. You want a series of barplots that have space for the same number of vertical bars along the x axis, but there may be gaps in the series for any given barplot. Presumably, those gaps may be anywhere in the time series along the x axis. Hint: barplot() will leave gaps in the bar series where an NA appears in the vector or in a matrix column of height values. Thus, if you want all of your barplots to have space for say 12 vertical bars, even though some may only have 7, you can do something like the following: # Let's plot these two vertically arranged for show # First save pars and then set device to two rows opar - par(no.readonly = TRUE) par(mfrow = c(2, 1)) # Example of complete data barplot() barplot(1:12) #Example of partial data MyData - c(1, 2, NA, 4, NA, NA, NA, 8, 9, 10, 11, NA) barplot(MyData) # restore pars par(opar) So, the key is to be sure that the vector or matrix has the same number of elements or matrix columns in each dataset. For your incomplete datasets, pad each series with NA's to fill out the missing entries in the time series. Does that do what you want? HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Can't get Sweave syntax highlighting with Emacs
I can't get Emacs to automatically do syntax highlighting of Sweave files. I have followed Friedrich's suggestion for code to insert into my .emacs file. The complete section from my .emacs file is given below. When I load a *.Snw file, font is white until I press M-x, then the first code and document chunks get highlighted, but not the rest of the file. Latex and Noweb menus are active, but not ESS, and there is no switching of modes as I move the pointer to different types of chunks. ; - ; Emacs Speaks Statistics ; mode for R ; - (load /home/waichler/emacs/ess-5.1.19/lisp/ess-site) ; ESS emacs speaks statistics SRW 2-19-01 (autoload 'ess-mode ess ess major mode t) (autoload 'ess-noweb-mode ess ess noweb mode t) (autoload 'ess-noweb-make-buffer ess open a buffer in R mode t) (autoload 'ess-make-buffer ess open a buffer in R mode t) (setq auto-mode-alist (append '((\\.R$ . ess-mode)) auto-mode-alist)) (setq auto-mode-alist (append '((\\.S$ . ess-mode)) auto-mode-alist)) (setq auto-mode-alist (append '((\\.sp$ . ess-mode)) auto-mode-alist)) (global-set-key [(f10)] 'ess-make-buffer) (add-hook 'ess-mode-hook 'turn-on-font-lock) ; Sweave mode (defun Rnw-mode () (require 'ess-noweb) (noweb-mode) (if (fboundp 'R-mode) (setq noweb-default-code-mode 'R-mode))) (add-to-list 'auto-mode-alist '(\\.Rnw\\' . Rnw-mode)) (add-to-list 'auto-mode-alist '(\\.Snw\\' . Rnw-mode)) (setq reftex-file-extensions '((Snw Rnw nw tex .tex .ltx) (bib .bib))) (setq TeX-file-extensions '(Snw Rnw nw tex sty cls ltx texi texinfo)) Scott Scott Waichler, Senior Research Scientist Pacific Northwest National Laboratory MSIN K9-36 P.O. Box 999 Richland, WA 99352USA 509-372-4423 (voice) 509-372-6089 (fax) [EMAIL PROTECTED] http://hydrology.pnl.gov __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] stop further sourcing of an R file
Thankyou, but i *donot* want the R session to quit. Someone suggested writing functions with return kept at the locations. I wanted to ask if there was another way. Just have a single } as your last line, and put: if (FALSE) { just after where you want to stop. Ray Brownrigg __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] stop further sourcing of an R file
This will source lines up but not including the first line with exit in it: z - readLines(myfile.r) z - textConnection(z[seq(grep(exit,z)[[1]]-1)]) source(z) close(z) --- Date: Thu, 13 Nov 2003 13:52:16 -0700 (MST) From: U.Ramakrishna [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [R] stop further sourcing of an R file Hello, Thanks to people who responded to previous mail! Is there a way in which we can stop further sourcing of an R file? i.e., i am sourcing an R file and keep an equivalent of 'exit' in it and run the code till that point? Thanks again Regards Ramakrishna __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Panel Data Analysis
umeno [EMAIL PROTECTED] writes: I have been having hard time trying to find out commands to conduct panel data analysis such as random effect, fixed effect, within effect, and specification tests for these panel data models. Could anyone please tell me where I can find commands and examples for panel data analysis? lme from the nlme package. It is described in detail in Pinheiro and Bates (2000) Mixed-effects Models in S and S-PLUS. Jed Frees [EMAIL PROTECTED] may have examples more specifically oriented to panel data models. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] xlims of barplot
-Original Message- From: Marc Schwartz [mailto:[EMAIL PROTECTED] Sent: Friday, 14 November 2003 9:44 AM To: Paul Sorenson Cc: [EMAIL PROTECTED] Subject: RE: [R] xlims of barplot On Thu, 2003-11-13 at 15:53, Paul Sorenson wrote: SNIP Sorry for being vague, it is the latter case, vertical bars. The data doesn't satisfy condition 1. The family of 6 plots is datestamped data, the first plot showing all defects, then each subsequent plot showing defects of each severity level we define. The min and max of each of the subsequent datasets is in general a subset of the full dataset. I can easily plot them but it would be nice to keep the same x limits on each graph. The x data is POSIXct although I suspect that is not relevant. OK...I think I understand what you are doing. You want a series of barplots that have space for the same number of vertical bars along the x axis, but there may be gaps in the series for any given barplot. Presumably, those gaps may be anywhere in the time series along the x axis. Correct and most problematically at the ends. Hint: barplot() will leave gaps in the bar series where an NA appears in the vector or in a matrix column of height values. ... So, the key is to be sure that the vector or matrix has the same number of elements or matrix columns in each dataset. For your incomplete datasets, pad each series with NA's to fill out the missing entries in the time series. That sounds like a way forward. I just need to go back to the basics and learn how to add rows to data.frames. I am sure it won't be hard, its just my personal learning curve with several new data types (factors, tables, data.frames vs vectors, lists, arrays which I am more familiar with). For example, yesterday I tried max(myFactor) and it gave me an error (something like must be a vector), even though to my naive way of thinking myFactor clearly had a numeric max. Thanks [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Program Saving
On 14 Nov 2003 at 8:14, Ko-Kang Kevin Wang wrote: Hi, On Thu, 13 Nov 2003, Marc-Antoine Vaillant wrote: I have a very simple question. If a want to save a whole program (say more than 5 command lines), how can I proceed without each time using the command history (that allow me to recall previously saved command, but which is to long if you want to recall more than 5 command lines), or without saving to a text file and use copy/paste when I open a new R session (but in fact this doesn't work since when you copy your program to a text file, you copy the or the + , and when you paste it back to a new R command sheet, you get syntax error since you now have double () and double + (++) at each line. Please wrap your text to something like 80 character per line... Or even a little bit less ... Copy/paste works very well. Instead of copying from your R session over to a text editor, why don't you do it the other way round? i.e. type your R codes in your favourite editor, THEN copy/paste into R. That way you don't get any syntax error, and you have all your R codes saved into one file. There are several good tools. (X)Emacs/ESS is one of them (and it's the one I prefer). For beginners there is RWinEdt (a plugin, written by Uwe Ligges, for WinEdt). Both allows direct communication from the editor to R Yes. But sometimes one wants to experiment, then it is usefull to have options(continue= ) Kjetil Halvorsen HTH. -- Cheers, Kevin --- Try not. Do, do! Or do not. There is no try Jedi Master Yoda Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] calculating arc length using R?
Hi, All. I have a function I want to know the plotted length of. is it possible to calculate the length of the function (e.g., arc length)? for example, if I want to know the length of the line of sin(x) from -pi to pi, how can I do that in R? thanks! greg __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help