Re: [R] Failed install of package xlsReadWrite
Hi, all. I too got this error, and when I went to register the correct DLL (thinking the one downloaded but not installed might have been the development version) I got an error that the registration had failed. What I typed: C:\Program Files\R\R-2.10.0\library\xlsReadWrite\libs>regsvr32 xlsReadWrite.dll The error dialog returned is attached. Any idea what I'm doing wrong? Thanks, Doug http://n4.nabble.com/file/n1566476/R_DLL_ERR.jpg -- View this message in context: http://n4.nabble.com/Failed-install-of-package-xlsReadWrite-tp1476880p1566476.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] Failed install of package xlsReadWrite
Sorry, forgot to mention I'm running R 2.10 on Windows 7, and I ran the command window as Administrator. Thanks, Doug -- View this message in context: http://n4.nabble.com/Failed-install-of-package-xlsReadWrite-tp1476880p1566479.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] Labeling plot points
Thanks, Greg, downloading now! Doug Greg Snow-2 wrote: > > There are 2 functions in the development version of the TeachingDemos > package (the version on R-forge, not CRAN yet) that do just what you > describe. The functions are HWidentify which only works on windows > machines and HTKidentify which uses the tcltk package. > > Hope this helps, > > -- > 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 Doug >> Sent: Thursday, December 10, 2009 1:49 PM >> To: r-help@r-project.org >> Subject: [R] Labeling plot points >> >> >> Hi, all. I've been searching for a while to find out how to create an >> scatterplot which would let a user interact with it, specifically by >> hovering the mouse over a point and having a pop-up appear with data >> about >> the point. The pop-up would disappear when the mouse moved away. I've >> included a mock-up below. >> >> I've found out how to use identify() to make a label appear when >> clicking a >> point, but as far as I can tell that label text remains on the plot >> once >> inserted. If pop-ups aren't supported in R, is there a way to make a >> text >> label disappear when the mouse is clicked again? Are there other R >> graphic >> libraries I should use for this kind of feature? Any pointers or sample >> code >> would be appreciated. >> >> Thanks, >> >> Doug >> >> http://n4.nabble.com/file/n960517/Untitled.bmp >> -- >> View this message in context: http://n4.nabble.com/Labeling-plot- >> points-tp960517p960517.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. > > -- View this message in context: http://n4.nabble.com/Labeling-plot-points-tp960517p960573.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] Labeling plot points
Hi, again. False alarm, I thought I'd call lattice.demo() as a quick check of my install, but that was a bad idea and the errors were a red herring. Looked at you HWidentify() directly and now I get it - thanks! Doug Greg Snow-2 wrote: > > There are 2 functions in the development version of the TeachingDemos > package (the version on R-forge, not CRAN yet) that do just what you > describe. The functions are HWidentify which only works on windows > machines and HTKidentify which uses the tcltk package. > > Hope this helps, > > -- > 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 Doug >> Sent: Thursday, December 10, 2009 1:49 PM >> To: r-help@r-project.org >> Subject: [R] Labeling plot points >> >> >> Hi, all. I've been searching for a while to find out how to create an >> scatterplot which would let a user interact with it, specifically by >> hovering the mouse over a point and having a pop-up appear with data >> about >> the point. The pop-up would disappear when the mouse moved away. I've >> included a mock-up below. >> >> I've found out how to use identify() to make a label appear when >> clicking a >> point, but as far as I can tell that label text remains on the plot >> once >> inserted. If pop-ups aren't supported in R, is there a way to make a >> text >> label disappear when the mouse is clicked again? Are there other R >> graphic >> libraries I should use for this kind of feature? Any pointers or sample >> code >> would be appreciated. >> >> Thanks, >> >> Doug >> >> http://n4.nabble.com/file/n960517/Untitled.bmp >> -- >> View this message in context: http://n4.nabble.com/Labeling-plot- >> points-tp960517p960517.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. > > -- View this message in context: http://n4.nabble.com/Labeling-plot-points-tp960517p961132.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] Labeling plot points
Greg, I tried installing v2.5 using the instructions on R-forge but ran into errors: > install.packages("TeachingDemos", repos="http://R-Forge.R-project.org";) Warning: unable to access index for repository http://R-Forge.R-project.org/bin/windows/contrib/2.10 Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘TeachingDemos’ is not available Looked like some dependency was not being found. Somehow I determined it might be a missing tcl/tk-related package (don't remember how), so I did this: > library("tcltk") Loading Tcl/Tk interface ... done > lattice.demo(x,y,z) Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), class = "tclObj") : [tcl] floating point value is Not a Number. So it got further but still not there. Any ideas? BTW, I'm using R 2.10 on Windows. Thanks, Doug Greg Snow-2 wrote: > > There are 2 functions in the development version of the TeachingDemos > package (the version on R-forge, not CRAN yet) that do just what you > describe. The functions are HWidentify which only works on windows > machines and HTKidentify which uses the tcltk package. > > Hope this helps, > > -- > 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 Doug >> Sent: Thursday, December 10, 2009 1:49 PM >> To: r-help@r-project.org >> Subject: [R] Labeling plot points >> >> >> Hi, all. I've been searching for a while to find out how to create an >> scatterplot which would let a user interact with it, specifically by >> hovering the mouse over a point and having a pop-up appear with data >> about >> the point. The pop-up would disappear when the mouse moved away. I've >> included a mock-up below. >> >> I've found out how to use identify() to make a label appear when >> clicking a >> point, but as far as I can tell that label text remains on the plot >> once >> inserted. If pop-ups aren't supported in R, is there a way to make a >> text >> label disappear when the mouse is clicked again? Are there other R >> graphic >> libraries I should use for this kind of feature? Any pointers or sample >> code >> would be appreciated. >> >> Thanks, >> >> Doug >> >> http://n4.nabble.com/file/n960517/Untitled.bmp >> -- >> View this message in context: http://n4.nabble.com/Labeling-plot- >> points-tp960517p960517.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. > > -- View this message in context: http://n4.nabble.com/Labeling-plot-points-tp960517p961122.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] Which hist cell each value falls in?
Hi, all. I'm using hist() to obtain a vector of break values in an interval. I then want to be able to identify which cell any value from another vector falls in. E.g. applying > breaks [1] -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 to > x [1] -3.74519666 -0.38183630 -1.22884247 -0.20971824 -0.30533939 -0.36271207 [7] -2.27513499 -2.23688653 -1.98827155 -1.48666274 -1.26155084 -0.15234555 [13] -0.09497287 0.34488440 would give > xcells [1] 1 8 6 8 8 8 4 4 5 6 6 8 8 9 where: x <= breaks[1] -> cell 1 breaks[1] < x <= breaks[2] -> cell 2 breaks[2] < x <= breaks[3] -> cell 3, etc. I'm sure there's either a built-in function or a concise way to do this, but I've not figured it out. Thanks, Doug -- View this message in context: http://n4.nabble.com/Which-hist-cell-each-value-falls-in-tp974316p974316.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] Which hist cell each value falls in?
Thanks, guys! Doug David Winsemius wrote: > > > On Dec 18, 2009, at 2:57 AM, Jim Lemon wrote: > >> On 12/18/2009 06:35 AM, Doug Hill wrote: >>> Hi, all. I'm using hist() to obtain a vector of break values in an >>> interval. >>> I then want to be able to identify which cell any value from >>> another vector >>> falls in. >>> >>> E.g. applying >>> >>> >>>> breaks >>>> >>> [1] -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 >>> >>> to >>> >>> >>>> x >>>> >>> [1] -3.74519666 -0.38183630 -1.22884247 -0.20971824 -0.30533939 >>> -0.36271207 >>> [7] -2.27513499 -2.23688653 -1.98827155 -1.48666274 -1.26155084 >>> -0.15234555 >>> [13] -0.09497287 0.34488440 >>> >>> would give >>> >>> >>>> xcells >>>> >>> [1] 1 8 6 8 8 8 4 4 5 6 6 8 8 9 >>> >>> where: >>> x<= breaks[1] -> cell 1 >>> breaks[1]< x<= breaks[2] -> cell 2 >>> breaks[2]< x<= breaks[3] -> cell 3, etc. > > > breaks <- scan() > 1: -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 > 13: > Read 12 items > > xcells <- scan() > 1: -3.74519666 -0.38183630 -1.22884247 -0.20971824 -0.30533939 > -0.36271207 > 7: -2.27513499 -2.23688653 -1.98827155 -1.48666274 -1.26155084 > -0.15234555 > 13: -0.09497287 0.34488440 > 15: > Read 14 items > > > breaks <- c(-Inf,breaks,Inf) > > findInterval(xcells, breaks) > [1] 1 8 6 8 8 8 4 4 5 6 6 8 8 9 > > -- > David >>> >>> >> Hi Doug, >> The function below does more or less what you want, except that the >> bins are numbered from zero (meaning that a value is below the range >> of bins as x[1] is) to length(breaks) (meaning that a value is above >> the range of bins). >> >> whichBin<-function(x,breaks,right=TRUE) { >> lenx<-length(x) >> # any leftovers must be out of range >> wb<-rep(lenx,lenx) >> if(right) wb[x<=breaks[1]]<-0 >> else wb[x> for(bin in 1:(length(breaks)-1)) { >> if(right) wb[x>breaks[bin] & x<=breaks[bin+1]]<-bin >> else wb[x>=breaks[bin] & x> } >> return(wb) >> } >> >> 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. > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/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/Which-hist-cell-each-value-falls-in-tp974316p974865.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] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)?
Hi all. I want to generate a sequence of n plots and save them into a single PDF file, one plot per page. From the R docs and other sources I gather the basic way to do this is save plot 1 into a file then append the 2:n plots to the same file. This code shows my basic approach, but for some reason only the last plot is saved into the pdf. I've tried different variations (e.g. using onefile only in the second call, or only in the first), to no avail. The comments show what I see if I step through the code one line at a time: scratch<-function() { graphics.off() plot(1:7, 1:7) # Opens a graphics window and displays a 7-point plot in it, as expected dev.copy2pdf(file="test.pdf", onefile=TRUE) # I see the 7-point plot in Adobe reader, as expected plot(1:5, 1:5) # Overwrites in the graphics window the 7-point plot with a 5-point, as expected dev.copy2pdf(file="test.pdf", onefile=TRUE) # Overwrites test.pdf so that it contains only the 7-point plot } A couple things: (1) The reason I don't just use something like pdf(filename) plot(...) plot(...) dev.off() is that I also want to see the plots before they're saved (I pause after each plot() command). But according to the docs for dev.copy2pdf(), that function accepts the same args as pdf() does, including onefile. (2) I wrap my code in a function to be able to use it in the StatEt debugger in Eclipse. If you know what I'm doing wrong, or know of a different/better way, advise away! Thanks, Doug [[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] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)?
Thanks Elai, that did it! I never considered using any X11 options, as I'm on Windows, and in the docs I read it sounded like X11 options only pertained to the OSX/Linux/.. world. Thanks for your help, Doug --- On Mon, 2/6/12, ilai wrote: From: ilai Subject: Re: [R] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)? To: "Doug Hill" Cc: r-help@r-project.org Date: Monday, February 6, 2012, 12:24 PM Doug, dev.copy2pdf closes the connection after it's "done", so onefile is meaningless. To look at each plot before copy to a single pdf, you could open a pdf(...) but revert between it and your graphic device: graphics.off() plot(1:7, 1:7) x11c<- dev.cur() # your current graphics device pdf(file="test.pdf") dev.set(which=x11c) # back from pdf dev.copy() # copy dev.set(which=x11c) # back to graphic plot(1:5, 1:5,col=2,pch=2) dev.copy() dev.set(which=x11c) # ... etc. however many more plots # don't forget to close the pdf device at the end: dev.off(which=x11c+1) # Both plots are in 'test.pdf' Depending on your application you might be able to simplify things with dev.next/dev.prev, or wrap this sequence into a little helper function to be used in a loop. Enjoy, Elai On Mon, Feb 6, 2012 at 6:44 AM, Doug Hill wrote: > Hi all. I want to generate a sequence of n plots and save them into a single > PDF file, one plot per page. From the R docs and other sources I gather the > basic way to do this is save plot 1 into a file then append the 2:n plots to > the same file. > This code shows my basic approach, but for some reason only the last plot is > saved into the pdf. I've tried different variations (e.g. using onefile only > in the second call, or only in the first), to no avail. The comments show > what I see if I step through the code one line at a time: > scratch<-function() { > graphics.off() > plot(1:7, 1:7) # Opens a graphics window and displays a 7-point plot in it, > as expected > dev.copy2pdf(file="test.pdf", onefile=TRUE) # I see the 7-point plot in Adobe > reader, as expected > plot(1:5, 1:5) # Overwrites in the graphics window the 7-point plot with a > 5-point, as expected > dev.copy2pdf(file="test.pdf", onefile=TRUE) # Overwrites test.pdf so that it > contains only the 7-point plot > } > A couple things: > (1) The reason I don't just use something like pdf(filename) plot(...) > plot(...) dev.off() is that I also want to see the plots before they're saved > (I pause after each plot() command). But according to the docs for > dev.copy2pdf(), that function accepts the same args as pdf() does, including > onefile. > (2) I wrap my code in a function to be able to use it in the StatEt debugger > in Eclipse. > If you know what I'm doing wrong, or know of a different/better way, advise > away! Thanks, Doug > [[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. > [[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.