[R] Clustering with clara
Hello everyone I am trying to use CLARA method for finding clusters in my spatial surface temperature data and noticed one problem. My data are in the form lat,lon,temperature. I extract lat,lon and cluster number for each point in the dataset. When I plotted a map of cluster numbers I found empty areas in the map. The point is that the number of points that were assigned a cluster number are less than the original temperature analyzed points. Why are there less points in the clustering results? is there any option in the CLARA method to retain every single point? is there another clustering method that preserves all the points? Thanks in advance Paco -- _ El ponent la mou, el llevant la plou Usuari Linux registrat: 363952 --- Fotos: http://picasaweb.google.es/pacomet [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Giving parameters from shell
Hi I want to give parameters for my function from the shell. I mean I defined a function like these: work1.R : myfunc - function(x,y) { z = x + y z } and now I want to use shell to give parameters like ./work1.R (3,5) to get sum 8. so what should I do? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] chron, xts and zoo
dear r folks i am a bit puzzled about how to use chron as an index xts and why it differs from zoo. in this example, why can i index zoo but not xts x-1:23 time.of.day - times(paste(x,:0:0,sep=),format=h:m:s) day - dates(4/8/90) period - chron(dates=day,times=time.of.day) xts(1:23,period) zoo(1:23,period) i suspect it might be to do with chron, but i cant see why. it seems to behave normally in the way i am trying to use it. grateful for any help simeon [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Updated comparison table for SAS-SPSS Add-ons and R Functions
On Thu, Jan 14, 2010 at 12:39 AM, Muenchen, Robert A (Bob) muenc...@utk.edu wrote: One of the things I updated was to *remove* the now-obsolete PASW! Since IBM bought the company, they did away with that and renamed things IBM SPSS See the list at: http://spss.com/software/statistics/ Sheesh! I knew IBM had bought it up but I guess I missed the memo about changing the name-changing to a different name-change. I'm wondering if you should have a spatial statistics category as well as (or instead of) a GIS category. GIS would be more about making maps and manipulating geographic data in a non-statistical way, whereas spatial statistics has wider applications to 2-d data in general. The Spatial Task View you reference talks about both aspects. For R, spatial stats packages include spatstat, splancs and gstat. I don't know if SAS or SPSS do point-pattern analysis or Kriging. It seems odd that SPPS Maps is 'defunct', as you say, since there's such a rise in geospatial technologies. Have they got anything to replace it? Can you make maps in IBM SPSS Whatever? Barry [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Online R documentation
On Fri, 8 Jan 2010 16:35:25 +0100 Karl Ove Hufthammer k...@huftis.org wrote: Well, I was thinking of better integration with the help pages, e.g., having each image appear right after the code that generated it, having larger images (perhaps at approx. the default window size for graphs in R?), and having all images for a given help page shown on the page, instead of the user having to click on a PDF link to see them. Which I now discovered that the Graphical Manual http://bm2.genes.nig.ac.jp/RGM2/index.php?clear=all has ... :-) There really is too much good R documentation people don't know about! -- Karl Ove Hufthammer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Barchart bar lengths not proportionate
When I use barchart (with default formatting options), I get bars whose lengths/heights are not proportional to their value. For example: http://drop.io/wbagm6s/asset/capture-png Many of the values in this chart are 1; however, because the blue bars extend to the left of the 0 tick mark, those bars appear to represent higher numeric values. Is there a way to make the length of the bar proportional to the data value, so that people looking at my chart are not misled? Thanks, Rex [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Online R documentation
On 01/14/2010 07:44 PM, Karl Ove Hufthammer wrote: On Fri, 8 Jan 2010 16:35:25 +0100 Karl Ove Hufthammerk...@huftis.org wrote: Well, I was thinking of better integration with the help pages, e.g., having each image appear right after the code that generated it, having larger images (perhaps at approx. the default window size for graphs in R?), and having all images for a given help page shown on the page, instead of the user having to click on a PDF link to see them. Which I now discovered that the Graphical Manual http://bm2.genes.nig.ac.jp/RGM2/index.php?clear=all has ... :-) There really is too much good R documentation people don't know about! Wow, that is an excellent website. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Giving parameters from shell
cihan inan wrote: Hi I want to give parameters for my function from the shell. I mean I defined a function like these: work1.R : myfunc - function(x,y) { z = x + y z } and now I want to use shell to give parameters like ./work1.R (3,5) to get sum 8. so what should I do? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hi, Add the following shebang line at the top of your script: #! /path/to/Rscript The following lines will get you the parameters passed on by the user: args = commandArgs(TRUE) cheers, Paul -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Logical function
Dear all, I'm learning R, with a classical programming background. Some hours were necessary for me to programm the vector way. Here is my dataset : ds - data.frame( st=runif(100), st=runif(100),s1=runif(100),mp=runif(100)) I need to generate 2 new variables. First was easy : ds$n1 - (ds$st0.38)*1 Second involve a if statement. Here is the python way of expressing what I need : nash - function(st,s0,s1,mp){ if (is.na(st) | (st=0.38)){ return(0.25) } if (s0 == mp){ return(0.25) } if (s1 == mp){ return(0.5) } if (mp == 1){ return(0.75) } } I would like to do something like : ds$n2 - nash(ds) I mean I would like to add a new variable n2, whose value depends on the value of other variables - row per row. I played with a for loop (don't flame :p), with apply functions and derivatives, with a logical set, etc Can you help me find the R way, please ? Cheers, -- Olivier Deckmyn | oliv...@deckmyn.org | 06 73 40 89 88 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to color a splom?
Dear R-Users, I would like to color the data in a splom according to their position in the matrix, i.e. I would like to have all data shown in the upper left corner to be blue, all entries below that to be black, and the data to the right to be all red. I tried to color the splom with the following call... splom(~iris[1:3],col=c(black,blue,red)) ...however, the colors are mixed. I also constructed a matrix containing the required colors, but that also did not work. How do I color the splom according to the location in the matrix as mentioned above? Cheers, Marius __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to install old randomForest?
Note that all these instructions are outdated since there is no chm help support for R-2.10.x, for example. Please use the R Installation and Administration manual as the reference. Best wishes, Uwe Ligges On 14.01.2010 06:10, David Scott wrote: Julian Ramirez wrote: Hi Ted, You need to unzip and untar the files that are inside that file, and then build the package using R CMD build --binary PackageName. However, for compiling a package under a windows environment you will need Rtools2.10 from Duncan Murdoch, along with Miktex, and html workshop from microsoft. All that is free. I suggest you to read tutorials on how to build packages from sources in Windows. This website might be a good start point http://www.biostat.wisc.edu/~kbroman/Rintro/Rwinpack.html. Hope this helps, Julian Ramirez Research Assistant International Centre for Tropical Agriculture, CIAT On Wed, Jan 13, 2010 at 11:29 PM, Chang, C-Y. changcy.m...@gmail.comwrote: Hi all, I'm using windowsXP and R 2.10.0. I downloaded randomForest 4.5-33.tar.gz from its archive, but how do I make it into a installation ZIP file? Thanks, Ted As an alternative guide to the build process, have a look at Rob Hyndman's instructions: http://robjhyndman.com/researchtips/building-r-packages-for-windows/ David Scott _ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.sc...@auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Logical function
Here's one way : ds - data.frame( st = runif(100), s0=runif(100), s1=runif(100),s2=runif(100),mp=runif(100)) ds - within( ds, { n1 - 1*( st0.38 ) n2 - numeric( length( st ) ) n2[ is.na(st) | st = 0.38 ] - .25 n2[ s0 == mp ] - .25 n2[ s2 == mp ] - .5 n2[ mp == 1 ] - .75 } ) See ?within for why/how this works. Romain On 01/14/2010 11:10 AM, Olivier Deckmyn wrote: Dear all, I'm learning R, with a classical programming background. Some hours were necessary for me to programm the vector way. Here is my dataset : ds- data.frame( st=runif(100), st=runif(100),s1=runif(100),mp=runif(100)) I need to generate 2 new variables. First was easy : ds$n1- (ds$st0.38)*1 Second involve a if statement. Here is the python way of expressing what I need : nash- function(st,s0,s1,mp){ if (is.na(st) | (st=0.38)){ return(0.25) } if (s0 == mp){ return(0.25) } if (s1 == mp){ return(0.5) } if (mp == 1){ return(0.75) } } I would like to do something like : ds$n2- nash(ds) I mean I would like to add a new variable n2, whose value depends on the value of other variables - row per row. I played with a for loop (don't flame :p), with apply functions and derivatives, with a logical set, etc Can you help me find the R way, please ? Cheers, -- Olivier Deckmyn | oliv...@deckmyn.org | 06 73 40 89 88 -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/KfKn : Rcpp 0.7.2 |- http://tr.im/JOlc : External pointers with Rcpp `- http://tr.im/JFqa : R Journal, Volume 1/2, December 2009 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Better way than an ifelse statement?
Try this: example$X3 - sapply(example$X2, switch, -3, -1, 1, 3) On Thu, Jan 14, 2010 at 5:05 AM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hello All, I am trying to create a column of weights based off of factor levels from another column. I am using the weights to calculate L scores. Here is an example where the first column are scores, the second is my factor and the third I want to be a column of weights. I can do what I want with an ifelse statement (see below), but I am wondering if anyone knows of a cleaner way to do this? example - data.frame(cbind(rnorm(4), rep(1:4, 1), c(0))) example$X3 - ifelse(example$X2==1, -3, ( ifelse(example$X2==2, -1, ( ifelse(example$X2==3, 1, ( ifelse(example$X2==4, 3, NA))) ## this seems sloppy to me example X1 X2 X3 1 1.75308880 1 -3 2 -0.49273616 2 -1 3 -0.12446648 3 1 4 -0.06417217 4 3 Thanks for your help, Joshua -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Clustering with clara
Dear Paco, as far as I know, there is no such problem with clara, but I may be wrong. However, in order to help you (though I'm not sure whether I'll be able to do that), we'd need to understand precisely what you were doing in R and how your data looks like (code and data; you can show us a relevant bit of the data using the str command). Chances are that the problem is not in clara but some other thing that you do doesn't do what you expect it to do. Christian On Thu, 14 Jan 2010, pacomet wrote: Hello everyone I am trying to use CLARA method for finding clusters in my spatial surface temperature data and noticed one problem. My data are in the form lat,lon,temperature. I extract lat,lon and cluster number for each point in the dataset. When I plotted a map of cluster numbers I found empty areas in the map. The point is that the number of points that were assigned a cluster number are less than the original temperature analyzed points. Why are there less points in the clustering results? is there any option in the CLARA method to retain every single point? is there another clustering method that preserves all the points? Thanks in advance Paco -- _ El ponent la mou, el llevant la plou Usuari Linux registrat: 363952 --- Fotos: http://picasaweb.google.es/pacomet [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. *** --- *** Christian Hennig University College London, Department of Statistical Science Gower St., London WC1E 6BT, phone +44 207 679 1698 chr...@stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Better way than an ifelse statement?
Or this ; example$X3 - c(-3, -1, 1, 3)[ example$X2 ] Romain On 01/14/2010 11:55 AM, Henrique Dallazuanna wrote: Try this: example$X3- sapply(example$X2, switch, -3, -1, 1, 3) On Thu, Jan 14, 2010 at 5:05 AM, Joshua Wileyjwiley.ps...@gmail.com wrote: Hello All, I am trying to create a column of weights based off of factor levels from another column. I am using the weights to calculate L scores. Here is an example where the first column are scores, the second is my factor and the third I want to be a column of weights. I can do what I want with an ifelse statement (see below), but I am wondering if anyone knows of a cleaner way to do this? example- data.frame(cbind(rnorm(4), rep(1:4, 1), c(0))) example$X3- ifelse(example$X2==1, -3, ( ifelse(example$X2==2, -1, ( ifelse(example$X2==3, 1, ( ifelse(example$X2==4, 3, NA))) ## this seems sloppy to me example X1 X2 X3 1 1.75308880 1 -3 2 -0.49273616 2 -1 3 -0.12446648 3 1 4 -0.06417217 4 3 Thanks for your help, Joshua -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/KfKn : Rcpp 0.7.2 |- http://tr.im/JOlc : External pointers with Rcpp `- http://tr.im/JFqa : R Journal, Volume 1/2, December 2009 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Better way than an ifelse statement?
This works too: example$X3 - example$X2 * 2 - 5 On Thu, Jan 14, 2010 at 8:55 AM, Henrique Dallazuanna www...@gmail.com wrote: Try this: example$X3 - sapply(example$X2, switch, -3, -1, 1, 3) On Thu, Jan 14, 2010 at 5:05 AM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hello All, I am trying to create a column of weights based off of factor levels from another column. I am using the weights to calculate L scores. Here is an example where the first column are scores, the second is my factor and the third I want to be a column of weights. I can do what I want with an ifelse statement (see below), but I am wondering if anyone knows of a cleaner way to do this? example - data.frame(cbind(rnorm(4), rep(1:4, 1), c(0))) example$X3 - ifelse(example$X2==1, -3, ( ifelse(example$X2==2, -1, ( ifelse(example$X2==3, 1, ( ifelse(example$X2==4, 3, NA))) ## this seems sloppy to me example X1 X2 X3 1 1.75308880 1 -3 2 -0.49273616 2 -1 3 -0.12446648 3 1 4 -0.06417217 4 3 Thanks for your help, Joshua -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R package dependencies
Thanks Gabor, Are you or anyone aware if there is a text list of of package contents? The only way i have managed to get information like the number of dlls per package is by downloading the zip file to a tempporary file and listing its contents via unzip(..., list = TRUE). However, downloading every package on CRAN is a time consuming so if there was a more efficient way of finding the contents of each it would be useful to know. The code i am using on R2.10.1 on windows 7 contriburl - http://cran.uk.r-project.org/bin/windows/contrib/2.10 http://cran.uk.r-project.org/bin/windows/contrib/2.10 destdir - C:/colin/SCOTS-user-group/pkgs lab.pkgs - c(gamair,mgcv,survival,lme4,nlme,lattice,MASS,nnet,splines,stats4, stats, methods) available - available.packages(contriburl = contriburl) fnames - paste(available[,Repository], available[,File], sep = /) tmpf - paste(tempfile(), .zip, sep = ) pkg.contents - lapply(fnames, function(x) {download.file(x, tmpf); unzip(tmpf, list = TRUE)}) ndlls - sapply(pkg.contents, function(x) sum( grepl( .dll, x $ Name ))) pkg.summ - data.frame(pkg = rownames(available), dll = ndlls) Thanks again, Colin. From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Wed 13/01/2010 22:09 To: Colin Millar Cc: r-help@r-project.org Subject: Re: [R] R package dependencies See the dep function defined here: http://tolstoy.newcastle.edu.au/R/e6/help/09/03/7159.html On Wed, Jan 13, 2010 at 11:39 AM, Colin Millar c.mil...@marlab.ac.uk wrote: Hi there, My question relates to getting information about R packages. In particular i would like to be able to find from within R: what are a packages dependencies what are a packages reverse dependencies does a package contain a dll The reason i ask is: The organisation that i work for is introducing a secure intranet operating on windows PCs and laptops, and this requires that all software / executables / dlls are validated before they are combined to produce a generic PC build. I would like to maximise the packages available to our staff and so for the packages that we have listed as buisness needs, i would like to include all reverse dependencies of this collection that do not have dlls. I hope this makes sense (the question not the reason). Kind regards, Colin. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Windows Shell: R Gui Here
Some years ago I published the reg string here to start RGui in a selected Windows directory via right key click without keeping a cmd window open. That string no longer works in Vista/Windows 7. Below is the alternative. It assumes that rgui is on your path, or that you have Gabor's rbatch installed and on you path. http://batchfiles.googlecode.com If you must use an explicit path to RGui, use the short path name, or find out how to escape double quotes in registry/shell. (\ or \\ or does not work). Dieter Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Folder\shell\RGui] @=R Gui here [HKEY_CLASSES_ROOT\Folder\shell\RGui\command] @=cmd.exe /c \pushd %L start rgui --no-restore --no-save\ -- View this message in context: http://n4.nabble.com/Windows-Shell-R-Gui-Here-tp1013783p1013783.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Is it possible to create the genetic code circle graph ?
Hello dear R help group, Can any one suggest me of a way of making this: http://portal.techhigh.us/Teachers/lauritsenk/PublishingImages/genetic%20code.jpg Using R ? Thanks! Tal http://portal.techhigh.us/Teachers/lauritsenk/PublishingImages/genetic%20code.jpg Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Need help with R-tasks
Hello everybody, I have got some problems concerning my tasks using R. I have got a true regression function for a double-log model. I also have got two samples n1=100 and n2=400 which are saved in X1 and Y1, and in X2 and Y2 respectively. Now I have to display the original data and the double-log transformed data for the two samples. Could you please tell me a code to log-transform the data? Is it possibly: Take the log-log transformation with n1 Y1=log(Y1) X1=log(X1) with n2 Y2=log(Y2) X2=log(X2) -- View this message in context: http://n4.nabble.com/Need-help-with-R-tasks-tp1013670p1013670.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] To add text in a matrix
Dear colleagues, I would need to add text (some rows of information) in a matrix. For example, given this matrix 1 2 3 4 5 6 7 8 9 I would need to add this info: THIS IS AN EXAMPLE OF a 3x3 MATRIX 1 2 3 4 5 6 7 8 9 I have been looking for a function that works similar to fopen in matlab, but unfortunately I have not found It in R. Thank you in advance for your help! Carlos Fernandez __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fixed size permutations
I'm using functions to return a matrix of all permutations of a specified size from a larger list for predictor selection. For each predictor size I use a seperate function like this: bag2 - function(n) { rl - c() for (i1 in seq(n)) { for (i2 in seq(n)) { if (length(unique(c(i1,i2)))==1) {next} rl - cbind(rl,matrix(c(i1,i2))) } } rl } bag3 - function(n) { rl - c() for (i1 in seq(n)) { for (i2 in seq(n)) { for (i3 in seq(n)) { if (length(unique(c(i1,i2,i3)))==1) {next} rl - cbind(rl,matrix(c(i1,i2,i3))) } } } rl } But I think it should be somehow possible in R to use one general function for all sizes. Can someone help? I don't exactly know how this kind of permutation is called, maybe this would help to find a solution. Nick __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] To add text in a matrix
On 14-Jan-10 10:04:27, carfer...@alum.us.es wrote: Dear colleagues, I would need to add text (some rows of information) in a matrix. For example, given this matrix 1 2 3 4 5 6 7 8 9 I would need to add this info: THIS IS AN EXAMPLE OF a 3x3 MATRIX 1 2 3 4 5 6 7 8 9 I have been looking for a function that works similar to fopen in matlab, but unfortunately I have not found It in R. Thank you in advance for your help! Carlos Fernandez You cannot mix data types (in this case character and numeric) in a matrix (and in any case, even if you could, your text would become an element of the matrix itself, which presumably you would not want). One way to do this is to make a list, one element being the text metadata, the other the matrix itself: M - list(Meta=THIS IS AN EXAMPLE OF a 3x3 MATRIX, Matrix=matrix(c(1,2,3,4,5,6,7,8,9),byrow=TRUE,ncol=3)) M # $Meta # [1] THIS IS AN EXAMPLE OF a 3x3 MATRIX # $Matrix # [,1] [,2] [,3] # [1,]123 # [2,]456 # [3,]789 and you can access either element using M$Meta M$Matrix Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 14-Jan-10 Time: 11:55:22 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Advantages of using SQLite for data import in comparison to csv files
sqldf is layered on top of RSQLite. Its not a separate facility. On Thu, Jan 14, 2010 at 2:12 AM, Juliet Jacobson julietjacob...@aim.com wrote: Thanks for your answer. I hadn't found this possibility by web search. Since sqldf also allows the import of tables from csv files, complex SELECT queries and even joins on tables, I have the impression that there aren't any reasons for using a SQLite database to organise the data for R. But then why has the R driver for data import from a SQLite database been written? Gabor Grothendieck wrote: You could look at read.csv.sql in sqldf (http://sqldf.googlecode.com) as well. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Updated comparison table for SAS-SPSS Add-ons and R Functions
Hello On 1/13/10, Muenchen, Robert A (Bob) muenc...@utk.edu wrote: http://r4stats.com/add-on-modules and I would very much appreciate any feedback you might have on it. Perhaps add latticist and playwith to the list of Graphics, Interactive? Regards Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] To add text in a matrix
You can use the Matrix package: Matrix::Matrix(1:9, ncol = 3) On Thu, Jan 14, 2010 at 8:04 AM, carfer...@alum.us.es wrote: Dear colleagues, I would need to add text (some rows of information) in a matrix. For example, given this matrix 1 2 3 4 5 6 7 8 9 I would need to add this info: THIS IS AN EXAMPLE OF a 3x3 MATRIX 1 2 3 4 5 6 7 8 9 I have been looking for a function that works similar to fopen in matlab, but unfortunately I have not found It in R. Thank you in advance for your help! Carlos Fernandez __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Updated comparison table for SAS-SPSS Add-ons and R Functions
On 1/14/10, Liviu Andronic landronim...@gmail.com wrote: Perhaps add latticist and playwith to the list of Graphics, Interactive? .. and remove latticist from Graphics, Static. Also, add rattle to Graphical user interfaces? Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] memDecompress and zlib compressed base64 encoded string
Hi, I have zlib compressed strings (example is attached) and would like to decompress them using memDecompress ... I try this: connection - file(compressed.txt,r) compressed - readLines(connection) memDecompress(as.raw(compressed),type=g) Error in memDecompress(as.raw(compressed), type = g) : internal error -3 in memDecompress(2) In addition: Warning messages: 1: In memDecompress(as.raw(compressed), type = g) : NAs introduced by coercion 2: In memDecompress(as.raw(compressed), type = g) : out-of-range values treated as 0 in coercion to raw Can anyone nudge me into the right direction regarding this? Thanks, JoheJw03Hdcjt//B3CKtLRkk6KlbBnZOu/rLjKzs1f23qOMSLuE0t5DgyYqM6FCxgdlFj72+lofm9+L8/755/m4b+e6znWd64z3Oee6E6F1dOrgnwitY8s6s4ukGtfZj9IGxqwdO27wqHe1cA3NrtgM9ykNw3/DAsWl6SR4Q5nY7SH8pJiVZYhQzSZ0LOAj7EmzbZ3geHLp0gqupdlrvGEouVxdD4+Q+YkSWCWuGE+An2V+Wk3ZXuwEqYUDO5v1ZBPZM+Jl9mD4iJbdxGfLerTfVwua09Ls8ZBEtNEtOEemt9zJJrNnpTtGssvYIDabvSIWr1sK/0fb3eaL0J2GdNIvCXalbLdvcDSN3dgCrhTbts2FIfK4nbnsP+wHqdc+toC9wf4n3dVEjBxwEPaksJp3cIKi/rwHXKfobr0Bw6jwgDM8KrJykd+uaj7ui9S7OWsvDX4n3W3IdmVd2JVsCJ2fhee0O0+5ufpf+I9qwrgZ8IPK/zTyCzFWbQ2aDe1UZuEr4Vhlndo0uEZcuBYA+b5CDrM3Wb6vPV+le/n69vZhXdmNonIt6tPeSFq4cxgsJu9FRvAudWqPerj3h0PwdGMRuq+VTL+vPzuVdZdGXGRfSyMbsh3ZEQ43TqfBpdS56X4YSOEXV8NDFJ3VFF6m0aP/B9+Kg73ri9AoA3lcVBd2NLvir2GGnmwiW8r+KzWqz1pQu8guUEUPRFPoprR94Qd3Ka3Hm8BUulLPDpZR58w/n5+J/lmnRFgjLXl8o/bsUHah1F2btWWd2cVsAJtF2zWNYaVi22Q3fKNsPhIqwjz0lY3dlsMuSjuPYjiKRn9cDfn+PELYXPYfVvYfYQHTWA82lj3F1oqjvY+IsMC65KRSwba0/akbdKCxRV/gbOF70RbukOkDk9iz7BNp1GX2f9JoQ7Yr6yISPtTAVbRBLwTuoYKW8TCfDn6IhjdoqtUL+J/YbpwswmKayONierET2fXSWL6f2Bj2J! FsrjasrXrmfhWY04osRdKCVLlFwNjn3QT5xnuL+nemQ7yeO7yfusTReQ/qRn+NHPzaTvcS+Fkl+o0XYJz2yUvsIO9O2zivhKAqYtAiuoPEVfz7vFrfccb+f+Dl94uf0iZ/Tf43/ur9xDHuCrZH+LY4/mon1zYygA3l0+fN5Np2a6AA96VjzEzCJtt0Ph2fF0243oHw++5s2YK3ZIVKT79I2rdj+7DR2i6hKXANjaaH/fHiK/I4+gw9o7t58sd9UjdQKkmA7md6U2Lms7Nf3x1Szsp/ZH9uC7ctOEaX2B6A7+Y7fBmOo4NdteJKi9njBWhr6sovYj+f6c9NO2FYeFyfYOSznl7iZjWa5PBO5PJPqiJStuK8kM7L++As60LLi+3A2bZjwxx3UY2sgTBbuMyzhOT7uqTRZk5XtPtxiCRvIHmKvsO8dYq1biXDLRrR2mSm0U+pNrwvHKR0dB8G1Sqs7ETCMSoyGwULSr28Ab8vjLeVzCrdqxcrnFL4nhM1nb7CyXw/f21TcWLYN2lPvkeuhK82L14SbaNi0rTBa/DzQC57g9LJ8wvfVZWU5h8eUsrI+hcc2YK3ZoeJrVTFcRKeqL0N/xfK7Ch5URNo8eFkxTUuF7ygrtEyExxmJtDrtYHd5fNw4di0bxvL9x/H9x7dmB7DTxaOfeXAb7Y5Nggl0c95SeIaO/lsOH9Pg1toiPEFDjHY5B63kcQlD2IWsbN/hKQZsV9aFXc3uEzf8NsHDZOt3F1bTpA3P4Fdy6b1dhKe2oJaDcmE/kbHPDMrxLzzVg41jT0ufyTgr/Hlztg87hXUX57KtYCy17HwdnqKunSzhA7I+fUKEv1An/buh0Fymf6Fi57E+f40w6MAOZ5exwWyuePxAC/5D6xecgJ/oyrVYEWHYhH732gV7052LA+EkWu04Fm4SW1q+gVHyeMMTrKw/EUay/kSYrWBD2Hz2BvuZDLoMExFtm1EvvX9hH+o5yRpOJ! pNuNtCdtPN7Q9kvRrQ9xT6QtlNnzVmVuHnhLZxHwWcqoY9iFYn7apeuLD1uBC8q827OgK+ VVoFIZ65PQaN0YBdx8m0bKJ93hPkqdh8r46aIjifZWmknNbYdq4hCZQJ0I7N3S6E3KdP+gwfIrr0TvCA+nke+nWT8E9FZj+3CyvglYnUlK8fTiDWGbHd2LLuWBi8zh/uVxkcawUJl1WQNeEfZNm8f/KH0tDIUEWtNyK8S5bB2kIP6hy5wpjx+rSebzMp+LmLrafaRdFs91pJ1EoNdQuECavG+BfSjjQXzYSZtsHGFlWRe+Of7/4kTpuEiYjtf/3a+/u3jWNneI/beYX9K97VhB7GzxGXNcriDbAaoYDIFhznC83Rv7gb4XKn7Xl9EhGpT9e/BsAMtMl4JR4iDJ/pDru+hu9k8Vs63IsIN2G4sl2/4GjZM9DNNgYUUsuYVvK207IxyDv+hDNP4LiIiTBS7dpPgQCr/fhXOFFcN90Au34gklss3Qo4jEVG9WVd2ExvNnhTave/DWnKa+0JERKtRjLUXNKf9NdlQoZ77/3w/T1jbVEBu79Hp7EX2jTTOhh3GLmGD2BxqMOwuvEazzb7Aj7Q56aGIiG9C9rddYC+x61I0nCTTx/P1xnM/EM/9QALX70R9lut3IrevxNXif65n4D6af1EXHqHt7/XgLVoszsFv5FKB8k1qRf2PJ8EBpD1zAJwuj0/axiaycnyK+HGW5fL9qcXyff8cJl6svgyX0pDV72EwbU6fA3Np87pW8B8a554PP5FZMzsR8aupuKt6AOV8LeIXP6dfm1nZL0XWNWUd2NnsTjZVrJ0xDZaT/fDt8CXN6dRNRKrpkpXhcthJTHZ7CEfJ9Gor2b2snI9GNotnz7ByHhPZXIO1Fj9NLsCh1GLPYbiYJkXfhQEUfmA8PESHL1XDq3SgXgT8QNPblYjIFo1FyDdPKOPtyBYT2Y2sfL6Rm/qwU1gPNo49LX6mL4CPaHwazr+5Ps24qwetUJ6hcIjYmjsJyvWOyM0B7CH2qjT2CHuLleN/ZFxrdqBI0E2EMym7! 12voqdjYroXJyqjUVfC8YpvhBZ9TVvszIjJeR9jtOwflPDMyfiS7gpXjU+SB+awvm8lWsrI/jkw3ovVWTaAdfdB4C8crek1q4Xp68N8RGEHTNC3hMYeJT+PgfXlcRh22LSvj5SjrHPYf9pO0fVPWXlwwLIBTyHpFCPSgsb3+GEeqd9dhCen/+0dZH6JsNNj2rJx3Ru2pZOW6Q9TeRmwPdqLYGbwObqSuTZJgFC3ufBeepLEdi+AD8XbaTxG1T467UfssWCdWxlNRYTL+jNrfjO3LTmW3UB0jLxiPeGkrLKU+doPgE7K/0lZEhWtSzyUp0JZyLvaEwxXNtQvgMkUjbQgMoQOpETBffFu7Asr1jKhwOb+IimjJyjg5KqWK/SZNbcUOYGdSg6Sl0JO89C1hMh3aXAHLaN+0W/AF6Z1/I6LSdGX6tM7saFbGC9FWE9iNbBR7kn0gbhj9FNHW9UiJ1YWWND4hGw6hVuVT4CKR1Pk7lPOIaOts9h9W1oto98PsLVa2j2gPE3aQ+P7OB86mrTmR0IuCxv0xjUZeKoEXxNkgLSj76egtBmx3Vo7P0d4X2bdSH0PWjp1AOnf2ww20rjYFRtGut0HwBPWzmQMfCLeajSLaV9b7aN92rMLK9ha9T/bX0aHabAd2JLuStHIM4F7aYdEJHqH9/jbwNo35HQJ/iI49y0R0mIwbosMGs3PYXdKoSla24+joRmxPdqJIbpQIN5HNxSIYQ+Nmj4enyHLiTfhILFuF/GPkulF0jDXrzMrxNDqe7yvel81ir7DvxeW0HiI6oTE5P8HnhN7k7fQYutLmJi0g4t663jBOpk8oYeX6RHSinH/GJM5lvdkMtpJ95/Bz2lERk2RMk7RbwV6U1rsHdKW4F9ehOw29PAfGCZ+qMVCOKzFJcp4Xk6zFyucR22ADG8WeZB9KNetT3Tn7oTXt/VwDnRW1zolwmWLZsxUMUZq/mwQL6MxeC1gtPqA9x2rK! +hurZcIOZuXzi224nU1my9iXUj098XV5G9iNugYWwXE0pqUHXE8OLf4YKV5MvgFPcHo5f4
Re: [R] HTML translation problem in R-2.10.1
On 14/01/2010 11:20 AM, Jim Lemon wrote: Hi Core Team, I received an email about a problem with the help on the plotrix package. Apparently the \link tags in the help pages were showing up as literal text. I couldn't see this problem, nor any problem with the Rd files. Since the plotrix package hasn't been built for a while, I rechecked, rebuilt and reinstalled it. Sure enough, the \link tags showed up as literal text in both text and HTML help. This may be peculiar to R-2.10.1 as I never installed 2.10.0. If it helps, the --no-latex tag wasn't recognized by the INSTALL command (although only the HTML help was apparently built). As far as I can see, the previous behavior of translating \link{ into a href=... and the following } into /a has been lost. The \samp{ string is now translated to an HTML span tag whereas I think it used to be translated to a code tag and this may be where the problem lies. I think this is all done in Perl, so I can't help with the debugging. The help parsing is done in C now, and the conversion to output formats is done in R. See the Rd2* functions in the tools package if you want to debug anything. Duncan Murdoch Jim R version 2.10.1 (2009-12-14) i686-pc-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] plotrix_2.7-2 prettyR_1.8 loaded via a namespace (and not attached): [1] tools_2.10.1 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plot type any symbols?
Dear all, I have a question is there a possibility to plot points with different symbols like stars, crosses? I looked at different types for plot command and didn't find anything like that. Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot type any symbols?
See pch argument: plot(1:10, pch = 1:10) On Thu, Jan 14, 2010 at 11:22 AM, Trafim Vanishek rdapam...@gmail.com wrote: Dear all, I have a question is there a possibility to plot points with different symbols like stars, crosses? I looked at different types for plot command and didn't find anything like that. Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot type any symbols?
Trafim Use the pch= argument within plot(). Try ?points to get details. Trafim wrote: Dear all, I have a question is there a possibility to plot points with different symbols like stars, crosses? I looked at different types for plot command and didn't find anything like that. Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://n4.nabble.com/plot-type-any-symbols-tp1013838p1013849.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Better way than an ifelse statement?
Hello, Thanks for all of your responses. I got a lot of great options that work. Thanks again! Joshua __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] To add text in a matrix
You can also use the comment() function to add comments to any kind of R object. Matthieu Dubois __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R package dependencies
For the original question: what are a packages dependencies tools:::package.dependencies(available.packages()) what are a packages reverse dependencies tools:::dependsOnPkgs(available.packages()[,1]) does a package contain a dll If the package has been installed already and you want to get the number of dlls in libs: length(grep(\\.dll$, dir(system.file(package=foo, libs or if not installed, you can get an idea by looking at the check logs on CRAN. If they contain a line * checking line endings in C/C++/Fortran sources/headers ... OK they also contain compiled code. This is not a save test, though. Uwe Ligges On 14.01.2010 12:27, Colin Millar wrote: Thanks Gabor, Are you or anyone aware if there is a text list of of package contents? The only way i have managed to get information like the number of dlls per package is by downloading the zip file to a tempporary file and listing its contents via unzip(..., list = TRUE). However, downloading every package on CRAN is a time consuming so if there was a more efficient way of finding the contents of each it would be useful to know. The code i am using on R2.10.1 on windows 7 contriburl- http://cran.uk.r-project.org/bin/windows/contrib/2.10http://cran.uk.r-project.org/bin/windows/contrib/2.10 destdir- C:/colin/SCOTS-user-group/pkgs lab.pkgs- c(gamair,mgcv,survival,lme4,nlme,lattice,MASS,nnet,splines,stats4, stats, methods) available- available.packages(contriburl = contriburl) fnames- paste(available[,Repository], available[,File], sep = /) tmpf- paste(tempfile(), .zip, sep = ) pkg.contents- lapply(fnames, function(x) {download.file(x, tmpf); unzip(tmpf, list = TRUE)}) ndlls- sapply(pkg.contents, function(x) sum( grepl( .dll, x $ Name ))) pkg.summ- data.frame(pkg = rownames(available), dll = ndlls) Thanks again, Colin. From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Wed 13/01/2010 22:09 To: Colin Millar Cc: r-help@r-project.org Subject: Re: [R] R package dependencies See the dep function defined here: http://tolstoy.newcastle.edu.au/R/e6/help/09/03/7159.html On Wed, Jan 13, 2010 at 11:39 AM, Colin Millarc.mil...@marlab.ac.uk wrote: Hi there, My question relates to getting information about R packages. In particular i would like to be able to find from within R: what are a packages dependencies what are a packages reverse dependencies does a package contain a dll The reason i ask is: The organisation that i work for is introducing a secure intranet operating on windows PCs and laptops, and this requires that all software / executables / dlls are validated before they are combined to produce a generic PC build. I would like to maximise the packages available to our staff and so for the packages that we have listed as buisness needs, i would like to include all reverse dependencies of this collection that do not have dlls. I hope this makes sense (the question not the reason). Kind regards, Colin. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fixed size permutations
Nick Fankhauser wrote: I'm using functions to return a matrix of all permutations of a specified size from a larger list for predictor selection. For each predictor size I use a seperate function like this: bag2 - function(n) { rl - c() for (i1 in seq(n)) { for (i2 in seq(n)) { if (length(unique(c(i1,i2)))==1) {next} rl - cbind(rl,matrix(c(i1,i2))) } } rl } bag3 - function(n) { rl - c() for (i1 in seq(n)) { for (i2 in seq(n)) { for (i3 in seq(n)) { if (length(unique(c(i1,i2,i3)))==1) {next} rl - cbind(rl,matrix(c(i1,i2,i3))) } } } rl } But I think it should be somehow possible in R to use one general function for all sizes. Can someone help? I don't exactly know how this kind of permutation is called, maybe this would help to find a solution. Nick Looks to me like you're just doing expand.grid, but without the 'all variables equal' cases. If that's correct and if n 1, then this might do it: bag - function(n,K){ L - vector(mode='list', length=K) L - lapply(L, function(x) {x - seq_len(n)}) d - expand.grid(L) keeprow - apply(d, 1, function(x) {var(x)!=0}) ## I'm blanking out on a better way to test for equal values td - t(as.matrix(d[keeprow,])) dimnames(td) - c(NULL, NULL) rtd - td[nrow(td):1,] rtd } all.equal(bag(5,2), bag2(5)) #[1] TRUE all.equal(bag(9,3), bag3(9)) #[1] TRUE -Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fixed size permutations
Try this: v - 1:5 n - 2 t(subset(do.call(expand.grid, replicate(n, v, FALSE))[n:1], Var1 != Var2)) On Thu, Jan 14, 2010 at 9:51 AM, Nick Fankhauser li...@nyk.ch wrote: I'm using functions to return a matrix of all permutations of a specified size from a larger list for predictor selection. For each predictor size I use a seperate function like this: bag2 - function(n) { rl - c() for (i1 in seq(n)) { for (i2 in seq(n)) { if (length(unique(c(i1,i2)))==1) {next} rl - cbind(rl,matrix(c(i1,i2))) } } rl } bag3 - function(n) { rl - c() for (i1 in seq(n)) { for (i2 in seq(n)) { for (i3 in seq(n)) { if (length(unique(c(i1,i2,i3)))==1) {next} rl - cbind(rl,matrix(c(i1,i2,i3))) } } } rl } But I think it should be somehow possible in R to use one general function for all sizes. Can someone help? I don't exactly know how this kind of permutation is called, maybe this would help to find a solution. Nick __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fixed size permutations
Small modification below. Peter Ehlers wrote: Nick Fankhauser wrote: I'm using functions to return a matrix of all permutations of a specified size from a larger list for predictor selection. For each predictor size I use a seperate function like this: bag2 - function(n) { rl - c() for (i1 in seq(n)) { for (i2 in seq(n)) { if (length(unique(c(i1,i2)))==1) {next} rl - cbind(rl,matrix(c(i1,i2))) } } rl } bag3 - function(n) { rl - c() for (i1 in seq(n)) { for (i2 in seq(n)) { for (i3 in seq(n)) { if (length(unique(c(i1,i2,i3)))==1) {next} rl - cbind(rl,matrix(c(i1,i2,i3))) } } } rl } But I think it should be somehow possible in R to use one general function for all sizes. Can someone help? I don't exactly know how this kind of permutation is called, maybe this would help to find a solution. Nick Looks to me like you're just doing expand.grid, but without the 'all variables equal' cases. If that's correct and if n 1, then this might do it: bag - function(n,K){ L - vector(mode='list', length=K) L - lapply(L, function(x) {x - seq_len(n)}) d - expand.grid(L) keeprow - apply(d, 1, function(x) {var(x)!=0}) ## I'm blanking out on a better way to test for equal values keeprow - apply(d, 1, function(x) {length(unique(x)) 1}) is probably more efficient and certainly more transparent. -Peter Ehlers td - t(as.matrix(d[keeprow,])) dimnames(td) - c(NULL, NULL) rtd - td[nrow(td):1,] rtd } all.equal(bag(5,2), bag2(5)) #[1] TRUE all.equal(bag(9,3), bag3(9)) #[1] TRUE -Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Peter Ehlers University of Calgary 403.202.3921 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Barchart bar lengths not proportionate
Rex, I think this problem can be solved using xlim()/ylim() argument. Look at the follwing code: require(lattice) da - expand.grid(A=c(a,b), x=1:4) da$y - c(1,5,6,3,2,0,6,0) barchart(y~x|A, data=da, horizontal=FALSE) barchart(y~x|A, data=da, horizontal=FALSE, ylim=c(0, 1.05*max(da$y))) At your disposal. Walmes. Rex C. Eastbourne wrote: When I use barchart (with default formatting options), I get bars whose lengths/heights are not proportional to their value. For example: http://drop.io/wbagm6s/asset/capture-png Many of the values in this chart are 1; however, because the blue bars extend to the left of the 0 tick mark, those bars appear to represent higher numeric values. Is there a way to make the length of the bar proportional to the data value, so that people looking at my chart are not misled? Thanks, Rex [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - ..oooO .. ..()... 0ooo... Walmes Zeviani ...\..(.(.)... Master in Statistics and Agricultural Experimentation \_). )../ walmeszevi...@hotmail.com, Lavras - MG, Brasil (_/ -- View this message in context: http://n4.nabble.com/Barchart-bar-lengths-not-proportionate-tp1013702p1013918.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Barchart bar lengths not proportionate
On Thu, Jan 14, 2010 at 1:16 AM, Rex C. Eastbourne rex.eastbou...@gmail.com wrote: When I use barchart (with default formatting options), I get bars whose lengths/heights are not proportional to their value. For example: http://drop.io/wbagm6s/asset/capture-png Many of the values in this chart are 1; however, because the blue bars extend to the left of the 0 tick mark, those bars appear to represent higher numeric values. Is there a way to make the length of the bar proportional to the data value, so that people looking at my chart are not misled? Add 'origin = 0' as an argument. -Deepayan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R ON Mac
Hi, it appears that your corrdinates contain commas, instead of decimal points, R sees the commas and immediatly thinks the data are text, you should replace the commas with decimal points in a text editor. Corey gedasg wrote: hello, I have strange error. gyliai-read.table(file.choose(),header=T) summary(gyliai) xy gylis 307577,08: 1 6124296,56: 1 3,00 : 59 308613,01: 1 6124353,50: 1 2,80 : 51 313800,45: 1 6124530,65: 1 3,10 : 36 313840,17: 1 6124970,20: 1 2,90 : 32 313864,05: 1 6124991,68: 1 2,70 : 22 313869,26: 1 6125009,34: 1 3,43 : 5 (Other) :393 (Other) :393 (Other):194 coordinates(gyliai)=~x+y Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements Your version of R is up to date Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements - whats is that I use Gstat, mass, and sp packages. any ideas why this error shows to me? I check it on windows couple days ago it worked fine, but not on my mac, I don't have windows pc at the moment :) so help me :) Gedas -- View this message in context: http://n4.nabble.com/R-ON-Mac-tp1013829p1013925.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R ON Mac
Corey Sparks wrote: Hi, it appears that your corrdinates contain commas, instead of decimal points, R sees the commas and immediatly thinks the data are text, you should replace the commas with decimal points in a text editor. Alternatively, set dec=, or use read.delim2() (if the file is tab-separated). Corey gedasg wrote: hello, I have strange error. gyliai-read.table(file.choose(),header=T) summary(gyliai) xy gylis 307577,08: 1 6124296,56: 1 3,00 : 59 308613,01: 1 6124353,50: 1 2,80 : 51 313800,45: 1 6124530,65: 1 3,10 : 36 313840,17: 1 6124970,20: 1 2,90 : 32 313864,05: 1 6124991,68: 1 2,70 : 22 313869,26: 1 6125009,34: 1 3,43 : 5 (Other) :393 (Other) :393 (Other):194 coordinates(gyliai)=~x+y Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements Your version of R is up to date Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements - whats is that I use Gstat, mass, and sp packages. any ideas why this error shows to me? I check it on windows couple days ago it worked fine, but not on my mac, I don't have windows pc at the moment :) so help me :) Gedas -- 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 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R ON Mac
On Thu, 14 Jan 2010 07:07:49 -0800 (PST), Corey Sparks wrote: CS CS Hi, it appears that your corrdinates contain commas, instead of CS decimal points, R sees the commas and immediatly thinks the data CS are text, you should replace the commas with decimal points in a CS text editor. CS or keep the data as they are, and use the dec parameter, as in gyliai-read.table(file.choose(),header=T, dec=,) CS Corey CS CS gedasg wrote: CS CS hello, I have strange error. CS CS gyliai-read.table(file.choose(),header=T) CS summary(gyliai) CS xy gylis CS 307577,08: 1 6124296,56: 1 3,00 : 59 CS 308613,01: 1 6124353,50: 1 2,80 : 51 CS 313800,45: 1 6124530,65: 1 3,10 : 36 CS 313840,17: 1 6124970,20: 1 2,90 : 32 CS 313864,05: 1 6124991,68: 1 2,70 : 22 CS 313869,26: 1 6125009,34: 1 3,43 : 5 CS (Other) :393 (Other) :393 (Other):194 CS coordinates(gyliai)=~x+y CS Error in .checkNumericCoerce2double(obj) : CScannot retrieve coordinates from non-numeric elements CS CS Your version of R is up to date CS CS CS Error in .checkNumericCoerce2double(obj) : CScannot retrieve coordinates from non-numeric elements - whats CS is that CS CS I use Gstat, mass, and sp packages. any ideas why this error CS shows to me? I check it on windows couple days ago it worked CS fine, but not on my mac, I don't have windows pc at the moment :) CS so help me :) CS CS Gedas CS CS __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] FW: Problems connecting with MySQL using odbcDriverConnect (RODBC package) on Linux
Orvalho: Thanks for pointing our RMySQL. The reason is that we have similar data stored in both SQL server and MySQL databases and I want to reuse code as much as possible. Jeff -Original Message- From: Orvalho Augusto [mailto:orvaq...@gmail.com] Sent: Wednesday, January 13, 2010 10:57 PM To: Marcus, Jeffrey Cc: r-help@r-project.org Subject: Re: [R] FW: Problems connecting with MySQL using odbcDriverConnect (RODBC package) on Linux Thanks you solved and share with us. But, why don't you use the RMySQL, which connects to MySQL without the need of ODBC? Caveman On Wed, Jan 13, 2010 at 1:48 AM, Marcus, Jeffrey jeffrey.mar...@nuance.com wrote: I think I figured this out. I should not have put the Driver name in braces. Changing it from {MySQL} to MySQL seems to work. -Original Message- From: Marcus, Jeffrey Sent: Tuesday, January 12, 2010 6:09 PM To: 'r-help@r-project.org' Subject: Problems connecting with MySQL using odbcDriverConnect (RODBC package) on Linux I am sure I'm doing something wrong here but not sure what. Our system administrator recently installed UnixODBC and the MyODBC driver on a Linux box running Linux version 2.6 x86_64. I have an .odbc.ini file in my home directory with following lines: [mydb] Description = MySQL server on my-server Driver=/usr/lib64/libmyodbc3.so SERVER=my-server I can successfully do the following: library(RODBC) channel - odbcConnect(mydb) sqlQuery(channel, show databases) And in general, I have no problems using odbcConnect to connect to the mydb DSN. However, for various reasons I want to make a DSN-less connection using odbcDriverConnect. However, everything I've tried generated a data source not found message (see below for details) After reading through various documents, I tried doing following. (1) Put an odbcinst.ini file in my home directory with following lines [MySQL] Description = ODBC for MySQL Driver=/usr/lib64/libmyodbc3.so Setup = /usr/lib/libodbcmyS.so FileUsage = 1 (2) Install it with odbcinst -i -f. This seems to work as when I type odbcinst -j I get DRIVERS: /home/jmarcus/odbcinst.ini SYSTEM DATA SOURCES: /home/jmarcus/odbc.ini USER DATA SOURCES..: /home/jmarcus/.odbc.ini (2) Set the environment variable to point to this file: bash-3.2$ ODBCSYSINI=/home/jmarcus bash-3.2$ export ODBCSYSINI (3) Start R Note that R has inherited environment variable Sys.getenv(ODBCSYSINI) ODBCSYSINI /home/jmarcus (4) Try to connect to the MySQL server conn - odbcDriverConnect(connection=Driver={MySQL};Server=my-server;Database=m y_database;Uid=my_username;Pwd=my_password) This generates following: Warning messages: 1: In odbcDriverConnect(connection = Driver={MySQL};Server=my-server;Database=my_database;Uid=my_username;Pw d=my_password) : [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specified 2: In odbcDriverConnect(connection = Driver={MySQL};Server=my-server;Database=my_database;Uid=my_username;Pw d=my_password) : ODBC connection failed Can anyone see what I'm doing wrong? Thanks. Jeff __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- OpenSource Software Consultant CENFOSS (www.cenfoss.co.mz) SP Tech (www.sptech.co.mz) email: orvaq...@cenfoss.co.mz cell: +258828810980 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R package dependencies
Thanks guys! The tools functions are very useful, and also the the utils:::.clean_up_dependencies hiding in there, which I had a managed to do myself but in far more lines! I think I am going to download each zip file one by one to find if there are dlls - which sounds like an overnight job to me. Many thanks again, Colin. -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: 14 January 2010 14:06 To: Colin Millar Cc: Gabor Grothendieck; r-help@r-project.org Subject: Re: [R] R package dependencies For the original question: what are a packages dependencies tools:::package.dependencies(available.packages()) what are a packages reverse dependencies tools:::dependsOnPkgs(available.packages()[,1]) does a package contain a dll If the package has been installed already and you want to get the number of dlls in libs: length(grep(\\.dll$, dir(system.file(package=foo, libs or if not installed, you can get an idea by looking at the check logs on CRAN. If they contain a line * checking line endings in C/C++/Fortran sources/headers ... OK they also contain compiled code. This is not a save test, though. Uwe Ligges On 14.01.2010 12:27, Colin Millar wrote: Thanks Gabor, Are you or anyone aware if there is a text list of of package contents? The only way i have managed to get information like the number of dlls per package is by downloading the zip file to a tempporary file and listing its contents via unzip(..., list = TRUE). However, downloading every package on CRAN is a time consuming so if there was a more efficient way of finding the contents of each it would be useful to know. The code i am using on R2.10.1 on windows 7 contriburl- http://cran.uk.r-project.org/bin/windows/contrib/2.10http://cran.uk.r- project.org/bin/windows/contrib/2.10 destdir- C:/colin/SCOTS-user-group/pkgs lab.pkgs- c(gamair,mgcv,survival,lme4,nlme,lattice,MASS,nnet,spli nes,stats4, stats, methods) available- available.packages(contriburl = contriburl) fnames- paste(available[,Repository], available[,File], sep = /) tmpf- paste(tempfile(), .zip, sep = ) pkg.contents- lapply(fnames, function(x) {download.file(x, tmpf); unzip(tmpf, list = TRUE)}) ndlls- sapply(pkg.contents, function(x) sum( grepl( .dll, x $ Name ))) pkg.summ- data.frame(pkg = rownames(available), dll = ndlls) Thanks again, Colin. From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Wed 13/01/2010 22:09 To: Colin Millar Cc: r-help@r-project.org Subject: Re: [R] R package dependencies See the dep function defined here: http://tolstoy.newcastle.edu.au/R/e6/help/09/03/7159.html On Wed, Jan 13, 2010 at 11:39 AM, Colin Millarc.mil...@marlab.ac.uk wrote: Hi there, My question relates to getting information about R packages. In particular i would like to be able to find from within R: what are a packages dependencies what are a packages reverse dependencies does a package contain a dll The reason i ask is: The organisation that i work for is introducing a secure intranet operating on windows PCs and laptops, and this requires that all software / executables / dlls are validated before they are combined to produce a generic PC build. I would like to maximise the packages available to our staff and so for the packages that we have listed as buisness needs, i would like to include all reverse dependencies of this collection that do not have dlls. I hope this makes sense (the question not the reason). Kind regards, Colin. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible
Re: [R] R ON Mac
However, for there to be a difference between Mac and PC means that something else is going on. I would guess that the PC is set to a LOCALE for which , is the default decimal separator, and the Mac is set to a LOCALE for which . is the default decimal separator. (If locale settings affect the separator, that is. I don't know for sure whether they do. See ?locales to start learning more...) Either that or the input files are different on the two different computers. -Don At 7:07 AM -0800 1/14/10, Corey Sparks wrote: Hi, it appears that your corrdinates contain commas, instead of decimal points, R sees the commas and immediatly thinks the data are text, you should replace the commas with decimal points in a text editor. Corey gedasg wrote: hello, I have strange error. gyliai-read.table(file.choose(),header=T) summary(gyliai) xy gylis 307577,08: 1 6124296,56: 1 3,00 : 59 308613,01: 1 6124353,50: 1 2,80 : 51 313800,45: 1 6124530,65: 1 3,10 : 36 313840,17: 1 6124970,20: 1 2,90 : 32 313864,05: 1 6124991,68: 1 2,70 : 22 313869,26: 1 6125009,34: 1 3,43 : 5 (Other) :393 (Other) :393 (Other):194 coordinates(gyliai)=~x+y Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements Your version of R is up to date Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements - whats is that I use Gstat, mass, and sp packages. any ideas why this error shows to me? I check it on windows couple days ago it worked fine, but not on my mac, I don't have windows pc at the moment :) so help me :) Gedas -- View this message in context: http://*n4.nabble.com/R-ON-Mac-tp1013829p1013925.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://*stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] To add text in a matrix
In R, see ?connectionfor information about functions similar to matlab's fopen. If what you're trying to do is write information and the matrix to a file, then you can at least get started with something along the lines of: cat('This is my information\nand a second line of it\n',file='myfile') write.table(mymatrix, 'myfile',append=TRUE) See also the sink() function -Don At 11:04 AM +0100 1/14/10, carfer...@alum.us.es wrote: Dear colleagues, I would need to add text (some rows of information) in a matrix. For example, given this matrix 1 2 3 4 5 6 7 8 9 I would need to add this info: THIS IS AN EXAMPLE OF a 3x3 MATRIX 1 2 3 4 5 6 7 8 9 I have been looking for a function that works similar to fopen in matlab, but unfortunately I have not found It in R. Thank you in advance for your help! Carlos Fernandez __ R-help@r-project.org mailing list https://*stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R package dependencies
Hi Colin, The pkgDepTools package from Bioconductor will help with question #1: http://bioconductor.org/packages/2.5/bioc/html/pkgDepTools.html I am not positive on this, but I believe this package is also used to determine the reverse dependencies that would be listed on that page if there were any for this package. An example with reverse dependencies is e.g., the IRanges package: http://bioconductor.org/packages/2.5/bioc/html/IRanges.html The maintainer (Seth Falcon) would know for sure if the package will do reverse dependencies as well. Best, Jim Colin Millar wrote: Hi there, My question relates to getting information about R packages. In particular i would like to be able to find from within R: what are a packages dependencies what are a packages reverse dependencies does a package contain a dll The reason i ask is: The organisation that i work for is introducing a secure intranet operating on windows PCs and laptops, and this requires that all software / executables / dlls are validated before they are combined to produce a generic PC build. I would like to maximise the packages available to our staff and so for the packages that we have listed as buisness needs, i would like to include all reverse dependencies of this collection that do not have dlls. I hope this makes sense (the question not the reason). Kind regards, Colin. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826 ** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R ON Mac
Don MacQueen wrote: However, for there to be a difference between Mac and PC means that something else is going on. I would guess that the PC is set to a LOCALE for which , is the default decimal separator, and the Mac is set to a LOCALE for which . is the default decimal separator. (If locale settings affect the separator, that is. I don't know for sure whether they do. See ?locales to start learning more...) Either that or the input files are different on the two different computers. Locale settings are not supposed to affect how R reads files. They might well affect how other programs write them, though. E.g. cut-and-paste or save-as-text from a spreadsheet will come out differently in English and German locales. -Don At 7:07 AM -0800 1/14/10, Corey Sparks wrote: Hi, it appears that your corrdinates contain commas, instead of decimal points, R sees the commas and immediatly thinks the data are text, you should replace the commas with decimal points in a text editor. Corey gedasg wrote: hello, I have strange error. gyliai-read.table(file.choose(),header=T) summary(gyliai) xy gylis 307577,08: 1 6124296,56: 1 3,00 : 59 308613,01: 1 6124353,50: 1 2,80 : 51 313800,45: 1 6124530,65: 1 3,10 : 36 313840,17: 1 6124970,20: 1 2,90 : 32 313864,05: 1 6124991,68: 1 2,70 : 22 313869,26: 1 6125009,34: 1 3,43 : 5 (Other) :393 (Other) :393 (Other):194 coordinates(gyliai)=~x+y Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements Your version of R is up to date Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements - whats is that I use Gstat, mass, and sp packages. any ideas why this error shows to me? I check it on windows couple days ago it worked fine, but not on my mac, I don't have windows pc at the moment :) so help me :) Gedas -- View this message in context: http://*n4.nabble.com/R-ON-Mac-tp1013829p1013925.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://*stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Extracting data from a list of matrices
Hi, Apologies in advance for the basic nature of my question. I am still very much a rookie when it comes to R. Having googled it, checked Nabble and trial/error to the best of my ability, I have yet to find an easy solution. I am currently working with a list of 5x5 matrices, and want to extract a list consisting of the first number of each matrix. In other words I want to go from: [[1]] [,1] [,2] [,3] [,4] [,5] [1,] a X X X X [2,] X X X X X [3,] X X X X X [4,] X X X X X [5,] X X X X X [[2]] [,1] [,2] [,3] [,4] [,5] [1,] b X X X X [2,] X X X X X [3,] X X X X X [4,] X X X X X [5,] X X X X X etc. to a new list: [,1] [[1]]a [[2]]b etc. Any help will be greatly appreciated. -Hubert [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extracting data from a list of matrices
Try this: lapply(l, '[', 1, 1) On Thu, Jan 14, 2010 at 2:22 PM, Hubert Colt hubert.c...@gmail.com wrote: Hi, Apologies in advance for the basic nature of my question. I am still very much a rookie when it comes to R. Having googled it, checked Nabble and trial/error to the best of my ability, I have yet to find an easy solution. I am currently working with a list of 5x5 matrices, and want to extract a list consisting of the first number of each matrix. In other words I want to go from: [[1]] [,1] [,2] [,3] [,4] [,5] [1,] a X X X X [2,] X X X X X [3,] X X X X X [4,] X X X X X [5,] X X X X X [[2]] [,1] [,2] [,3] [,4] [,5] [1,] b X X X X [2,] X X X X X [3,] X X X X X [4,] X X X X X [5,] X X X X X etc. to a new list: [,1] [[1]] a [[2]] b etc. Any help will be greatly appreciated. -Hubert [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Mode of a histogram
Hi all I recently Googled to find out how to get the mode from my continuous data in R, and came up with this ancient thread from the archives: http://tolstoy.newcastle.edu.au/R/help/99b/1319.html But sorting is very inefficient if you have lots of data, so can I propose this method: h - hist(x, breaks=512) mode - h$mids[h$counts == max(h$counts)] of course, breaks can be whatever is sensible for your data, which you can check by running plot(h) Apologies if this is ridiculously obvious, Michael -- Dr Michael Doube BPhil BVSc PhD MRCVS Research Associate Department of Bioengineering Imperial College London South Kensington Campus London SW7 2AZ United Kingdom __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extracting data from a list of matrices
Excellent! That did the trick. Thank you very much. On Thu, Jan 14, 2010 at 5:27 PM, Henrique Dallazuanna www...@gmail.comwrote: Try this: lapply(l, '[', 1, 1) On Thu, Jan 14, 2010 at 2:22 PM, Hubert Colt hubert.c...@gmail.com wrote: Hi, Apologies in advance for the basic nature of my question. I am still very much a rookie when it comes to R. Having googled it, checked Nabble and trial/error to the best of my ability, I have yet to find an easy solution. I am currently working with a list of 5x5 matrices, and want to extract a list consisting of the first number of each matrix. In other words I want to go from: [[1]] [,1] [,2] [,3] [,4] [,5] [1,] a X X X X [2,] X X X X X [3,] X X X X X [4,] X X X X X [5,] X X X X X [[2]] [,1] [,2] [,3] [,4] [,5] [1,] b X X X X [2,] X X X X X [3,] X X X X X [4,] X X X X X [5,] X X X X X etc. to a new list: [,1] [[1]]a [[2]]b etc. Any help will be greatly appreciated. -Hubert [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Mode of a histogram
Michael Doube-3 wrote: But sorting is very inefficient if you have lots of data, so can I propose this method: Mmm. Good to know that sorting is very inefficient. Dieter -- View this message in context: http://n4.nabble.com/Mode-of-a-histogram-tp1014012p1014019.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R ON Mac
hello, I have strange error. gyliai-read.table(file.choose(),header=T) summary(gyliai) xy gylis 307577,08: 1 6124296,56: 1 3,00 : 59 308613,01: 1 6124353,50: 1 2,80 : 51 313800,45: 1 6124530,65: 1 3,10 : 36 313840,17: 1 6124970,20: 1 2,90 : 32 313864,05: 1 6124991,68: 1 2,70 : 22 313869,26: 1 6125009,34: 1 3,43 : 5 (Other) :393 (Other) :393 (Other):194 coordinates(gyliai)=~x+y Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements Your version of R is up to date Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements - whats is that I use Gstat, mass, and sp packages. any ideas why this error shows to me? I check it on windows couple days ago it worked fine, but not on my mac, I don't have windows pc at the moment :) so help me :) Gedas -- View this message in context: http://n4.nabble.com/R-ON-Mac-tp1013829p1013829.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] paired repeated measurements
I have the following problem: I measured co2 on 6 paired sites (one grubbed and one non-grubbed fence per site - grubbing = treatment). These measurements I repeated 15 times over 2 years. So, now my problem is how to analyze these data. I tried the following model: mod1_CO2-lme(co2~treatment+time,random=~1|site,data=CO2_t1_t15) I think with the random effect I included the paired sample design of my study, but obviously the model does not check for the repeated measurements structure of my data. Or in other words, the model assumpt that different sampling dates are independent of each other, but they aren't (since I measured the CO2 15 times on exactly the same spot). So, that's why my question is how can I combine the paired (or nested) design with the repeated measurements in one model??? Thank you for any help Sven -- Sven Wirthner Eidg. Forschungsanstalt für Wald, Schnee und Landschaft WSL Tierökologie Zürcherstrasse 111 CH-8903 Birmensdorf Tel. +41 44 7392 371 Fax +41 44 7392 215 sven.wirth...@wsl.ch http://www.wsl.ch --- This message was sent using IMP (http://horde.org/imp/) at WSL (http://www.wsl.ch). __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R ON Mac
Thanks Corey! I change that, and its start working. Best, Gedas Corey Sparks wrote: Hi, it appears that your corrdinates contain commas, instead of decimal points, R sees the commas and immediatly thinks the data are text, you should replace the commas with decimal points in a text editor. Corey gedasg wrote: hello, I have strange error. gyliai-read.table(file.choose(),header=T) summary(gyliai) xy gylis 307577,08: 1 6124296,56: 1 3,00 : 59 308613,01: 1 6124353,50: 1 2,80 : 51 313800,45: 1 6124530,65: 1 3,10 : 36 313840,17: 1 6124970,20: 1 2,90 : 32 313864,05: 1 6124991,68: 1 2,70 : 22 313869,26: 1 6125009,34: 1 3,43 : 5 (Other) :393 (Other) :393 (Other):194 coordinates(gyliai)=~x+y Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements Your version of R is up to date Error in .checkNumericCoerce2double(obj) : cannot retrieve coordinates from non-numeric elements - whats is that I use Gstat, mass, and sp packages. any ideas why this error shows to me? I check it on windows couple days ago it worked fine, but not on my mac, I don't have windows pc at the moment :) so help me :) Gedas -- View this message in context: http://n4.nabble.com/R-ON-Mac-tp1013829p1013935.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot type any symbols?
Also look at the my.symbols function in the TeachingDemos package for more options. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Trafim Vanishek Sent: Thursday, January 14, 2010 6:23 AM To: r-help@r-project.org Subject: [R] plot type any symbols? Dear all, I have a question is there a possibility to plot points with different symbols like stars, crosses? I looked at different types for plot command and didn't find anything like that. Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Barchart bar lengths not proportionate
I think you should rather look at the origin= parameter in barchart. See ?panel.barchart for a discussion of this exact problem: origin: the origin for the bars. For grouped displays with 'stack = TRUE', this argument is ignored and the origin set to 0. Otherwise, defaults to 'NULL', in which case bars start at the left (or bottom) end of a panel. This choice is somewhat unfortuntate, as it can be misleading, but is the default for historical reasons. For tabular (or similar) data, 'origin = 0' is usually more appropriate; if not, one should reconsider the use of a bar chart in the first place (dot plots are often a good alternative). The result of setting origin is more sensible: require(lattice) da - expand.grid(A=c(a,b), x=1:4) da$y - c(1,5,6,3,2,0,6,0) barchart(y~x|A, data=da, horizontal=FALSE) barchart(y~x|A, data=da, horizontal=FALSE, origin=0) Walmes Zeviani walmeszevi...@hotmail.com 14/01/2010 14:49:01 Rex, I think this problem can be solved using xlim()/ylim() argument. Look at the follwing code: require(lattice) da - expand.grid(A=c(a,b), x=1:4) da$y - c(1,5,6,3,2,0,6,0) barchart(y~x|A, data=da, horizontal=FALSE) barchart(y~x|A, data=da, horizontal=FALSE, ylim=c(0, 1.05*max(da$y))) At your disposal. Walmes. Rex C. Eastbourne wrote: When I use barchart (with default formatting options), I get bars whose lengths/heights are not proportional to their value. For example: http://drop.io/wbagm6s/asset/capture-png Many of the values in this chart are 1; however, because the blue bars extend to the left of the 0 tick mark, those bars appear to represent higher numeric values. Is there a way to make the length of the bar proportional to the data value, so that people looking at my chart are not misled? Thanks, Rex [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - ..oooO .. ..()... 0ooo... Walmes Zeviani ...\..(.(.)... Master in Statistics and Agricultural Experimentation \_). )../ walmeszevi...@hotmail.com, Lavras - MG, Brasil (_/ -- View this message in context: http://n4.nabble.com/Barchart-bar-lengths-not-proportionate-tp1013702p1013918.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lattice dotplot with missing levels in factor variable
Hi, I am trying to create a dotplot where each panel shows levels vs. responses; the levels are sorted by responses but levels vary from one panel to another. However, I run into problems with controlling the y-limits and y-labels. In particular, suppose I have a data frame rsp - c(10,2,4,0,2,3) lvl - factor(c(L1,L2,L3,L2,L3,L4),levels=c(L1,L2,L3,L4)) cat - factor(c(A,A,A,B,B,B),levels=c(A,B)) xx - data.frame(cat,lvl,rsp) print(xx) cat lvl rsp 1 A L1 10 2 A L2 2 3 A L3 4 4 B L2 0 5 B L3 2 6 B L4 3 I tried to follow the Lattice ... book and used dotplot(lvl~rsp|cat,data=xx,type=c(h,p), panel=function(x,y,...){y1 - reorder(y,x) y1 - y1[,drop=TRUE] panel.dotplot(x,y1,...)}, prepanel=function(x,y){y1 - reorder(y,x) y1 - y1[,drop=TRUE] return(list(ylim=levels(y1)))}, layout=c(1,2)) However, the resulting has incorrect y-labels: Desired Plot Achieved Plot Panel B: Panel B: L4 L4 o L1 o L3 ---o L3 ---o L2 o L3 o panel A: Panel A: L4 L1 --oL1 --o L3 o L3 o L2 --oL2 --o It appears that the y-limits and y-labels specified by the pre-panel function are overwritten by something in dotplot. Can anybody suggest what I am doing incorrectly? Regards, Boris. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Updated comparison table for SAS-SPSS Add-ons and R Functions
Hi Liviu, Thanks for those suggestions. I've made the changes and added you to the list of contributors. Cheers, Bob -Original Message- From: Liviu Andronic [mailto:landronim...@gmail.com] Sent: Thursday, January 14, 2010 7:06 AM To: Muenchen, Robert A (Bob) Cc: sa...@listserv.uga.edu; spss...@listserv.uga.edu; r-h...@r- project.org Subject: Re: [R] Updated comparison table for SAS-SPSS Add-ons and R Functions On 1/14/10, Liviu Andronic landronim...@gmail.com wrote: Perhaps add latticist and playwith to the list of Graphics, Interactive? .. and remove latticist from Graphics, Static. Also, add rattle to Graphical user interfaces? Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Barchart bar lengths not proportionate
That fixed it! Thanks to all who replied. On Thu, Jan 14, 2010 at 9:13 AM, S Ellison s.elli...@lgc.co.uk wrote: I think you should rather look at the origin= parameter in barchart. See ?panel.barchart for a discussion of this exact problem: origin: the origin for the bars. For grouped displays with 'stack = TRUE', this argument is ignored and the origin set to 0. Otherwise, defaults to 'NULL', in which case bars start at the left (or bottom) end of a panel. This choice is somewhat unfortuntate, as it can be misleading, but is the default for historical reasons. For tabular (or similar) data, 'origin = 0' is usually more appropriate; if not, one should reconsider the use of a bar chart in the first place (dot plots are often a good alternative). The result of setting origin is more sensible: require(lattice) da - expand.grid(A=c(a,b), x=1:4) da$y - c(1,5,6,3,2,0,6,0) barchart(y~x|A, data=da, horizontal=FALSE) barchart(y~x|A, data=da, horizontal=FALSE, origin=0) Walmes Zeviani walmeszevi...@hotmail.com 14/01/2010 14:49:01 Rex, I think this problem can be solved using xlim()/ylim() argument. Look at the follwing code: require(lattice) da - expand.grid(A=c(a,b), x=1:4) da$y - c(1,5,6,3,2,0,6,0) barchart(y~x|A, data=da, horizontal=FALSE) barchart(y~x|A, data=da, horizontal=FALSE, ylim=c(0, 1.05*max(da$y))) At your disposal. Walmes. Rex C. Eastbourne wrote: When I use barchart (with default formatting options), I get bars whose lengths/heights are not proportional to their value. For example: http://drop.io/wbagm6s/asset/capture-png Many of the values in this chart are 1; however, because the blue bars extend to the left of the 0 tick mark, those bars appear to represent higher numeric values. Is there a way to make the length of the bar proportional to the data value, so that people looking at my chart are not misled? Thanks, Rex [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - ..oooO .. ..()... 0ooo... Walmes Zeviani ...\..(.(.)... Master in Statistics and Agricultural Experimentation \_). )../ walmeszevi...@hotmail.com, Lavras - MG, Brasil (_/ -- View this message in context: http://n4.nabble.com/Barchart-bar-lengths-not-proportionate-tp1013702p1013918.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. *** This email and any attachments are confidential. Any u...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How can I store the results
If you absolutely need a single file for each iteration, you can also include the iteration number into your output filename. for(i in 1:dim(your input data)[1]) { results- your calculation write.csv(results, paste(filename, _, i, sep=)) } Arnaud Date: Wed, 13 Jan 2010 15:59:37 +0100 From: Alex Roy alexroy2...@gmail.com To: r-help@r-project.org Subject: [R] How can I store the results Message-ID: 8bdeb1b51001130659n6341b0e6oe42a029efb7a1...@mail.gmail.com Content-Type: text/plain Dear R users, I am running a R code which gives me 10 columns and 160 rows. I need to run the code for 100 times and each time I need to store the results in a single file. I do not know how can I store them in a single file without over writting the results? Thanks Alex [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] extracting columns with same partial name
Hi folks, I'm new to the list. I have a data file with 256 columns. Here's just a subset of names(data): [1] MOUSE BASEDATE1 PERCENTSLEEPTOT1 [4] PERCENTSLEEPNIGHT1 PERCENTSLEEPDAY1BOUTLENGTHTOT1 [7] BOUTLENGTHNITE1 BOUTLENGTHDAY1 BOUTTHRESTOTP1 [10] BOUTTHRESHNITEP1BOUTTHRESHDAYP1 BOUTTHRESTOTN1 [13] BOUTTHRESHNITEN1BOUTTHRESHDAYN1 ACTONSET1 [16] PEAKACT1BASEDATE2 PERCENTSLEEPTOT2 [19] PERCENTSLEEPNIGHT2 PERCENTSLEEPDAY2BOUTLENGTHTOT2 [22] BOUTLENGTHNITE2 BOUTLENGTHDAY2 BOUTTHRESTOTP2 [25] BOUTTHRESHNITEP2BOUTTHRESHDAYP2 BOUTTHRESTOTN2 [28] BOUTTHRESHNITEN2BOUTTHRESHDAYN2 ACTONSET2 [31] PEAKACT2BASEDATE3 PERCENTSLEEPTOT3 [34] PERCENTSLEEPNIGHT3 PERCENTSLEEPDAY3BOUTLENGTHTOT3 You'll notice that certain names repeat, like BOUTLENGTHTOT1, BOUTLENGTHTOT2, etc. These represent each day of data recording, and they go up to 17. I want to extract, for example, BOUTLENGTHTOT1 - 17. I'm new to R, and the only ways that I know how to this are: newData - data[, c(BOUTLENGTHTOT1, BOUTLENGTHTOT2, )] or newData - data.frame(col1 = data$BOUTLENGTHTOT1, col2 = data$BOUTLENGTHTOT2, .) Both of which take a long time for 17 columns. Is there a way that I can use a wildcard to grab all BOUTLENGTHTOT* columns? Thanks, Martin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extracting columns with same partial name
Try this: DF[,grep(BOUTLENGTHTOT, l)] On Thu, Jan 14, 2010 at 4:43 PM, Martin Striz mst...@gmail.com wrote: Hi folks, I'm new to the list. I have a data file with 256 columns. Here's just a subset of names(data): [1] MOUSE BASEDATE1 PERCENTSLEEPTOT1 [4] PERCENTSLEEPNIGHT1 PERCENTSLEEPDAY1 BOUTLENGTHTOT1 [7] BOUTLENGTHNITE1 BOUTLENGTHDAY1 BOUTTHRESTOTP1 [10] BOUTTHRESHNITEP1 BOUTTHRESHDAYP1 BOUTTHRESTOTN1 [13] BOUTTHRESHNITEN1 BOUTTHRESHDAYN1 ACTONSET1 [16] PEAKACT1 BASEDATE2 PERCENTSLEEPTOT2 [19] PERCENTSLEEPNIGHT2 PERCENTSLEEPDAY2 BOUTLENGTHTOT2 [22] BOUTLENGTHNITE2 BOUTLENGTHDAY2 BOUTTHRESTOTP2 [25] BOUTTHRESHNITEP2 BOUTTHRESHDAYP2 BOUTTHRESTOTN2 [28] BOUTTHRESHNITEN2 BOUTTHRESHDAYN2 ACTONSET2 [31] PEAKACT2 BASEDATE3 PERCENTSLEEPTOT3 [34] PERCENTSLEEPNIGHT3 PERCENTSLEEPDAY3 BOUTLENGTHTOT3 You'll notice that certain names repeat, like BOUTLENGTHTOT1, BOUTLENGTHTOT2, etc. These represent each day of data recording, and they go up to 17. I want to extract, for example, BOUTLENGTHTOT1 - 17. I'm new to R, and the only ways that I know how to this are: newData - data[, c(BOUTLENGTHTOT1, BOUTLENGTHTOT2, )] or newData - data.frame(col1 = data$BOUTLENGTHTOT1, col2 = data$BOUTLENGTHTOT2, .) Both of which take a long time for 17 columns. Is there a way that I can use a wildcard to grab all BOUTLENGTHTOT* columns? Thanks, Martin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] paired repeated measurements
Sven: 1. Try this question on the r-sig-mixwed-models list -- more likely to get good responses there, I think. 2. However, my less expert opinion is that you need a random fence within site term (each fence has it's own ID) co2 ~ treatment + time, rand = ~1|fence/site This assumes time is continuous and not a factor, btw; if time is a factor, I think there may be identifiability problems -- but folks on the mixed models list should be able to provide you better guidance. There may well be better ways to model the covariance structure. Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sven Wirthner Sent: Thursday, January 14, 2010 5:24 AM To: r-help@r-project.org Subject: [R] paired repeated measurements I have the following problem: I measured co2 on 6 paired sites (one grubbed and one non-grubbed fence per site - grubbing = treatment). These measurements I repeated 15 times over 2 years. So, now my problem is how to analyze these data. I tried the following model: mod1_CO2-lme(co2~treatment+time,random=~1|site,data=CO2_t1_t15) I think with the random effect I included the paired sample design of my study, but obviously the model does not check for the repeated measurements structure of my data. Or in other words, the model assumpt that different sampling dates are independent of each other, but they aren't (since I measured the CO2 15 times on exactly the same spot). So, that's why my question is how can I combine the paired (or nested) design with the repeated measurements in one model??? Thank you for any help Sven -- Sven Wirthner Eidg. Forschungsanstalt für Wald, Schnee und Landschaft WSL Tierökologie Zürcherstrasse 111 CH-8903 Birmensdorf Tel. +41 44 7392 371 Fax +41 44 7392 215 sven.wirth...@wsl.ch http://www.wsl.ch --- This message was sent using IMP (http://horde.org/imp/) at WSL (http://www.wsl.ch). __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extracting columns with same partial name
Try dat[names(dat) %in% paste(BOUTLENGTHTOT, 1:17, sep=)] -Peter Ehlers Martin Striz wrote: Hi folks, I'm new to the list. I have a data file with 256 columns. Here's just a subset of names(data): [1] MOUSE BASEDATE1 PERCENTSLEEPTOT1 [4] PERCENTSLEEPNIGHT1 PERCENTSLEEPDAY1BOUTLENGTHTOT1 [7] BOUTLENGTHNITE1 BOUTLENGTHDAY1 BOUTTHRESTOTP1 [10] BOUTTHRESHNITEP1BOUTTHRESHDAYP1 BOUTTHRESTOTN1 [13] BOUTTHRESHNITEN1BOUTTHRESHDAYN1 ACTONSET1 [16] PEAKACT1BASEDATE2 PERCENTSLEEPTOT2 [19] PERCENTSLEEPNIGHT2 PERCENTSLEEPDAY2BOUTLENGTHTOT2 [22] BOUTLENGTHNITE2 BOUTLENGTHDAY2 BOUTTHRESTOTP2 [25] BOUTTHRESHNITEP2BOUTTHRESHDAYP2 BOUTTHRESTOTN2 [28] BOUTTHRESHNITEN2BOUTTHRESHDAYN2 ACTONSET2 [31] PEAKACT2BASEDATE3 PERCENTSLEEPTOT3 [34] PERCENTSLEEPNIGHT3 PERCENTSLEEPDAY3BOUTLENGTHTOT3 You'll notice that certain names repeat, like BOUTLENGTHTOT1, BOUTLENGTHTOT2, etc. These represent each day of data recording, and they go up to 17. I want to extract, for example, BOUTLENGTHTOT1 - 17. I'm new to R, and the only ways that I know how to this are: newData - data[, c(BOUTLENGTHTOT1, BOUTLENGTHTOT2, )] or newData - data.frame(col1 = data$BOUTLENGTHTOT1, col2 = data$BOUTLENGTHTOT2, .) Both of which take a long time for 17 columns. Is there a way that I can use a wildcard to grab all BOUTLENGTHTOT* columns? Thanks, Martin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Peter Ehlers University of Calgary 403.202.3921 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extracting columns with same partial name
On Thu, Jan 14, 2010 at 1:57 PM, Dennis Murphy djmu...@gmail.com wrote: Try this: nms - paste(BOUTLENGTHTOT, 1:17, sep = ) data[, nms] On Thu, Jan 14, 2010 at 2:08 PM, Peter Ehlers ehl...@ucalgary.ca wrote: Try dat[names(dat) %in% paste(BOUTLENGTHTOT, 1:17, sep=)] Thanks! Both methods worked. --Martin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice dotplot with missing levels in factor variable
Hi: Based on an old R-help post, http://tolstoy.newcastle.edu.au/R/e2/help/06/09/1579.html I managed to get the desired plot with the following call: dotplot(reorder(lvl, rsp) ~ rsp | cat, data = xx, type = c('h', 'p'), layout = c(1, 2), scales = list(y = list(relation = 'free', rot = 0)), prepanel = function(x, y, ...) { yy - y[, drop = TRUE] list(ylim = levels(yy), yat = sort(unique(as.numeric(yy }, panel = function(x, y, ...) { yy - y[, drop = TRUE] panel.dotplot(x, yy, ...) } ) Trivial :) HTH, Dennis On Thu, Jan 14, 2010 at 10:53 AM, Dennis Murphy djmu...@gmail.com wrote: Hi: I can get you halfway there, but I haven't figured out yet how to get rid of the unused levels... dotplot(reorder(lvl, rsp) ~ rsp | cat, data = xx, type = c('h', 'p'), layout = c(1, 2)) I'll play with this for a few more minutes...if I get something, I'll let you know. HTH, Dennis On Thu, Jan 14, 2010 at 9:25 AM, boris.vasil...@forces.gc.ca wrote: Hi, I am trying to create a dotplot where each panel shows levels vs. responses; the levels are sorted by responses but levels vary from one panel to another. However, I run into problems with controlling the y-limits and y-labels. In particular, suppose I have a data frame rsp - c(10,2,4,0,2,3) lvl - factor(c(L1,L2,L3,L2,L3,L4),levels=c(L1,L2,L3,L4)) cat - factor(c(A,A,A,B,B,B),levels=c(A,B)) xx - data.frame(cat,lvl,rsp) print(xx) cat lvl rsp 1 A L1 10 2 A L2 2 3 A L3 4 4 B L2 0 5 B L3 2 6 B L4 3 I tried to follow the Lattice ... book and used dotplot(lvl~rsp|cat,data=xx,type=c(h,p), panel=function(x,y,...){y1 - reorder(y,x) y1 - y1[,drop=TRUE] panel.dotplot(x,y1,...)}, prepanel=function(x,y){y1 - reorder(y,x) y1 - y1[,drop=TRUE] return(list(ylim=levels(y1)))}, layout=c(1,2)) However, the resulting has incorrect y-labels: Desired Plot Achieved Plot Panel B: Panel B: L4 L4 o L1 o L3 ---o L3 ---o L2 o L3 o panel A: Panel A: L4 L1 --oL1 --o L3 o L3 o L2 --oL2 --o It appears that the y-limits and y-labels specified by the pre-panel function are overwritten by something in dotplot. Can anybody suggest what I am doing incorrectly? Regards, Boris. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rollapply
For anyone who may be interested . Gabor Grothendieck suggested a link and then provided additional help resulting in the following. Any mistakes are mine. The code will allow you to build a rolling regression and to pass a (different) predictor to that regression model. # DATA ## df = data.frame(x = c(70.67,70.54,69.87,69.51,70.69,72.66,72.65,73.36), y = c(78.01,77.07,77.35,76.72,77.49,78.70,77.78,79.58)) pred2 = c(70,71,72,73,72,70) width = 3 FUNCTIONS # embed.data.frame - function(df,width) apply(embed(1:nrow(df),width),1,function(idx)df[idx,]) f-function(df,pred2){ model - lm(y ~ x, data = df) v - coefficients(model) p - predict(model, data.frame(x=pred2),se=TRUE) data.frame(intcpt=v[1],slope=v[2],modfit=p$fit,modse=p$se.fit,row.names=NULL) } # MAPPLY mapply(f, embed.data.frame(df,width), pred2) Thanks Gabor. -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Wednesday, January 13, 2010 4:02 PM To: Brecknock, Peter Cc: r-help@r-project.org Subject: Re: [R] Rollapply See: http://tolstoy.newcastle.edu.au/R/help/04/03/1446.html On Wed, Jan 13, 2010 at 3:45 PM, Pete B peter.breckn...@bp.com wrote: Hi I would like to understand how to extend the function (FUN) I am using in rollapply below. ## With the following simplified data, test1 yields parameters for a rolling regression data = data.frame(Xvar=c(70.67,70.54,69.87,69.51,70.69,72.66,72.65,73.36), Yvar =c(78.01,77.07,77.35,76.72,77.49,78.70,77.78,79.58)) data.z = zoo(d) test1 = rollapply(data.z, width=3, FUN = function(z) coef(lm(z[,1]~z[,2], data=as.data.frame(z))), by.column = FALSE, align = right) print(test1) ## Rewriting this to call myfn1 gives test2 (and is consistent with test1 above) myfn1 = function(mydata){ dd = as.data.frame(mydata) l = lm(dd[,1]~dd[,2], data=dd) c = coef(l) } test2 = rollapply(data.z, width=3, FUN= myfn1, by.column = FALSE, align = right) print(test2) ## I would like to be able to use the predict function to obtain a prediction (and its std error) from the rolling regression I have just calculated. My effort below issues a warning that 'newdata' had 1 row but variable(s) found have 3 rows. (if I run this outside of rollapply I don't get this warning) Also, I don't see the predicted value or its se with print(fm2[[1]]). Again, if I run this outside of rollapply I am able to extract the predicted value. Xpred=c(70.67) myfn2 = function(mydata){ dd = as.data.frame(mydata) l = lm(dd[,1]~dd[,2], data=dd) c = coef(l) p = predict(l, data.frame(Xvar=Xpred),se=T) ret=c(l,c,p) } fm2 = rollapply(data.z, width=3, FUN= myfn2, by.column = FALSE, align = right) print(fm2[[1]]) Any insights would be gratefully received. Best regards Pete -- View this message in context: http://n4.nabble.com/Rollapply-tp1013345p1013345.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] paired repeated measurements: Correction
Just realized that I got my nesting specification backwards. For fence in site, which is what I wanted, it should have been: co2 ~ treatment + time, rand = ~1|site/fence Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: bgunter Sent: Thursday, January 14, 2010 10:59 AM To: Sven Wirthner; r-help@r-project.org Subject: RE: [R] paired repeated measurements Sven: 1. Try this question on the r-sig-mixwed-models list -- more likely to get good responses there, I think. 2. However, my less expert opinion is that you need a random fence within site term (each fence has it's own ID) co2 ~ treatment + time, rand = ~1|fence/site This assumes time is continuous and not a factor, btw; if time is a factor, I think there may be identifiability problems -- but folks on the mixed models list should be able to provide you better guidance. There may well be better ways to model the covariance structure. Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sven Wirthner Sent: Thursday, January 14, 2010 5:24 AM To: r-help@r-project.org Subject: [R] paired repeated measurements I have the following problem: I measured co2 on 6 paired sites (one grubbed and one non-grubbed fence per site - grubbing = treatment). These measurements I repeated 15 times over 2 years. So, now my problem is how to analyze these data. I tried the following model: mod1_CO2-lme(co2~treatment+time,random=~1|site,data=CO2_t1_t15) I think with the random effect I included the paired sample design of my study, but obviously the model does not check for the repeated measurements structure of my data. Or in other words, the model assumpt that different sampling dates are independent of each other, but they aren't (since I measured the CO2 15 times on exactly the same spot). So, that's why my question is how can I combine the paired (or nested) design with the repeated measurements in one model??? Thank you for any help Sven -- Sven Wirthner Eidg. Forschungsanstalt für Wald, Schnee und Landschaft WSL Tierökologie Zürcherstrasse 111 CH-8903 Birmensdorf Tel. +41 44 7392 371 Fax +41 44 7392 215 sven.wirth...@wsl.ch http://www.wsl.ch --- This message was sent using IMP (http://horde.org/imp/) at WSL (http://www.wsl.ch). __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice dotplot with missing levels in factor variable
Great! Thank you very much. I missed the old R-help post but indeed this too simple ... Boris. From: Dennis Murphy [mailto:djmu...@gmail.com] Sent: Thursday, 14, January, 2010 14:40 PM To: Vasiliev b...@cefcom h...@ottawa-hull Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] lattice dotplot with missing levels in factor variable Based on an old R-help post, *http://tolstoy.newcastle.edu.au/R/e2/help/06/09/1579.html I managed to get the desired plot with the following call: dotplot(reorder(lvl, rsp) ~ rsp | cat, data = xx, type = c( 'h', 'p'), layout = c(1, 2), scales = list(y = list(relation = 'free', rot = 0)), prepanel = function(x, y, ...) { yy - y[, drop = TRUE] list(ylim = levels(yy), yat = sort(unique(as.numeric(yy }, panel = function(x, y, ...) { yy - y[, drop = TRUE] panel.dotplot(x, yy, ...) } ) Trivial :) HTH, Dennis On Thu, Jan 14, 2010 at 10:53 AM, Dennis Murphy djmu...@gmail.com wrote: Hi: I can get you halfway there, but I haven't figured out yet how to get rid of the unused levels... dotplot(reorder(lvl, rsp) ~ rsp | cat, data = xx, type = c('h', 'p'), layout = c(1, 2)) I'll play with this for a few more minutes...if I get something, I'll let you know. HTH, Dennis On Thu, Jan 14, 2010 at 9:25 AM, boris.vasil...@forces.gc.ca wrote: Hi, I am trying to create a dotplot where each panel shows levels vs. responses; the levels are sorted by responses but levels vary from one panel to another. However, I run into problems with controlling the y-limits and y-labels. In particular, suppose I have a data frame rsp - c(10,2,4,0,2,3) lvl - factor(c(L1,L2,L3,L2,L3,L4),levels=c(L1,L2,L3,L4)) cat - factor(c(A,A,A,B,B,B),levels=c(A,B)) xx - data.frame(cat,lvl,rsp) print(xx) cat lvl rsp 1 A L1 10 2 A L2 2 3 A L3 4 4 B L2 0 5 B L3 2 6 B L4 3 I tried to follow the Lattice ... book and used dotplot(lvl~rsp|cat,data=xx,type=c(h,p), panel=function(x,y,...){y1 - reorder(y,x) y1 - y1[,drop=TRUE] panel.dotplot(x,y1,...)}, prepanel=function(x,y){y1 - reorder(y,x) y1 - y1[,drop=TRUE] return(list(ylim=levels(y1)))}, layout=c(1,2)) However, the resulting has incorrect y-labels: Desired Plot Achieved Plot Panel B: Panel B: L4 L4 o L1 o L3 ---o L3 ---o L2 o L3 o panel A: Panel A: L4 L1 --o L1 --o L3 o L3 o L2 --o L2 --o It appears that the y-limits and y-labels specified by the pre-panel function are overwritten by something in dotplot. Can anybody suggest what I am doing incorrectly? Regards, Boris. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide *http://*www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Odp: a question about deleting rows
thank all of you for the help. to Petr: thanks for the suggestion, I will read the R intro manual. :-) -- View this message in context: http://n4.nabble.com/a-question-about-deleting-rows-tp1013403p1014267.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] memDecompress and zlib compressed base64 encoded string
On Thu, 14 Jan 2010, Johannes Graumann wrote: Hi, I have zlib compressed strings (example is attached) What is that file? Not gzip compression: gannet% file compressed.txt compressed.txt: ASCII text, with very long lines since gzip uses a magic header that 'file' knows about. And even if the header was stripped, such files are 8-bit and yours is ASCII. Try x - 'Johannes Graumann' xx - charToRaw(x) xxx - memCompress(xx, g) rawToChar(xxx) [1] x\x9c\xf3\xca\xcfH\xcc\xcbK-Vp/J,\xcd\0052\001:\n\006\x90 to see what a real gzipped string looks like. and would like to decompress them using memDecompress ... I try this: connection - file(compressed.txt,r) compressed - readLines(connection) You have not told us the 'at a minimum' information requested in the posting guide. But you should not expect that to read a binary file, especially not in a MBCS locale. We have readBin for that purpose. memDecompress(as.raw(compressed),type=g) I don't think you know what as.raw does: it does not convert bytes in a character string to raw (for which you need charToRaw). It is always a good idea to look at each stage of your computation: as.raw(compressed) [1] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [26] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Error in memDecompress(as.raw(compressed), type = g) : internal error -3 in memDecompress(2) In addition: Warning messages: 1: In memDecompress(as.raw(compressed), type = g) : NAs introduced by coercion 2: In memDecompress(as.raw(compressed), type = g) : out-of-range values treated as 0 in coercion to raw Can anyone nudge me into the right direction regarding this? Thanks, Joh -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Error bars on barplots for only particular bars
Hi, I have a data set that has columns bird.species, tree.speciesand count. I am investigating differences in tree species usge by two species of birds. Count is numerical and is a count of observations of bird species x using tree species x. For bird species A I have 3 different counts for each tree species. For bird species B I have only 1 count for each tree species. I have generated a barplot using the following function: barplot(tapply(count,list(bird.species,tree.species),mean),beside=TRUE) This graph is so far ok and gives the mean count for bird species A. I want to add error bars to illustrate the variance in mean of bird species A for each tree species. The error bar function I am using is: error.bars-function(yv,z,nn){ xv-barplot(yv,ylim=c(0,(max(yv)+max(z))),names=nn, ylab=deparse(substitute(yv))) g-(max(xv)-min(xv))/50 for (i in 1:length(xv)){lines(c(xv[i],xv[i]),c(yv[i]+z[i],yv[i]-z[i])) lines(c(xv[i]-g,xv[i]+g),c(yv[i]+z[i],yv[i]+z[i])) lines(c(xv[i]-g,xv[i]+g),c(yv[i]-z[i],yv[i]-z[i]))}} I used error.bars(ybar1,se1,labels1) to try generate the error bars with se1-rep(standard error of a mean, no. of numbers used to calculate mean) labels1-as.character(levels(tree.species)) ybar1-as.vector(tapply(count,tree.species,mean)) but the it failed and the resulting warning I got was: Error in barplot.default(yv, ylim = c(0, (max(yv) + max(z))), names = nn, : incorrect number of names I was wondering If anyone could help with me this warning, or point me in the right direction as to how to illustrate the variance in means from bird species A without adding any error bars to bird species B (which has no variance to show)? Any help is very much appreciated, Thanks, Seán Kelly. -- View this message in context: http://n4.nabble.com/Error-bars-on-barplots-for-only-particular-bars-tp1014284p1014284.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error bars on barplots for only particular bars
On 01/15/2010 08:43 AM, kellys17 wrote: Hi, I have a data set that has columns bird.species, tree.speciesand count. I am investigating differences in tree species usge by two species of birds. Count is numerical and is a count of observations of bird species x using tree species x. For bird species A I have 3 different counts for each tree species. For bird species B I have only 1 count for each tree species. I have generated a barplot using the following function: barplot(tapply(count,list(bird.species,tree.species),mean),beside=TRUE) This graph is so far ok and gives the mean count for bird species A. I want to add error bars to illustrate the variance in mean of bird species A for each tree species. The error bar function I am using is: error.bars-function(yv,z,nn){ xv-barplot(yv,ylim=c(0,(max(yv)+max(z))),names=nn, ylab=deparse(substitute(yv))) g-(max(xv)-min(xv))/50 for (i in 1:length(xv)){lines(c(xv[i],xv[i]),c(yv[i]+z[i],yv[i]-z[i])) lines(c(xv[i]-g,xv[i]+g),c(yv[i]+z[i],yv[i]+z[i])) lines(c(xv[i]-g,xv[i]+g),c(yv[i]-z[i],yv[i]-z[i]))}} I used error.bars(ybar1,se1,labels1) to try generate the error bars with se1-rep(standard error of a mean, no. of numbers used to calculate mean) labels1-as.character(levels(tree.species)) ybar1-as.vector(tapply(count,tree.species,mean)) but the it failed and the resulting warning I got was: Error in barplot.default(yv, ylim = c(0, (max(yv) + max(z))), names = nn, : incorrect number of names I was wondering If anyone could help with me this warning, or point me in the right direction as to how to illustrate the variance in means from bird species A without adding any error bars to bird species B (which has no variance to show)? Hi Sean, The easiest way I can think of is to add a test to your error bar drawing routine so that it does nothing when the variance is NA: for(i in 1:length(xv)) { if(!is.na(z[i])) { lines... } } However, the error is about the number of names not being equal to the number of heights, so you will have to make sure that is fixed, too. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Giving parameters from shell
I want to learn one more thing. You said args = commandArgs(TRUE) should I write this sentence in my function or out of my function area ? can you give me an example .r file ? 2010/1/14 Paul Hiemstra p.hiems...@geo.uu.nl cihan inan wrote: Hi I want to give parameters for my function from the shell. I mean I defined a function like these: work1.R : myfunc - function(x,y) { z = x + y z } and now I want to use shell to give parameters like ./work1.R (3,5) to get sum 8. so what should I do? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hi, Add the following shebang line at the top of your script: #! /path/to/Rscript The following lines will get you the parameters passed on by the user: args = commandArgs(TRUE) cheers, Paul -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul -- Özgürlük için...http://www.pardus.org.tr/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Newbie mistakes saving images to files
On Thu, Jan 14, 2010 at 2:15 PM, Rex C. Eastbourne rex.eastbou...@gmail.com wrote: I am encountering problems using the png() function to save around 20 charts to separate files. My script is conceptually structured as follows: ### script png(Image %03d.png) # the following are calls to user-defined functions I wrote that call plot, barchart, etc. with special arguments. myPlot(a) myPlot(b) myPlot(c) myBarchart(a) myBarchart(b) myBarchart(c) myBarchart2(a) myBarchart2(b) myBarchart2(c) dev.off() ### /script When I run the code a few lines at a time it generates the images correctly. However, when I execute all lines of the script at once (Ctrl+A, Ctrl+R in the Rgui editor), the output doesn't get generated right. Most notably: - Only one plot created by myBarchart (or myBarchart2) gets saved, instead of all 3 - Some images are blank I'm having trouble isolating the problem to one line of code. I suspect there is some fundamental paradigm I'm not aware of about how R devices and images work, perhaps relating to the importance of the order in which the calls to png, dev.off(), etc. are executed, the required state of my workspace before I run the code (e.g. whether the previous plot window should be open or closed), or maybe even time dependency (do I need to insert timed pauses so that my diagram has time to render before saving to a file?). Does this ring a bell to anyone? I read the R documentation on devices and png(), and searched the mailing list archives and the web, but haven't figured out how to get this working. Any help would be appreciated. Thanks, Rex I'm on Windows 7 and R 2.9.2, BTW. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Advantages of using SQLite for data import in comparison to csv files
RSQLite is actually much more than a driver for data import. It basically allows any manipulation of SQLite databases, including reading, writing, or updating and munging data within the database. Regarding the original question of data import: I use csv and sqlite files interchangeably to store my data, and converting between one and the other is generally trivial (read one format into a data.frame and then write it into the other). For me, the key determinant is whether a given data set is so big that reading it into a data.frame with read.csv() every time I need it is a pain. I usually keep all my original data in csv files and write routines to write the contents of huge files into sqlite databases. sqldf is a great package as well, but it definitely does not obviate the need to actually be able to manipulate data base files. For one thing, you cannot index a csv file or a data.frame. If you have to repeatedly select subsets of your large data set, creating an index on the relevant column in the sqlite table is an absolute life saver. (However, with a 1000x20 data set, you will probably not have to worry about the speed of selecting from the table. Unless you need to use bigger data sets, the simplest way is probably to just use csv files, read the contents into a data.frame with read.csv, and then use sqldf on the data.frame if you need to do complicated subsetting) Best, Magnus On 1/14/2010 2:12 AM, Juliet Jacobson wrote: But then why has the R driver for data import from a SQLite database been written? Gabor Grothendieck wrote: You could look at read.csv.sql in sqldf (http://sqldf.googlecode.com) as well. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Giving parameters from shell
Try for yourself and see. (it's not difficult to try) For example, put the line in both places, followed by print(args) and see what happens. -Don At 11:49 PM +0200 1/14/10, cihan inan wrote: Content-Type: text/plain Content-Disposition: inline Content-length: 1496 I want to learn one more thing. You said args = commandArgs(TRUE) should I write this sentence in my function or out of my function area ? can you give me an example .r file ? 2010/1/14 Paul Hiemstra p.hiems...@geo.uu.nl cihan inan wrote: Hi I want to give parameters for my function from the shell. I mean I defined a function like these: work1.R : myfunc - function(x,y) { z = x + y z } and now I want to use shell to give parameters like ./work1.R (3,5) to get sum 8. so what should I do? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://*stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hi, Add the following shebang line at the top of your script: #! /path/to/Rscript The following lines will get you the parameters passed on by the user: args = commandArgs(TRUE) cheers, Paul -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://*intamap.geo.uu.nl/~paul -- Özgürlük için...http://*www.*pardus.org.tr/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://*stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Newbie mistakes saving images to files
I am encountering problems using the png() function to save around 20 charts to separate files. My script is conceptually structured as follows: ### script png(Image %03d.png) # the following are calls to user-defined functions I wrote that call plot, barchart, etc. with special arguments. myPlot(a) myPlot(b) myPlot(c) myBarchart(a) myBarchart(b) myBarchart(c) myBarchart2(a) myBarchart2(b) myBarchart2(c) dev.off() ### /script When I run the code a few lines at a time it generates the images correctly. However, when I execute all lines of the script at once (Ctrl+A, Ctrl+R in the Rgui editor), the output doesn't get generated right. Most notably: - Only one plot created by myBarchart (or myBarchart2) gets saved, instead of all 3 - Some images are blank I'm having trouble isolating the problem to one line of code. I suspect there is some fundamental paradigm I'm not aware of about how R devices and images work, perhaps relating to the importance of the order in which the calls to png, dev.off(), etc. are executed, the required state of my workspace before I run the code (e.g. whether the previous plot window should be open or closed), or maybe even time dependency (do I need to insert timed pauses so that my diagram has time to render before saving to a file?). Does this ring a bell to anyone? I read the R documentation on devices and png(), and searched the mailing list archives and the web, but haven't figured out how to get this working. Any help would be appreciated. Thanks, Rex [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] HTML translation problem in R-2.10.1
On 01/15/2010 12:13 AM, Duncan Murdoch wrote: On 14/01/2010 11:20 AM, Jim Lemon wrote: Hi Core Team, I received an email about a problem with the help on the plotrix package. Apparently the \link tags in the help pages were showing up as literal text. I couldn't see this problem, nor any problem with the Rd files. Since the plotrix package hasn't been built for a while, I rechecked, rebuilt and reinstalled it. Sure enough, the \link tags showed up as literal text in both text and HTML help. This may be peculiar to R-2.10.1 as I never installed 2.10.0. If it helps, the --no-latex tag wasn't recognized by the INSTALL command (although only the HTML help was apparently built). As far as I can see, the previous behavior of translating \link{ into a href=... and the following } into /a has been lost. The \samp{ string is now translated to an HTML span tag whereas I think it used to be translated to a code tag and this may be where the problem lies. I think this is all done in Perl, so I can't help with the debugging. The help parsing is done in C now, and the conversion to output formats is done in R. See the Rd2* functions in the tools package if you want to debug anything. Thanks for the tip. You're talking my language now. The problem is indeed with the \samp{} markup tag, as this is translated to define a span class samp that is supposed to change the font to monospace between the tags (it doesn't). I tried changing this to defining a style (not recommended, but...) and that didn't work, either. Fooled around with the R.css file, explicitly defining fontfamily as Courier doesn't work. None of the other classes defined as a font change to monospace work. span itself doesn't appear consider any text within it as literal, as manually entering the link within the span tags in the HTML page creates a valid link. As far as I can determine, the writeLink function doesn't get called for links within a \samp{} as there are no error messages but the link doesn't get written to the HTML file. My suspicion at the moment is that by the time the action reaches line 227 in Rd2HTML, the \link string is no longer there to recognize. I can fix the problem by reverting to using \code{} _except_ where that markup includes a link. This gives the font change, but of course prints everything within the resulting pre tags literally. However, that produces an HTML page that looks okay and has the requested links. I suspect that this will not be a welcome fix, as I can still recall changing all the \code{} to \samp{} in my Rd files. I wouldn't mind an opinion on a preferred direction before trying to find where the processing of \samp{} is going wrong. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Newbie mistakes saving images to files
?png says: If you plot more than one page on one of these devices and do not include something like %d for the sequence number in file, the file will contain the last page plotted. meaning png(foo%03d.png, width=300, height=300); plot(1); plot(2); plot(3); dev.off(); generates foo001.png, foo002.png, foo003.png. Work from this example, and figure out what's missing in your code. Your custom plot functions probably don't generate new plots per se. Personally, I always make sure to do one explicit pair of png() and dev.off() calls per plot/image file. That always works and makes it more clear what is generated. /Henrik On Thu, Jan 14, 2010 at 2:17 PM, Rex C. Eastbourne rex.eastbou...@gmail.com wrote: On Thu, Jan 14, 2010 at 2:15 PM, Rex C. Eastbourne rex.eastbou...@gmail.com wrote: I am encountering problems using the png() function to save around 20 charts to separate files. My script is conceptually structured as follows: ### script png(Image %03d.png) # the following are calls to user-defined functions I wrote that call plot, barchart, etc. with special arguments. myPlot(a) myPlot(b) myPlot(c) myBarchart(a) myBarchart(b) myBarchart(c) myBarchart2(a) myBarchart2(b) myBarchart2(c) dev.off() ### /script When I run the code a few lines at a time it generates the images correctly. However, when I execute all lines of the script at once (Ctrl+A, Ctrl+R in the Rgui editor), the output doesn't get generated right. Most notably: - Only one plot created by myBarchart (or myBarchart2) gets saved, instead of all 3 - Some images are blank I'm having trouble isolating the problem to one line of code. I suspect there is some fundamental paradigm I'm not aware of about how R devices and images work, perhaps relating to the importance of the order in which the calls to png, dev.off(), etc. are executed, the required state of my workspace before I run the code (e.g. whether the previous plot window should be open or closed), or maybe even time dependency (do I need to insert timed pauses so that my diagram has time to render before saving to a file?). Does this ring a bell to anyone? I read the R documentation on devices and png(), and searched the mailing list archives and the web, but haven't figured out how to get this working. Any help would be appreciated. Thanks, Rex I'm on Windows 7 and R 2.9.2, BTW. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Newbie mistakes saving images to files
If you are using lattice, check out FAQ 7.22 On Thu, Jan 14, 2010 at 5:15 PM, Rex C. Eastbourne rex.eastbou...@gmail.com wrote: I am encountering problems using the png() function to save around 20 charts to separate files. My script is conceptually structured as follows: ### script png(Image %03d.png) # the following are calls to user-defined functions I wrote that call plot, barchart, etc. with special arguments. myPlot(a) myPlot(b) myPlot(c) myBarchart(a) myBarchart(b) myBarchart(c) myBarchart2(a) myBarchart2(b) myBarchart2(c) dev.off() ### /script When I run the code a few lines at a time it generates the images correctly. However, when I execute all lines of the script at once (Ctrl+A, Ctrl+R in the Rgui editor), the output doesn't get generated right. Most notably: - Only one plot created by myBarchart (or myBarchart2) gets saved, instead of all 3 - Some images are blank I'm having trouble isolating the problem to one line of code. I suspect there is some fundamental paradigm I'm not aware of about how R devices and images work, perhaps relating to the importance of the order in which the calls to png, dev.off(), etc. are executed, the required state of my workspace before I run the code (e.g. whether the previous plot window should be open or closed), or maybe even time dependency (do I need to insert timed pauses so that my diagram has time to render before saving to a file?). Does this ring a bell to anyone? I read the R documentation on devices and png(), and searched the mailing list archives and the web, but haven't figured out how to get this working. Any help would be appreciated. Thanks, Rex [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] HTML translation problem in R-2.10.1
On 15/01/2010 6:24 AM, Jim Lemon wrote: On 01/15/2010 12:13 AM, Duncan Murdoch wrote: On 14/01/2010 11:20 AM, Jim Lemon wrote: Hi Core Team, I received an email about a problem with the help on the plotrix package. Apparently the \link tags in the help pages were showing up as literal text. I couldn't see this problem, nor any problem with the Rd files. Since the plotrix package hasn't been built for a while, I rechecked, rebuilt and reinstalled it. Sure enough, the \link tags showed up as literal text in both text and HTML help. This may be peculiar to R-2.10.1 as I never installed 2.10.0. If it helps, the --no-latex tag wasn't recognized by the INSTALL command (although only the HTML help was apparently built). As far as I can see, the previous behavior of translating \link{ into a href=... and the following } into /a has been lost. The \samp{ string is now translated to an HTML span tag whereas I think it used to be translated to a code tag and this may be where the problem lies. I think this is all done in Perl, so I can't help with the debugging. The help parsing is done in C now, and the conversion to output formats is done in R. See the Rd2* functions in the tools package if you want to debug anything. Thanks for the tip. You're talking my language now. The problem is indeed with the \samp{} markup tag, as this is translated to define a span class samp that is supposed to change the font to monospace between the tags (it doesn't). I tried changing this to defining a style (not recommended, but...) and that didn't work, either. Fooled around with the R.css file, explicitly defining fontfamily as Courier doesn't work. None of the other classes defined as a font change to monospace work. span itself doesn't appear consider any text within it as literal, as manually entering the link within the span tags in the HTML page creates a valid link. As far as I can determine, the writeLink function doesn't get called for links within a \samp{} as there are no error messages but the link doesn't get written to the HTML file. My suspicion at the moment is that by the time the action reaches line 227 in Rd2HTML, the \link string is no longer there to recognize. The \samp{} macro is defined (in Writing R Extensions) as \samp{text} Indicate text that is a literal example of a sequence of characters, entered verbatim. No wrapping or reformatting will occur. Displayed using typewriter font if possible. In 2.8.x and 2.9.x, it said something similar, but was less explicit: \samp{text} Indicate text that is a literal example of a sequence of characters. The Perl converters in earlier versions may have processed \link macros within this, but I think that was an error. This macro should be used to document things like Rd macros or other literal sequences of characters, without requiring escapes (or with minimal requirements for escapes). Part of the problem with writing a grammar for Rd files is that usage was so irregular, so this looks like a case where I decided on something that was close to the documentation, but not so close to the existing implementation. I can fix the problem by reverting to using \code{} _except_ where that markup includes a link. This gives the font change, but of course prints everything within the resulting pre tags literally. However, that produces an HTML page that looks okay and has the requested links. I suspect that this will not be a welcome fix, as I can still recall changing all the \code{} to \samp{} in my Rd files. You don't want to use \code{} unless you are entering R code. I don't think you've said exactly what your goal is: is it just to get a typewriter font for text? I'm not sure there's a way to do that, and it does seem like a reasonable thing to want to do, but the current styles don't support it. We've got \emph, \bold, \strong, but no \texttt equivalent. What would you use it for? Duncan Murdoch I wouldn't mind an opinion on a preferred direction before trying to find where the processing of \samp{} is going wrong. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R/Rmetrics Conference Singapore, February 19/20
2nd Announcement --- R/Rmetrics Computational Topics in Finance Conference National University of Singapore, February 19/20, 2009. --- www.rmetrics.org Sponsored by: ETH Zurich, Finance Online Zurich, REvolution Computing New Haven, RMI National University of Singapore. The Rmetrics Organization from the Swiss Federal Institute of Technology (ETHZ) and the National University of Singapore invite you to the first R Conference in Asia. R was definitely the shooting star in the financial software world 2009. Even the New York Times recently reported about R in an enthusiastic article. One can say that R has established itself as the open source rapid model prototyping system for financial applications in business, research and education. The conference will cover the topics: Econometric Modeling, Financial Time Series Analysis, Volatility Forecasting, Trading and Decision Making Systems, Portfolio Selection and Optimization, Financial Stability Analysis, Stress Testing, Performance Analysis, Benchmarking, Risk Analysis and Measurement, Valuation of Financial Derivatives, Extreme Value Theory and Copulae, FX High Frequency Data Analysis, Time Sales Data, Monte Carlo Simulation and Pricing, Robust Statistics in Finance, Using R/Rmetrics in Finance and Insurance. Keynote Speakers of the conference include: Karim Chine, Cloud Era Ltd Cambridge UK Sun Defeng, National University of Singapore Juri Hinz, National University of Singapore Stefano Iacus, University of Milano Marc Paolella, Swiss Banking Institute Zurich Vikram Kuriyan, K3 Advisors New York David Scott, University of Auckland Pradap Sondhi, GF Management Hongkong Diethelm Wuertz, ETH Zurich Eric Zivot, University of Washington ... We have a limited number of slots for contributed presentations; if you are interested in giving a presentation, please contact the organizers: submissi...@rmetrics.org. Submission will be considered on a rolling admission basis. The conference is recommended to fund and/or risk managers from banks andinsurance firms, to researchers from industry and academia, and to decision makers. Come, discuss, and get new ideas for your own business and research. The topics will be by no means confined to applications from R/Rmetrics or related rapid model prototyping systems, the conference is also open to theoretical concepts and ideas, behind the applications and software solutions. Preceding the conference, the Rmetrics team is giving a two-day Basic R for Finance course. For more information, see: www.rmetrics.org/basicRsingapore. There is a limited number of free scholarships for students, for more information please contact the organizers: submissi...@rmetrics.org. We wish you a happy new year and we are looking forward to meet you in February at RMI/NUS in Singapore. For the organizing committee Diethelm Wuertz ETH Zurich, Juri Hinz NUS Singapore, Mahendra Mehta NTS Mumbai, David Scott University of Auckland www.rmetrics.org /// __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how do I test regime shift in R?
Hi all, Let's say I have a time series data. I would like to test online for regime shift, are there any R packages that can do that? Thanks a lot! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] advice/opinion on - vs = in teaching R
Hi R People: I'm teaching a statistical computing class using R starting next week (yay!) and I have an opinion type question, please. I'm old school and use - in an assignment. However, I'm starting to see the = in the literature. Which should I use or does it matter, please? Thanks for your input! Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Sampling from a Postgres database
Hi Everybody Is there a way in which one can use the RPostgreSQL package to take a sample from a table in Postgres database without having to read the whole table into R regards Christiaan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] advice/opinion on - vs = in teaching R
On 15/01/2010, at 4:45 PM, Erin Hodgess wrote: Hi R People: I'm teaching a statistical computing class using R starting next week (yay!) and I have an opinion type question, please. I'm old school and use - in an assignment. However, I'm starting to see the = in the literature. Which should I use or does it matter, please? It's basically a matter of taste. But people with ***good*** taste use -. :-) Constructions such as a = a+3 are toadally illogical whereas a - a +3 makes perfect sense. However I'm sore afraid that as is always the case, good taste fails and bad taste prevails. I.e. = for assignment will take over. Personally I shall resist as long as possible, i.e. until - is removed from the syntax structure by R Core. cheers, Rolf ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Newbie mistakes saving images to files
Thanks Jim! I followed the instructions in the FAQ and wrapped print() around my function calls. The images are now properly generated. Rex On Thu, Jan 14, 2010 at 4:38 PM, jim holtman jholt...@gmail.com wrote: If you are using lattice, check out FAQ 7.22 On Thu, Jan 14, 2010 at 5:15 PM, Rex C. Eastbourne rex.eastbou...@gmail.com wrote: I am encountering problems using the png() function to save around 20 charts to separate files. My script is conceptually structured as follows: ### script png(Image %03d.png) # the following are calls to user-defined functions I wrote that call plot, barchart, etc. with special arguments. myPlot(a) myPlot(b) myPlot(c) myBarchart(a) myBarchart(b) myBarchart(c) myBarchart2(a) myBarchart2(b) myBarchart2(c) dev.off() ### /script When I run the code a few lines at a time it generates the images correctly. However, when I execute all lines of the script at once (Ctrl+A, Ctrl+R in the Rgui editor), the output doesn't get generated right. Most notably: - Only one plot created by myBarchart (or myBarchart2) gets saved, instead of all 3 - Some images are blank I'm having trouble isolating the problem to one line of code. I suspect there is some fundamental paradigm I'm not aware of about how R devices and images work, perhaps relating to the importance of the order in which the calls to png, dev.off(), etc. are executed, the required state of my workspace before I run the code (e.g. whether the previous plot window should be open or closed), or maybe even time dependency (do I need to insert timed pauses so that my diagram has time to render before saving to a file?). Does this ring a bell to anyone? I read the R documentation on devices and png(), and searched the mailing list archives and the web, but haven't figured out how to get this working. Any help would be appreciated. Thanks, Rex [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] advice/opinion on - vs = in teaching R
On 15-Jan-10 04:06:55, Rolf Turner wrote: On 15/01/2010, at 4:45 PM, Erin Hodgess wrote: Hi R People: I'm teaching a statistical computing class using R starting next week (yay!) and I have an opinion type question, please. I'm old school and use - in an assignment. However, I'm starting to see the = in the literature. Which should I use or does it matter, please? It's basically a matter of taste. But people with ***good*** taste use -. :-) Constructions such as a = a+3 are toadally illogical whereas a - a + 3 makes perfect sense. However I'm sore afraid that as is always the case, good taste fails and bad taste prevails. I.e. = for assignment will take over. Yes, water flows down-hill -- unless we build control structures ... Personally I shall resist as long as possible, i.e. until - is removed from the syntax structure by R Core. cheers, Rolf There is at least one context where the distinction must be preserved. Example: pnorm(1.5) # [1] 0.9331928 pnorm(x=1.5) # Error in pnorm(x = 1.5) : unused argument(s) (x = 1.5) pnorm(x-1.5) # [1] 0.9331928 x # [1] 1.5 Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 15-Jan-10 Time: 06:57:16 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.