[R] cloud function doesn't plot
Forgive me please if this has been answered previously, but the r-help archive doesn't have a search capability. It's a pity, as I'm sure that there's a wealth of informative help in there. I am unable to get the cloud function to produce a fundamental 3D scatterplot. I have a 3-column numeric matrix: is.matrix(sanity.MIF); is.numeric(sanity.MIF); dim(sanity.MIF); cloud(sanity.MIF) [1] TRUE [1] TRUE [1] 29703 A blank grey graphics window is opened, but no vestige of a plot or labels of any kind. Can someone tell me what I am missing please? R 1.7.1 Windows2000 is new to me, but plenty of prior S-Plus Unix experience, including the use of the spin function for rotational 3D scatterplots. Thank You for your help. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] cloud function doesn't plot
From: Simon Blomberg [EMAIL PROTECTED] Date: Mon, 23 Jun 2003 16:26:39 +1000 If you type ?cloud, you can see that you need to provide a formula as well as a dataset. So if your variables are x,y,z in dataframe dat, then cloud(z~x*y, data=dat) should work. [...] is.matrix(sanity.MIF); is.numeric(sanity.MIF); dim(sanity.MIF); cloud(sanity.MIF) [1] TRUE [1] TRUE [1] 29703 The help(cloud) facility states: `formula' can be a matrix. As I stated, I have a 3-column numeric matrix, so colum 3 should be plotted as a point above the 1st and 2nd column co-ordinates. No plot is produced however, just a blank graphics device. Thanks. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] cloud function doesn't plot
On Sun, 22 Jun 2003, Tony Ross wrote: From: Simon Blomberg [EMAIL PROTECTED] Date: Mon, 23 Jun 2003 16:26:39 +1000 If you type ?cloud, you can see that you need to provide a formula as well as a dataset. So if your variables are x,y,z in dataframe dat, then cloud(z~x*y, data=dat) should work. [...] is.matrix(sanity.MIF); is.numeric(sanity.MIF); dim(sanity.MIF); cloud(sanity.MIF) [1] TRUE [1] TRUE [1] 29703 The help(cloud) facility states: `formula' can be a matrix. As I stated, I have a 3-column numeric matrix, so colum 3 should be plotted as a point above the 1st and 2nd column co-ordinates. You are misleading yourself and us by selective quoting: it says As an extension to partially support the form used in `filled.contour' and `image', `formula' can be a matrix. The form used in those quoted function is *not* a three-column matrix, and your interpretation is not in the R help file. No plot is produced however, just a blank graphics device. Not so in my experiments: a border box is drawn. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] cloud function doesn't plot
Tony Ross wrote: From: Simon Blomberg [EMAIL PROTECTED] Date: Mon, 23 Jun 2003 16:26:39 +1000 If you type ?cloud, you can see that you need to provide a formula as well as a dataset. So if your variables are x,y,z in dataframe dat, then cloud(z~x*y, data=dat) should work. [...] is.matrix(sanity.MIF); is.numeric(sanity.MIF); dim(sanity.MIF); cloud(sanity.MIF) [1] TRUE [1] TRUE [1] 29703 The help(cloud) facility states: `formula' can be a matrix. It states completely: As an extension to partially support the form used in filled.contour and image, formula can be a matrix. Thus, see ?image that you don't need a 3 column matrix, but a matrix containing the z values. I'd suggest to convert the matrix to a data.frame and follow the suggestion from Simon Blomberg. Uwe Ligges As I stated, I have a 3-column numeric matrix, so colum 3 should be plotted as a point above the 1st and 2nd column co-ordinates. No plot is produced however, just a blank graphics device. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] glmm and overall goodness of fit
Hi, exist in R any glmm function that have any tools for test for overall goodness of fit? True measures of overall goodness of fit may be difficult to formulate for such mixed models. Relative goodness of fit (as compared to glm) is available through the AIC produced by my glmm function. Cheers, Jim Thanks Ronaldo -- O papel da impressora é sempre mais forte na parte picotada. -- | // | \\ [***] | ( õ õ ) [Ronaldo Reis Júnior] | V [UFV/DBA-Entomologia] | / \ [36571-000 Viçosa - MG ] | /(.''`.)\ [Fone: 31-3899-2532 ] |/(: :' :)\ [EMAIL PROTECTED]] |/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ] | ( `- ) [***] | _/ \_Powered by GNU/Debian Woody/Sarge __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] dispersion matrices
Hello Does R have any function that calculates from a data matrix with several classes the between and within dispersion matrices S_b and S_w Thanks Luis __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Problem with installation under R 1.7.1 and unzip
Thanks a lot professor, but no in fact it is like you've said c:\Program Files\R\rw1071\Rwork is my Working directory = C:\Program Files\R\rw1071\Rwork, i am in fact using the functions you've gave me to know what is happening with me because with R 1.6.2 i could install my packages with no problem like that, and i didn't change anything after uninstalling R 1.6.2 and installing R 1.7.1 (except of course in the propreties of R 1.7.2 Shortcut) zip.unpack(sma,dirperm) [1] 1 attr(,extracted) character(0) Warning message: error 1 in extracting from zip file options(unzip) $unzip [1] internal and this is what i got after the error message of packages installation traceback() 9: zip.unpack(pkg, tmpDir) 8: unpackPkg(foundpkgs[okp, 2], pkgnames[okp], lib, installWithVers) 7: install.packages(select.list(a[, 1], , TRUE), .libPaths()[1], available = a, CRAN = getOption(BIOC)) 6: eval(expr, envir, enclos) 5: eval(quote({ a - CRAN.packages(CRAN = getOption(BIOC)) install.packages(select.list(a[, 1], , TRUE), .libPaths()[1], available = a, CRAN = getOption(BIOC)) }), new.env()) 4: eval(expr, envir, enclos) 3: eval(expr, p) 2: eval.parent(substitute(eval(quote(expr), envir))) 1: local({ a - CRAN.packages(CRAN = getOption(BIOC)) install.packages(select.list(a[, 1], , TRUE), .libPaths()[1], available = a, CRAN = getOption(BIOC)) }) thanks again Ramzi - [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] How can I do a spinning plot in R?
Some days ago I wrote a function for rotating a cloud of points. To control the rotation a simple Tcl/Tk-widget is used. Here you can find the R code: http://www.wiwi.uni-bielefeld.de/~wolf/software/spin3R/spin3R.sch Peter Wolf, [EMAIL PROTECTED] Richard A. O'Keefe wrote: I have found XLispStat's spinning plots illuminating. I'd like to do the same thing in R. A dozen or so probes with help, help.search, apropos haven't turned up anything, and I've even resorted to grepping through the entire R source distribution looking for 'spin.*plot', to no avail. Either the feature is called something else in R (what?), or it's in some other package in CRAN (which?), or it's not yet available (I hope not, because I am very far from being skilled enough in R programming to do it myself). Help? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] precision matrix for polynomial growth curves
What does the warning message 1: Singular precision matrix in level -1, block 1 mean? I get this warning 50+ times when I try to fit the following model lme( response ~ covariateA + poly(covariateB,3), ~poly(covariateB,3)|group ) It's not a small dataset - a set of up to 20 blood pressure readings on just over 2000 people, and I don't get the error message when I try to fit fewer random effects (although I'm not sure whether fitting random effects poly(B,2) with fixed effects poly(B,3) is generally the same as fitting random effects B+B^2 with fixed effects B+B^2+B^3). Sometimes I don't get the error message when I use subsets of the data, but that isn't guaranteed to be the case. If anybody could give me pointers to references for or could answer either question themselves (1. why the error message/what's causing it and 2. fitting random polynomials using poly()) I would be very grateful. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Changing lattice theme
Ernesto Jardim wrote: Hi Can someone tell me how I can change the lattice theme to black white ? See, e.g., ?trellis.device. Uwe Ligges Thanks EJ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Rcmd check problem
I have the following message error when I try to buid my package : C:\Documents and Settings\PhilippeRcmd check mypackage * checking for working latex ...Error: environment variable TMPDIR not set (or set to unusable value) and no default available. at C:\PROGRA~1\R\rw1071\share\perl/R/Utils.pm line 165 Does someone have any idea ? Thanks OS Windows XP miktex R 1.7.1 ActivePerle 5.8.0 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] FW: S4 classes, creating in C
I am using C code to create an S4 object based on Douglas Bates's example in his lecture notes on http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slide s.pdf http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slides .pdf e.g. SEXP La_DGE_dc(SEXP A) { SEXP aa = PROTECT(duplicate(A)); SEXP adims, pivot, val; int m, n, info; if (!isMatrix(aa) || !isReal(aa)) { error(A must be a double precision matrix); } adims = GET_DIM(aa); m = INTEGER(adims)[0]; n = INTEGER(adims)[1]; pivot = PROTECT(NEW_INTEGER(m n ? m : n)); F77_CALL(dgetrf)(m, n, REAL(aa), m, INTEGER(pivot), info); check_Lapack_error(info, dtrtrf); val = PROTECT(NEW_OBJECT(MAKE_CLASS(LUdecomposition))); SET_SLOT(val, install(a), aa); SET_SLOT(val, install(pivot), pivot); UNPROTECT(3); return val; } LUdecomposition is an S4 class defined as setClass(LUdecomposition, representation(a=matrix, pivot = integer)) This works in R 1.7.0 and R 1.7.1 but if I initialise any of the slots setClass(LUdecomposition, representation(a=matrix, pivot = integer), prototype=list(pivot = NA)) then I get the following error message in R 1.7.1 but not R 1.7.0 Error in makePrototypeFromClassDef(properties, ClassDef, immediate) : In making the prototype for class LUdecomposition elements of the prototype failed to match the corresponding slot class: pivot (class integer ) Why can I no longer use the prototype to set the default values? Laurence Kell CEFAS Lowestoft Laboratory Pakefield Road Lowestoft, NR33 0HT UK Tel +44 1502 52 42 57 Fax +44 1502 52 45 11 e-mail [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rcmd check problem
Philippe Hupé wrote: I have the following message error when I try to buid my package : C:\Documents and Settings\PhilippeRcmd check mypackage * checking for working latex ...Error: environment variable TMPDIR not set (or set to unusable value) and no default available. at C:\PROGRA~1\R\rw1071\share\perl/R/Utils.pm line 165 Does someone have any idea ? Yes: Read the documentation and the error message. From .../src/gnuwin32/readme.packages: You may need to set TMPDIR to (the absolute path to) a suitable temporary directory: the default is c:/TEMP. (Use forward slashes, although the code will try to convert backslashes as from 1.7.0.) Uwe Ligges Thanks OS Windows XP miktex R 1.7.1 ActivePerle 5.8.0 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Rcmd check problem
I have the following message error when I try to buid my package : C:\Documents and Settings\PhilippeRcmd check mypackage * checking for working latex ...Error: environment variable TMPDIR not set (or set to unusable value) and no default available. at C:\PROGRA~1\R\rw1071\share\perl/R/Utils.pm line 165 Hello Philippe, just a guess...have you included your miktex-path as an environmental variable in your path (see:START - Settings - Control Panel - System Properties - Advanced - Environment Variables) and a tempdir likewise? HTH, Bernhard Does someone have any idea ? Thanks OS Windows XP miktex R 1.7.1 ActivePerle 5.8.0 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] precision matrix for polynomial growth curves
Robert - Just guessing, does the growth curve for any individual have exactly four points ? If so, then the fit with an order 3 polynomial would be exact, and have zero residual variance, while the fit with an order 2 polynomial would likely still have non-zero residuals. Another way the same thing might happen: Could any of the growth curves in the data set have been interpolated using a third order polynomial in covariateB ? This, too, would produce zero residuals in a subsequent third order polynomial fit, even if there are many more than four points in the curve. Note that these are just guesses, without knowing anything about the innards of lme(). - tom blackwell - u michigan medical school - ann arbor - On Mon, 23 Jun 2003, Robert Cuffe wrote: What does the warning message 1: Singular precision matrix in level -1, block 1 mean? I get this warning 50+ times when I try to fit the following model lme( response ~ covariateA + poly(covariateB,3), ~poly(covariateB,3)|group ) It's not a small dataset - a set of up to 20 blood pressure readings on just over 2000 people, and I don't get the error message when I try to fit fewer random effects (although I'm not sure whether fitting random effects poly(B,2) with fixed effects poly(B,3) is generally the same as fitting random effects B+B^2 with fixed effects B+B^2+B^3). Sometimes I don't get the error message when I use subsets of the data, but that isn't guaranteed to be the case. If anybody could give me pointers to references for or could answer either question themselves (1. why the error message/what's causing it and 2. fitting random polynomials using poly()) I would be very grateful. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R Commander
I am trying to import a file using R Commander. It was working a few days ago, but now I get the following message when I try to import from SPSS. Any thoughts? Error in parse(file, n, text, prompt) : parse error -- Harold C. Doran Director of Research and Evaluation New American Schools 675 N. Washington Street, Suite 220 Alexandria, Virginia 22314 703.647.1628 http://www.edperform.net/ [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] saving plots
On Mon, Jun 23, 2003 at 11:07:15AM -0400, Matt Oliver wrote: Hi all, I am have an R script that makes many plots, and I would like to string them into a movie file. To do that I have to save all of my plots as jpegs or gifs. I don't want to go through all of my plots and save them by hand though. Is there a way to automate saving the plots as a gif or a jpeg so I can string them into a movie? ?dev.copy is probably that you want. dev.copy(device = jpeg) dev.off() -- WBR, Timur __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] mode of a data set
Dear R People: Is there a function to find the mode of a data set, please? This is the mode as in the value(s) which occur most often. Thanks so much! R for Windows, v 1.7.0 Sincerely, Erin Hodgess mailto: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] FW: S4 classes, creating in C
I don't believe the fact that you are doing this in C code is relevant in this problem. If you define LUdecomposition as setClass(LUdecomposition, representation(a=matrix, pivot = integer), prototype=list(pivot = NA)) you will get an error if you simply type new(LUdecomposition) To make this work, define the class as setClass(LUdecomposition, representation(a=matrix, pivot = integer), prototype=list(pivot = as.integer(NA) )) Why the original does not work is because typeof(NA) returns logical. So it is merely the type of the value that is the problem. HTH, Duncan Douglas Bates wrote: Laurence Kell FM CEFAS [EMAIL PROTECTED] writes: I am using C code to create an S4 object based on Douglas Bates's example in his lecture notes on http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slide s.pdf http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Tutorials/RExtensions/slides .pdf e.g. SEXP La_DGE_dc(SEXP A) { SEXP aa = PROTECT(duplicate(A)); SEXP adims, pivot, val; int m, n, info; if (!isMatrix(aa) || !isReal(aa)) { error(A must be a double precision matrix); } adims = GET_DIM(aa); m = INTEGER(adims)[0]; n = INTEGER(adims)[1]; pivot = PROTECT(NEW_INTEGER(m n ? m : n)); F77_CALL(dgetrf)(m, n, REAL(aa), m, INTEGER(pivot), info); check_Lapack_error(info, dtrtrf); val = PROTECT(NEW_OBJECT(MAKE_CLASS(LUdecomposition))); SET_SLOT(val, install(a), aa); SET_SLOT(val, install(pivot), pivot); UNPROTECT(3); return val; } LUdecomposition is an S4 class defined as setClass(LUdecomposition, representation(a=matrix, pivot = integer)) This works in R 1.7.0 and R 1.7.1 but if I initialise any of the slots setClass(LUdecomposition, representation(a=matrix, pivot = integer), prototype=list(pivot = NA)) then I get the following error message in R 1.7.1 but not R 1.7.0 Error in makePrototypeFromClassDef(properties, ClassDef, immediate) : In making the prototype for class LUdecomposition elements of the prototype failed to match the corresponding slot class: pivot (class integer ) Why can I no longer use the prototype to set the default values? I'm not sure. This may be the type of question that requires John Chambers' attention and I think he is away from his email this week. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- ___ Duncan Temple Lang[EMAIL PROTECTED] Bell Labs, Lucent Technologiesoffice: (908)582-3217 700 Mountain Avenue, Room 2C-259 fax:(908)582-3340 Murray Hill, NJ 07974-2070 http://cm.bell-labs.com/stat/duncan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mode of a data set
On Monday 23 June 2003 17:50, Erin Hodgess wrote: Dear R People: Is there a function to find the mode of a data set, please? This is the mode as in the value(s) which occur most often. x[rev(order(table(x)))[1]] is this what you want? regards Adelchi Azzalini -- Adelchi Azzalini [EMAIL PROTECTED] Dipart.Scienze Statistiche, Università di Padova, Italia http://azzalini.stat.unipd.it/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mode of a data set
Dear Erin, Assuming that by data set you mean a vector v, then sort(table(v)) will give you what you want. On Mon, 23 Jun 2003, Erin Hodgess wrote: Date: Mon, 23 Jun 2003 10:50:47 -0500 (CDT) From: Erin Hodgess [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [R] mode of a data set Dear R People: Is there a function to find the mode of a data set, please? This is the mode as in the value(s) which occur most often. Thanks so much! R for Windows, v 1.7.0 Sincerely, Erin Hodgess mailto: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help J.R. Lockwood 412-683-2300 x4941 [EMAIL PROTECTED] http://www.rand.org/methodology/stat/members/lockwood/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] read.spss
I have loaded the foreign package and am still having problems with an import. I get a message that reads, unable to open file. Whe I try different files I get the same message. Here is the code I used. Am I missing something? I am using 1.7 and have also tried this in 1.6 with the same problem. hsb-read.spss(C:\HLM504_Student\Examples\AppendxA\HSB1.SAV, use.value.labels=TRUE, to.data.frame=FALSE, max.value.labels=Inf) -- Harold C. Doran Director of Research and Evaluation New American Schools 675 N. Washington Street, Suite 220 Alexandria, Virginia 22314 703.647.1628 http://www.edperform.net/ [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] read.spss
The message is quite correct. See the rw-FAQ, Q2.14, or the FAQ Q7.10. On Mon, 23 Jun 2003, Harold Doran wrote: I have loaded the foreign package and am still having problems with an import. I get a message that reads, unable to open file. Whe I try different files I get the same message. Here is the code I used. Am I missing something? The FAQs! I am using 1.7 and have also tried this in 1.6 with the same problem. hsb-read.spss(C:\HLM504_Student\Examples\AppendxA\HSB1.SAV, use.value.labels=TRUE, to.data.frame=FALSE, max.value.labels=Inf) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] read.spss
On Mon, 2003-06-23 at 11:15, Harold Doran wrote: I have loaded the foreign package and am still having problems with an import. I get a message that reads, unable to open file. Whe I try different files I get the same message. Here is the code I used. Am I missing something? I am using 1.7 and have also tried this in 1.6 with the same problem. hsb-read.spss(C:\HLM504_Student\Examples\AppendxA\HSB1.SAV, use.value.labels=TRUE, to.data.frame=FALSE, max.value.labels=Inf) Running under Windows, you need to escape the backslashes, so you need to use double backslashes: hsb-read.spss(C:\\HLM504_Student\\Examples\\AppendxA\\HSB1.SAV, use.value.labels = TRUE, to.data.frame = FALSE, max.value.labels = Inf) This is in the Windows FAQ 2.14. HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Summary for mode of a data set
Dear R People: thank you for the many helpful sets of code that I received!!! I combined several of the concepts for the following function: mode1 function(x) { y - rle(sort(x)) z - y$values[y$lengths==max(y$lengths)] return(z) } xm [1] 22 15 10 30 25 26 2 17 28 2 24 6 26 24 5 22 20 14 mode1(xm) [1] 2 22 24 26 This will pick up multiple modes. Again thanks to all who helped! Sincerely, Erin mailto: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] saving plots
You might want to look at recordPlot(). While the script is running record the plots using recordPlot(). Afterwards replay them with the jpeg device active. -Don At 11:07 AM -0400 6/23/03, Matt Oliver wrote: Hi all, I am have an R script that makes many plots, and I would like to string them into a movie file. To do that I have to save all of my plots as jpegs or gifs. I don't want to go through all of my plots and save them by hand though. Is there a way to automate saving the plots as a gif or a jpeg so I can string them into a movie? Thanks in advance Matt Oliver == When you reach an equilibrium in biology, you're dead. - A. Mandell == Matthew J. Oliver Institute of Marine and Coastal Sciences 71 Dudley Road, New Brunswick New Jersey, 08901 http://marine.rutgers.edu/cool/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] FW: S4 classes, creating in C
Hi Laurence, Laurence Kell FM CEFAS wrote: [...] LUdecomposition is an S4 class defined as setClass(LUdecomposition, representation(a=matrix, pivot = integer)) This works in R 1.7.0 and R 1.7.1 but if I initialise any of the slots setClass(LUdecomposition, representation(a=matrix, pivot = integer), prototype=list(pivot = NA)) then I get the following error message in R 1.7.1 but not R 1.7.0 Error in makePrototypeFromClassDef(properties, ClassDef, immediate) : In making the prototype for class LUdecomposition elements of the prototype failed to match the corresponding slot class: pivot (class integer ) Why can I no longer use the prototype to set the default values? just tried your example in R 1.6.2 and it worked. And as you say for R 1.7.1 it won't. So take a look at (R 1.7.1) setClass(LUdecompositio, representation(a=matrix, pivot = integer), prototype(pivot=NA)) [1] LUdecompositio lu-new(LUdecompositio) Error in makePrototypeFromClassDef(properties, ClassDef, immediate) : In making the prototype for class LUdecompositio elements of the prototype failed to match the corresponding slot class: pivot (class integer ) setClass(LUdecompositi, representation(a=matrix, pivot = integer), prototype(pivot=as.integer(NA)) + + ) [1] LUdecompositi lu3-new(LUdecompositi) lu3 An object of class LUdecompositi Slot a: 0 x 0 matrix Slot pivot: [1] NA is([EMAIL PROTECTED]) [1] integer vector numeric So providing an explicit cast in the prototype cures the problem. HTH, Matthias Laurence Kell CEFAS Lowestoft Laboratory Pakefield Road Lowestoft, NR33 0HT UK Tel +44 1502 52 42 57 Fax +44 1502 52 45 11 e-mail [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Matthias Burger Bioinformatics RD Epigenomics AG www.epigenomics.com Kleine Pr?sidentenstra?e 1 fax: +49-30-24345-555 10178 Berlin Germanyphone: +49-30-24345-0 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Reliability analysis and Laplace factor functions
Is there some package out there that implements functions for reliability analysis, especially for software reliability? In particular, I'm looking for: * Laplace factor (Cox Lewis 1978) * Goel-Okumoto fitting Thanks in advance, -Ekr -- [Eric Rescorla [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Summary for mode of a data set
Your mode1 function will identify multiple modes only if they have the same number of observations. Consider the following: x2 - c(2, 1,1, 3,3,3) mode1(x2) [1] 3 Here, mode1 did not identify the local mode at 1, because it had fewer observations than 3. If you want the modes at both 1 and 3, then consider the following: modes - function(x){ xt - table(x) nt - length(xt) sel - c(xt[-nt]=xt[-1], T)c(T, xt[-1]=xt[-nt]) as.numeric(names(xt[sel])) } modes(x2) [1] 1 3 hth. spencer graves Erin Hodgess wrote: Dear R People: thank you for the many helpful sets of code that I received!!! I combined several of the concepts for the following function: mode1 function(x) { y - rle(sort(x)) z - y$values[y$lengths==max(y$lengths)] return(z) } xm [1] 22 15 10 30 25 26 2 17 28 2 24 6 26 24 5 22 20 14 mode1(xm) [1] 2 22 24 26 This will pick up multiple modes. Again thanks to all who helped! Sincerely, Erin mailto: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Lwd ignored when printing on Windows
Dear R-help, Has anyone notice the problem that, on Windows (NT and XP), when printing a graph using the File - Print... menu in the graphics window to print the graph, that line width seemed to be ignored in the printed output? For example, if I make a plot with plot(1:10, type=l, lwd=5), it looks right on screen, but when printed out using the menu, it looks like the plot was made with lwd=1. I've had this problem for quite a while (at least since 1.3.x) and still present in 1.7.1. Has anyone else seen this, or just me? Best, Andy Andy Liaw, PhD Biometrics Research PO Box 2000, RY33-300 Merck Research Labs Rahway, NJ 07065 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 732-594-0820 -- Notice: This e-mail message, together with any attachments, cont... {{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] erase.screen bug?
Hi, I'm using R 1.7.1 on a Windows 2K computer. For some reason erase.screen does not seem to be working correctly. That is it does not erase the requested screen. That is the old graphic is still visible and any subsequent graphics are superimposed over it making them impossible to read. What is worse is that they print out this way also. The same behaviour happens with a Windows XP computer. I have not yet examined this on Unix but will do so tomorrow. Is this a known problem? Is there an easy workaround? Thanks, Angelo -- | Angelo J. CantyEmail: [EMAIL PROTECTED] | | Mathematics and Statistics Phone: (905) 525-9140 x 27079 | | McMaster UniversityFax : (905) 522-0935 | | 1280 Main St. W. | | Hamilton ON L8S 4K1 | __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Lwd ignored when printing on Windows
Andy, I've experienced the same thing. What's interesting is that printing a plot (CTRL-P) with lwd = 25 makes lines on the hardcopy look like lwd = 5. I'm using R1.7.1 on Win2000Pro. Regards, Sundar Liaw, Andy wrote: Dear R-help, Has anyone notice the problem that, on Windows (NT and XP), when printing a graph using the File - Print... menu in the graphics window to print the graph, that line width seemed to be ignored in the printed output? For example, if I make a plot with plot(1:10, type=l, lwd=5), it looks right on screen, but when printed out using the menu, it looks like the plot was made with lwd=1. I've had this problem for quite a while (at least since 1.3.x) and still present in 1.7.1. Has anyone else seen this, or just me? Best, Andy Andy Liaw, PhD Biometrics Research PO Box 2000, RY33-300 Merck Research Labs Rahway, NJ 07065 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 732-594-0820 -- Notice: This e-mail message, together with any attachments, cont... {{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] heatmap
Dear R-users, I am using R-1.7.1. on windows 2000. When I use the heatmap() function, I found lines on the dendorgam are not well connected. For example, the two dendrograms produced by the following have this problem. set.seed(1234) heatmap(x-matrix(rnorm(100*30),100,30)) Is there a bug in plot(dendrogram object) which heatmap used? Thanks, Ming-Chung Li __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] erase.screen bug?
Is your background colour set to transparent? There is no way to erase screens in the R/S model: all you can do is overpaint with the background. And the default on-screen background colour is ... transparent. This described in the Warning (and elsewhere) on the help page. With a solid background colour it appears to work. On Mon, 23 Jun 2003, Angelo Canty wrote: I'm using R 1.7.1 on a Windows 2K computer. For some reason erase.screen does not seem to be working correctly. That is it does not erase the requested screen. That is the old graphic is still visible and any subsequent graphics are superimposed over it making them impossible to read. What is worse is that they print out this way also. The same behaviour happens with a Windows XP computer. I have not yet examined this on Unix but will do so tomorrow. Is this a known problem? Is there an easy workaround? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] A final global mode function
From [EMAIL PROTECTED] Mon Jun 23 14:36:45 2003 Received: from postal.pdf.com (pdf193.pdf.com [209.128.81.193]) by uhddx01.dt.uh.edu (8.9.2/8.9.2) with ESMTP id OAA09671 for [EMAIL PROTECTED]; Mon, 23 Jun 2003 14:36:44 -0500 (CDT) Received: from postage.pdf.com (postage.pdf.com [10.10.8.7]) by postal.pdf.com (Switch-3.0.4/Switch-3.0.0) with ESMTP id h5NJYisf002096; Mon, 23 Jun 2003 12:34:44 -0700 (PDT) Received: from malt.PDF.COM (malt.pdf.com [10.10.8.80]) by postage.pdf.com (Switch-3.1.0/Switch-3.1.0) with ESMTP id h5NJZw4U022559; Mon, 23 Jun 2003 12:35:58 -0700 (PDT) Received: from pdf.com (sjc-10-10-11-97.pdf.com [10.10.11.97]) by malt.PDF.COM (8.9.3/8.9.3) with ESMTP id MAA24847; Mon, 23 Jun 2003 12:36:05 -0700 (PDT) Message-ID: [EMAIL PROTECTED] Date: Mon, 23 Jun 2003 12:36:05 -0700 From: Spencer Graves [EMAIL PROTECTED] User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ravi Varadhan [EMAIL PROTECTED] CC: Erin Hodgess [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [R] Summary for mode of a data set References: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Status: R You are correct that my function is also wrong. You need to decide what you want and write a function to do that, if you don't have it already. Best Wishes, Spencer Graves Ravi Varadhan wrote: Dear Spencer: In the following example, your code doesn't pick up the local mode at 5. x2 - c(1,1,2,3,3,3,3,5,5,5) modes(x2) [1] 1 3 In this example, it gives a mode at 7, which is incorrect. x2 - c(1,1,2,3,3,3,3,5,5,5,6,7) modes(x2) [1] 1 3 7 Ravi. - Original Message - From: Spencer Graves [EMAIL PROTECTED] Date: Monday, June 23, 2003 2:53 pm Subject: Re: [R] Summary for mode of a data set Your mode1 function will identify multiple modes only if they have the same number of observations. Consider the following: x2 - c(2, 1,1, 3,3,3) mode1(x2) [1] 3 Here, mode1 did not identify the local mode at 1, because it had fewer observations than 3. If you want the modes at both 1 and 3, then consider the following: modes - function(x){ xt - table(x) nt - length(xt) sel - c(xt[-nt]=xt[-1], T)c(T, xt[-1]=xt[-nt]) as.numeric(names(xt[sel])) } modes(x2) [1] 1 3 hth. spencer graves Erin Hodgess wrote: Dear R People: thank you for the many helpful sets of code that I received!!! I combined several of the concepts for the following function: mode1 function(x) { y - rle(sort(x)) z - y$values[y$lengths==max(y$lengths)] return(z) } xm [1] 22 15 10 30 25 26 2 17 28 2 24 6 26 24 5 22 20 14 mode1(xm) [1] 2 22 24 26 This will pick up multiple modes. Again thanks to all who helped! Sincerely, Erin mailto: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ?plot problem
On Mon, 23 Jun 2003, Paul, David A wrote: R1.7.0, Win2k: When I use plot( ) on a groupedData object, if I have 165 subjects I'm supposed to be able to use plot(..., layout = c(5,3,11)) to get all 165 on 11 separate sheets. The graphics window is only displaying the first 10. If I use plot(..., layout = c(5,3,12)) I get the appropriate 11 sheets. Furthermore, yesterday I noticed that when using plot( linear model object ) along with the record feature, after using Page Up to scroll up through the graphs, I was unable to scroll back down to the last (fourth) graph to see the Cook's Distance plot, though the first three plots remained scollable. What is going on? Does R for Windows have issues with the last plot in a series of plots? Perhaps recording does, as people have reported similar things, but neither Duncan nor I could reproduce them. I've just tried several plot.lm examples, and it worked flawlessly. We can't help you further unless you can produce reproducible examples. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] sequential gaussian simulation
Hello, I am wondering does anyone have experience with sequential gaussian simulation? what package would you recommend for that purpose? I also have a related Q: In R, is there a function I can use to test that if my data is multi-point, or multi-variant gaussian? Any information and pointer is appreciated! yan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Lwd ignored when printing on Windows
Prof. Ripley, I'm using one of following the HPLaserJet-4000 (Driver: HP LaserJet 5Si/5Si MX PS) HPLaserJet-4100DTN (Driver: HP LaserJet 8150 PCL 6) You are correct: the lines are thicker on the hardcopy. When I plotted the following: plot(rnorm(10), type = l, lwd = 5) lines(rnorm(10), lwd = 1) there is a difference on the plot. The first line is slightly darker than the second. So it appears to actually be working properly though it's not apparent unless you have the second line as a reference. Note that saving the plot (File - Save as) to emf and then printing the resulting file produces much thicker lines using the above print drivers. Regards, Sundar Prof Brian Ripley wrote: What printer driver are you using? I've just tried this and it works exactly as one would expect on my HP 970CXi, as well as cut-and-paste into other applications. It also worked printing to Acrobat Distiller (although all the lines were thinner there than on-screen and on the 970CXi, the ratio was still 1:5). We've been here before, and had to abandon some optimizations because of a bug in interpreting Windows metafiles in Word. On Mon, 23 Jun 2003, Sundar Dorai-Raj wrote: Andy, I've experienced the same thing. What's interesting is that printing a plot (CTRL-P) with lwd = 25 makes lines on the hardcopy look like lwd = 5. I'm using R1.7.1 on Win2000Pro. Regards, Sundar Liaw, Andy wrote: Dear R-help, Has anyone notice the problem that, on Windows (NT and XP), when printing a graph using the File - Print... menu in the graphics window to print the graph, that line width seemed to be ignored in the printed output? For example, if I make a plot with plot(1:10, type=l, lwd=5), it looks right on screen, but when printed out using the menu, it looks like the plot was made with lwd=1. I've had this problem for quite a while (at least since 1.3.x) and still present in 1.7.1. Has anyone else seen this, or just me? Best, Andy Andy Liaw, PhD Biometrics Research PO Box 2000, RY33-300 Merck Research Labs Rahway, NJ 07065 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 732-594-0820 -- Notice: This e-mail message, together with any attachments, cont... {{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Smooth of a temporal serie
Hello all, I'm a new member in this list and, also, a new R user and need some information about Resistant Smooth (using medians). The method I need of Resistant Smooth is the 4253H one and I didn't found how to perform that in R. Does anybody have an idea? Thanks, Henrique. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Debian packages of Hmisc and Design Packages available
Two Debian packages for Hmisc and Design have been created and are currently available at http://dirk.eddelbuettel.com/code/debian/misc/ along with the package sources. I may upload these to the Debian archive as well. Feedback is, as always, welcome. Dirk -- Don't drink and derive. Alcohol and analysis don't mix. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Warnings using MASS Library
I am running R version 1.7.1. In the process of checking the results from some code against the results obtained from version 1.5.1, I encountered a set of warning messages upon exiting from the session: Save workspace image? [y/n/c]: y Warning messages: 1: namespaces may not be available when loading 2: names in persistent strings are currently ignored This happened only after loading the MASS library and running glm.nb. I have read the postings of other users who have encountered these warnings. The solutions suggested did not solve the problem for me (e.g. running update.packages(), not surprising since I'm running the latest version of MASS [7.1-8]). Is there anything I can do that will cause these messages to disappear? Can I safely ignore them? Thanks, Brian __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] How can I do a spinning plot in R?
I asked about spinning plots in R. Peter Wolf [EMAIL PROTECTED] wrote about a function of his using Tcl/Tk, at: http://www.wiwi.uni-bielefeld.de/~wolf/software/spin3R/spin3R.sch I have downloaded this. Now I face another problem. f% R R : Copyright 2003, The R Development Core Team Version 1.7.1 (2003-06-16) [rest of banner snipped] library(tcltk) Segmentation Fault (core dumped) f% gdb $R_HOME/bin/R.bin core [snip] (gdb) where #0 0x7f6e5644 in Tcl_ParseCommand () from /usr/local/lib/libtcl8.1.so #1 0x7f6e6878 in Tcl_EvalEx () from /usr/local/lib/libtcl8.1.so #2 0x7f6e6b04 in Tcl_Eval () from /usr/local/lib/libtcl8.1.so #3 0x7f772cfc in tcltk_init () at tcltk.c:570 #4 0x615a0 in do_dotCode (call=0xcd452c, op=0xcd59a0, args=0x1e39f0, env=0x0) at dotcode.c:1307 #5 0x750a8 in Rf_eval (e=0xcd452c, rho=0x9825fc) at eval.c:441 #6 0x7673c in do_begin (call=0xcd4430, op=0x1f4c54, args=0xcd4548, rho=0x9825fc) at eval.c:1077 #7 0x74f38 in Rf_eval (e=0xcd4430, rho=0x9825fc) at eval.c:418 #8 0x755c4 in Rf_applyClosure (call=0x65a6ac, op=0x9d4ef4, arglist=0x984a94, rho=0xf13ea8, suppliedenv=0x1e39f0) at eval.c:609 [snip snip] When I installed R 1.7.1 I went through the usual ./configure make make check sequence. Make check reported a problem in a Tcl/Tk check, but it didn't dump core, and didn't explain what the problem actually _was_. I went carefully through the log produced by ./configure and found that it had located the Tcl/Tk libraries correctly, and we see from the dump above that this is certainly true of Tcl. (I actually have tcl 8.3 installed privately; R's configure located the system-wide 8.1 version.) This is on a Sun Blade 100 running Solaris 2.9. What is the next step in tracking this problem down? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] help on R programming.
Hello all, I am looking for books to help me gain a firmer grasp on the S/R programming language , programing / data structures etc. it seems that for this purpose two books are typically recommended: Programming with Data: A Guide to the S Language, John M. Chambers and S Programming by Venables Ripley. - The Chambers book is published 1998. is it a bit dated at this point. - is the Venables and Ripley's book a good source on the design and manipulation of data structures in R (it seems mostly focused on R extensions). - are there any other books, possibly published more recently, that you could recommend. I also have a couple of particular programming questions: -coming from a C++/java programming background I found that I often end up in R with lists of objects (each constructed, in turn, as a list, say list(x=x,y=y,z=z)). often, these individual objects have recursive 'attributes' so a matrix representation of this set of objects is not an option. although a data.frame might be. I typically need to access certain attributes of these objects for plotting or analysis etc. however, I have not been able to come up with a clean way to do this? e.g. object.list = list(o1=list(x=1,y=2,z=3), o2=list(x=11,y=22,z=33)) what I would like to do is say get a vector of x values for the objects in object.list, but something like object.list[[1:length(object.list)]]$x, for example, returns NULL. is there a better way to set up such an object list data structure that will allow me to do this? - what is the correct way to -remove- a component from a list. this seems to do the trick: list[[1]] = NULL, however, you'd think this should simply attach a NULL object at the first component position? many thanks for any help -- Murad Nayal M.D. Ph.D. Department of Biochemistry and Molecular Biophysics College of Physicians and Surgeons of Columbia University 630 West 168th Street. New York, NY 10032 Tel: 212-305-6884 Fax: 212-305-6926 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] FW: S4 classes, creating in C
Laurence Kell FM CEFAS [EMAIL PROTECTED] asked about setClass(LUdecomposition, representation(a=matrix, pivot = integer), prototype=list(pivot = NA)) then I get the following error message in R 1.7.1 but not R 1.7.0 Error in makePrototypeFromClassDef(properties, ClassDef, immediate) : In making the prototype for class LUdecomposition elements of the prototype failed to match the corresponding slot class: pivot (class integer ) Why can I no longer use the prototype to set the default values? The prototype says 'pivot = integer'. Had you noticed in the R language PDf file that typeof(NA) = logical? What happens when you try prototype=list(pivot=as.integer(NA)) instead? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help on R programming.
I can help with the second of the three questions I see your email: object.list = list(o1=list(x=1,y=2,z=3), o2=list(x=11,y=22,z=33)) sapply(object.list, function(x)x$x) o1 o2 1 11 See for example Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. (Springer, pp. 33-34). hth. spencer graves Murad Nayal wrote: Hello all, I am looking for books to help me gain a firmer grasp on the S/R programming language , programing / data structures etc. it seems that for this purpose two books are typically recommended: Programming with Data: A Guide to the S Language, John M. Chambers and S Programming by Venables Ripley. - The Chambers book is published 1998. is it a bit dated at this point. - is the Venables and Ripley's book a good source on the design and manipulation of data structures in R (it seems mostly focused on R extensions). - are there any other books, possibly published more recently, that you could recommend. I also have a couple of particular programming questions: -coming from a C++/java programming background I found that I often end up in R with lists of objects (each constructed, in turn, as a list, say list(x=x,y=y,z=z)). often, these individual objects have recursive 'attributes' so a matrix representation of this set of objects is not an option. although a data.frame might be. I typically need to access certain attributes of these objects for plotting or analysis etc. however, I have not been able to come up with a clean way to do this? e.g. object.list = list(o1=list(x=1,y=2,z=3), o2=list(x=11,y=22,z=33)) what I would like to do is say get a vector of x values for the objects in object.list, but something like object.list[[1:length(object.list)]]$x, for example, returns NULL. is there a better way to set up such an object list data structure that will allow me to do this? - what is the correct way to -remove- a component from a list. this seems to do the trick: list[[1]] = NULL, however, you'd think this should simply attach a NULL object at the first component position? many thanks for any help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] help on R programming.
-Original Message- From: Murad Nayal [mailto:[EMAIL PROTECTED] Sent: Tuesday, 24 June 2003 12:02 PM Cc: [EMAIL PROTECTED] Subject: [R] help on R programming. Hello all, I am looking for books to help me gain a firmer grasp on the S/R programming language , programing / data structures etc. it seems that for this purpose two books are typically recommended: Programming with Data: A Guide to the S Language, John M. Chambers and S Programming by Venables Ripley. - The Chambers book is published 1998. is it a bit dated at this point. - is the Venables and Ripley's book a good source on the design and manipulation of data structures in R (it seems mostly focused on R extensions). - are there any other books, possibly published more recently, that you could recommend. I like Venables and Ripley's S Programming. Of course it is focussed on R (S) extensions, since programming in S is often extending the language. I think there is enough information in there on data structures (don't have the book in front of me). S has very simple data structures. I also have a couple of particular programming questions: -coming from a C++/java programming background I found that I often end up in R with lists of objects (each constructed, in turn, as a list, say list(x=x,y=y,z=z)). often, these individual objects have recursive 'attributes' so a matrix representation of this set of objects is not an option. although a data.frame might be. I typically need to access certain attributes of these objects for plotting or analysis etc. however, I have not been able to come up with a clean way to do this? e.g. object.list = list(o1=list(x=1,y=2,z=3), o2=list(x=11,y=22,z=33)) what I would like to do is say get a vector of x values for the objects in object.list, but something like object.list[[1:length(object.list)]]$x, for example, returns NULL. is there a better way to set up such an object list data structure that will allow me to do this? try sapply(object.list, function (element) element$x) (I come from a Lisp background, so this seems natural to me. There may be better ways! *sighs with fond memories of mapcar and lambda*) - what is the correct way to -remove- a component from a list. this seems to do the trick: list[[1]] = NULL, however, you'd think this should simply attach a NULL object at the first component position? You'd think that, but you would be wrong. :-). To add a NULL object to the front of a list: c(list(NULL), object.list) Cheers, Simon. Simon Blomberg, PhD Depression Anxiety Consumer Research Unit Centre for Mental Health Research Australian National University http://www.anu.edu.au/cmhr/ [EMAIL PROTECTED] +61 (2) 6125 3379 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Writing R demo files
Hi, Is it possible to comment demo() files? I am trying to write demos that have comments, R commands, and R output so that new users will be able to follow along. I have tried readline(), but that returns the readline(...) command statement as well as the output from readline, and the demos are ugly. I have also tried: options(echo = FALSE) print(my comments here) options(echo = TRUE) [some R commands here] options(echo = FALSE) print(more comments) options(echo = TRUE) but options() seems to work only at the beginning of the file. Is there a special command or procedure that I should use? Thanks, Olivia Lau __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help on R programming.
Murad Nayal wrote: Hello all, I am looking for books to help me gain a firmer grasp on the S/R programming language , programing / data structures etc. it seems that for this purpose two books are typically recommended: Programming with Data: A Guide to the S Language, John M. Chambers and Although it was published in 1998, I hardly find it outdated. Still a good reference, but as far as I know, not everything is implemented in R. S Programming by Venables Ripley. - The Chambers book is published 1998. is it a bit dated at this point. - is the Venables and Ripley's book a good source on the design and manipulation of data structures in R (it seems mostly focused on R extensions). - are there any other books, possibly published more recently, that you could recommend. Modern Applied Statistics in S (4th ed.) by Venables Ripley is not so much about the language itself but is always a good reference. I also have a couple of particular programming questions: -coming from a C++/java programming background I found that I often end up in R with lists of objects (each constructed, in turn, as a list, say list(x=x,y=y,z=z)). often, these individual objects have recursive 'attributes' so a matrix representation of this set of objects is not an option. although a data.frame might be. I typically need to access certain attributes of these objects for plotting or analysis etc. however, I have not been able to come up with a clean way to do this? e.g. object.list = list(o1=list(x=1,y=2,z=3), o2=list(x=11,y=22,z=33)) what I would like to do is say get a vector of x values for the objects in object.list, but something like object.list[[1:length(object.list)]]$x, for example, returns NULL. You can use sapply: sapply(object.list, [[, x) is there a better way to set up such an object list data structure that will allow me to do this? - what is the correct way to -remove- a component from a list. this seems to do the trick: list[[1]] = NULL, however, you'd think this should simply attach a NULL object at the first component position? many thanks for any help -roger __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help