Re: [R] Is this correct?
Joe a écrit : Dear userR, With the following results, are they correct or acceptable? What can I do to correct them if they are not correct? http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f see also ?round hih __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] greek symbols using pch
This is now well off the topic of the subject line, but I am afraid some misinformation has been propagated (and that is the `bug'). There _are_ bugs in the code shown: the postscript fonts support 32:255, not 1:256, and pch:0:31 are not taken from the font. It seems an uninformed modification of the code in ?postscript. What locale are you in? That's something bug.report() gives and the posting guide asks for (because it often matters). The code given works (albeit with warnings) in an 8-bit locale, but it often will not work in a multi-byte locale. In particular it does not work in a UTF-8 locale for a postcript() device. The help page for points() does point out clearly In a multi-byte locale such as UTF-8, numeric values of \code{pch} greater than or equal to 32 specify a Unicode code point. Thus in UTF-8, pch=167 should be interpreted as a Unicode code point, and that is not a Greek symbol. The problem for postscript() (and X11()) is that the standard font=5 is not encoded in the locale's encoding but Adobe Symbol, so supplying Unicode characters is unsupported. I think R is working as documented here, but the piece of documentation about font=5 is in a different place (it is driver-specific). Internationalization support for the postscript() driver is work in progress (more features will appear in 2.3.0), but at present all you can expect to work in a UTF-8 locale are ISO Latin-1 characters, and symbols via plotmath. (I am aware of a few things that are not quite right in the Unicode support: some are being fixed for 2.3.0.) On Tue, 11 Oct 2005, ecatchpole wrote: On 11/10/05 01:12, Earl F. Glynn wrote,: FISCHER, Matthew [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In a plot, can I specify pch to be a greek symbol? (I looked at show.pch() in the Hmisc package but couldn't see the right symbols in there). If not, I guess I can get around this using text(x,y,expression()). I'm not sure where this is explained very well. Having ?font give a clue about this would be nice. Use font=5, the symbol font. To see what's in font=5: par(font=5, las=1) plot(0:15,0:15,type=n,ylim=c(15,0), main=Symbols in Font=5, xlab=, ylab=,xaxt=n, yaxt=n) axis(BOTTOM-1, at=0:15, 1:16) axis(LEFT -2, at=0:15) abline(v=0.5 + 0:14, h=0.5 + 0:14, col=grey, lty=dotted) # pch index of any cell is 16*row + column for(i in 0:255) { x - i %%16; y - i %/% 16; points(x,y,pch=i+1) } When I execute this code, I get a calligraphic R or P occurring with all of the nifty characters, e.g. \clubsuit. For example par(font=5, las=1) plot(0:1, 0:1, type=n) points(.5, .5, pch=167) This occurs on screen and in postscript() output. And with R2.1.0 and R2.2.0. Is this a bug? Ted. -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Writing to a file with fixed precision
On Mon, 10 Oct 2005, Marc Schwartz wrote: On Mon, 2005-10-10 at 19:50 -0400, Richard Hedger wrote: Hi, I'm trying to ouput to a filled with a fixed precision: eg. if I have data x=c(1.0,1.4,2.0), I want to be able to ouput the following to a file: 1.00 1.40 2.00 I was wondering if there was a function to do this in R? Thanks, Richard It is possible that someone has written such a function somewhere. It's called format(). x - c(1.0,1.4,2.0) write(format(x, nsmall=14)) does this. However, this is relatively easy using write.table(). You just need to pre-format the numeric values prior to writing to the file: write.table(sprintf(%.14f, x), data.txt, col.names = FALSE, row.names = FALSE, quote = FALSE) Using sprintf(), we force the floats to have 14 decimal places. sprintf() outputs character vectors, so we remove the quoting of the resultant character vectors and don't write column/row names. Note that if 'x' is a matrix, using sprintf() will return a vector. So you might want to use the following instead to retain the dims: x [,1] [,2] [,3] [,4] [1,]147 10 [2,]258 11 [3,]369 12 x.fmt - apply(x, 1, function(x) sprintf(%.14f, x)) x.fmt [,1][,2][,3] [1,] 1.00 2.00 3.00 [2,] 4.00 5.00 6.00 [3,] 7.00 8.00 9.00 [4,] 10.00 11.00 12.00 write.table(x.fmt, data.txt, col.names = FALSE, row.names = FALSE, quote = FALSE) If needed, you can of course change the default delimiter from a to another character in write.table(). See ?write.table and ?sprintf. -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] aligning column of xyplots and removing space between them
The code below displays three graphs in three rows and one column but: 1. I want to remove the space between the graphs (I tried playing with position= arg to print.trellis but it seems quite difficult to get the right values and all my attempts had space between them or had overlapping graphs. Is there a better way to do this? 2. the widths of the plots are not the same even though I specified the same xlim= to them all. How do I make them the same? 3. how do I get rid of the ticks at the top of the bottom plot? 4. the bottom graph is supposed to plot 1:3 against itself but the third point is not showing even though I specified ylim = c(0,3). Must I specify ylim = c(0,3+1) or is there a better way? Here is the code (its a modified version of some code that I previously posted regarding a different question): ### everything from here to the grid.newpage line is just ### to set up the viewports for the graphs so you ### can just go to the comment that says ### 'relevant part starts here' library(grid) library(lattice) trellis.par.set(theme = col.whitebg()) grid.newpage() pushLayout - function(nr, nc, ..., name=layout) { pushViewport(viewport(layout=grid.layout(nr, nc, ...), name=name)) for (i in 1:nr) { for (j in 1:nc) { pushViewport(viewport(layout.pos.row=i, layout.pos.col=j)) upViewport() } } upViewport() } with.vpPath - with.viewport - function(data, expr, ...) { # if data is a vpPath it cannot be ROOT since NULL will not dispatch here depth - if (data$name == ROOT) 0 else downViewport(data$name) result - eval.parent(substitute(expr)) upViewport(depth) invisible(result) } grid.newpage() # n and nr are number of cells and rows n - nr - 3 nc - 1 # must be 1 heights - unit(c(2, rep(1, nr-1)), null) downViewport(pushLayout(nr, nc, heights = heights)) vpt - current.vpTree(all = FALSE) ### relevant part starts here # xlab - main - function(x) if (x) v for(k in 1:n) with(vpt$children[[k]], print( xyplot(v ~ v, list(v = 1:k), xlab = xlab(k == n), xlim = c(0,n), ylim = c(0,n), main = main(k == 1), scales = list(x = list(draw = k == n), y = list(alternating = 3))), newpage = FALSE) ) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Q: Suggestions for long-term data/program storage policy?
Dear list, we are a statistical/epidemiological departement that - after a few years of rapid growth - finally is getting around to formulate a general data storage and retention policy - mainly to ensure that we can reproduce results from published papers/theses easier in the future, but also with the hope that we get more synergy between related projects. We have formulated what we feel is a reasonable draft, requiring basically that the raw data, all programs to create derived data sets, and the analysis programs are stored and documented in a uniform manner, regardless of the analysis software used. The minimum data retention we are aiming for is 10 years, and the format for the raw data is quite sane (either flat ASCII or real Given the rapid devlopment cycle of R, this suggests that at the very least all non-base packages used in the analysis are stored together with each project. I have basically two questions: 1) Are old R versions (binaries/sources) going to be available on CRAN indefinitely? 2) Is .RData a reasonable file format for long term storage? I would also be very grateful for any other suggestions, comments or links for setting up and implementing such a storage policy (R- specific or otherwise). Thank you for your time, alexander [EMAIL PROTECTED] Medical Epidemiology Biostatistics Karolinska Institutet, Stockholm Tel: ++46-8-524-82329 Fax: ++46-8-31 49 75 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] knn
Hello, Why do I get doubt (NA) in the factor of test classification even if I fix l (minimum vote)? By setting l, no doubt should be occurred. Look forward to your reply Haleh __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with lapply(x, subset, ...) and variable select argument
Gabor Grothendieck wrote: The problem is that subset looks into its parent frame but in this case the parent frame is not the environment in tt but the environment in lapply since tt does not call subset directly but rather lapply does. Try this which is similar except we have added the line beginning with environment before the print statement. tt - function (n) { x - list(data.frame(a=1,b=2), data.frame(a=3,b=4)) environment(lapply) - environment() print(lapply(x, subset, select = n)) } n - b tt(a) What this does is create a new version of lapply whose parent is the environment in tt. On 10/10/05, joerg van den hoff [EMAIL PROTECTED] wrote: I need to extract identically named columns from several data frames in a list. the column name is a variable (i.e. not known in advance). the whole thing occurs within a function body. I'd like to use lapply with a variable 'select' argument. example: tt - function (n) { x - list(data.frame(a=1,b=2), data.frame(a=3,b=4)) for (xx in x) print(subset(xx, select = n)) ### works print (lapply(x, subset, select = a)) ### works print (lapply(x, subset, select = a)) ### works print (lapply(x, subset, select = n)) ### does not work as intended } n = b tt(a) #works (but selects not the intended column) rm(n) tt(a) #no longer works in the lapply call including variable 'n' question: how can I enforce evaluation of the variable n such that the lapply call works? I suspect it has something to do with eval and specifying the correct evaluation frame, but how? many thanks joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html many thanks to thomas and gabor for their help. both solutions solve my problem perfectly. but just as an attempt to improve my understanding of the inner workings of R (similar problems are sure to come up ...) two more question: 1. why does the call of the [ function (thomas' solution) behave different from subset in that the look up of the variable n works without providing lapply with the current environment (which is nice)? 2. using 'subset' in this context becomes more cumbersome, if sapply is used. it seems that than I need ... environment(sapply) - environment(lapply) - environment() sapply(x, subset, select = n)) ... to get it working (and that means you must know, that sapply uses lapply). or can I somehow avoid the additional explicit definition of the lapply-environment? again: many thanks joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot - no main title and missing abscissa value
Thanks Uwe. The R version I'm using is 2.1.1 on Mac OS 10.3.9 I was going to try and replicate this on a linux system at home but have not had the time so far. I'll let you know how it goes. Iain Uwe Ligges wrote: Iain Gallagher wrote: Hi. Sorry (esp to Uwe for the repeated messages!) Here is the data and my code in full. Thanks for the help. Data. DayYm1ImpYm1shamSemimpSemsham 05.785.781.221.36 144.3642.116.2618.83 338.3914.6618.022.86 557.761.0315.280.29 772.932.7118.61.06 1048.574.6111.265.21 1474.081.539.660.11 2173.860.147.20.02 Code ym- read.table(ym1expression.csv, header=T, sep=\t, quote=\) #read in ym data attach(ym)# make data visible to R par(mar=c(5,5,4,5),las=1, xpd=NA) x- c(0,1,3,5,7,10,14,21) plot(Day, Ym1Imp, ylim=c(0,100), type=b, bty=l, main=Ym1 Expression, cex=1.3, xaxt=n, yaxt=n) #plot implant data axis(side=1, at=c(0,1,3,5,7,10,14,21), labels=c(0,1,3,5,7,10,14,21)) # label x axis mtext(Day, side =1, at=10, line=3, cex=1.2) # title x axis mtext(AU, side=2, at=50, line=3, cex=1.2)# y axis title axis(side=2, at=c(0, 25, 50, 75, 100), labels=expression(0, 25, 50, 75, 100)) # label y axis arrows(x, Ym1Imp-Semimp, x, Ym1Imp+Semimp, code=3, angle=90, length=0.1)# place error bars points(Day, Ym1sham, type=b, pch=16, cex=1.3)# plot sham data arrows(x, Ym1sham-Semsham, x, Ym1sham+Semsham, code=3, angle=90, length=0.1)# plot sham error bars legend(20, 60, legend=Implant, pch=1, lty=1, bty=n)# implant legend legend(20, 50, legend=Sham, pch=16, lty=1, bty=n)# sham legend Iain Three points: 1. The main title appears for me under the Windows device. I really wonder why you do not see it, this seems to be quite a strange device dependence I would not expect in this case. Since you told us you have R 2.1, we do not know exactly what you have got - there is no such version. There are versions R-2.0.1, R-2.1.0 and R-2.1.1, though. Anyway, you told us you found a workaround. 2. In order to re-plot the axis labels, you should specify xlab=NA, ylab=NA in your call to plot() as in: plot(Day, Ym1Imp, ylim=c(0,100), type=b, bty=l, xlab=NA, ylab=NA, main=Ym1 Expression, cex=1.3, xaxt=n, yaxt=n) 3. As I have already guessed, the axis annotation of the tick at position 1 is left out because R thinks there is not enough space left. You can workaround this point by making the label appear separately as in: axis(side=1, at=c(0,3,5,7,10,14,21)) axis(1, 1) Uwe Ligges -- Iain Gallagher Institute for Infection Immunology Research Ashworth Laboratories Kings Buildings University of Edinburgh Edinburgh EH9 3JT UK (+44) 0131 651 3630 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Multiple expressions, when using substitute()
Yes, I did get a very helpful reply from Marc Schwartz. I have had substitute() working in legend(), when the legend argument has length one. The challenge was to find some way to do the equivalent of substitute() when several expressions appear in parallel, as may be required for legend(). The trick is to use bquote() to do the substitution. The resulting quoted expression (of mode call) can then be an element in a list, along with other quoted (or bquoted) expressions. The list elements, when passed to expression() via the args argument of do.call(), become unquoted expressions. Note that bquote() uses a syntax for the substitution of variables that is different from that used by substitute(). It would be useful to include some such example as below on the help page for bquote(): library(DAAG) Acmena - subset(rainforest, species=Acmena) plot(wood~dbh, data=Acmena) Acmena.lm - lm(log(wood) ~ log(dbh), data=Acmena) b - round(coef(Acmena.lm), 3) arg1 - bquote(italic(y) == .(A) * italic(x)^.(B), list(A=b[1], B=b[2])) arg2 - quote(where * italic(y) * =wood; * italic(x) * =dbh) legend(topleft, legend=do.call(expression, c(arg1, arg2)), bty=n) John Maindonald. On 11 Oct 2005, at 11:41 AM, Spencer Graves wrote: Have you received a reply to this post? I couldn't find one, and I couldn't find a solution, even though one must exist. I can get the substitute to work in main but not legend: B - 2:3 eB - substitute(y==a*x^b, list(a=B[1], b=B[2])) plot(1:2, 1:2, main=eB) You should be able to construct it using mtext, but I couldn't get the desired result using legend. hope this helps. spencer graves John Maindonald wrote: expression() accepts multiple expressions as arguments, thus: plot(1:2, 1:2) legend(topleft, expression(y == a * x^b, where * paste(y==wood; , x==dbh))) Is there a way to do this when values are to be substituted for a and b? i.e., the first element of the legend argument to legend() becomes, effectively: substitute(y == a * x^b, list(a = B[1], b=B[2])) John Maindonald email: [EMAIL PROTECTED] phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Bioinformation Science, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 John Maindonald email: [EMAIL PROTECTED] phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Bioinformation Science, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] font=5 (Was: greek symbols using pch)
Thanks for that. Very instructive, and much appreciated. And sorry, yes, I strayed well off the original topic. The Greek symbols come out fine with font=5 in my locale, Locale: LC_CTYPE=en_GB.UTF-8; LC_NUMERIC=C; LC_TIME=en_GB.UTF-8; I was interested in some of the other nice characters, for example \infty and \partial, that appear in the table, but with a calligraphic R attached to them. But plotmath() works fine, so I'm happy. Ted. On 11/10/05 17:36, Prof Brian Ripley wrote,: This is now well off the topic of the subject line, but I am afraid some misinformation has been propagated (and that is the `bug'). There _are_ bugs in the code shown: the postscript fonts support 32:255, not 1:256, and pch:0:31 are not taken from the font. It seems an uninformed modification of the code in ?postscript. What locale are you in? That's something bug.report() gives and the posting guide asks for (because it often matters). The code given works (albeit with warnings) in an 8-bit locale, but it often will not work in a multi-byte locale. In particular it does not work in a UTF-8 locale for a postcript() device. The help page for points() does point out clearly In a multi-byte locale such as UTF-8, numeric values of \code{pch} greater than or equal to 32 specify a Unicode code point. Thus in UTF-8, pch=167 should be interpreted as a Unicode code point, and that is not a Greek symbol. The problem for postscript() (and X11()) is that the standard font=5 is not encoded in the locale's encoding but Adobe Symbol, so supplying Unicode characters is unsupported. I think R is working as documented here, but the piece of documentation about font=5 is in a different place (it is driver-specific). Internationalization support for the postscript() driver is work in progress (more features will appear in 2.3.0), but at present all you can expect to work in a UTF-8 locale are ISO Latin-1 characters, and symbols via plotmath. (I am aware of a few things that are not quite right in the Unicode support: some are being fixed for 2.3.0.) On Tue, 11 Oct 2005, ecatchpole wrote: On 11/10/05 01:12, Earl F. Glynn wrote,: FISCHER, Matthew [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In a plot, can I specify pch to be a greek symbol? (I looked at show.pch() in the Hmisc package but couldn't see the right symbols in there). If not, I guess I can get around this using text(x,y,expression()). I'm not sure where this is explained very well. Having ?font give a clue about this would be nice. Use font=5, the symbol font. To see what's in font=5: par(font=5, las=1) plot(0:15,0:15,type=n,ylim=c(15,0), main=Symbols in Font=5, xlab=, ylab=,xaxt=n, yaxt=n) axis(BOTTOM-1, at=0:15, 1:16) axis(LEFT -2, at=0:15) abline(v=0.5 + 0:14, h=0.5 + 0:14, col=grey, lty=dotted) # pch index of any cell is 16*row + column for(i in 0:255) { x - i %%16; y - i %/% 16; points(x,y,pch=i+1) } When I execute this code, I get a calligraphic R or P occurring with all of the nifty characters, e.g. \clubsuit. For example par(font=5, las=1) plot(0:1, 0:1, type=n) points(.5, .5, pch=167) This occurs on screen and in postscript() output. And with R2.1.0 and R2.2.0. Is this a bug? Ted. -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with lapply(x, subset, ...) and variable select argument
As Gabor said, the issue here is that subset.data.frame() evaluates the value of the `select' argument in the parent.frame(); Thus, if you create a local function within lapply() (or sapply()) it works: tt - function (n) { x - list(data.frame(a = 1, b = 2), data.frame(a = 3, b = 4)) print(lapply(x, function(y, n) subset(y, select = n), n = n)) print(sapply(x, function(y, n) subset(y, select = n), n = n)) } tt(a) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: joerg van den hoff [EMAIL PROTECTED] To: Gabor Grothendieck [EMAIL PROTECTED]; Thomas Lumley [EMAIL PROTECTED] Cc: r-help r-help@stat.math.ethz.ch Sent: Tuesday, October 11, 2005 10:18 AM Subject: Re: [R] problem with lapply(x, subset,...) and variable select argument Gabor Grothendieck wrote: The problem is that subset looks into its parent frame but in this case the parent frame is not the environment in tt but the environment in lapply since tt does not call subset directly but rather lapply does. Try this which is similar except we have added the line beginning with environment before the print statement. tt - function (n) { x - list(data.frame(a=1,b=2), data.frame(a=3,b=4)) environment(lapply) - environment() print(lapply(x, subset, select = n)) } n - b tt(a) What this does is create a new version of lapply whose parent is the environment in tt. On 10/10/05, joerg van den hoff [EMAIL PROTECTED] wrote: I need to extract identically named columns from several data frames in a list. the column name is a variable (i.e. not known in advance). the whole thing occurs within a function body. I'd like to use lapply with a variable 'select' argument. example: tt - function (n) { x - list(data.frame(a=1,b=2), data.frame(a=3,b=4)) for (xx in x) print(subset(xx, select = n)) ### works print (lapply(x, subset, select = a)) ### works print (lapply(x, subset, select = a)) ### works print (lapply(x, subset, select = n)) ### does not work as intended } n = b tt(a) #works (but selects not the intended column) rm(n) tt(a) #no longer works in the lapply call including variable 'n' question: how can I enforce evaluation of the variable n such that the lapply call works? I suspect it has something to do with eval and specifying the correct evaluation frame, but how? many thanks joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html many thanks to thomas and gabor for their help. both solutions solve my problem perfectly. but just as an attempt to improve my understanding of the inner workings of R (similar problems are sure to come up ...) two more question: 1. why does the call of the [ function (thomas' solution) behave different from subset in that the look up of the variable n works without providing lapply with the current environment (which is nice)? 2. using 'subset' in this context becomes more cumbersome, if sapply is used. it seems that than I need ... environment(sapply) - environment(lapply) - environment() sapply(x, subset, select = n)) ... to get it working (and that means you must know, that sapply uses lapply). or can I somehow avoid the additional explicit definition of the lapply-environment? again: many thanks joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Q: Suggestions for long-term data/program storage policy?
Alexander Ploner wrote: Dear list, we are a statistical/epidemiological departement that - after a few years of rapid growth - finally is getting around to formulate a general data storage and retention policy - mainly to ensure that we can reproduce results from published papers/theses easier in the future, but also with the hope that we get more synergy between related projects. We have formulated what we feel is a reasonable draft, requiring basically that the raw data, all programs to create derived data sets, and the analysis programs are stored and documented in a uniform manner, regardless of the analysis software used. The minimum data retention we are aiming for is 10 years, and the format for the raw data is quite sane (either flat ASCII or real Given the rapid devlopment cycle of R, this suggests that at the very least all non-base packages used in the analysis are stored together with each project. I have basically two questions: 1) Are old R versions (binaries/sources) going to be available on CRAN indefinitely? 2) Is .RData a reasonable file format for long term storage? I would also be very grateful for any other suggestions, comments or links for setting up and implementing such a storage policy (R- specific or otherwise). I am coming more from a software development angle but you might want to take a look at subversion for versioning your projects. For non-geeky types, TortoiseSVN has a point and click interface. It handles binary files efficiently and you can easily go back and get earlier versions of your projects. http://subversion.tigris.org/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with lapply(x, subset, ...) and variable select argument
Dimitris Rizopoulos [EMAIL PROTECTED] writes: As Gabor said, the issue here is that subset.data.frame() evaluates the value of the `select' argument in the parent.frame(); Thus, if you create a local function within lapply() (or sapply()) it works: It's more complicated than that: It evaluates the select argument in a named list with names duplicating those of the data frame, and *then* in parent.frame. This is convenient for command line use, because you can specify ranges of variables as in dfsub - subset(dfr,select=c(sex:treat, x_pre:x_24)) but it is quite risky to try and do this inside a function - if you're passing in a variable, the result depends on whether there is a variable of the same name in the data frame! You can probably get around it using substitute() constructions, but I think it is safer to avoid using functions with nonstandard semantics inside functions. tt - function (n) { x - list(data.frame(a = 1, b = 2), data.frame(a = 3, b = 4)) print(lapply(x, function(y, n) subset(y, select = n), n = n)) print(sapply(x, function(y, n) subset(y, select = n), n = n)) } tt(a) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: joerg van den hoff [EMAIL PROTECTED] To: Gabor Grothendieck [EMAIL PROTECTED]; Thomas Lumley [EMAIL PROTECTED] Cc: r-help r-help@stat.math.ethz.ch Sent: Tuesday, October 11, 2005 10:18 AM Subject: Re: [R] problem with lapply(x, subset,...) and variable select argument Gabor Grothendieck wrote: The problem is that subset looks into its parent frame but in this case the parent frame is not the environment in tt but the environment in lapply since tt does not call subset directly but rather lapply does. Try this which is similar except we have added the line beginning with environment before the print statement. tt - function (n) { x - list(data.frame(a=1,b=2), data.frame(a=3,b=4)) environment(lapply) - environment() print(lapply(x, subset, select = n)) } n - b tt(a) What this does is create a new version of lapply whose parent is the environment in tt. On 10/10/05, joerg van den hoff [EMAIL PROTECTED] wrote: I need to extract identically named columns from several data frames in a list. the column name is a variable (i.e. not known in advance). the whole thing occurs within a function body. I'd like to use lapply with a variable 'select' argument. example: tt - function (n) { x - list(data.frame(a=1,b=2), data.frame(a=3,b=4)) for (xx in x) print(subset(xx, select = n)) ### works print (lapply(x, subset, select = a)) ### works print (lapply(x, subset, select = a)) ### works print (lapply(x, subset, select = n)) ### does not work as intended } n = b tt(a) #works (but selects not the intended column) rm(n) tt(a) #no longer works in the lapply call including variable 'n' question: how can I enforce evaluation of the variable n such that the lapply call works? I suspect it has something to do with eval and specifying the correct evaluation frame, but how? many thanks joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html many thanks to thomas and gabor for their help. both solutions solve my problem perfectly. but just as an attempt to improve my understanding of the inner workings of R (similar problems are sure to come up ...) two more question: 1. why does the call of the [ function (thomas' solution) behave different from subset in that the look up of the variable n works without providing lapply with the current environment (which is nice)? 2. using 'subset' in this context becomes more cumbersome, if sapply is used. it seems that than I need ... environment(sapply) - environment(lapply) - environment() sapply(x, subset, select = n)) ... to get it working (and that means you must know, that sapply uses lapply). or can I somehow avoid the additional explicit definition of the lapply-environment? again: many thanks joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list
Re: [R] knn
Please do read the posting guide and supply a reproducible example as it asks. Here it matters critically what you mean by `fix l' (to what value?). Is this knn in package class? Have you read the help page? Have you read the references (especially the first)? On Tue, 11 Oct 2005, Haleh Yasrebi wrote: Why do I get doubt (NA) in the factor of test classification even if I fix l (minimum vote)? By setting l, no doubt should be occurred. That is completely opposite to what the help page for knn in package class says happens, so why do you think so? -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Is this correct?
Joe wrote: Dear userR, With the following results, are they correct or acceptable? Yes. See the FAQ: 7.31 Why doesn't R think these numbers are equal? The only numbers that can be represented exactly in R's numeric type are integers and fractions whose denominator is a power of 2. Other numbers have to be rounded to (typically) 53 binary digits accuracy. As a result, two floating point numbers will not reliably be equal unless they have been computed by the same algorithm, and not always even then. For example R a - sqrt(2) R a * a == 2 [1] FALSE R a * a - 2 [1] 4.440892e-16 The function all.equal() compares two objects using a numeric tolerance of .Machine$double.eps ^ 0.5. If you want much greater accuracy than this you will need to consider error propagation carefully. For more information, see e.g. David Goldberg (1991), “What Every Computer Scientist Should Know About Floating-Point Arithmetic”, ACM Computing Surveys, 23/1, 5–48, also available via http://docs.sun.com/source/806-3568/ncg_goldberg.html. x - c(1.4, 1.2, 2.8) sum(x) [1] 5.4 sum(x) == 5.4 [1] FALSE (1.4 + 1.2 + 2.8) - 5.4 [1] -8.881784e-16 (1.4 + 1.2) - 2.6 [1] -4.440892e-16 2.6 - 1.5 - 1.1 [1] 0 version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.0 year 2005 month10 day 06 svn rev 35749 language R What can I do to correct them if they are not correct? Thanks! -- C. Joseph Lu Department of Statistics National Cheng-Kung University Tainan, Taiwan, ROC __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Q: Suggestions for long-term data/program storage policy?
Alexander Ploner wrote: Dear list, we are a statistical/epidemiological departement that - after a few years of rapid growth - finally is getting around to formulate a general data storage and retention policy - mainly to ensure that we can reproduce results from published papers/theses easier in the future, but also with the hope that we get more synergy between related projects. We have formulated what we feel is a reasonable draft, requiring basically that the raw data, all programs to create derived data sets, and the analysis programs are stored and documented in a uniform manner, regardless of the analysis software used. The minimum data retention we are aiming for is 10 years, and the format for the raw data is quite sane (either flat ASCII or real Given the rapid devlopment cycle of R, this suggests that at the very least all non-base packages used in the analysis are stored together with each project. I have basically two questions: 1) Are old R versions (binaries/sources) going to be available on CRAN indefinitely? I think sources will be, binaries much less reliably. (I just discovered that one or two of the old Windows binaries are corrupted; I'm not sure I'll be able to find good copies.) 2) Is .RData a reasonable file format for long term storage? I think the intention is that it will be supported in future versions of R, but storing data in a binary format is risky. What if you don't use R in 5 years? You would find it a lot easier to decode text format files in another package than .RData format. The other advantage of text format is that it works very well with version control systems like Subversion or CVS. You can see several versions of the file, see comments on why changes were made, etc. Duncan Murdoch I would also be very grateful for any other suggestions, comments or links for setting up and implementing such a storage policy (R- specific or otherwise). Thank you for your time, alexander [EMAIL PROTECTED] Medical Epidemiology Biostatistics Karolinska Institutet, Stockholm Tel: ++46-8-524-82329 Fax: ++46-8-31 49 75 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R on a supercomputer
On 10/10/05 3:54 PM, Kimpel, Mark William [EMAIL PROTECTED] wrote: I am using R with Bioconductor to perform analyses on large datasets using bootstrap methods. In an attempt to speed up my work, I have inquired about using our local supercomputer and asked the administrator if he thought R would run faster on our parallel network. I received the following reply: The second benefit is that the processors have large caches. Briefly, everything is loaded into cache before going into the processor. With large caches, there is less movement of data between memory and cache, and this can save quite a bit of time. Indeed, when programmers optimize code they usually think about how to do things to keep data in cache as long as possible. Whether you would receive any benefit from larger cache depends on how R is written. If it's written such that data remain in cache, the speed-up could be considerable, but I have no way to predict it. My question is, is R written such that data remain in cache? Using the cluster model (which may or may not be what you are calling a supercomputer--I don't know the exact terminology here), jobs that involve repetitive, independent tasks like computing statistics on bootstrap replicates can benefit from parallelization IF the I/O associated with running the single replicate does not outweigh the benefit of using multiple processors. For example, if you are running 1 replicates and each takes 1 ms, then you have a 10 second job on a single processor. One could envision spreading that same process over 1000 processors and doing the job in 10 ms, but if one counts the I/O (network, moving into cache, etc.) which could take 1 second per batch of replicates (for example), then that job will take AT LEAST 10 seconds with 1000 processors, also. However, if the same computation takes 1 second per replicate, then the whole job takes 10,000 seconds on a single processor, but only about 11 seconds on the 1000 processors (approximately). This rationale is only approximate, but I hope it shows the point. We have begun to use a 60-node linux cluster for some of our work (also microarray-based) and use MPI/snow with very nice results for multiple independent, long-running tasks. Snow is VERY easy to use, but one could also drop back to the Rmpi if needed, to have finer-grain control over the parallelization process. As for how caching behaviors come into it and how R without parallelized R-code would perform, I can't really comment; my experience is limited to the cluster model with parallelized R-code. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Q: Suggestions for long-term data/program storage policy?
On Tue, 11 Oct 2005, Alexander Ploner wrote: we are a statistical/epidemiological departement that - after a few years of rapid growth - finally is getting around to formulate a general data storage and retention policy - mainly to ensure that we can reproduce results from published papers/theses easier in the future, but also with the hope that we get more synergy between related projects. We have formulated what we feel is a reasonable draft, requiring basically that the raw data, all programs to create derived data sets, and the analysis programs are stored and documented in a uniform manner, regardless of the analysis software used. The minimum data retention we are aiming for is 10 years, and the format for the raw data is quite sane (either flat ASCII or real You are intending to retain copies of the OS used and hardware too? The results depend far more on those than you apparently realize. Given the rapid devlopment cycle of R, I think you will find your OS changes as fast: all those security updates potentially affect your results. this suggests that at the very least all non-base packages used in the analysis are stored together with each project. I have basically two questions: 1) Are old R versions (binaries/sources) going to be available on CRAN indefinitely? Not binaries. The intention is that source files be available, but they could become corrupted (as it seems the Windows binary has for a past version). 2) Is .RData a reasonable file format for long term storage? I would say not, as it is almost impossible to recover from any corruption in such a file. We like to have long-term data in a human-readable printout, with a print copy, and also store some checksums. I would also be very grateful for any other suggestions, comments or links for setting up and implementing such a storage policy (R- specific or otherwise). You need to consider the medium on which you are going to store the archive. We currrently use CD-R (and not tapes as those are less compatible across drives -- we have two identical drives currently but do not expect either to last 10 years), and check them annually -- I guess we will re-write to another medium after much less than 10 years. -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Q: Suggestions for long-term data/program storage policy?
On 10/11/05 6:54 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: Alexander Ploner wrote: Dear list, we are a statistical/epidemiological departement that - after a few years of rapid growth - finally is getting around to formulate a general data storage and retention policy - mainly to ensure that we can reproduce results from published papers/theses easier in the future, but also with the hope that we get more synergy between related projects. I would also be very grateful for any other suggestions, comments or links for setting up and implementing such a storage policy (R- specific or otherwise). I would also consider a relational database (such as mysql or postgres) for your data warehousing. These products (particularly postgres) are designed with data integrity first-and-foremost. Data formats can change over time, but the data can be easily extracted from the database to match the needs at hand. Data generated at different times can be easily mined and combined as needed. The data backup process is fairly straightforward. R already integrates with several relational database systems, so an integrated solution can be defined if one so desires. Look at RMySQL, Rdbi, and RdbiPgSQL for how to integrate R with MySQL and Postgres. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] random effects are mixture of normals
Dear All, I wonder if there is an R package to estimate the generalized linear mixed models but with a random effects having a mixture of normals as a prior distributinon .. Thank you, Abderrahim [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Writing to a file with fixed precision
On Tue, 2005-10-11 at 08:42 +0100, Prof Brian Ripley wrote: On Mon, 10 Oct 2005, Marc Schwartz wrote: On Mon, 2005-10-10 at 19:50 -0400, Richard Hedger wrote: Hi, I'm trying to ouput to a filled with a fixed precision: eg. if I have data x=c(1.0,1.4,2.0), I want to be able to ouput the following to a file: 1.00 1.40 2.00 I was wondering if there was a function to do this in R? Thanks, Richard It is possible that someone has written such a function somewhere. It's called format(). x - c(1.0,1.4,2.0) write(format(x, nsmall=14)) does this. Indeed. Sorry, I was not clear in my use of words. I was thinking along the lines of a single function call such as: write.fmt(x, file = data.txt, ndigits = 14) It would of course be easy enough to create such a wrapper using existing functions. I was aware of format(), but for some reason had in the back of my mind that the use of 'nsmall' was not consistent in the decimal place output based upon prior experience. The result of which led me to use the vectorized formatC() to control such output. I then shifted to using sprintf(), when in 2.1.0, it was vectorized. Using format() also adds the benefit of having methods for matrices, etc., as opposed to sprintf(). Thanks, Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Vectorizing loop
I don't have anything specific to say. Only the following suggestion: Try and find out where in the code most of the time is spent. R has nice tools for that. See ?Rprof. If it's runifpoint() and Kest() that are taking most of the computing time, you may not be able to do much better. Andy From: Rainer M. Krug Sorry runifpoint() and Kest are from the package spatstat Rainer Liaw, Andy wrote: Not unless we know what runifpoint() and Kest() are. AFAIK these are not part of base R. If you use functions from add-on packages, please state them so as not to leave others guessing. (This is in the Posting Guide, which you were asked to read.) Andy From: Rainer M. Krug Hi I have the following loop and would like to vectorize it. Any ideas if it is possible? Thanks, Rainer Tha Loop: for (i in 2:Result$NoSims) { ppp - runifpoint(Result$NoPlants) K - Kest(ppp) Result$LSim[i,] - sqrt(K$iso / pi) - K$r CM - (Result$LSim[i,] * Result$LSim[i,]) / abs(K$r[2] - K$r[1]) Result$SigCM[i] - sum(CM, na.rm=TRUE) print(i) flush.console() } __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] glm contrasts (was: no subject)
estimable in bundle gregmisc (package gmodels) should do this. (Kiebitzers: Hope I got the bundle/package/library definition correct) FWIW, we tried gregmisc as a bundle, but it proved to be too much of a pain, so all of the component packages are now separately provided. The 'gremgisc' package now simply depends on the individual components. Thus, install.package('gregmisc',depend=TRUE) will get all of the packages. -Greg -- LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Hmisc latex function
I'm using R 2.2.0 on an up-to-date version of Fedora Core 4 with the latest version of Hmisc. When I run an example from the latex function I get the following: x - matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','enLine 2'))) x c d enLine 2 a 1 35 b 2 46 latex(x) # creates x.tex in working directory sh: line 0: cd: “/tmp/Rtmpl10983”: No such file or directory This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) entering extended mode ! I can't find file `“/tmp/Rtmpl10983/file643c9869”'. * “/tmp/Rtmpl10983/file643c9869” Please type another input file name: q (/usr/share/texmf/tex/latex/tools/q.tex LaTeX2e 2003/12/01 Babel v3.8d and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur kish, ukrainian, nohyphenation, loaded. File ignored xdvi-motif.bin: Fatal error: /tmp/Rtmpl10983/file643c9869.dvi: No such file. How can I fix this? Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with lapply(x, subset, ...) and variable select argument
On Tue, 11 Oct 2005, joerg van den hoff wrote: many thanks to thomas and gabor for their help. both solutions solve my problem perfectly. but just as an attempt to improve my understanding of the inner workings of R (similar problems are sure to come up ...) two more question: 1. why does the call of the [ function (thomas' solution) behave different from subset in that the look up of the variable n works without providing lapply with the current environment (which is nice)? [ behaves like nearly all functions in R: the value of the argument is passed. subset() does some tricky things to subvert the usual argument passing. Quite a few of the modelling functions do similar tricky things, and they do sometimes get confused when passed as arguments to another function. 2. using 'subset' in this context becomes more cumbersome, if sapply is used. it seems that than I need ... environment(sapply) - environment(lapply) - environment() sapply(x, subset, select = n)) ... to get it working (and that means you must know, that sapply uses lapply). or can I somehow avoid the additional explicit definition of the lapply-environment? You really don't want to go around playing with environment() on functions. That way lies madness. Use subset at the command line and [ or [[ in programming. I don't think I have ever set environment() on a function (only on formulas). -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with lapply(x, subset, ...) and variable select argument
Just one simple shortening of DR's solution: tt - function (n) { x - list(data.frame(a=1,b=2), data.frame(a=3,b=4)) print(sapply(x, function(...) subset(...), select = n)) } n - b tt(a) On 10/11/05, Dimitris Rizopoulos [EMAIL PROTECTED] wrote: As Gabor said, the issue here is that subset.data.frame() evaluates the value of the `select' argument in the parent.frame(); Thus, if you create a local function within lapply() (or sapply()) it works: tt - function (n) { x - list(data.frame(a = 1, b = 2), data.frame(a = 3, b = 4)) print(lapply(x, function(y, n) subset(y, select = n), n = n)) print(sapply(x, function(y, n) subset(y, select = n), n = n)) } tt(a) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: joerg van den hoff [EMAIL PROTECTED] To: Gabor Grothendieck [EMAIL PROTECTED]; Thomas Lumley [EMAIL PROTECTED] Cc: r-help r-help@stat.math.ethz.ch Sent: Tuesday, October 11, 2005 10:18 AM Subject: Re: [R] problem with lapply(x, subset,...) and variable select argument Gabor Grothendieck wrote: The problem is that subset looks into its parent frame but in this case the parent frame is not the environment in tt but the environment in lapply since tt does not call subset directly but rather lapply does. Try this which is similar except we have added the line beginning with environment before the print statement. tt - function (n) { x - list(data.frame(a=1,b=2), data.frame(a=3,b=4)) environment(lapply) - environment() print(lapply(x, subset, select = n)) } n - b tt(a) What this does is create a new version of lapply whose parent is the environment in tt. On 10/10/05, joerg van den hoff [EMAIL PROTECTED] wrote: I need to extract identically named columns from several data frames in a list. the column name is a variable (i.e. not known in advance). the whole thing occurs within a function body. I'd like to use lapply with a variable 'select' argument. example: tt - function (n) { x - list(data.frame(a=1,b=2), data.frame(a=3,b=4)) for (xx in x) print(subset(xx, select = n)) ### works print (lapply(x, subset, select = a)) ### works print (lapply(x, subset, select = a)) ### works print (lapply(x, subset, select = n)) ### does not work as intended } n = b tt(a) #works (but selects not the intended column) rm(n) tt(a) #no longer works in the lapply call including variable 'n' question: how can I enforce evaluation of the variable n such that the lapply call works? I suspect it has something to do with eval and specifying the correct evaluation frame, but how? many thanks joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html many thanks to thomas and gabor for their help. both solutions solve my problem perfectly. but just as an attempt to improve my understanding of the inner workings of R (similar problems are sure to come up ...) two more question: 1. why does the call of the [ function (thomas' solution) behave different from subset in that the look up of the variable n works without providing lapply with the current environment (which is nice)? 2. using 'subset' in this context becomes more cumbersome, if sapply is used. it seems that than I need ... environment(sapply) - environment(lapply) - environment() sapply(x, subset, select = n)) ... to get it working (and that means you must know, that sapply uses lapply). or can I somehow avoid the additional explicit definition of the lapply-environment? again: many thanks joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] probs in installing packages with R 2.2.0
Dear R users. I was wondering if you could help me with this error message I get when I try to install packages. I just installed R (the latest version, R 2.2.0) on my laptop (windows), and I was trying to install packages intwo ways: 1) Packages Install Package(s)... 2) Packages Install Package(s) from local zip files... , but in both ways I get the following error message: Warning: unable to access index for repository http://cran.uk.r-project.org/bin/windows/contrib/2.2 Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.2 Error in install.packages(NULL, .libPaths()[1], dependencies = TRUE, type = type) : no packages were specified PS: I try selecting my CRAN mirror from different parts (UK, USA, ...), but it doesn't work Any idea, what is wrong with that? Should I install something before installing packages? Thanks in advance for your help! Cheers, Marco [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] probs in installing packages with R 2.2.0
I expect you need to set a proxy. This is covered in the rw-FAQ that we do ask you to read before posting. See the item The internet download functions fail. On Tue, 11 Oct 2005, Giannitrapani, Marco GSUK-GSSC wrote: Dear R users. I was wondering if you could help me with this error message I get when I try to install packages. I just installed R (the latest version, R 2.2.0) on my laptop (windows), and I was trying to install packages intwo ways: 1) Packages Install Package(s)... 2) Packages Install Package(s) from local zip files... , but in both ways I get the following error message: Warning: unable to access index for repository http://cran.uk.r-project.org/bin/windows/contrib/2.2 Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.2 Error in install.packages(NULL, .libPaths()[1], dependencies = TRUE, type = type) : no packages were specified PS: I try selecting my CRAN mirror from different parts (UK, USA, ...), but it doesn't work Any idea, what is wrong with that? Should I install something before installing packages? Thanks in advance for your help! Cheers, Marco [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Sweave and Rnews
Hello list, I am writing a paper for Rnews. I use Sweave to do it. I did not find information about writing a paper for Rnews using Sweave and have some questions: - Is there a problem to use the environment 'Sinput' in the place of 'example' or 'smallexample'. It works fine but perhaps there are some technical/editorial problems ? - I have some long lines of code in schunk. I did not find any way to cut them in the Rnw file and they appear out of the column in the dvi file. The only solution I found is to cut these lines in the tex file generated by Sweave. Is there a more elegant and automatic solution to this problem? Thanks in advance. -- Stéphane DRAY ([EMAIL PROTECTED] ) Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - Lyon I 43, Bd du 11 Novembre 1918, 69622 Villeurbanne Cedex, France Tel: 33 4 72 43 27 57 Fax: 33 4 72 43 13 88 http://www.steph280.freesurf.fr/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Set Covering Problem (SCP) (in mathgraphs)
Dear All, Can I solve a Set Covering Problem (in a mathgraph) using R? Which package should I use for that? Thank you in advance. Sara Maltez Mouro [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] font=5 (Was: greek symbols using pch)
ecatchpole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for that. Very instructive, and much appreciated. And sorry, yes, I strayed well off the original topic. The Greek symbols come out fine with font=5 in my locale, Locale: LC_CTYPE=en_GB.UTF-8; LC_NUMERIC=C; LC_TIME=en_GB.UTF-8; I was interested in some of the other nice characters, for example \infty and \partial, that appear in the table, but with a calligraphic R attached to them. But plotmath() works fine, so I'm happy. I performed some tests with font=5 on both Linux and Windows using source(font5.R), which is shown below, and then calling the Font5Test() function. Consistent results were seen with devices X11, png, and jpeg under either Linux (R 2.1.1) or Windows (R 2.2.0) in my locale. Oddly, both the pdf and postscript devices create 2 pages of output with the first page the expected table and a second unexpected page with only the clubs suite symbol (167) in the middle of the plot. I'd call this a bug, but I guess I haven't read all the documentation about this yet. efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research font5.R == ShowFont5 - function() { oldpar - par(font=5, las=1) plot(0:1, 0:1, type=n) points(.5, .5, pch=167) par(font=5, las=1) plot(0:15,0:15,type=n,ylim=c(15,0), main=Symbols in Font=5, xlab=, ylab=,xaxt=n, yaxt=n) axis(BOTTOM-1, at=0:15) axis(LEFT -2, at=0:15, 16*0:15) abline(v=0.5 + 0:14, h=0.5 + 0:14, col=grey, lty=dotted) # pch index of any cell is 16*row + column for(i in 0:255) { x - i %%16; y - i %/% 16; points(x,y,pch=i) } par(oldpar) } Font5Test - function() { X11() ShowFont5() dev.off() pdf(font5.pdf) ShowFont5() dev.off() png(font5.png) ShowFont5() dev.off() jpeg(font5.jpg) ShowFont5() dev.off() postscript(font5.ps) ShowFont5() dev.off() } Linux Test === Sys.getlocale() [1] C R.Version() $platform [1] x86_64-unknown-linux-gnu $arch [1] x86_64 $os [1] linux-gnu $system [1] x86_64, linux-gnu $status [1] $major [1] 2 $minor [1] 1.1 $year [1] 2005 $month [1] 06 $day [1] 20 $language [1] R Windows Test == Sys.getlocale() [1] LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 R.Version() $platform [1] i386-pc-mingw32 $arch [1] i386 $os [1] mingw32 $system [1] i386, mingw32 $status [1] $major [1] 2 $minor [1] 2.0 $year [1] 2005 $month [1] 10 $day [1] 06 $svn rev [1] 35749 $language [1] R __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Sweave and Rnews
Le 11 Octobre 2005 11:18, Stéphane Dray a écrit : - I have some long lines of code in schunk. I did not find any way to cut them in the Rnw file and they appear out of the column in the dvi file. The only solution I found is to cut these lines in the tex file generated by Sweave. Is there a more elegant and automatic solution to this problem? See the Sweave FAQ: http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html#x1-16000A.14 -- Vincent Goulet, Professeur agrégé École d'actuariat Université Laval, Québec [EMAIL PROTECTED] http://vgoulet.act.ulaval.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Q: Suggestions for long-term data/program storage policy?
A general comment. As usual, Brian is right on target. Indeed, this has been written, conferenced, agonized, kvetched, etc. about extensively in the computer science community (and no doubt, among many others ... like accountants). I seem to remember reading a Scientific American Magazine article (or was it Science) about 10-15 years ago. As Brian says, it's not only application versions, applications, OS's -- but even hardware that goes obsolete. Do you have any data on 5 1/4 floppies from appications written for CP/M running on an Intel 8080? Think of poor banks, drug companies -- or the census bureau -- who have to keep their data forever. I sometimes wonder if all these bits and bytes will fill up all the earth's storage eventually? :-) Anyway, you might try researching this in the CS literature to see what the strategy du jour is for this. Cheers, -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Prof Brian Ripley Sent: Tuesday, October 11, 2005 4:05 AM To: Alexander Ploner Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Q: Suggestions for long-term data/program storage policy? On Tue, 11 Oct 2005, Alexander Ploner wrote: we are a statistical/epidemiological departement that - after a few years of rapid growth - finally is getting around to formulate a general data storage and retention policy - mainly to ensure that we can reproduce results from published papers/theses easier in the future, but also with the hope that we get more synergy between related projects. We have formulated what we feel is a reasonable draft, requiring basically that the raw data, all programs to create derived data sets, and the analysis programs are stored and documented in a uniform manner, regardless of the analysis software used. The minimum data retention we are aiming for is 10 years, and the format for the raw data is quite sane (either flat ASCII or real You are intending to retain copies of the OS used and hardware too? The results depend far more on those than you apparently realize. Given the rapid devlopment cycle of R, I think you will find your OS changes as fast: all those security updates potentially affect your results. this suggests that at the very least all non-base packages used in the analysis are stored together with each project. I have basically two questions: 1) Are old R versions (binaries/sources) going to be available on CRAN indefinitely? Not binaries. The intention is that source files be available, but they could become corrupted (as it seems the Windows binary has for a past version). 2) Is .RData a reasonable file format for long term storage? I would say not, as it is almost impossible to recover from any corruption in such a file. We like to have long-term data in a human-readable printout, with a print copy, and also store some checksums. I would also be very grateful for any other suggestions, comments or links for setting up and implementing such a storage policy (R- specific or otherwise). You need to consider the medium on which you are going to store the archive. We currrently use CD-R (and not tapes as those are less compatible across drives -- we have two identical drives currently but do not expect either to last 10 years), and check them annually -- I guess we will re-write to another medium after much less than 10 years. -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Two factor (or more) non-parametric comparison of means
Can anyone suggest a good non-parametric test, and an R implementation of the test, that allows for two or more factors? Wilcoxon signed rank allows for only one. Thanks, John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC and University of Maryland School of Medicine Claude Pepper OAIC University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 410-605-7119 - NOTE NEW EMAIL ADDRESS: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Logistic Regression using glm
Hello everyone, I am currently teaching an intermediate stats. course at UCSD Extension using R. We are using Venables and Ripley as the primary text for the course, with Freund Wilson's Statistical Methods as a secondary reference. I recently gave a homework assignment on logistic regression, and I had a question about glm. Let n be the number of trials, p be the estimated sample proportion, and w be the standard binomial weights n*p*(1-p). If you perform output - glm(p ~ x, family = binomial, weights = n) you get a different result than if you perform the logit transformation manually on p and perform output - lm(logit(p) ~ x, weights = w), where logit(p) is either obtained from R with qlogis(p) or from a manual computation of ln(p/1-p). The difference seems to me to be too large to be roundoff error. The only thing I can guess is that the application of the weights in glm is different than in a manual computation. Can anyone explain the difference in results? Daniel Pick Principal Daniel Pick Scientific Software Consulting San Diego, CA E-Mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Two factor (or more) non-parametric comparison of means
?kruskal.test 2005/10/11, John Sorkin [EMAIL PROTECTED]: Can anyone suggest a good non-parametric test, and an R implementation of the test, that allows for two or more factors? Wilcoxon signed rank allows for only one. Thanks, John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC and University of Maryland School of Medicine Claude Pepper OAIC University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 410-605-7119 -- NOTE NEW EMAIL ADDRESS: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Johan Sandblom N8, MRC, Karolinska sjh t +46851776108 17176 Stockholm m +46735521477 Sweden What is wanted is not the will to believe, but the will to find out, which is the exact opposite - Bertrand Russell __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Two factor (or more) non-parametric comparison of means
I suspect that John may be looking for ?friedman.test, which I believe will allow for a two-way non-parametric test. kruskal.test() will perform a non-parametric test on two or more samples (or factor levels) as a generalization of wilcox.test() for one or two samples (or factor levels). HTH, Marc Schwartz On Tue, 2005-10-11 at 18:22 +0200, Johan Sandblom wrote: ?kruskal.test 2005/10/11, John Sorkin [EMAIL PROTECTED]: Can anyone suggest a good non-parametric test, and an R implementation of the test, that allows for two or more factors? Wilcoxon signed rank allows for only one. Thanks, John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Hmisc latex function
On Tue, 2005-10-11 at 10:01 -0400, Rick Bilonick wrote: I'm using R 2.2.0 on an up-to-date version of Fedora Core 4 with the latest version of Hmisc. When I run an example from the latex function I get the following: x - matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','enLine 2'))) x c d enLine 2 a 1 35 b 2 46 latex(x) # creates x.tex in working directory sh: line 0: cd: “/tmp/Rtmpl10983”: No such file or directory This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) entering extended mode ! I can't find file `“/tmp/Rtmpl10983/file643c9869”'. * “/tmp/Rtmpl10983/file643c9869” Please type another input file name: q (/usr/share/texmf/tex/latex/tools/q.tex LaTeX2e 2003/12/01 Babel v3.8d and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur kish, ukrainian, nohyphenation, loaded. File ignored xdvi-motif.bin: Fatal error: /tmp/Rtmpl10983/file643c9869.dvi: No such file. How can I fix this? Rick B. I get the same results, also on FC4 with R 2.2.0. I am cc:ing Frank here for his input, but a quick review of the code and created files suggests that there may be conflict between the locations of some of the resultant files during the latex system call. Some files appear in a temporary R directory, while others appear in the current R working directory. For example, if I enter the full filename: /tmp/RtmpC12100/file643c9869.tex at the latex prompt, I get: latex(x) sh: line 0: cd: “/tmp/RtmpC12100”: No such file or directory This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) entering extended mode ! I can't find file `“/tmp/RtmpC12100/file643c9869”'. * “/tmp/RtmpC12100/file643c9869” Please type another input file name: *** loading the extensions datasource /tmp/RtmpC12100/file643c9869.tex (/tmp/RtmpC12100/file643c9869.tex LaTeX2e 2003/12/01 Babel v3.8d and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur kish, ukrainian, nohyphenation, loaded. (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2004/02/16 v1.4f Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/usr/share/texmf/tex/latex/geometry/geometry.sty (/usr/share/texmf/tex/latex/graphics/keyval.sty) (/usr/share/texmf/tex/latex/geometry/geometry.cfg)) No file file643c9869.aux. [1] (./file643c9869.aux) ) Output written on file643c9869.dvi (1 page, 368 bytes). Transcript written on file643c9869.log. xdvi-motif.bin: Fatal error: /tmp/RtmpC12100/file643c9869.dvi: No such file. The temporary .tex file is present, but the .dvi, .aux and .log files are created in the current working R directory. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Problems with plot function
Hello all R users, My simulation function works correctly, but I have problems with plot function. You will find the following code using it. Thank you for your help ## simulation - function(k, n){ conc - seq(0,10,by=0.5) #choixg - seq(1, length(conc)) choixg - rep(0,length(conc)) for (i in 1:length(conc)){ choixg[i] - (k + conc[i])^2/((k+conc[i])^n + (k+1)^n) } return(choixg) } simulation(5,1) plot(conc, choixg, main =fonction de choix, col= blue, pch=20, xlab = concentration, ylab=proba de choisir la gauche) ## Lassana KOITA Service Technique de l'Aviation Civile (STAC) Direction Générale de l'Aviation Civile (DGAC) Tel: 01 49 56 80 60 Fax: 01 49 56 82 14 http://www.stac.aviation-civile.gouv.fr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Logistic Regression using glm
You're fitting two different models. The latter is saying: logit(p)=x+e, where e is a normal error, so that logit(p) is normal. lm fits a Linear Model, which uses normal error. The former says that p is Bernoulli; and p~Bernoulli does not imply logit(p) is normal. A Generalized Linear Model has different options for specifying the random component. Agresti's Categorical Data Analysis lays out the details very well. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Pick Sent: Tuesday, October 11, 2005 12:22 PM To: r-help@stat.math.ethz.ch Subject: [R] Logistic Regression using glm Hello everyone, I am currently teaching an intermediate stats. course at UCSD Extension using R. We are using Venables and Ripley as the primary text for the course, with Freund Wilson's Statistical Methods as a secondary reference. I recently gave a homework assignment on logistic regression, and I had a question about glm. Let n be the number of trials, p be the estimated sample proportion, and w be the standard binomial weights n*p*(1-p). If you perform output - glm(p ~ x, family = binomial, weights = n) you get a different result than if you perform the logit transformation manually on p and perform output - lm(logit(p) ~ x, weights = w), where logit(p) is either obtained from R with qlogis(p) or from a manual computation of ln(p/1-p). The difference seems to me to be too large to be roundoff error. The only thing I can guess is that the application of the weights in glm is different than in a manual computation. Can anyone explain the difference in results? Daniel Pick Principal Daniel Pick Scientific Software Consulting San Diego, CA E-Mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- This e-mail and any attachments may be confidential or\ ...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Logistic Regression using glm
One of these is modelling the mean of the logit of p, the other is modelling the logit of the mean of p. They aren't the same. -thomas On Tue, 11 Oct 2005, Daniel Pick wrote: Hello everyone, I am currently teaching an intermediate stats. course at UCSD Extension using R. We are using Venables and Ripley as the primary text for the course, with Freund Wilson's Statistical Methods as a secondary reference. I recently gave a homework assignment on logistic regression, and I had a question about glm. Let n be the number of trials, p be the estimated sample proportion, and w be the standard binomial weights n*p*(1-p). If you perform output - glm(p ~ x, family = binomial, weights = n) you get a different result than if you perform the logit transformation manually on p and perform output - lm(logit(p) ~ x, weights = w), where logit(p) is either obtained from R with qlogis(p) or from a manual computation of ln(p/1-p). The difference seems to me to be too large to be roundoff error. The only thing I can guess is that the application of the weights in glm is different than in a manual computation. Can anyone explain the difference in results? Daniel Pick Principal Daniel Pick Scientific Software Consulting San Diego, CA E-Mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Any way to add to data frame saved as .rData file?
Hi all, I've got a script that generates a few moderate-size data frames, and then puts them together into one big data frame at the end in order to write that data frame to disk, so that it may be re-opened later on... I'm trying to trim down memory requirements in this script, so I was wondering if there was any way to append to a data frame already saved on disk (just like appending to a text file)..all the data frames here have identical row names; what I want to do is to tack on additional columns to a data frame stored in the working directory... Alternatively, is there another data structure that would allow me to do this (and could preferably be converted to a data frame) ? Thanks in advance, Ken __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] non-zero sequence of numbers
Can anyone think of a way to create a pretty() sequence that excludes zero? Or a way to remove the zero from a sequence after using pretty()? Thanks, - Jason Jason Horn Boston University Department of Biology 5 Cumington Street Boston, MA 02215 [EMAIL PROTECTED] office: 617 353 6987 cell: 401 588 2766 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Two factor (or more) non-parametric comparison of means
Marc Schwartz (via MN) [EMAIL PROTECTED] writes: I suspect that John may be looking for ?friedman.test, which I believe will allow for a two-way non-parametric test. You could be right, but you could also be wrong... It depends quite a bit on what is meant by a two-factor comparison of means. If he literally means means (!), then a permutation test (permuting within levels of the other factor) could be appropriate. It also makes a difference whether there's a single replication or more per cell in the cross-classification. kruskal.test() will perform a non-parametric test on two or more samples (or factor levels) as a generalization of wilcox.test() for one or two samples (or factor levels). HTH, Marc Schwartz On Tue, 2005-10-11 at 18:22 +0200, Johan Sandblom wrote: ?kruskal.test 2005/10/11, John Sorkin [EMAIL PROTECTED]: Can anyone suggest a good non-parametric test, and an R implementation of the test, that allows for two or more factors? Wilcoxon signed rank allows for only one. Thanks, John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Two factor (or more) non-parametric comparison of means
Peter, Good points all around. Hopefully John will provide further clarification. Best regards, Marc On Tue, 2005-10-11 at 19:46 +0200, Peter Dalgaard wrote: Marc Schwartz (via MN) [EMAIL PROTECTED] writes: I suspect that John may be looking for ?friedman.test, which I believe will allow for a two-way non-parametric test. You could be right, but you could also be wrong... It depends quite a bit on what is meant by a two-factor comparison of means. If he literally means means (!), then a permutation test (permuting within levels of the other factor) could be appropriate. It also makes a difference whether there's a single replication or more per cell in the cross-classification. kruskal.test() will perform a non-parametric test on two or more samples (or factor levels) as a generalization of wilcox.test() for one or two samples (or factor levels). HTH, Marc Schwartz On Tue, 2005-10-11 at 18:22 +0200, Johan Sandblom wrote: ?kruskal.test 2005/10/11, John Sorkin [EMAIL PROTECTED]: Can anyone suggest a good non-parametric test, and an R implementation of the test, that allows for two or more factors? Wilcoxon signed rank allows for only one. Thanks, John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] non-zero sequence of numbers
Jason Horn [EMAIL PROTECTED] writes: Can anyone think of a way to create a pretty() sequence that excludes zero? Or a way to remove the zero from a sequence after using pretty()? The former is rather hard because zero is generally considered just about the prettiest number around... As for the latter, something like s - pretty(x); s - s[s!=0] or maybe s[zapsmall(s) != 0]. Thanks, - Jason Jason Horn Boston University Department of Biology 5 Cumington Street Boston, MA 02215 [EMAIL PROTECTED] office: 617 353 6987 cell: 401 588 2766 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Need help write a function
Dear all, I am still learning R with write a small function for my self. I was wondering if someone can help me to write a R function formula below: Z_k (x) = \sum_{i=0}^{i=k} \binom{n}{i} (m-1)^i Thanks a million in advance, Sincerely, Jan Sabee [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Reading # in file with read.csv
I'm using read.csv to read in a csv file containing '#' characters. For example, say I'm reading the following file (test.csv): var1,var2,var3 a,b,c d,e#,f g,h,i It outputs: read.csv(Raw Data\\test.csv) var1 var2 var3 1abc 2de 3ghi Warning message: incomplete final line found by readTableHeader on 'Raw Data\test.csv' read.csv appears to be treating '#' as a comment even in input data. Is there a way to turn this interpretation off? Thanks, Mike __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to get aspect ratio as output from from plot()
Is there a way to get the aspect ratio as output from a plot() call or something similar in the base graphics system? I would like to note vertical exaggeration on an elevation profile. Thanks, Scott Waichler Pacific Northwest National Laboratory [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] a problem in random forest
Hi, there: I spent some time on this but I think I really cannot figure it out, maybe I missed something here: my data looks like this: dim(trn3) [1] 7361 209 dim(val3) [1] 7427 209 mg.rf2-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, xtest=val3[, 1:208], ytest=val3[,209], importance=T) my test data has 7427 observations but after prediction, dim(mg.rf2$votes) [1] 7361 2 which has the same length as my training data. but if I use mg.rf-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, importance=T) followed by mg.pred-predict(mg.rf, newdata=val3[,1:208]) length(mg.pred) [1] 7427 it works. But i need to know votes so I have to use the first way. Please help. Weiwei -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reading # in file with read.csv
Michel Friesenhahn wrote: I'm using read.csv to read in a csv file containing '#' characters. For example, say I'm reading the following file (test.csv): var1,var2,var3 a,b,c d,e#,f g,h,i It outputs: read.csv(Raw Data\\test.csv) var1 var2 var3 1abc 2de 3ghi Warning message: incomplete final line found by readTableHeader on 'Raw Data\test.csv' read.csv appears to be treating '#' as a comment even in input data. Is there a way to turn this interpretation off? From ?read.csv: comment.char: character: a character vector of length one containing a single character or an empty string. Use '' to turn off the interpretation of comments altogether. Thus, you should use: read.csv(Raw Data\\test.csv, comment.char = ) --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] a problem in random forest
I am sorry for bother. I think I figured that out. the result of votes for test data is not rf$votes, but rf$test$votes On 10/11/05, Weiwei Shi [EMAIL PROTECTED] wrote: Hi, there: I spent some time on this but I think I really cannot figure it out, maybe I missed something here: my data looks like this: dim(trn3) [1] 7361 209 dim(val3) [1] 7427 209 mg.rf2-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, xtest=val3[, 1:208], ytest=val3[,209], importance=T) my test data has 7427 observations but after prediction, dim(mg.rf2$votes) [1] 7361 2 which has the same length as my training data. but if I use mg.rf-randomForest(x=trn3[,1:208], y=trn3[,209], data=trn3, importance=T) followed by mg.pred-predict(mg.rf, newdata=val3[,1:208]) length(mg.pred) [1] 7427 it works. But i need to know votes so I have to use the first way. Please help. Weiwei -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Need help write a function
Jan Sabee wrote: Dear all, I am still learning R with write a small function for my self. I was wondering if someone can help me to write a R function formula below: Z_k (x) = \sum_{i=0}^{i=k} \binom{n}{i} (m-1)^i Thanks a million in advance, Sincerely, Jan Sabee (This smells like a homework problem.) What is m? Your Z_k is a function of x and there is no x on the RHS. Are you trying to re-write pbinom? --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Reading # in file with read.csv
Never mind on my previous question below. read.csv(Raw Data\\test.csv,comment.char=) does it. Mike I'm using read.csv to read in a csv file containing '#' characters. For example, say I'm reading the following file (test.csv): var1,var2,var3 a,b,c d,e#,f g,h,i It outputs: read.csv(Raw Data\\test.csv) var1 var2 var3 1abc 2de 3ghi Warning message: incomplete final line found by readTableHeader on 'Raw Data\test.csv' read.csv appears to be treating '#' as a comment even in input data. Is there a way to turn this interpretation off? Thanks, Mike __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to get aspect ratio as output from from plot()
Waichler, Scott R wrote: Is there a way to get the aspect ratio as output from a plot() call or something similar in the base graphics system? I would like to note vertical exaggeration on an elevation profile. Thanks, Scott Waichler Pacific Northwest National Laboratory [EMAIL PROTECTED] Hi, Scott, Perhaps this will work for you? plot(1:10) w - par(pin)[1]/diff(par(usr)[1:2]) h - par(pin)[2]/diff(par(usr)[3:4]) asp - w/h HTH, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] permutational Kolmogorov-Smirnov p-value for paired data
Here is one way to do a paired permutation test: perm1 - function(x,y){ rb - rbinom(length(x),1,0.5) xp - ifelse(rb==1, x, y) yp - ifelse(rb==1, y, x) ks.test(xp,yp)$statistic } my.x - rnorm(100) my.y - my.x + rnorm(100, 0.2, 0.1) mystat - ks.test(my.x,my.y)$statistic out - replicate(1000, perm1(my.x,my.y) ) hist(out) abline(v=mystat) mean(out mystat) hope this helps, Greg Snow, Ph.D. Statistical Data Center, LDS Hospital Intermountain Health Care [EMAIL PROTECTED] (801) 408-8111 John Chen [EMAIL PROTECTED] 10/07/05 06:05AM Dear List, I am new to R and find it very powerful. I would like to compute the permutational p-value for paired data using Kolmogorov-Smirnov, but the built-in ks.test does not have this option, unlike the t.test which has a paired=TRUE flag. Has someone written a library or a routine that does this? Alternatively, if someone could show me how to do pair-wise permutations in R, then I can compute the ks statistic for each permutation, that'll work too. Thank you! John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reading # in file with read.csv
Michel Friesenhahn [EMAIL PROTECTED] writes: I'm using read.csv to read in a csv file containing '#' characters. For example, say I'm reading the following file (test.csv): var1,var2,var3 a,b,c d,e#,f g,h,i It outputs: read.csv(Raw Data\\test.csv) var1 var2 var3 1abc 2de 3ghi Warning message: incomplete final line found by readTableHeader on 'Raw Data\test.csv' read.csv appears to be treating '#' as a comment even in input data. Is there a way to turn this interpretation off? comment.char= -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to get aspect ratio as output from from plot()
Sundar, Perhaps this will work for you? plot(1:10) w - par(pin)[1]/diff(par(usr)[1:2]) h - par(pin)[2]/diff(par(usr)[3:4]) asp - w/h Thank you for your help. For vertical exaggeration I will make a slight change to make it more intuitive (for me): w - diff(par(usr)[1:2]) / par(pin)[1] # plot units per inch horizontal axis h - diff(par(usr)[3:4]) / par(pin)[2] # plot units per inch vertical axis vertical.exaggeration - w/h Scott Waichler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] problems with levelplot and contourplot
Hello, Using the following code i want to make a level or contourplot of some data that I produced library(grid);library(lattice); mydata - read.table(avgee.dat); mymat - as.matrix(mydata); mymat -t(mymat) vals-as.vector(mymat); conc-c(0.0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5); a- c(0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5,5.0, 7.5,10, 25, 50, 75, 100); grid-expand.grid(x=conc, y=a); levelplot(vals ~ conc * a, grid, region=TRUE, cuts=20); When I do this get a blank output window and the following warnings Warning messages: 1: longer object length is not a multiple of shorter object length in: is.na(x) | is.na(y) 2: longer object length is not a multiple of shorter object length in: id.na | is.na(var) 3: longer object length is not a multiple of shorter object length in: id if (is.shingle(var)) ((var = levels(var)[[cond.current.level[i]]][1]) I've examined this mailinglist and the web and tried the examples other people suggested. They seem to work. Yet, my code seems the same as a -1:10 b -11:20 j - rnorm(100) grid-expand.grid(a = a, b = b) levelplot(j~a*b, grid) (from a previous mail) and it does not work. Can anybody tell me what I'm doing wrong? Furthermore as you ight notice the data in a is in log-scale so I want the y-axis of the plot in logscale. All the best Tom Tom Lenaerts (tlenaert at ulb.ac.be) http://www.tomlenaerts.tk/ Postdoc Researcher @ IRIDIA-Universite Libre de Bruxelles-Belgium Guest Professor @ DINF-Vrije Uiversiteit Brussel-Belgium [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problems with levelplot and contourplot
Tom Lenaerts wrote: Hello, Using the following code i want to make a level or contourplot of some data that I produced library(grid);library(lattice); No need to explicitly load grid. This is done when attaching lattice. Also, you do not need any ; at the end of any lines. mydata - read.table(avgee.dat); mymat - as.matrix(mydata); mymat -t(mymat) vals-as.vector(mymat); conc-c(0.0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5); a- c(0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5,5.0, 7.5,10, 25, 50, 75, 100); grid-expand.grid(x=conc, y=a); levelplot(vals ~ conc * a, grid, region=TRUE, cuts=20); Don't you mean levelplot(vals ~ x * y, grid, region=TRUE, cuts=20) Your data.frame grid has columns x and y, not conc and a. When I do this get a blank output window and the following warnings Warning messages: 1: longer object length is not a multiple of shorter object length in: is.na(x) | is.na(y) 2: longer object length is not a multiple of shorter object length in: id.na | is.na(var) 3: longer object length is not a multiple of shorter object length in: id if (is.shingle(var)) ((var = levels(var)[[cond.current.level[i]]][1]) I've examined this mailinglist and the web and tried the examples other people suggested. They seem to work. Yet, my code seems the same as a -1:10 b -11:20 j - rnorm(100) grid-expand.grid(a = a, b = b) levelplot(j~a*b, grid) (from a previous mail) and it does not work. Can anybody tell me what I'm doing wrong? Furthermore as you ight notice the data in a is in log-scale so I want the y-axis of the plot in logscale. To print y in log-scale, add the following: levelplot(..., scale = list(y = list(log = TRUE))) HTH, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] an error in my using of nnet
Hi, there: I am trying nnet as followed: mg.nnet-nnet(x=trn3[,r.v[1:100]], y=trn3[,209], size=5, decay = 5e-4, maxit = 200) # weights: 511 initial value 13822.108453 iter 10 value 7408.169201 iter 20 value 7362.201934 iter 30 value 7361.669408 iter 40 value 7361.294379 iter 50 value 7361.045190 final value 7361.038121 converged Error in y - tmp : non-numeric argument to binary operator Please help! Thanks, Weiwei -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problems with levelplot and contourplot
Dear Sundar Thanks a lot, this resolves the problem of the warning messages. Yet it does not produce the plot: I only get a blank Quartz panel (i'm using R on Mac OS X 1.3). I attached the file and the corrected code. Maybe it is a problem of the data? library(lattice); mydata - read.table(avgee.dat); mymat - as.matrix(mydata); mymat -t(mymat) vals-as.vector(mymat); conc-c(0.0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5); a- c(0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5,5.0, 7.5,10, 25, 50, 75, 100); grid-expand.grid(x=conc, y=a); levelplot(vals ~ x * y, grid, region=TRUE, cuts=20,scale = list(y = list(log = TRUE))); Thanks in advance Tom - Tom Lenaerts (tlenaert at ulb.ac.be) http://www.tomlenaerts.tk/ Postdoc Researcher @ IRIDIA-Universite Libre de Bruxelles-Belgium Guest Professor @ DINF-Vrije Uiversiteit Brussel-Belgium On 11 Oct 2005, at 22:26, Sundar Dorai-Raj wrote: scale = list(y = list(log = TRUE))__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Any way to add to data frame saved as .rData file?
Ken Termiso wrote: Hi all, I've got a script that generates a few moderate-size data frames, and then puts them together into one big data frame at the end in order to write that data frame to disk, so that it may be re-opened later on... I'm trying to trim down memory requirements in this script, so I was wondering if there was any way to append to a data frame already saved on disk (just like appending to a text file)..all the data frames here have identical row names; what I want to do is to tack on additional columns to a data frame stored in the working directory... No, I don't think so. Alternatively, is there another data structure that would allow me to do this (and could preferably be converted to a data frame) ? I'd put the extra columns in their own data frame, and save that to disk (use dates/times/process ids or some other unique identifier in the filenames to distinguish them). When you need access to a mixture of columns, load (or source, depending how you did the save) the columns you need, and cbind them together into one big data frame. If you are concerned about memory requirements when producing the pieces, watch out that you don't write out so much data that you'll never have enough memory to load all you need at once. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Q: Suggestions for long-term data/program storage policy?
Berton Gunter wrote: A general comment. As usual, Brian is right on target. Indeed, this has been written, conferenced, agonized, kvetched, etc. about extensively in the computer science community (and no doubt, among many others ... like accountants). I seem to remember reading a Scientific American Magazine article (or was it Science) about 10-15 years ago. As Brian says, it's not only application versions, applications, OS's -- but even hardware that goes obsolete. Do you have any data on 5 1/4 floppies from appications written for CP/M running on an Intel 8080? Think of poor banks, drug companies -- or the census bureau -- who have to keep their data forever. I sometimes wonder if all these bits and bytes will fill up all the earth's storage eventually? :-) Anyway, you might try researching this in the CS literature to see what the strategy du jour is for this. Now that journals are becoming electronic, librarians are also very concerned with this problem, and they tend to have very long term storage goals. Duncan Murdoch Cheers, -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Prof Brian Ripley Sent: Tuesday, October 11, 2005 4:05 AM To: Alexander Ploner Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Q: Suggestions for long-term data/program storage policy? On Tue, 11 Oct 2005, Alexander Ploner wrote: we are a statistical/epidemiological departement that - after a few years of rapid growth - finally is getting around to formulate a general data storage and retention policy - mainly to ensure that we can reproduce results from published papers/theses easier in the future, but also with the hope that we get more synergy between related projects. We have formulated what we feel is a reasonable draft, requiring basically that the raw data, all programs to create derived data sets, and the analysis programs are stored and documented in a uniform manner, regardless of the analysis software used. The minimum data retention we are aiming for is 10 years, and the format for the raw data is quite sane (either flat ASCII or real You are intending to retain copies of the OS used and hardware too? The results depend far more on those than you apparently realize. Given the rapid devlopment cycle of R, I think you will find your OS changes as fast: all those security updates potentially affect your results. this suggests that at the very least all non-base packages used in the analysis are stored together with each project. I have basically two questions: 1) Are old R versions (binaries/sources) going to be available on CRAN indefinitely? Not binaries. The intention is that source files be available, but they could become corrupted (as it seems the Windows binary has for a past version). 2) Is .RData a reasonable file format for long term storage? I would say not, as it is almost impossible to recover from any corruption in such a file. We like to have long-term data in a human-readable printout, with a print copy, and also store some checksums. I would also be very grateful for any other suggestions, comments or links for setting up and implementing such a storage policy (R- specific or otherwise). You need to consider the medium on which you are going to store the archive. We currrently use CD-R (and not tapes as those are less compatible across drives -- we have two identical drives currently but do not expect either to last 10 years), and check them annually -- I guess we will re-write to another medium after much less than 10 years. -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] aligning column of xyplots and removing space between them
On 10/11/05, Gabor Grothendieck [EMAIL PROTECTED] wrote: The code below displays three graphs in three rows and one column but: 1. I want to remove the space between the graphs (I tried playing with position= arg to print.trellis but it seems quite difficult to get the right values and all my attempts had space between them or had overlapping graphs. Is there a better way to do this? Define theme.novpadding - list(layout.heights = list(top.padding = 0, main.key.padding = 0, key.axis.padding = 0, axis.xlab.padding = 0, xlab.key.padding = 0, key.sub.padding = 0, bottom.padding = 0)) and then add par.settings = theme.novpadding to all your xyplot calls. 2. the widths of the plots are not the same even though I specified the same xlim= to them all. How do I make them the same? They seem to be the same for me, but they might be different if the y-axis labels are different. See the 'panel.width' argument in ?print.trellis. 3. how do I get rid of the ticks at the top of the bottom plot? add scales = list(x = list(relation = free)) 4. the bottom graph is supposed to plot 1:3 against itself but the third point is not showing even though I specified ylim = c(0,3). Must I specify ylim = c(0,3+1) or is there a better way? There's no better way. This behaviour is intentionally different from base graphics. Here's a modified version of the last part of your code: grid.newpage() # n and nr are number of cells and rows n - nr - 3 nc - 1 # must be 1 heights - unit(c(2, rep(1, nr-1)), null) downViewport(pushLayout(nr, nc, heights = heights)) vpt - current.vpTree(all = FALSE) ### relevant part starts here # xlab - main - function(x) if (x) v for(k in 1:n) with(vpt$children[[k]], print( xyplot(v ~ v, list(v = 1:k), xlab = xlab(k == n), xlim = c(0,n), ylim = c(0,n), main = main(k == 1), par.settings = theme.novpadding, scales = list(x = list(draw = k == n, relation = free, c(1, 0)), y = list(alternating = 3))), newpage = FALSE, panel.width = list(x = 4, units = inches)) ) -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problems with levelplot and contourplot
I have to correct my previous reply. The changes you propose work The strange thing is that if I upload the R-script to produce the plot from file using source(/Users/tomlenaerts/Programming/ObjC/Tools/AllEE/build/EEcont.R) The script does not work. When I copy-past the script myself into the R-window and execute things work ok. Any explanation for this? Tom - Tom Lenaerts (tlenaert at ulb.ac.be) http://www.tomlenaerts.tk/ Postdoc Researcher @ IRIDIA-Universite Libre de Bruxelles-Belgium Guest Professor @ DINF-Vrije Uiversiteit Brussel-Belgium On 11 Oct 2005, at 22:26, Sundar Dorai-Raj wrote: Tom Lenaerts wrote: Hello, Using the following code i want to make a level or contourplot of some data that I produced library(grid);library(lattice); No need to explicitly load grid. This is done when attaching lattice. Also, you do not need any ; at the end of any lines. mydata - read.table(avgee.dat); mymat - as.matrix(mydata); mymat -t(mymat) vals-as.vector(mymat); conc-c(0.0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5); a- c(0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5,5.0, 7.5,10, 25, 50, 75, 100); grid-expand.grid(x=conc, y=a); levelplot(vals ~ conc * a, grid, region=TRUE, cuts=20); Don't you mean levelplot(vals ~ x * y, grid, region=TRUE, cuts=20) Your data.frame grid has columns x and y, not conc and a. When I do this get a blank output window and the following warnings Warning messages: 1: longer object length is not a multiple of shorter object length in: is.na(x) | is.na(y) 2: longer object length is not a multiple of shorter object length in: id.na | is.na(var) 3: longer object length is not a multiple of shorter object length in: id if (is.shingle(var)) ((var = levels(var)[[cond.current.level[i]]][1]) I've examined this mailinglist and the web and tried the examples other people suggested. They seem to work. Yet, my code seems the same as a -1:10 b -11:20 j - rnorm(100) grid-expand.grid(a = a, b = b) levelplot(j~a*b, grid) (from a previous mail) and it does not work. Can anybody tell me what I'm doing wrong? Furthermore as you ight notice the data in a is in log-scale so I want the y-axis of the plot in logscale. To print y in log-scale, add the following: levelplot(..., scale = list(y = list(log = TRUE))) HTH, --sundar [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problems with levelplot and contourplot
Tom Lenaerts wrote: I have to correct my previous reply. The changes you propose work The strange thing is that if I upload the R-script to produce the plot from file using source(/Users/tomlenaerts/Programming/ObjC/Tools/AllEE/build/EEcont.R) The script does not work. When I copy-past the script myself into the R-window and execute things work ok. Any explanation for this? Yes. See FAQ 7.22. --sundar Tom - Tom Lenaerts (tlenaert at ulb.ac.be) http://www.tomlenaerts.tk/ Postdoc Researcher @ IRIDIA-Universite Libre de Bruxelles-Belgium Guest Professor @ DINF-Vrije Uiversiteit Brussel-Belgium On 11 Oct 2005, at 22:26, Sundar Dorai-Raj wrote: Tom Lenaerts wrote: Hello, Using the following code i want to make a level or contourplot of some data that I produced library(grid);library(lattice); No need to explicitly load grid. This is done when attaching lattice. Also, you do not need any ; at the end of any lines. mydata - read.table(avgee.dat); mymat - as.matrix(mydata); mymat -t(mymat) vals-as.vector(mymat); conc-c(0.0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5); a- c(0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5,5.0, 7.5,10, 25, 50, 75, 100); grid-expand.grid(x=conc, y=a); levelplot(vals ~ conc * a, grid, region=TRUE, cuts=20); Don't you mean levelplot(vals ~ x * y, grid, region=TRUE, cuts=20) Your data.frame grid has columns x and y, not conc and a. When I do this get a blank output window and the following warnings Warning messages: 1: longer object length is not a multiple of shorter object length in: is.na(x) | is.na(y) 2: longer object length is not a multiple of shorter object length in: id.na | is.na(var) 3: longer object length is not a multiple of shorter object length in: id if (is.shingle(var)) ((var = levels(var)[[cond.current.level[i]]][1]) I've examined this mailinglist and the web and tried the examples other people suggested. They seem to work. Yet, my code seems the same as a -1:10 b -11:20 j - rnorm(100) grid-expand.grid(a = a, b = b) levelplot(j~a*b, grid) (from a previous mail) and it does not work. Can anybody tell me what I'm doing wrong? Furthermore as you ight notice the data in a is in log-scale so I want the y-axis of the plot in logscale. To print y in log-scale, add the following: levelplot(..., scale = list(y = list(log = TRUE))) HTH, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] non-zero sequence of numbers
Jason Horn [EMAIL PROTECTED] wrote: Can anyone think of a way to create a pretty() sequence that excludes zero? You could use except(pretty(x), 0), if you first defined the (quite useful) set-operation function: R except - function(a,b) unique(a[!match(a, b, 0)]) (Consider this a plug to add except to the union, intersect, etc., family of set operations.) -- David Brahm ([EMAIL PROTECTED]) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problems with plot function
KOITA Lassana - STAC/ACE wrote: Hello all R users, My simulation function works correctly, but I have problems with plot function. You will find the following code using it. Thank you for your help ## simulation - function(k, n){ conc - seq(0,10,by=0.5) #choixg - seq(1, length(conc)) choixg - rep(0,length(conc)) for (i in 1:length(conc)){ choixg[i] - (k + conc[i])^2/((k+conc[i])^n + (k+1)^n) } return(choixg) } simulation(5,1) Please read the manuals! The objects conc and choixg ar local to your function simulation... If you return return(list(choixg=choixg, conc=conc)) from your function, then you can plot as follows: simResult - simulation(5,1) with(simResult, plot(conc, choixg, main =fonction de choix, col= blue, pch=20, xlab = concentration, ylab=proba de choisir la gauche)) Uwe Ligges plot(conc, choixg, main =fonction de choix, col= blue, pch=20, xlab = concentration, ylab=proba de choisir la gauche) ## Lassana KOITA Service Technique de l'Aviation Civile (STAC) Direction Générale de l'Aviation Civile (DGAC) Tel: 01 49 56 80 60 Fax: 01 49 56 82 14 http://www.stac.aviation-civile.gouv.fr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] an error in my using of nnet
Weiwei Shi wrote: Hi, there: I am trying nnet as followed: mg.nnet-nnet(x=trn3[,r.v[1:100]], y=trn3[,209], size=5, decay = 5e-4, maxit = 200) # weights: 511 initial value 13822.108453 iter 10 value 7408.169201 iter 20 value 7362.201934 iter 30 value 7361.669408 iter 40 value 7361.294379 iter 50 value 7361.045190 final value 7361.038121 converged Error in y - tmp : non-numeric argument to binary operator Please help! Please ask appropriately (we pointed you to the posting guide dozens of times now)! - We do neither have trn3 nor r.v - Which function nnet() are we talking about? Do you meant the one from package nnet in the VR bundle? - Which version of R and nnet are we talking about? - What about trying to debug yourself in a first step? E.g. a traceback() might give you (and us) some first hints what is going on. Uwe Ligges Thanks, Weiwei -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Under-dispersion - a stats question?
Martin Henry H. Stevens wrote: Hello all: I frequently have glm models in which the residual variance is much lower than the residual degrees of freedom (e.g. Res.Dev=30.5, Res.DF = 82). Is it appropriate for me to use a quasipoisson error distribution and test it with an F distribution? It seems to me that I could stand to gain a much-reduced standard error if I let the procedure estimate my dispersion factor (which is what I assume the quasi- distributions do). I did'nt see an answer to this. maybe you could treat as a quasimodel, but first you should ask why there is underdispersion. Underdispersion could arise if you have dependent responses, for instance, competition (say, between plants) could produce underdispersion. Then you would be better off changing to an appropriate model. maybe you could post more about your experimental setup? Kjetil Thank you for any input at all. Hank Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Under-dispersion - a stats question?
On Mon, 10 Oct 2005, Martin Henry H. Stevens wrote: Hello all: I frequently have glm models in which the residual variance is much lower than the residual degrees of freedom (e.g. Res.Dev=30.5, Res.DF = 82). Is it appropriate for me to use a quasipoisson error distribution and test it with an F distribution? It seems to me that I could stand to gain a much-reduced standard error if I let the procedure estimate my dispersion factor (which is what I assume the quasi- distributions do). Thank you for any input at all. This usually indicates a deviation from the large-sample theory because of small counts. See e.g. MASS4 p.208. Then estimator residual variance - residual degrees of freedom is unreliable. If the better methods discuss there confirm under-dispersion, then you probably have some form of negative correlation and need to look at your experimental setup. (But it is usually are false alarm.) -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] an error in my using of nnet
Hi, I repost my question following the guide: trn3 is my dataset: str(trn3) `data.frame': 7361 obs. of 209 variables: $ V1 : num -0.931 -0.955 -0.843 -0.963 -0.967 ... $ V2 : num -0.4343 -0.0101 0.0707 -0.0909 -1. ... $ V3 : num -0.979 -0.979 -0.979 -0.980 -0.979 ... $ V4 : num -0.987 -0.987 -0.987 -0.990 -0.987 ... $ V5 : num -0.979 -0.979 -0.979 -0.980 -0.979 ... $ V6 : num -1 -1 -1 -1 -1 ... $ V7 : Factor w/ 2 levels -1,1: 1 1 1 2 1 2 2 1 1 2 ... ... $ V205: Factor w/ 2 levels -1,1: 1 1 1 1 1 1 2 1 2 2 ... $ V206: num -1 -1 -1 -1 -1 ... $ V207: Factor w/ 2 levels -1,1: 2 2 2 2 2 2 2 2 2 2 ... $ V208: Factor w/ 2 levels -1,1: 1 1 1 1 1 1 1 1 1 1 ... $ V209: Factor w/ 2 levels -1,1: 1 1 1 1 1 2 2 1 1 1 ... r.v. basically contained the indice of variables whose importance were evaluated from MeanDecreaseGini from randomForest, ordered descreasingly. So, r.v[1:100] means the first 100 important variables. R.version _ platform i686-redhat-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 2 minor 1.1 year 2005 month 06 day 20 language R traceback() 2: nnet.default(x = trn3[, r.v[1:100]], y = trn3[, 209], size = 5, decay = 5e-04, maxit = 200) 1: nnet(x = trn3[, r.v[1:100]], y = trn3[, 209], size = 5, decay = 5e-04, maxit = 200) nnet is from library(nnet) I need to say I read the post guide before. But I just did not want to take too much time from people, so I did not put details here. Weiwei On 10/11/05, Uwe Ligges [EMAIL PROTECTED] wrote: Weiwei Shi wrote: Hi, there: I am trying nnet as followed: mg.nnet-nnet(x=trn3[,r.v[1:100]], y=trn3[,209], size=5, decay = 5e-4, maxit = 200) # weights: 511 initial value 13822.108453 iter 10 value 7408.169201 iter 20 value 7362.201934 iter 30 value 7361.669408 iter 40 value 7361.294379 iter 50 value 7361.045190 final value 7361.038121 converged Error in y - tmp : non-numeric argument to binary operator Please help! Please ask appropriately (we pointed you to the posting guide dozens of times now)! - We do neither have trn3 nor r.v - Which function nnet() are we talking about? Do you meant the one from package nnet in the VR bundle? - Which version of R and nnet are we talking about? - What about trying to debug yourself in a first step? E.g. a traceback() might give you (and us) some first hints what is going on. Uwe Ligges Thanks, Weiwei -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Sometimes having problems finding a minimum using optim(), optimize(), and nlm() (while searching for noncentral F parameters)
Ken Kelley [EMAIL PROTECTED] wrote I have a problem that I have been unable to determine either the best way to proceed and why the methods I'm trying to use sometimes fail. I'm using the pf() function in an optimization function to find a noncentrality parameter that leads to a specific value at a specified quantile. [SNIP] I'm using three function [optim(), optimize(), and nlm()] to try and accomplish the same goal (which was stated above). I believe that they should all return the same value, and at times they do just that, but at other times the methods return inappropriate results. I'll paste my code that illustrates an example where all is well and one where things fail. Perhaps uniroot() might be better Low.Lim.NC.F - function(Lambda, alpha.lower, F.value, df.1, df.2) { pf(q=F.value, df1=df.1, df2=df.2, ncp=Lambda) - (1-alpha.lower) } uniroot(Low.Lim.NC.F, interval=c(0,5), alpha.lower=0.025, df.1=5, df.2=200, F.value=12) If you plot your example, the gradients are much steeper from above than below, so nlm() works when the starting value is say 50. In addition, underflow in pf for more extreme values of lambda affect these more general search algorithms. | David Duffy (MBBS PhD) ,-_|\ | email: [EMAIL PROTECTED] ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] adding 1 month to a date
Within an R dataset, I have a date field called date_. (The dates are in the format -MM-DD, e.g. 1995-12-01.) How can I add or subtract 1 month from this date, to get 1996-01-01 or 1995-11-01. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Sweave and Rnews
Hi Stéphane Dray wrote: Hello list, I am writing a paper for Rnews. I use Sweave to do it. I did not find information about writing a paper for Rnews using Sweave and have some questions: - Is there a problem to use the environment 'Sinput' in the place of 'example' or 'smallexample'. It works fine but perhaps there are some technical/editorial problems ? Sweave commands/environments are fine thanks. We can handle them without any hassle. Paul (as member of R News editorial board) - I have some long lines of code in schunk. I did not find any way to cut them in the Rnw file and they appear out of the column in the dvi file. The only solution I found is to cut these lines in the tex file generated by Sweave. Is there a more elegant and automatic solution to this problem? Thanks in advance. -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R data import
Hello, I hope all is well. I've gone through and searched just about all the manuals, faqs, contribs available on the data import/export process and have not found any answer to a specific question. Hopefully, I will be able to fall back upon the valuable expertise in mailing list. Here goes: How can I import SPECIFIC columns of data in a fixed width file? E.g. I have a fwf with 40 variables ranging from 1 to 10 characters and at any given time, need only a few to analyze, like so: age: 2 char sex: 1 charmorning: 1 charlocation: 3 char..family: 9 chartagged: date...weight at capture: 4 charlength at capture: 7 charetc. which looks something like: 02M1LOS...xxcanidae011289.10001291412 In essence I am looking for functionality similar to the SAS pointer/informat method. I would appreciate any help anyone would be able to give! Thanks so much for your help. best, Ratnendra Sharma U Minn __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R and SAS pointer/informat functionality
Hello, I hope all is well. I've gone through and searched just about all the manuals, faqs, contribs available on the data import/export process and have not found any answer to a specific question. Hopefully, I will be able to fall back upon the valuable expertise in mailing list. Here goes: How can I import SPECIFIC columns of data in a fixed width file? E.g. I have a fwf with 40 variables ranging from 1 to 10 characters and at any given time, need only a few to analyze, like so: age: 2 char sex: 1 charmorning: 1 charlocation: 3 char..family: 9 chartagged: date...weight at capture: 4 charlength at capture: 7 charetc. which looks something like: 02M1LOS...xxcanidae011289.10001291412 In essence I am looking for functionality similar to the SAS pointer/informat method. I would appreciate any help anyone would be able to give! Thanks so much for your help. best, Ratnendra Sharma U Minn __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] aligning column of xyplots and removing space between them
On 10/11/05, Gabor Grothendieck [EMAIL PROTECTED] wrote: Thanks. That works although the alignment is still not perfect. I am attaching the saved image in both .png and .emf formats so you can see what I mean. Its not far off but its noticeable. In .emf format a portion of the bounding box does not come out either and it comes out bluish rather than white. Not sure if such attachments can survive the list but I have sent you a copy too just in case. [I have no way to easily view the emf file, but] I can't see any reason for the misalignment in the PNG file (other than a driver or rendering bug). Do you see it in PDF output as well? Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] need suggestion about building formual
Have you considered writing a function to do the complex math and then calling nls referring to that function? Consider the following (not tried): expg - function(a., x, G0, R, T){ exp((a.[1]+(a.[2]*x)^(1/2)-G0)/(R*T)) } mynls-nls(formula=y~expg(a.=c(a, b), x=x, G0=G0, R=R, T=T), data=mydata,...) If nls stops prematurely, I then write another function, SSE to compute the sum of squares of deviations from y and then ask optim to minimize SSE, using hessian=TRUE. If you try this and have trouble making it work, please send another post. spencer graves Simple wrote: Thanks for your kind respond. Although the answer didn't solve my question clearly,maybe I still not understand the art of R. I'm sorry that I had not talked the problem clearly, maybe a example with more detail will be suitable as suggested in the the posting guide. In function fitting program, such as Sigmaplot, a fitting formula, can be write in separate form: G=a+(b*x)^(1/2) k=exp((G-G0)/(R*T)) fit k to y of course,in R's nls, can write as: mynls-nls(formula=y~exp((a+(b*x)^(1/2)-G0)/(R*T)),data=mydata,...) In this example, the formula is simple and acceptable. However, when the formula is more complexity,writing all in one formula,the readability will be damaged.So I'm looking for a way to write simple and readable code in this situation. Spencer Graves wrote: I'm not certain what you are asking. You can build expressions in R as character strings and then execute them. Example: expr - paste(two -, 1, +, 1) eval(parse(text=expr)) two If this does not answer your question, PLEASE do read the posting guide, www.R-project.org/posting-guide.html. It can help increase the chances of a quick and useful reply. spencer graves Simple wrote: hi, I'm an newbie for R,I want do some fitting in R. I wander if it is possible to write a few of equations but only one formual when fitting Currently,My problem is,in R, is there methods combination a few equations into one formual? For example, y=f1(k); k=f2(t); t=f3(x); although it is certain that the can be equations turn into one formual as y~f(x),but write such a complexity string make me painful. I have searched the web and found out there were only examples with one formual.any suggestion? I hope that I have omit something. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] symbol print-name too long
Have you received a reply or otherwise resolved this issue? If no, have you tried to construct the simplest possible example that comes to your mind. Sometimes in the course of trying that, I often figure out what the error message means. If you try this without getting the answer yourself, please send the resulting simple example to this list. If someone reading your email can copy a few lines of code from your message into R and get the same problem, you are more likely to get a quick, informative reply. (Please also specify which version of R on which platform.) spencer graves Afshartous, David wrote: All, I've coded a function and it works manually if I copy it line by line into R. However, when I try to load (copy and paste) the entire function into R, I get the following error after the listed line of code: + N.j.list = lapply(rej.hyp, length) Error: symbol print-name too long Does anyone you know what this error means? Strangely, when I copy the same line verbatim into R manually apart from the whole function, no error message results. I've checked the manuals and don't see anything RE print-name too long. I also tried google and saw an old message on this error message, but it doesn't seem to apply here. Thanks, Dave ps - please respond directly to [EMAIL PROTECTED] please. David Afshartous, PhD University of Miami Department of Management Science School of Business Coral Gables, FL 33124 phone: 305-284-8005 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R and SAS pointer/informat functionality
On Tue, 2005-10-11 at 18:55 -0500, Ratnendra Sharma wrote: Hello, I hope all is well. I've gone through and searched just about all the manuals, faqs, contribs available on the data import/export process and have not found any answer to a specific question. Hopefully, I will be able to fall back upon the valuable expertise in mailing list. Here goes: How can I import SPECIFIC columns of data in a fixed width file? E.g. I have a fwf with 40 variables ranging from 1 to 10 characters and at any given time, need only a few to analyze, like so: age: 2 char sex: 1 charmorning: 1 charlocation: 3 char..family: 9 chartagged: date...weight at capture: 4 charlength at capture: 7 charetc. which looks something like: 02M1LOS...xxcanidae011289.10001291412 In essence I am looking for functionality similar to the SAS pointer/informat method. I would appreciate any help anyone would be able to give! Thanks so much for your help. best, Ratnendra Sharma U Minn You just about answered the question yourself in your second paragraph ('fwf') See ?read.fwf and note the Details section regarding the use of negative numbers for the 'widths' argument to skip columns. HTH, Marc Schwartz Greetings from Eden Prairie __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] bug checking
I have observed the following behavior, wondering if it is a bug before I submit a report. I am using the plot function with call: plot(X, Y, col=red, . . . ) where X is an object that inherits from classes 'dates' and 'times' (created with the 'dates' function from package 'chron') and y is a numeric vector. The color red is applied to the area from the first to the last tick mark on the x axis (even if I don't set col=red and only set, say col.main=red). If instead of feeding the function X, I feed it unclass(X) or as.vector(X) the red color is not applied to the area between the first and last ticks on the x axis. Is this a bug, or just a consequence of there not being a plot method for the class I am trying to feed the function? Franklin Parlamis __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] adding 1 month to a date
On Tue, 2005-10-11 at 16:26 -0700, t c wrote: Within an R dataset, I have a date field called date_. (The dates are in the format -MM-DD, e.g. 1995-12-01.) How can I add or subtract 1 month from this date, to get 1996-01-01 or 1995-11-01. There might be an easier way to do this, but using seq.Date(), you can increment or decrement from a Time 0 by months: Add 1 month: This takes your Time 0, generates a 2 element sequence (which begins with Time 0) and then takes the second element: seq(as.Date(1995-12-01), by = month, length = 2)[2] [1] 1996-01-01 Subtract 1 month: Same as above, but we use 'by = -1 month' and take the second element: seq(as.Date(1995-12-01), by = -1 month, length = 2)[2] [1] 1995-11-01 See ?as.Date and ?seq.Date for more information. The former function is used to convert from a character vector to a Date class object. Note that in your case, the date format is consistent with the default. Pay attention to the 'format' argument in as.Date() if your dates should be in other formats. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] monte carlo simulation
Dear R user: I wonder if it is possible to run monte carlo simulation with dse2 package(MonteCarloSimulations function) using ordinary differential equation. How do I define the model? Or if there are any functions which can run monte carlo simulation using ordinary differential equation. Please give me some comments. Thanks in advance!! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] bug checking
On Tue, 2005-10-11 at 16:07 -1000, Parlamis Franklin wrote: I have observed the following behavior, wondering if it is a bug before I submit a report. I am using the plot function with call: plot(X, Y, col=red, . . . ) where X is an object that inherits from classes 'dates' and 'times' (created with the 'dates' function from package 'chron') and y is a numeric vector. The color red is applied to the area from the first to the last tick mark on the x axis (even if I don't set col=red and only set, say col.main=red). If instead of feeding the function X, I feed it unclass(X) or as.vector(X) the red color is not applied to the area between the first and last ticks on the x axis. Is this a bug, or just a consequence of there not being a plot method for the class I am trying to feed the function? Franklin Parlamis As per the Posting Guide, it would be immensely helpful in the attempt to help you, if you would provide the exact code you are using and some sample data here, so that we can exactly replicate what you are experiencing. Lacking that, it would be difficult to assist as we can only guess. It does sound like there is an _appropriate_ change in the plot method behavior as a direct consequence of your modifying the class of the argument(s), which is of course how methods are dispatched. Thus, if I were to guess, this is not a bug. I would however, certainly recommend that you submit an example here to confirm the behavior, before you post a bug report, as that would avoid a more energetic response. Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] ML optimization question--unidimensional unfolding scaling
There may be a few problems where ML (or more generally Bayes) fails to give sensible answers, but they are relatively rare. What is your likelihood? How many parameters are you trying to estimate? Are you using constrained or unconstrained optimization? If constrained, I suggest you remove the constraints by appropriate transformation. When considering alternative transformations, I consider (a) what makes physical sense, and (b) which transformation produces a log likelihood that is more close to being parabolic. Hou are you calling optim? Have you tried all SANN as well as Nelder-Mead, BFGS, and CG? If you are using constrained optimization, I suggest you move the constraints to Inf by appropriate transformation and use the other methods, as I just suggested. If you would still like more suggestions from this group, please provide more detail -- but as tersely as possible. The posting guide is, I believe, quite useful (www.R-project.org/posting-guide.html). spencer graves Peter Muhlberger wrote: I'm trying to put together an R routine to conduct unidimensional unfolding scaling analysis using maximum likelihood. My problem is that ML optimization will get stuck at latent scale points that are far from optimal. The point optimizes on one of the observed variables but not others and for ML to move away from this 'local optimum', it has to move in a direction in which the likelihood is decreasing, which it won't. It's not hard to know where to look for a more optimal value--it'll be just on the other side of the mean of a curve. So, I can find better values, but these values need to be fed back into ML for continued optimization. Problem is, optim or nlm don't allow me to feed them new values for parameters and in any event ML will likely choke w/ parameters jumping around. One solution I've thought of is to restart optim or nlm w/ the new values whenever a point jumps. Is there any good way to get optim or nlm to prematurely terminate, return control to the calling program, while retaining a copy of the estimates? Perhaps ML isn't the best approach for this kind of problem. Suggestions welcome! Cheers, Peter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] log4j
I just got 145 hits from RSiteSearch(debugger). Does this help? spencer graves Omar Lakkis wrote: Is there a log4j, or similar, package for R? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] bug checking
## Code was long, so I simplified it by creating vectors from scratch so it would run as is. Putative bug is still evidenced on the x axis discount.factors.dates - seq.dates(from=09/30/2005, to=09/30/2035) rates-seq(4.4, 5.2, by=0.0025); plot(discount.factors.dates[1:length(rates)], rates, pch=18, las=1, bty=n, col=red, col.main=red, xlab=Date, ylab=Rate, ylim=c(min(rates)-(max(rates)-min(rates))/10,max(rates)+(max (rates)-min(rates))/10)) ## This is the output: plot.pdf Description: Adobe PDF document ## Hopefully you all see the red x axis. ## I am running R Cocoa GUI 1.1.2 with R 2.1.1 framework on a dual proc 2.7 Ghz Power Mac. A Quartz device is opened when 'plot' is called. X11User and X11SDK are installed on t he computer, as well as xCode 2.1 (in case that's relevant). On Oct 11, 2005, at 4:47 PM, Marc Schwartz wrote: On Tue, 2005-10-11 at 16:07 -1000, Parlamis Franklin wrote: I have observed the following behavior, wondering if it is a bug before I submit a report. I am using the plot function with call: plot(X, Y, col=red, . . . ) where X is an object that inherits from classes 'dates' and 'times' (created with the 'dates' function from package 'chron') and y is a numeric vector. The color red is applied to the area from the first to the last tick mark on the x axis (even if I don't set col=red and only set, say col.main=red). If instead of feeding the function X, I feed it unclass(X) or as.vector(X) the red color is not applied to the area between the first and last ticks on the x axis. Is this a bug, or just a consequence of there not being a plot method for the class I am trying to feed the function? Franklin Parlamis As per the Posting Guide, it would be immensely helpful in the attempt to help you, if you would provide the exact code you are using and some sample data here, so that we can exactly replicate what you are experiencing. Lacking that, it would be difficult to assist as we can only guess. It does sound like there is an _appropriate_ change in the plot method behavior as a direct consequence of your modifying the class of the argument(s), which is of course how methods are dispatched. Thus, if I were to guess, this is not a bug. I would however, certainly recommend that you submit an example here to confirm the behavior, before you post a bug report, as that would avoid a more energetic response. Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] bug checking
Thanks for the code and the clarifications, including the PDF file. Yes, I can replicate the behavior here (R 2.2.0 on FC4) and I am cc:ing Kurt Hornik, who ported chron to R and is the chron package maintainer. It appears that the culprit is the argument 'col = red', which towards the end of plot.times() is used as follows: ... else if (x.times) axis.times(1, x, simplify = simplify, labels = TRUE, adj = adj, col = col, cex = cex, font = font, las = las, lab = lab, mgp = mgp, tcl = tcl) ... Thus, if the 'x' data is of class 'times', the above code is used and the color of the axis line and tick marks are set to red as per the 'col' argument to axis(), which axis.times() ultimately calls. This results in the behavior that you are seeing, where both the plot symbols/lines and the axis are colored the same. This does sound like a bug and Kurt can comment better on this. HTH, Marc Schwartz On Tue, 2005-10-11 at 18:02 -1000, Parlamis Franklin wrote: ## Code was long, so I simplified it by creating vectors from scratch so it would run as is. Putative bug is still evidenced on the x axis discount.factors.dates - seq.dates(from=09/30/2005, to=09/30/2035) rates-seq(4.4, 5.2, by=0.0025); plot(discount.factors.dates[1:length(rates)], rates, pch=18, las=1, bty=n, col=red, col.main=red, xlab=Date, ylab=Rate, ylim=c(min(rates)-(max(rates)-min(rates))/10,max(rates)+(max (rates)-min(rates))/10)) ## This is the output: ## Hopefully you all see the red x axis. ## I am running R Cocoa GUI 1.1.2 with R 2.1.1 framework on a dual proc 2.7 Ghz Power Mac. A Quartz device is opened when 'plot' is called. X11User and X11SDK are installed on t he computer, as well as xCode 2.1 (in case that's relevant). On Oct 11, 2005, at 4:47 PM, Marc Schwartz wrote: On Tue, 2005-10-11 at 16:07 -1000, Parlamis Franklin wrote: I have observed the following behavior, wondering if it is a bug before I submit a report. I am using the plot function with call: plot(X, Y, col=red, . . . ) where X is an object that inherits from classes 'dates' and 'times' (created with the 'dates' function from package 'chron') and y is a numeric vector. The color red is applied to the area from the first to the last tick mark on the x axis (even if I don't set col=red and only set, say col.main=red). If instead of feeding the function X, I feed it unclass(X) or as.vector(X) the red color is not applied to the area between the first and last ticks on the x axis. Is this a bug, or just a consequence of there not being a plot method for the class I am trying to feed the function? Franklin Parlamis As per the Posting Guide, it would be immensely helpful in the attempt to help you, if you would provide the exact code you are using and some sample data here, so that we can exactly replicate what you are experiencing. Lacking that, it would be difficult to assist as we can only guess. It does sound like there is an _appropriate_ change in the plot method behavior as a direct consequence of your modifying the class of the argument(s), which is of course how methods are dispatched. Thus, if I were to guess, this is not a bug. I would however, certainly recommend that you submit an example here to confirm the behavior, before you post a bug report, as that would avoid a more energetic response. Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Under-dispersion - a stats question?
On Tue, 2005-10-11 at 17:16 -0400, Kjetil Holuerson wrote: Martin Henry H. Stevens wrote: Hello all: I frequently have glm models in which the residual variance is much lower than the residual degrees of freedom (e.g. Res.Dev=30.5, Res.DF = 82). Is it appropriate for me to use a quasipoisson error distribution and test it with an F distribution? It seems to me that I could stand to gain a much-reduced standard error if I let the procedure estimate my dispersion factor (which is what I assume the quasi- distributions do). I did'nt see an answer to this. maybe you could treat as a quasimodel, but first you should ask why there is underdispersion. Underdispersion could arise if you have dependent responses, for instance, competition (say, between plants) could produce underdispersion. Then you would be better off changing to an appropriate model. maybe you could post more about your experimental setup? Some ecologists from Bergen, Norway, suggest using quasipoisson with its underdispersed residual error (while I wouldn't do that). However, it indeed would be useful to know a bit more about the setup, like the type of dependent variable. If the dependent variable happens to be the number of species (like it's been in some papers by MHHS), this certainly is *not* Poisson nor quasi-Poisson nor in the exponential family, although it so often is modelled. I've often seen that species richness (number of species -- or in R-speak 'tokens' -- in a collection) is underdispersed to Poisson, and for a good reason. Even there I'd play safe and use poisson() instead of underdispersed quasipoisson(). cheers, jari oksanen -- Jari Oksanen -- Dept Biology, Univ Oulu, 90014 Oulu, Finland Ph. +358 8 5531526, cell +358 40 5136529, fax +358 8 5531061 email [EMAIL PROTECTED], homepage http://cc.oulu.fi/~jarioksa/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] font=5 (Was: greek symbols using pch)
Earl, I don't think that's a bug. Try pdf(font5.pdf, onefile=FALSE) and similarly for postscript(). Ted. On 12/10/05 01:23, Earl F. Glynn wrote,: ecatchpole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for that. Very instructive, and much appreciated. And sorry, yes, I strayed well off the original topic. The Greek symbols come out fine with font=5 in my locale, Locale: LC_CTYPE=en_GB.UTF-8; LC_NUMERIC=C; LC_TIME=en_GB.UTF-8; I was interested in some of the other nice characters, for example \infty and \partial, that appear in the table, but with a calligraphic R attached to them. But plotmath() works fine, so I'm happy. I performed some tests with font=5 on both Linux and Windows using source(font5.R), which is shown below, and then calling the Font5Test() function. Consistent results were seen with devices X11, png, and jpeg under either Linux (R 2.1.1) or Windows (R 2.2.0) in my locale. Oddly, both the pdf and postscript devices create 2 pages of output with the first page the expected table and a second unexpected page with only the clubs suite symbol (167) in the middle of the plot. I'd call this a bug, but I guess I haven't read all the documentation about this yet. efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research font5.R == ShowFont5 - function() { oldpar - par(font=5, las=1) plot(0:1, 0:1, type=n) points(.5, .5, pch=167) par(font=5, las=1) plot(0:15,0:15,type=n,ylim=c(15,0), main=Symbols in Font=5, xlab=, ylab=,xaxt=n, yaxt=n) axis(BOTTOM-1, at=0:15) axis(LEFT -2, at=0:15, 16*0:15) abline(v=0.5 + 0:14, h=0.5 + 0:14, col=grey, lty=dotted) # pch index of any cell is 16*row + column for(i in 0:255) { x - i %%16; y - i %/% 16; points(x,y,pch=i) } par(oldpar) } Font5Test - function() { X11() ShowFont5() dev.off() pdf(font5.pdf) ShowFont5() dev.off() png(font5.png) ShowFont5() dev.off() jpeg(font5.jpg) ShowFont5() dev.off() postscript(font5.ps) ShowFont5() dev.off() } Linux Test === Sys.getlocale() [1] C R.Version() $platform [1] x86_64-unknown-linux-gnu $arch [1] x86_64 $os [1] linux-gnu $system [1] x86_64, linux-gnu $status [1] $major [1] 2 $minor [1] 1.1 $year [1] 2005 $month [1] 06 $day [1] 20 $language [1] R Windows Test == Sys.getlocale() [1] LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 R.Version() $platform [1] i386-pc-mingw32 $arch [1] i386 $os [1] mingw32 $system [1] i386, mingw32 $status [1] $major [1] 2 $minor [1] 2.0 $year [1] 2005 $month [1] 10 $day [1] 06 $svn rev [1] 35749 $language [1] R __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] log4j
no, there isn't a general logging package. On 10/12/05, Spencer Graves [EMAIL PROTECTED] wrote: I just got 145 hits from RSiteSearch(debugger). Does this help? spencer graves Omar Lakkis wrote: Is there a log4j, or similar, package for R? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- best, -tony [EMAIL PROTECTED] Muttenz, Switzerland. Commit early,commit often, and commit in a repository from which we can easily roll-back your mistakes (AJR, 4Jan05). __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html