Re: [R] installing "rgl" package
Hi Rxperts, I tried with r-cran-rgl (based on the default installation of Ubuntu) with reinstalled rgl package from R-forge.. I get the missing GL/gl.h header. Didn't reinstall Mesa libraries per recommendations of Duncan. * installing *source* package ‘rgl’ ...** package ‘rgl’ successfully unpacked and MD5 sums checkedchecking for gcc... gcc -std=gnu99 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for gcc... (cached) gcc -std=gnu99 checking whether we are using the GNU C compiler... (cached) yes checking whether gcc -std=gnu99 accepts -g... (cached) yes checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed checking for libpng-config... yes configure: using libpng-config configure: using libpng dynamic linkage checking for X... libraries , headers checking GL/gl.h usability... no checking GL/gl.h presence... no checking for GL/gl.h... no checking GL/glu.h usability... no checking GL/glu.h presence... no checking for GL/glu.h... noconfigure: error: missing required header GL/gl.hERROR: configuration failed for package ‘rgl’ * removing ‘/data/R/lib/rgl’Warning in install.packages : installation of package ‘rgl’ had non-zero exit status On Fri, Nov 24, 2017 at 3:45 PM, Santosh <santosh2...@gmail.com> wrote: > Hi Duncan, > Thanks for the suggestions. How do I uninstall mesa related installations? > Do I need to uninstall all of "mesa" or only the specific ones? > > Santosh > > On Fri, Nov 24, 2017 at 3:05 PM, Duncan Murdoch <murdoch.dun...@gmail.com> > wrote: > >> On 24/11/2017 5:45 PM, Dirk Eddelbuettel wrote: >> >>> >>> On 24 November 2017 at 11:30, Santosh wrote: >>> | Hi All, Duncan, Rolf, Ista, DIrk, >>> | >>> | Thanks for the suggestions and I tried all of them (as suggested by >>> Duncan, >>> | Rolf, Ista and Dirk)... I still get similar error as before while >>> | installing 'rgl' package.. I also tried to manually configure "rgl" >>> and got >>> | an error message (please see below for the verbatim output). Would >>> highly >>> | any further ideas/suggestions! >>> | >>> | *In my system, "GL" library is present under "/usr/include/GL"* >>> | >>> | Here are the libraries available (as suggested by Rolf) >>> | >>> | After installing some of them, I continue to get the same error >>> message, >>> | please below the output messages in config.log after I ran >>> "./configure") >>> | >>> | >>> | "ii r-cran-rgl0.93.996-1 >>> | amd64GNU R package for three-dimensional visualisation >>> | using OpenGL" >>> >>> That means you _have_ the rgl package installed, and can stop everything >>> you >>> are doing. >>> >>> You do _not_ need to install it from source via R. You have it from >>> Ubuntu. >>> >>> >> Actually the version on CRAN is pretty old, so I'd recommend people do >> install it from source, getting the source from R-forge. Since that is a >> development site the quality varies over time, but right at this minute I >> would say it is better than the CRAN version. >> >> Re Santosh's error messages: it looks as though the Mesa installation is >> messed up. I'd recommend uninstalling it, making sure there's no remnant >> of Mesa anywhere, then reinstalling it. >> >> Duncan Murdoch >> > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] installing "rgl" package
Hi Duncan, Thanks for the suggestions. How do I uninstall mesa related installations? Do I need to uninstall all of "mesa" or only the specific ones? Santosh On Fri, Nov 24, 2017 at 3:05 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 24/11/2017 5:45 PM, Dirk Eddelbuettel wrote: > >> >> On 24 November 2017 at 11:30, Santosh wrote: >> | Hi All, Duncan, Rolf, Ista, DIrk, >> | >> | Thanks for the suggestions and I tried all of them (as suggested by >> Duncan, >> | Rolf, Ista and Dirk)... I still get similar error as before while >> | installing 'rgl' package.. I also tried to manually configure "rgl" and >> got >> | an error message (please see below for the verbatim output). Would >> highly >> | any further ideas/suggestions! >> | >> | *In my system, "GL" library is present under "/usr/include/GL"* >> | >> | Here are the libraries available (as suggested by Rolf) >> | >> | After installing some of them, I continue to get the same error message, >> | please below the output messages in config.log after I ran >> "./configure") >> | >> | >> | "ii r-cran-rgl0.93.996-1 >> | amd64GNU R package for three-dimensional visualisation >> | using OpenGL" >> >> That means you _have_ the rgl package installed, and can stop everything >> you >> are doing. >> >> You do _not_ need to install it from source via R. You have it from >> Ubuntu. >> >> > Actually the version on CRAN is pretty old, so I'd recommend people do > install it from source, getting the source from R-forge. Since that is a > development site the quality varies over time, but right at this minute I > would say it is better than the CRAN version. > > Re Santosh's error messages: it looks as though the Mesa installation is > messed up. I'd recommend uninstalling it, making sure there's no remnant > of Mesa anywhere, then reinstalling it. > > Duncan Murdoch > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] installing "rgl" package
Hi Duncan, Dirk, & Others, Mine has also like this... /usr/lib/x86_64-linux-gnu/libGL.so -> mesa/libGL.so -> libGL.so.1.2.0 however, I could not find the source of libGL.so.1.2.0 Dirk, I just now saw your response... Yes, r-cran-rgl and ibgl1-mesa-glx <https://packages.ubuntu.com/quantal/libgl1-mesa-glx-dbg> are the latest available now. How do I install R package "rgl" successfully? it gives the error about glEnd... and removes the R package "rgl". Thanks again, Santosh On Fri, Nov 24, 2017 at 2:33 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 24/11/2017 5:24 PM, Santosh wrote: > >> Hi Duncan, and others.. >> >> Yes, below are the search results. it is linked to mesa/libGL.so and is >> again point to libGL.so -> libGL.so.1.2.0 . However, I could not find >> libGL.so.1.2.0 or its source. Where is libGL.so.1.2.0 expected to be >> located? >> > > Mine was in /usr/lib/x86_64-linux-gnu/mesa/. > > Duncan Murdoch > > >> >> /usr/lib/libGL.so.1 >> >> /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGL.so.1 >> /usr/lib/x86_64-linux-gnu/mesa/libGL.so >> >> >> Thanks again, >> Santosh >> >> On Fri, Nov 24, 2017 at 12:39 PM, Duncan Murdoch < >> murdoch.dun...@gmail.com <mailto:murdoch.dun...@gmail.com>> wrote: >> >> On 24/11/2017 2:30 PM, Santosh wrote: >> >> Hi All, Duncan, Rolf, Ista, DIrk, >> >> Thanks for the suggestions and I tried all of them (as suggested >> by Duncan, >> Rolf, Ista and Dirk)... I still get similar error as before while >> installing 'rgl' package.. I also tried to manually configure >> "rgl" and got >> an error message (please see below for the verbatim output). >>Would highly >> any further ideas/suggestions! >> >> *In my system, "GL" library is present under "/usr/include/GL"* >> >> >> That's the include file. The error is saying you don't have >> libGL.so, which it is looking for in /usr/lib/x86_64-linux-gnu. Do >> you have that file? Is it there, and marked as executable? >> >> It's probably a symbolic link; on an old Ubuntu system I just >> checked, it points to mesa/libGL.so, which is also a symlink, >> pointing to mesa/libGL.so.1.2.0, which is executable. >> >> Duncan Murdoch >> >> >> >> Here are the libraries available (as suggested by Rolf) >> >> After installing some of them, I continue to get the same error >> message, >> please below the output messages in config.log after I ran >> "./configure") >> >> >> "ii r-cran-rgl0.93.996-1 >> amd64GNU R package for three-dimensional >> visualisation >> using OpenGL" >> >> "ii libegl1-mesa:amd6410.1.3-0ubuntu0.6 >> amd64free implementation of the EGL API -- >> runtime" >> >> "ii libegl1-mesa-dev 10.1.3-0ubuntu0.6 >> amd64free implementation of the EGL API -- >> development files" >> >> "ii libegl1-mesa-drivers:amd6410.1.3-0ubuntu0.6 >> amd64free implementation of the EGL API -- >> hardware drivers" >> >> "ii libgl1-mesa-dev 10.1.3-0ubuntu0.6 >> amd64free implementation of the OpenGL API -- GLX >> development files" >> >> "ii libgl1-mesa-dri:amd64 10.1.3-0ubuntu0.6 >> amd64free implementation of the OpenGL API -- >> DRI modules" >> >> >> "ii libgl1-mesa-glx:amd64 10.1.3-0ubuntu0.6 >> amd64free implementation of the OpenGL API -- >> GLX runtime" >> >> >> "ii libglapi-mesa:amd64 10.1.3-0ubuntu0.6 >> amd64free implementation of the GL API -- >> shared library" >> >> "ii libglu1-mesa:amd649.0.0-2 >> amd64Mesa OpenGL utility library (GLU)" >> >> "ii libglu1-mesa-dev 9.0.0-2 >> amd64Mesa OpenGL uti
Re: [R] installing "rgl" package
Hi Duncan, and others.. Yes, below are the search results. it is linked to mesa/libGL.so and is again point to libGL.so -> libGL.so.1.2.0 . However, I could not find libGL.so.1.2.0 or its source. Where is libGL.so.1.2.0 expected to be located? /usr/lib/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/mesa/libGL.so Thanks again, Santosh On Fri, Nov 24, 2017 at 12:39 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 24/11/2017 2:30 PM, Santosh wrote: > >> Hi All, Duncan, Rolf, Ista, DIrk, >> >> Thanks for the suggestions and I tried all of them (as suggested by >> Duncan, >> Rolf, Ista and Dirk)... I still get similar error as before while >> installing 'rgl' package.. I also tried to manually configure "rgl" and >> got >> an error message (please see below for the verbatim output). Would highly >> any further ideas/suggestions! >> >> *In my system, "GL" library is present under "/usr/include/GL"* >> > > That's the include file. The error is saying you don't have libGL.so, > which it is looking for in /usr/lib/x86_64-linux-gnu. Do you have that > file? Is it there, and marked as executable? > > It's probably a symbolic link; on an old Ubuntu system I just checked, it > points to mesa/libGL.so, which is also a symlink, pointing to > mesa/libGL.so.1.2.0, which is executable. > > Duncan Murdoch > > > >> Here are the libraries available (as suggested by Rolf) >> >> After installing some of them, I continue to get the same error message, >> please below the output messages in config.log after I ran "./configure") >> >> >> "ii r-cran-rgl0.93.996-1 >> amd64GNU R package for three-dimensional visualisation >> using OpenGL" >> >> "ii libegl1-mesa:amd6410.1.3-0ubuntu0.6 >> amd64free implementation of the EGL API -- runtime" >> >> "ii libegl1-mesa-dev 10.1.3-0ubuntu0.6 >> amd64free implementation of the EGL API -- development >> files" >> >> "ii libegl1-mesa-drivers:amd6410.1.3-0ubuntu0.6 >> amd64free implementation of the EGL API -- hardware >> drivers" >> >> "ii libgl1-mesa-dev 10.1.3-0ubuntu0.6 >> amd64free implementation of the OpenGL API -- GLX >> development files" >> >> "ii libgl1-mesa-dri:amd64 10.1.3-0ubuntu0.6 >> amd64free implementation of the OpenGL API -- DRI modules" >> >> >> "ii libgl1-mesa-glx:amd64 10.1.3-0ubuntu0.6 >> amd64free implementation of the OpenGL API -- GLX runtime" >> >> >> "ii libglapi-mesa:amd64 10.1.3-0ubuntu0.6 >> amd64free implementation of the GL API -- shared library" >> >> "ii libglu1-mesa:amd649.0.0-2 >> amd64Mesa OpenGL utility library (GLU)" >> >> "ii libglu1-mesa-dev 9.0.0-2 >> amd64Mesa OpenGL utility library -- development files" >> >> "ii libwayland-client0:amd64 1.4.0-1ubuntu1 >> amd64wayland compositor infrastructure - client library" >> >> "ii libwayland-cursor0:amd64 1.4.0-1ubuntu1 >> amd64wayland compositor infrastructure - cursor library" >> >> "ii libwayland-dev1.4.0-1ubuntu1 >> amd64wayland compositor infrastructure - development >> files" >> >> "ii libwayland-egl1-mesa:amd6410.1.3-0ubuntu0.6 >> amd64implementation of the Wayland EGL platform -- >> runtime" >> >> "ii libwayland-server0:amd64 1.4.0-1ubuntu1 >> amd64wayland compositor infrastructure - server library" >> >> "ii mesa-common-dev 10.1.3-0ubuntu0.6 >> amd64Developer documentation for Mesa" >> >> "ii mesa-vdpau-drivers:amd64 10.1.3-0ubuntu0.6 >> amd64Mesa VDPAU video acceleration drivers" >> >> "ii mesa-utils8.1.0-2 >> amd64Miscellaneous Mesa GL utilities" >> >> >> The error message when installing "rgl" library, >> >
Re: [R] installing "rgl" package
lGL -L/usr/lib/x86_64-linux-gnu -lpng12 -lX11 >&5*/*usr/bin/ld: cannot find -lGL collect2: error: ld returned 1 exit status configure:4288: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "" | #define HAVE_GL_GL_H 1 | #define HAVE_GL_GLU_H 1 | /* end confdefs.h. */ | | /* Override any GCC internal prototype to avoid an error. |Use char because int might match the return type of a GCC |builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern "C" | #endif | char glEnd (); | int | main () | { | return glEnd (); | ; | return 0; | }configure:4298: result: no configure:4311: error: missing required library GL Thanks a ton, again! Santosh On Fri, Nov 24, 2017 at 5:13 AM, Dirk Eddelbuettel <e...@debian.org> wrote: > > On 23 November 2017 at 15:05, Santosh wrote: > | I am trying to install 'rgl' package in Ubuntu.. Would highly appreciate > | your assistance .. I tried several leads available on various discussion > | fora and nothing helped so far. > > Install the _pre-built binary package_ via > > sudo apt install r-cran-rgl > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] installing "rgl" package
Hi Rxperts, I am trying to install 'rgl' package in Ubuntu.. Would highly appreciate your assistance .. I tried several leads available on various discussion fora and nothing helped so far. * installing *source* package ‘rgl’ ...checking for gcc... gcc -std=gnu99 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for gcc... (cached) gcc -std=gnu99 checking whether we are using the GNU C compiler... (cached) yes checking whether gcc -std=gnu99 accepts -g... (cached) yes checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed checking for libpng-config... yes configure: using libpng-config configure: using libpng dynamic linkage checking for X... libraries , headers checking GL/gl.h usability... yes checking GL/gl.h presence... yes checking for GL/gl.h... yes checking GL/glu.h usability... yes checking GL/glu.h presence... yes checking for GL/glu.h... yes checking for glEnd in -lGL... noconfigure: error: missing required library GLERROR: configuration failed for package ‘rgl’* removing ‘/data/R/lib/rgl’Warning in install.packages : installation of package ‘rgl’ had non-zero exit status Checking the system dependencies based on README.. system('dpkg -l |grep libgl1')ii libgl1-mesa-dev 10.1.3-0ubuntu0.6 amd64free implementation of the OpenGL API -- GLX development files > system('dpkg -l |grep libglu1')ii libglu1-mesa:amd64 > 9.0.0-2 amd64Mesa OpenGL utility > library (GLU) ii libglu1-mesa-dev 9.0.0-2 amd64Mesa OpenGL utility library -- development files > system('dpkg -l |grep libpng')ii libpng12-0:amd64 > 1.2.50-1ubuntu2.14.04.2 amd64PNG library - runtime ii libpng12-dev 1.2.50-1ubuntu2.14.04.2 amd64PNG library - development I also tried installing .. using the following command.. install.packages("rgl",dep=T, INSTALL_opts="--no-multiarch", configure.args=c(rgl="--with-gl-includes=/usr/include/GL")) Thanks so much for your help! Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] help needed for RInside with Qt
Hi Bert and Jeff, Thanks a lot for pointing it out. It is a commercial application. I would be distributing it. This makes R out of consideration. Thanks again for saving much time and effort. On Thu, Jun 29, 2017 at 10:22 AM, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: > If you adhere to the terms of the license for R you should be okay > legally. If you use contributed packages they may have additional > requirements. However, these terms are often overlooked by programmers > targeting Windows, hence Bert's caution. > > As to the content of the original post itself, it is off-topic for this > list... it belongs in R-devel (but you may need to study the Posting Guide > more thoroughly (use plain text at least) and clearly communicate your > licensing intentions to elicit help there. You probably also ought to > carefully read the R Installation and Administration Manual and indicate > why that document did not answer your questions. > -- > Sent from my phone. Please excuse my brevity. > > On June 29, 2017 12:32:40 AM EDT, Bert Gunter <bgunter.4...@gmail.com> > wrote: > >Is this application meant to be commercial? If so, R's open source > >license probably would forbid you to use it. I defer to those with > >real legal knowledge on this point, but you should check it. If it is > >not meant to be commercial, then ignore -- I have nothing useful to > >offer you. > > > >Cheers, > >Bert > > > > > >Bert Gunter > > > >"The trouble with having an open mind is that people keep coming along > >and sticking things into it." > >-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > > > >On Wed, Jun 28, 2017 at 1:36 PM, Santosh Kumar > ><lsantoshksi...@gmail.com> wrote: > >> Hello, > >> > >> I am developing an application using Qt framework and C++. I want to > >use R > >> as statistics engine of my application. After doing some search on > >> internet; I came to the conclusion that RCPP, MPI with RInside is > >what I > >> need. The next logical task was to quickly tryout "qtdensity" project > >of > >> RInside, for understanding the build and other settings. I hit some > >> roadblock here and got little confused. I have following quaries: > >> > >> 1. I am using Qt 5.8 MSVC and would like to distribute both 64 bit > >as well > >> as 32 bit application. > >> 2. Can I use binary distribution provided on CRAN with this version > >of Qt? > >> 3. If not then; do I need to build R myself with MinGW and Qt too > >with the > >> same version of MinGW? > >> 4. regarding make file modifications how should I set R_HOME env. > >variable? > >> Currently my R is installed in "C:\Program Files\R\R-3.4.0" If I set > >env > >> variable R_HOME = "C:\Program Files\R\R-3.4.0"I get QMake error: > >The > >> system cannot find the path specified. > >> > >> Any help will be much appreciated. > >> > >> Thanks, > >> Santosh > >> > >> [[alternative HTML version deleted]] > >> > >> __ > >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> 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 -- To UNSUBSCRIBE and more, see > >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 -- To UNSUBSCRIBE and more, see 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 needed for RInside with Qt
Hello, I am developing an application using Qt framework and C++. I want to use R as statistics engine of my application. After doing some search on internet; I came to the conclusion that RCPP, MPI with RInside is what I need. The next logical task was to quickly tryout "qtdensity" project of RInside, for understanding the build and other settings. I hit some roadblock here and got little confused. I have following quaries: 1. I am using Qt 5.8 MSVC and would like to distribute both 64 bit as well as 32 bit application. 2. Can I use binary distribution provided on CRAN with this version of Qt? 3. If not then; do I need to build R myself with MinGW and Qt too with the same version of MinGW? 4. regarding make file modifications how should I set R_HOME env. variable? Currently my R is installed in "C:\Program Files\R\R-3.4.0" If I set env variable R_HOME = "C:\Program Files\R\R-3.4.0"I get QMake error: The system cannot find the path specified. Any help will be much appreciated. Thanks, Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] A new -up?
otherwise explain it as unexplained "random variable"/ "residual error" :) Santosh On Wed, Apr 19, 2017 at 1:32 AM, Rolf Turner <r.tur...@auckland.ac.nz> wrote: > > On 19/04/17 20:01, peter dalgaard wrote: > > I believe that the list maintainer is hunting this down. As I >> understood it, it was more due to incompetence than to actual malice. >> > > Years ago I ran across an aphorism that very much appealed to me: "Never > attribute to malice that which may be adequately explained by stupidity." > > More recently I saw the same sentiment, expressed only slightly > differently, in someone's signature file --- can't remember whose. > > cheers, > > Rolf > > > -- > Technical Editor ANZJS > Department of Statistics > University of Auckland > Phone: +64-9-373-7599 ext. 88276 > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posti > ng-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] ggplot2 question plot mean/error bars
Dear Rxperts.. Here is the updated code.. to the above example.. how do I make the white circles as "white filled" so that lines in the circles are not shown.? Thanks and much appreciated.... Santosh q <- data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep( paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep( seq(10),15),b=round(runif(150,10,20))) q$r <- q$b*0.1 q2 <- q[order(q$G,q$D,q$a,q$t),] q3 <- as.data.frame(as.matrix(with(q2,aggregate(list(b=b),list(D=D,t=t),function(x) c(mean=mean(x),sd=sd(x),se=(sd(x)/sqrt(length(x))),stringsAsFactors=F) q3$t <- as.numeric(q3$t) q3$b.mean <- as.numeric(q3$b.mean) q3$b.sd <- as.numeric(q3$b.sd) q3$b.se <- as.numeric(q3$b.se) ggplot(q3[as.character(q3$D)%in%c("D1","D2"),],aes(x=t,y=b.mean,group=D,col=D,fill=D)) + geom_point(shape=21,size=4) + #,color=IP)) geom_line() + # geom_point(data=ipthd.f[ipthd.f$IP=="Cinacalcet",],fill='white')+ geom_errorbar(width=.2,aes(ymin=b.mean-b.se,ymax=b.mean+b.se)) + scale_shape_manual(values = c(16,21)) + # scale_shape(solid = T)+ # scale_shape_identity() + # scale_shape_discrete(solid = T) + scale_fill_manual(values=c("black","white")) + scale_color_manual(values=c("black","black")) On Wed, Apr 5, 2017 at 11:50 AM, Santosh <santosh2...@gmail.com> wrote: > Hello Rxperts.. > I am trying to generate a mean+/- error plot.. using ggplot2.. with filled > black and white circles and black lines, but no overlap of lines and > circles (symbols). Also, with no top and right lines of the plot box. I > remember having done this before.. unable to reproduce how I did! > > Yes, there are many ways of generating the plot.. Would high appreciate it > if you could help debug this piece of code. > > Attaching sample code for your convenience.. > Best, > Santosh > > q <- data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep( > paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep( > seq(10),15),b=round(runif(150,10,20))) > q$r <- q$b*0.1 > q2 <- q[order(q$G,q$D,q$a,q$t),] > > q3 <- > as.data.frame(as.matrix(with(q2,aggregate(list(b=b),list(D=D,t=t),function(x) > c(mean=mean(x),sd=sd(x),se=(sd(x)/sqrt(length(x))),stringsAsFactors=F) > q3$t <- as.numeric(q3$t) > q3$b.mean <- as.numeric(q3$b.mean) > q3$b.sd <- as.numeric(q3$b.sd) > q3$b.se <- as.numeric(q3$b.se) > > ggplot(q3[as.character(q3$D)%in%c("D1","D2"),],aes(x=t,y=b.mean,fill=D,col=D,group=D)) > + geom_point(shape=21,size=4) + > geom_line() + > geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) + > geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) + > scale_shape_manual(values = c(16,21)) + > scale_fill_manual(values=c("black","white")) + > scale_color_manual(values=c("black","black")) + > +legend.position = c(.8,.8)) > > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] ggplot2 question plot mean/error bars
Hello Rxperts.. I am trying to generate a mean+/- error plot.. using ggplot2.. with filled black and white circles and black lines, but no overlap of lines and circles (symbols). Also, with no top and right lines of the plot box. I remember having done this before.. unable to reproduce how I did! Yes, there are many ways of generating the plot.. Would high appreciate it if you could help debug this piece of code. Attaching sample code for your convenience.. Best, Santosh q <- data.frame(G=rep(paste("G",1:3,sep=""),each=50),D=rep(paste("D",1:5,sep=""),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20))) q$r <- q$b*0.1 q2 <- q[order(q$G,q$D,q$a,q$t),] q3 <- as.data.frame(as.matrix(with(q2,aggregate(list(b=b),list(D=D,t=t),function(x) c(mean=mean(x),sd=sd(x),se=(sd(x)/sqrt(length(x))),stringsAsFactors=F) q3$t <- as.numeric(q3$t) q3$b.mean <- as.numeric(q3$b.mean) q3$b.sd <- as.numeric(q3$b.sd) q3$b.se <- as.numeric(q3$b.se) ggplot(q3[as.character(q3$D)%in%c("D1","D2"),],aes(x=t,y=b.mean,fill=D,col=D,group=D)) + geom_point(shape=21,size=4) + geom_line() + geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) + geom_errorbar(width=1,aes(ymin=Mean-SE,ymax=Mean+SE)) + scale_shape_manual(values = c(16,21)) + scale_fill_manual(values=c("black","white")) + scale_color_manual(values=c("black","black")) + +legend.position = c(.8,.8)) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] fread transforms numbers
Dear Rxperts.. I am using R version 3.2.3 on Linux.. it says bit64 is not available for R version 3.2.3.. Thanks and your assistance much appreciated! Best regards, Santosh On Wed, Mar 22, 2017 at 7:50 PM, Santosh <santosh2...@gmail.com> wrote: > Thanks so much for your suggestions! Will try them out! > > Santosh > > On Wed, Mar 22, 2017 at 12:17 PM, Matt Dowle <mattjdo...@gmail.com> wrote: > >> Thanks Bill for cc. >> >> Santosh, >> >> I'm almost certain you don't have package bit64 installed. When you do >> it works fine : >> >> > remove.packages("bit64") >> > data.table::fread("9876543210\n") >> V1 >> 1: 4.879661e-314 >> > install.packages("bit64") >> > data.table::fread("9876543210\n") >>V1 >> 1: 9876543210 >> >> News for data.table v1.10.2 on CRAN 31 Jan 2017 contained : >> >> * When fread() or print() see integer64 columns are present, bit64's >> namespace is now automatically loaded for convenience. >> >> However, when data.table loads the namespace there is a bug in this >> function : >> >> > data.table:::require_bit64 >> function () >> { >> tt = try(requireNamespace("bit64", quietly = TRUE)) >> if (inherits(tt, "try-error")) >> warning("Some columns are type 'integer64' but package bit64 is >> not installed. Those columns will print as strange looking floating point >> data. There is no need to reload the data. Simply install.packages('bit64') >> to obtain the integer64 print method and print the data again.") >> } >> >> The intent was to display that nice helpful message to you. Due to this >> report, I can see now that I shouldn't have wrapped requireNamespace() with >> try() because requireNamespace() returns TRUE or FALSE anyway. Even though >> requireNamespace() prints 'Failed with error' it doesn't actually throw an >> error. I'll change data.table's function to the following : >> >> if (!requireNamespace("bit64", quietly = TRUE)) >> warning("Some columns ...") >> >> bit64 is correctly Suggests not Depends. It's just unfortunate the >> intended message wasn't displayed. >> >> Santosh, in future please follow the data.table support guide here: >> https://github.com/Rdatatable/data.table/wiki/Support. r-help is not >> supposed to be used for package support. The main thing though is thanks >> for helping me find this bug. >> >> Thanks, >> Matt >> >> >> On Wed, Mar 22, 2017 at 10:22 AM, William Dunlap <wdun...@tibco.com> >> wrote: >> >>> Here is a way to reproduce the problem: >>> > data.table::fread("9876543210\n") # number bigger than 2^31-1 >>> V1 >>> 1: 4.879661e-314 >>> and your work-around does fix things up >>> > data.table::fread("9876543210\n", colClasses="numeric") >>> V1 >>> 1: 9876543210 >>> >>> Bill Dunlap >>> TIBCO Software >>> wdunlap tibco.com >>> >>> >>> On Wed, Mar 22, 2017 at 9:58 AM, Jeff Newmiller >>> <jdnew...@dcn.davis.ca.us> wrote: >>> > You failed to provide a reproducible example, and you posted HTML so >>> the quality of any answer will be limited by the quality of your question. >>> > >>> > My stab at your problem is that you should read ?fread, and in >>> particular should try using the colClasses argument. >>> > -- >>> > Sent from my phone. Please excuse my brevity. >>> > >>> > On March 22, 2017 8:52:55 AM PDT, Santosh <santosh2...@gmail.com> >>> wrote: >>> >>Hi >>> >> >>> >>I have been using "fread" utility of "data.table" packge .. on a >>> >>dataset of >>> >>about 20 million rows. It's a fantastic package to read datasets. Thank >>> >>you, Matt D. >>> >> >>> >>However, I am faced with a peculiar instance of certain numbers in a >>> >>column being transformed. >>> >> >>> >>In the dataset, a column has values ranging from 1 to 9## >>> >>(nchar(x)=11, e.g. 98765432109). After using "fread" to read the >>> >>dataset, >>> >>values in all the columns are displayed correctly upto the first 1000 >>> >>rows. >>> >>If &
Re: [R] fread transforms numbers
Thanks so much for your suggestions! Will try them out! Santosh On Wed, Mar 22, 2017 at 12:17 PM, Matt Dowle <mattjdo...@gmail.com> wrote: > Thanks Bill for cc. > > Santosh, > > I'm almost certain you don't have package bit64 installed. When you do it > works fine : > > > remove.packages("bit64") > > data.table::fread("9876543210\n") > V1 > 1: 4.879661e-314 > > install.packages("bit64") > > data.table::fread("9876543210\n") >V1 > 1: 9876543210 > > News for data.table v1.10.2 on CRAN 31 Jan 2017 contained : > > * When fread() or print() see integer64 columns are present, bit64's > namespace is now automatically loaded for convenience. > > However, when data.table loads the namespace there is a bug in this > function : > > > data.table:::require_bit64 > function () > { > tt = try(requireNamespace("bit64", quietly = TRUE)) > if (inherits(tt, "try-error")) > warning("Some columns are type 'integer64' but package bit64 is > not installed. Those columns will print as strange looking floating point > data. There is no need to reload the data. Simply install.packages('bit64') > to obtain the integer64 print method and print the data again.") > } > > The intent was to display that nice helpful message to you. Due to this > report, I can see now that I shouldn't have wrapped requireNamespace() with > try() because requireNamespace() returns TRUE or FALSE anyway. Even though > requireNamespace() prints 'Failed with error' it doesn't actually throw an > error. I'll change data.table's function to the following : > > if (!requireNamespace("bit64", quietly = TRUE)) > warning("Some columns ...") > > bit64 is correctly Suggests not Depends. It's just unfortunate the > intended message wasn't displayed. > > Santosh, in future please follow the data.table support guide here: > https://github.com/Rdatatable/data.table/wiki/Support. r-help is not > supposed to be used for package support. The main thing though is thanks > for helping me find this bug. > > Thanks, > Matt > > > On Wed, Mar 22, 2017 at 10:22 AM, William Dunlap <wdun...@tibco.com> > wrote: > >> Here is a way to reproduce the problem: >> > data.table::fread("9876543210\n") # number bigger than 2^31-1 >> V1 >> 1: 4.879661e-314 >> and your work-around does fix things up >> > data.table::fread("9876543210\n", colClasses="numeric") >> V1 >> 1: 9876543210 >> >> Bill Dunlap >> TIBCO Software >> wdunlap tibco.com >> >> >> On Wed, Mar 22, 2017 at 9:58 AM, Jeff Newmiller >> <jdnew...@dcn.davis.ca.us> wrote: >> > You failed to provide a reproducible example, and you posted HTML so >> the quality of any answer will be limited by the quality of your question. >> > >> > My stab at your problem is that you should read ?fread, and in >> particular should try using the colClasses argument. >> > -- >> > Sent from my phone. Please excuse my brevity. >> > >> > On March 22, 2017 8:52:55 AM PDT, Santosh <santosh2...@gmail.com> >> wrote: >> >>Hi >> >> >> >>I have been using "fread" utility of "data.table" packge .. on a >> >>dataset of >> >>about 20 million rows. It's a fantastic package to read datasets. Thank >> >>you, Matt D. >> >> >> >>However, I am faced with a peculiar instance of certain numbers in a >> >>column being transformed. >> >> >> >>In the dataset, a column has values ranging from 1 to 9## >> >>(nchar(x)=11, e.g. 98765432109). After using "fread" to read the >> >>dataset, >> >>values in all the columns are displayed correctly upto the first 1000 >> >>rows. >> >>If "fread" is applied for reading >1000 rows of the total of 20Million >> >>rows, the values in only this (column (having wide range of values) are >> >>displayed as x.xxxe-3yy. (e.g. 3.5639877e-324) >> >> >> >>I tried reading all the columns as "character" and didn't help. >> >> >> >>Would highly appreciate your assistance! >> >> >> >>Thanks so much in advance. >> >> >> >>Best regards, >> >>Santosh >> >> >> >> [[alternative HTML version deleted]] >> >> >> >>___
[R] fread transforms numbers
Hi I have been using "fread" utility of "data.table" packge .. on a dataset of about 20 million rows. It's a fantastic package to read datasets. Thank you, Matt D. However, I am faced with a peculiar instance of certain numbers in a column being transformed. In the dataset, a column has values ranging from 1 to 9## (nchar(x)=11, e.g. 98765432109). After using "fread" to read the dataset, values in all the columns are displayed correctly upto the first 1000 rows. If "fread" is applied for reading >1000 rows of the total of 20Million rows, the values in only this (column (having wide range of values) are displayed as x.xxxe-3yy. (e.g. 3.5639877e-324) I tried reading all the columns as "character" and didn't help. Would highly appreciate your assistance! Thanks so much in advance. Best regards, Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Application of "merge" and "within"
Hi Peter and others.. In the code from Peter..(reproduced below for convenience..) > first <- function(x)x[1] > s <- within(q, {bl <- ave(b, paste(G,a), FUN=first); db <- b - bl}) is there a reason behind that 'ave' used in the above code? is there way to perform a multi-column sort in within? Thanks so much.. Santosh On Wed, Jun 1, 2016 at 1:45 AM, peter dalgaard <pda...@gmail.com> wrote: > Notice that within-group processing is intended. I'd try > > > first <- function(x)x[1] > > s <- within(q, {bl <- ave(b, paste(G,a), FUN=first); db <- b - bl}) > > Or perhaps > > q <- within(q, Ga <- paste(G,a)) > tbl <- with(q, tapply(b, Ga, first)) > s <- within(q, {bl <- tbl[Ga]; db <- b - bl}) > > -pd > > > On 28 May 2016, at 22:53 , Duncan Murdoch <murdoch.dun...@gmail.com> > wrote: > > > On 27/05/2016 7:00 PM, Santosh wrote: > >> Dear Rxperts! > >> > >> Is there a way to compute relative values.. using within().. function? > >> > >> Any assistance/suggestions are highly welcome!! > >> Thanks again, > >> Santosh... > >> ___ > >> A sample dataset and the computation "outside" within() function is > shown.. > >> > >> q <- data.frame(GL = rep(paste("G",1:3,sep = ""),each = 50), > >>G = rep(1:3,each = 50), > >>D = rep(paste("D",1:5,sep = ""),each = 30), > >>a = rep(1:15,each = 10), > >>t = rep(seq(10),15), > >>b = round(runif(150,10,20))) > >> r <- subset(q,!duplicated(paste(G,a)),sel=c(G,a,b)) > >> names(r)[3] <- "bl" > >> s <- merge(q,r) > >> s$db <- s$b-s$bl > >> > >>> head(s,5) > >>G a GL D t b bl db > >> 1 1 1 G1 D1 1 13 13 0 > >> 2 1 1 G1 D1 2 16 13 3 > >> 3 1 1 G1 D1 3 19 13 6 > >> 4 1 1 G1 D1 4 12 13 -1 > >> 5 1 1 G1 D1 5 19 13 6 > > > > Just use > > > > s <- within(s, db <- b - bl) > > > > Duncan Murdoch > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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 Dalgaard, Professor, > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Office: A 4.23 > Email: pd@cbs.dk Priv: pda...@gmail.com > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Application of "merge" and "within"
Thanks so much.. I will try that.. and keep you posted.. on a different note.. using the above examples.. after adding a new column is blank.. summarizing a null column causes errors.. (like min(NULL) or min(NA) etc.. to avoid that I was trying the following code.. within(q, as.data.frame(as.matrix(apply($DATA,2,function(x) {require(gtools);x1 <- ifelse(invalid(x),0,x);return(x1)} For some reason, the above code is not working.. any ideas on converting NAs/blanks to 0 using apply in within? or any other similar method? Thanks so much.. I appreciate your help!! Regards, Santosh On Wed, Jun 1, 2016 at 1:45 AM, peter dalgaard <pda...@gmail.com> wrote: > Notice that within-group processing is intended. I'd try > > > first <- function(x)x[1] > > s <- within(q, {bl <- ave(b, paste(G,a), FUN=first); db <- b - bl}) > > Or perhaps > > q <- within(q, Ga <- paste(G,a)) > tbl <- with(q, tapply(b, Ga, first)) > s <- within(q, {bl <- tbl[Ga]; db <- b - bl}) > > -pd > > > On 28 May 2016, at 22:53 , Duncan Murdoch <murdoch.dun...@gmail.com> > wrote: > > > On 27/05/2016 7:00 PM, Santosh wrote: > >> Dear Rxperts! > >> > >> Is there a way to compute relative values.. using within().. function? > >> > >> Any assistance/suggestions are highly welcome!! > >> Thanks again, > >> Santosh... > >> ___ > >> A sample dataset and the computation "outside" within() function is > shown.. > >> > >> q <- data.frame(GL = rep(paste("G",1:3,sep = ""),each = 50), > >>G = rep(1:3,each = 50), > >>D = rep(paste("D",1:5,sep = ""),each = 30), > >>a = rep(1:15,each = 10), > >>t = rep(seq(10),15), > >>b = round(runif(150,10,20))) > >> r <- subset(q,!duplicated(paste(G,a)),sel=c(G,a,b)) > >> names(r)[3] <- "bl" > >> s <- merge(q,r) > >> s$db <- s$b-s$bl > >> > >>> head(s,5) > >>G a GL D t b bl db > >> 1 1 1 G1 D1 1 13 13 0 > >> 2 1 1 G1 D1 2 16 13 3 > >> 3 1 1 G1 D1 3 19 13 6 > >> 4 1 1 G1 D1 4 12 13 -1 > >> 5 1 1 G1 D1 5 19 13 6 > > > > Just use > > > > s <- within(s, db <- b - bl) > > > > Duncan Murdoch > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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 Dalgaard, Professor, > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Office: A 4.23 > Email: pd@cbs.dk Priv: pda...@gmail.com > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Application of "merge" and "within"
I agree that performing merge outside the scope of "within" function, is pretty straight forward.. At times there are situations when many, if not all, of the operations are needed to be done within the scope the "within" environment.. Thanks so much.. Regards, Santosh On Tue, May 31, 2016 at 11:29 AM, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: > What is complicated about merge( q, r )? > > Keep in mind that there is nothing simple about the rules for non-standard > evaluation of variables that within() uses, and it only gets more > complicated if you try to apply those rules to two data frames at once. > While I am not quite sure I understand what you really want, I suspect you > won't like the behavior you get when you pile too much context into > within(). > > Note that dplyr::inner_join, which is designed to fit into a whole > ecosystem of NSE functions, uses strings to specify column names to join by > just like the merge "by" parameters do rather than using NSE, because it is > actually the least confusing approach when two data frames are being > referenced. > -- > Sent from my phone. Please excuse my brevity. > > On May 31, 2016 10:50:24 AM PDT, Santosh <santosh2...@gmail.com> wrote: >> >> Thanks for response.. I want to merge two data frames using "within" >> function..the columns to used for merge could vary.. then the other >> commands become simpler.. >> >> Thanks so much for your help! >> Santosh >> >> On Sat, May 28, 2016 at 1:53 PM, Duncan Murdoch <murdoch.dun...@gmail.com> >> wrote: >> >> On 27/05/2016 7:00 PM, Santosh wrote: >>> >>> Dear Rxperts! >>>> >>>> Is there a way to compute relative values.. using within().. function? >>>> >>>> Any assistance/suggestions are highly welcome!! >>>> Thanks again, >>>> Santosh... >>>> -- >>>> >>>> A sample dataset and the computation "outside" within() function is >>>> shown.. >>>> >>>> q <- data.frame(GL = >>>> rep(paste("G",1:3,sep = ""),each = 50), >>>> G = rep(1:3,each = 50), >>>> D = rep(paste("D",1:5,sep = ""),each = 30), >>>> a = rep(1:15,each = 10), >>>> t = rep(seq(10),15), >>>> b = round(runif(150,10,20))) >>>> r <- subset(q,!duplicated(paste(G,a)),sel=c(G,a,b)) >>>> names(r)[3] <- "bl" >>>> s <- merge(q,r) >>>> s$db <- s$b-s$bl >>>> >>>> head(s,5) >>>> >>>>> >>>>> G a GL D t b bl db >>>> 1 1 1 G1 D1 1 13 13 0 >>>> 2 1 1 G1 D1 2 16 13 3 >>>> 3 1 1 G1 D1 3 19 13 6 >>>> 4 1 1 G1 D1 4 12 13 -1 >>>> 5 1 1 G1 D1 5 19 13 6 >>> >>> >>> >>> Just use >>> >>> s <- within(s, db <- b - bl) >>> >>> Duncan Murdoch >> >> >> >> >> [[alternative HTML version deleted]] >> >> -- >> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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 -- To UNSUBSCRIBE and more, see 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] Application of "merge" and "within"
Thanks for response.. I want to merge two data frames using "within" function..the columns to used for merge could vary.. then the other commands become simpler.. Thanks so much for your help! Santosh On Sat, May 28, 2016 at 1:53 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 27/05/2016 7:00 PM, Santosh wrote: > >> Dear Rxperts! >> >> Is there a way to compute relative values.. using within().. function? >> >> Any assistance/suggestions are highly welcome!! >> Thanks again, >> Santosh... >> ___ >> A sample dataset and the computation "outside" within() function is >> shown.. >> >> q <- data.frame(GL = rep(paste("G",1:3,sep = ""),each = 50), >> G = rep(1:3,each = 50), >> D = rep(paste("D",1:5,sep = ""),each = 30), >> a = rep(1:15,each = 10), >> t = rep(seq(10),15), >> b = round(runif(150,10,20))) >> r <- subset(q,!duplicated(paste(G,a)),sel=c(G,a,b)) >> names(r)[3] <- "bl" >> s <- merge(q,r) >> s$db <- s$b-s$bl >> >> head(s,5) >>> >> G a GL D t b bl db >> 1 1 1 G1 D1 1 13 13 0 >> 2 1 1 G1 D1 2 16 13 3 >> 3 1 1 G1 D1 3 19 13 6 >> 4 1 1 G1 D1 4 12 13 -1 >> 5 1 1 G1 D1 5 19 13 6 >> > > Just use > > s <- within(s, db <- b - bl) > > Duncan Murdoch > > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Application of "merge" and "within"
Dear Rxperts! Is there a way to compute relative values.. using within().. function? Any assistance/suggestions are highly welcome!! Thanks again, Santosh... ___ A sample dataset and the computation "outside" within() function is shown.. q <- data.frame(GL = rep(paste("G",1:3,sep = ""),each = 50), G = rep(1:3,each = 50), D = rep(paste("D",1:5,sep = ""),each = 30), a = rep(1:15,each = 10), t = rep(seq(10),15), b = round(runif(150,10,20))) r <- subset(q,!duplicated(paste(G,a)),sel=c(G,a,b)) names(r)[3] <- "bl" s <- merge(q,r) s$db <- s$b-s$bl > head(s,5) G a GL D t b bl db 1 1 1 G1 D1 1 13 13 0 2 1 1 G1 D1 2 16 13 3 3 1 1 G1 D1 3 19 13 6 4 1 1 G1 D1 4 12 13 -1 5 1 1 G1 D1 5 19 13 6 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Testing installed package of rJava in Linux
Thanks for your response. Since the test failed due to X11 connectivity reasons, is it okay to use it in applications where X11 server connectivity is not required? Thanks and much appreciated, Santosh On Tue, Mar 8, 2016 at 10:41 PM, Uwe Ligges <lig...@statistik.tu-dortmund.de > wrote: > > > On 09.03.2016 02:19, Santosh wrote: > >> Dear Rxperts.. >> I installed rJava on 64-bit Linux system and apparently it installed >> without errors.However, I got the following error message when I tried to >> test the installed package. >> >> >> Error in .jcall("RJavaTools", "Ljava/lang/Object;", "newInstance", >> .jfindClass(class), : >>java.lang.InternalError: Can't connect to X11 window server using ':0' >> as >> the value of the DISPLAY variable. >> Calls: new -> new -> .J -> .jcall -> .jcheck -> .Call >> Execution halted >> > > > Apparently you do not have an X server running or no X forwarding enabled? > > Best, > Uwe Ligges > > > >> >> Would highly appreciate your tips/suggestions.. >> >> Thanks and much appreciated, >> Santosh >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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 -- To UNSUBSCRIBE and more, see 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] Testing installed package of rJava in Linux
Dear Rxperts.. I installed rJava on 64-bit Linux system and apparently it installed without errors.However, I got the following error message when I tried to test the installed package. Error in .jcall("RJavaTools", "Ljava/lang/Object;", "newInstance", .jfindClass(class), : java.lang.InternalError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable. Calls: new -> new -> .J -> .jcall -> .jcheck -> .Call Execution halted Would highly appreciate your tips/suggestions.. Thanks and much appreciated, Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] [FORGED] Use of "quote" in Windows and Linux..
Thanks all for your response. I didn't realize I posted in HTML.. I just typed an email as I usually do... how do I know whether it was sent in HTML? I had not changed any settings to send out in HTML format.. Seems like you got the impression based on the HTML tag like message of "simpleError" Anyway.. thanks for your help/response. again. Regards, Santosh On Wed, Feb 24, 2016 at 12:52 PM, Ista Zahn <istaz...@gmail.com> wrote: > On Wed, Feb 24, 2016 at 3:47 PM, Rolf Turner <r.tur...@auckland.ac.nz> > wrote: > > > > (1) Do not post in html. > > > > (2) This is the R-help forum, not the Rstudio help forum. > > > > (3) The call > > > > a1 <- quote(ID) > > > > works just fine under R (not Rstudio) on my Linux box. > > Works fine on my Linux machine too, even in Rstudio. > > > > > cheers, > > > > Rolf Turner > > > > -- > > Technical Editor ANZJS > > Department of Statistics > > University of Auckland > > Phone: +64-9-373-7599 ext. 88276 > > > > On 25/02/16 08:03, Santosh wrote: > >> > >> Dear Rxperts.. > >> > >> I noticed a puzzling behavior of 'quote' in Linux and Windows > environment > >> based RStudio.. > >> > >> In Linux based RStudio , > >> > >> a1 <- quote(ID) > >> > >> The error message I get is: > >> > >> object > >> 'ID' not found> > >> > >> > >> > >> > >> I dont get any error message when I do the same in Windows 7 based > >> RStudio.. > >> > >> > >> Could you please suggest how to use quote in Linux environment..and > >> explain > >> why there is such a difference? > >> > >> Thanks much in advance!! > > > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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 -- To UNSUBSCRIBE and more, see 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] Use of "quote" in Windows and Linux..
Dear Rxperts.. I noticed a puzzling behavior of 'quote' in Linux and Windows environment based RStudio.. In Linux based RStudio , a1 <- quote(ID) The error message I get is: I dont get any error message when I do the same in Windows 7 based RStudio.. Could you please suggest how to use quote in Linux environment..and explain why there is such a difference? Thanks much in advance!! Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Tables, knitr markdown
Thanks, Gergely.. I wonder if it allows to insert lines etc as sent in previous email which might need some additional preprocessing.. Best, Santosh On Mon, Feb 22, 2016 at 3:27 PM, Gergely Daróczi <gerg...@snowl.net> wrote: > On Mon, Feb 22, 2016 at 1:55 PM, Duncan Murdoch > <murdoch.dun...@gmail.com> wrote: > > > > On 22/02/2016 3:46 PM, Santosh wrote: > >> > >> Just figured out.. > >> > >> as.data.frame(as.matrix(),stringsAsFactors=F) > >> > >> could work! :) > > > > > > Why do you want to produce Markdown output? the tables package > (lowercase t!) can produce output in either LaTeX or HTML. Just tell knitr > to leave the output alone, e.g. for PDF output > > > > ```{r results="asis"} > > require(tables) > > tab <- tabular( (Species + 1) ~ (n=1) + Format(digits=2)* > > (Sepal.Length + Sepal.Width)*(mean + sd), data=iris ) > > latex(tab) > > ``` > > > > or for HTML output > > > > ```{r results="asis"} > > require(tables) > > tab <- tabular( (Species + 1) ~ (n=1) + Format(digits=2)* > > (Sepal.Length + Sepal.Width)*(mean + sd), data=iris ) > > html(tab) > > ``` > > > In case of you would rather generate markdown instead of HTML/LaTeX to > be independent from the resulting output document format, you can give > a try to the "pander" package, which can transform quite many R object > types into markdown, eg: > > #> library(tables) > #> tab <- tabular( (Species + 1) ~ (n=1) + Format(digits=2)* > #+ (Sepal.Length + Sepal.Width)*(mean + sd), data=iris ) > #> pander::pander(tab) > > > \\Sepal.Length\\Sepal.Width\\ > Species n meansd meansd > --- > *setosa*505.01 0.35 3.43 0.38 > > *versicolor* 505.94 0.52 2.77 0.31 > > *virginica* 506.59 0.64 2.97 0.32 > >*All* 1505.84 0.83 3.06 0.44 > -------- > > Please find more details at > http://rapporter.github.io/pander/#generic-pander-method, or the > knitr+pander vignette at > https://cran.rstudio.com/web/packages/pander/vignettes/knitr.html > > Best, > Gergely > > > > > > > > > > > > Duncan Murdoch > > > > > >> > >> > >> On Mon, Feb 22, 2016 at 12:17 PM, Santosh <santosh2...@gmail.com> > wrote: > >> > >>> Dear Rxperts.. > >>> I am able to generate tables using Tables R package.. > >>> However, when I have been unsuccessful in using kable (from knitr > package) > >>> to generate the table in R markdown script.. > >>> > >>> It's because the output generated by "tabular" in Tables package is of > >>> class "tabular". The kable function in knitr package accepts > data.frame. > >>> > >>> Is there a way to convert the tabular class objects into data.frame > >>> objects? > >>> > >>> Or is there a way that kable can accept "tabular" class object? > >>> > >>> > >>> Thanks so much.. > >>> Santosh > >>> > >> > >> [[alternative HTML version deleted]] > >> > >> __ > >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> 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 -- To UNSUBSCRIBE and more, see > > 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 -- To UNSUBSCRIBE and more, see 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] Tables, knitr markdown
Sorry.. I forgot to mention that I wanted it be published in MS Word, because it goes into a Report this is prepared using MS Word. Hence,the above effort.. yes, it's a lot easier to send it to Latex.. I was also wondering if it is possible to add "\hline" separating the categories in a table.. Using tabular, I get this: \begin{tabular}{l} \hline "Name" & "Value1" & \multicolumn{1}{c}{"Value2"} \\ \hline \nopagebreak A1 & 0.06 & 1.2 \\ \nopagebreak A5 & 0.62 & 8.9 \\ \nopagebreak A6 & 0.48 & 4.2 \\ \rule{0pt}{1.7\normalbaselineskip}A2 & 1.50 & 1.27 \\ \nopagebreak A7 & 0.11 & 4.3 \\ \nopagebreak A3 & 0.01 & 3.1 \\ \rule{0pt}{1.7\normalbaselineskip}A4 & 2.19 & 1.0 \\ \nopagebreak B1. & 0.03 & 2.0 \\ \nopagebreak B2. & 0.011 & 1.8 \\ \rule{0pt}{1.7\normalbaselineskip}B3 & 0.10 & 2.7 \\ \nopagebreak B4. & 0.02 & 1.6 \\ \nopagebreak C1. & 0.01 & 1.1 \\ \hline \end{tabular} But, I want in this way.. (with horizontal lines and customized text inserted at the beginning of a group.. \begin{tabular}{l} \hline "Name" & "Value1" & \multicolumn{1}{c}{"Value2"} \\ \hline \multicolumn{5}{l}{\textbf{Hardened}}\\ \hline \nopagebreak A1 & 0.06 & 1.2 \\ \nopagebreak \tA5 & 0.62 & 8.9 \\ \nopagebreak \tA6 & 0.48 & 4.2 \\ \rule{0pt}{1.7\normalbaselineskip}A2 & 1.50 & 1.27 \\ \nopagebreak \tA7 & 0.11 & 4.3 \\ \nopagebreak \tA3 & 0.01 & 3.1 \\ \rule{0pt}{1.7\normalbaselineskip}A4 & 2.19 & 1.0 \\ \hline \multicolumn{3}{l}{\textbf{Pulverized}}\\ \hline \nopagebreak B1. & 0.03 & 2.0 \\ \nopagebreak B2. & 0.011 & 1.8 \\ \rule{0pt}{1.7\normalbaselineskip}B3 & 0.10 & 2.7 \\ \nopagebreak B4. & 0.02 & 1.6 \\ \hline \multicolumn{3}{l}{\textbf{Molten}}\\ \hline \nopagebreak C1. & 0.01 & 1.1 \\ \hline \end{tabular} Thanks so much for your help! Santosh On Mon, Feb 22, 2016 at 1:55 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 22/02/2016 3:46 PM, Santosh wrote: > >> Just figured out.. >> >> as.data.frame(as.matrix(),stringsAsFactors=F) >> >> could work! :) >> > > Why do you want to produce Markdown output? the tables package (lowercase > t!) can produce output in either LaTeX or HTML. Just tell knitr to leave > the output alone, e.g. for PDF output > > ```{r results="asis"} > require(tables) > tab <- tabular( (Species + 1) ~ (n=1) + Format(digits=2)* > (Sepal.Length + Sepal.Width)*(mean + sd), data=iris ) > latex(tab) > ``` > > or for HTML output > > ```{r results="asis"} > require(tables) > tab <- tabular( (Species + 1) ~ (n=1) + Format(digits=2)* > (Sepal.Length + Sepal.Width)*(mean + sd), data=iris ) > html(tab) > ``` > > > Duncan Murdoch > > >> >> On Mon, Feb 22, 2016 at 12:17 PM, Santosh <santosh2...@gmail.com> wrote: >> >> Dear Rxperts.. >>> I am able to generate tables using Tables R package.. >>> However, when I have been unsuccessful in using kable (from knitr >>> package) >>> to generate the table in R markdown script.. >>> >>> It's because the output generated by "tabular" in Tables package is of >>> class "tabular". The kable function in knitr package accepts data.frame. >>> >>> Is there a way to convert the tabular class objects into data.frame >>> objects? >>> >>> Or is there a way that kable can accept "tabular" class object? >>> >>> >>> Thanks so much.. >>> Santosh >>> >>> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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 -- To UNSUBSCRIBE and more, see 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] Tables, knitr markdown
Just figured out.. as.data.frame(as.matrix(),stringsAsFactors=F) could work! :) On Mon, Feb 22, 2016 at 12:17 PM, Santosh <santosh2...@gmail.com> wrote: > Dear Rxperts.. > I am able to generate tables using Tables R package.. > However, when I have been unsuccessful in using kable (from knitr package) > to generate the table in R markdown script.. > > It's because the output generated by "tabular" in Tables package is of > class "tabular". The kable function in knitr package accepts data.frame. > > Is there a way to convert the tabular class objects into data.frame > objects? > > Or is there a way that kable can accept "tabular" class object? > > > Thanks so much.. > Santosh > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Tables, knitr markdown
Dear Rxperts.. I am able to generate tables using Tables R package.. However, when I have been unsuccessful in using kable (from knitr package) to generate the table in R markdown script.. It's because the output generated by "tabular" in Tables package is of class "tabular". The kable function in knitr package accepts data.frame. Is there a way to convert the tabular class objects into data.frame objects? Or is there a way that kable can accept "tabular" class object? Thanks so much.. Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] ReporteRs R package installation issues in R.3.2.3 (Windows)
Thanks so much for your response.. Would try that! Santosh On Mon, Feb 22, 2016 at 12:45 AM, Uwe Ligges < lig...@statistik.tu-dortmund.de> wrote: > I guess you are using a 64 bit version of R for Windows but you have only > a 32-bit installation of Java. Please install a 64-bit Java. > > Best, > Uwe Ligges > > > > On 22.02.2016 09:35, Santosh wrote: > >> Dear Rxperts.. >> >> I tried to install ReporteRs package..in R.3.2.3 (Windows) >> Below are the error messages... >> >> install.packages("ReporteRs",dep=T) >>> >> trying URL ' >> http://cran.cnr.berkeley.edu/bin/windows/contrib/3.2/ReporteRs_0.8.2.zip' >> Content type 'application/zip' length 947836 bytes (925 KB) >> downloaded 925 KB >> >> package ‘ReporteRs’ successfully unpacked and MD5 sums checked >> >> The downloaded binary packages are in >> >> C:\Users\santosh\AppData\Local\Temp\RtmpMlGfvG\downloaded_packages >> >> library(ReporteRs) >>> >> Loading required package: ReporteRsjars >> Error : .onLoad failed in loadNamespace() for 'rJava', details: >>call: fun(libname, pkgname) >>error: No CurrentVersion entry in Software/JavaSoft registry! Try >> re-installing Java and make sure R and Java have matching architectures. >> Error: package ‘ReporteRsjars’ could not be loaded >> >> I tried to install ReporteRsJars.. >> >>> install.packages("ReporteRsjars") >>> >> trying URL ' >> >> http://cran.cnr.berkeley.edu/bin/windows/contrib/3.2/ReporteRsjars_0.0.2.zip >> ' >> Content type 'application/zip' length 5502826 bytes (5.2 MB) >> downloaded 5.2 MB >> >> package ‘ReporteRsjars’ successfully unpacked and MD5 sums checked >> >> The downloaded binary packages are in >> C:\Users\santoshAppData\Local\Temp\RtmpMlGfvG\downloaded_packages >> >>> >>> library(ReporteRsjars) >>> >> Error : .onLoad failed in loadNamespace() for 'rJava', details: >>call: fun(libname, pkgname) >>error: No CurrentVersion entry in Software/JavaSoft registry! Try >> re-installing Java and make sure R and Java have matching architectures. >> Error: package or namespace load failed for ‘ReporteRsjars’ >> >>> >>> >> rJava and and ReporteRsjars were having issues with loading even though >> there were shown as successfully installed. >> >> Would appreciate your help/solution/ideas in this regard.. >> >> Thanks much, >> Santosh >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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 -- To UNSUBSCRIBE and more, see 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] ReporteRs R package installation issues in R.3.2.3 (Windows)
Dear Rxperts.. I tried to install ReporteRs package..in R.3.2.3 (Windows) Below are the error messages... > install.packages("ReporteRs",dep=T) trying URL ' http://cran.cnr.berkeley.edu/bin/windows/contrib/3.2/ReporteRs_0.8.2.zip' Content type 'application/zip' length 947836 bytes (925 KB) downloaded 925 KB package ‘ReporteRs’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\santosh\AppData\Local\Temp\RtmpMlGfvG\downloaded_packages > library(ReporteRs) Loading required package: ReporteRsjars Error : .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures. Error: package ‘ReporteRsjars’ could not be loaded I tried to install ReporteRsJars.. > install.packages("ReporteRsjars") trying URL ' http://cran.cnr.berkeley.edu/bin/windows/contrib/3.2/ReporteRsjars_0.0.2.zip ' Content type 'application/zip' length 5502826 bytes (5.2 MB) downloaded 5.2 MB package ‘ReporteRsjars’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\santoshAppData\Local\Temp\RtmpMlGfvG\downloaded_packages > > library(ReporteRsjars) Error : .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: No CurrentVersion entry in Software/JavaSoft registry! Try re-installing Java and make sure R and Java have matching architectures. Error: package or namespace load failed for ‘ReporteRsjars’ > rJava and and ReporteRsjars were having issues with loading even though there were shown as successfully installed. Would appreciate your help/solution/ideas in this regard.. Thanks much, Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Remote Connection
Hello All, I am having trouble connecting remotely to R. Following is my current setup. I have windows 8 as a host OS and Ubuntu 14 running in VM inside windows. I wanted to connect from windows to R running on Ubuntu VM. I cant see any configuration file at /etc/Rserv.conf Can you point to the document where I can find more details about remote connection. thanks, Santosh __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Convert csv to xpt file in R?
Dear Rxperts.. Thanks for your response. Below is the version on Windows 7 Enterprise (64-bit) OS machine..Yes, I tried SASxport, foreign and Hmisc.. have used SASxport before (not for writing to xpt though) and continue to have the same write to sas transport file issue.. version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 3 minor 0.2 year 2013 month 09 day25 svn rev63987 language R version.string R version 3.0.2 (2013-09-25) Thanks and regards, Santosh On Thu, May 7, 2015 at 8:51 AM, Nordlund, Dan (DSHS/RDA) nord...@dshs.wa.gov wrote: -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh Sent: Wednesday, May 06, 2015 8:04 PM To: r-help Subject: [R] Convert csv to xpt file in R? Dear Rxperts.. Was wondering if there is a way in R to read a csv file and generate an XPT file? For some reason the function write.xport() does not seem to work for me i get the following error... error in label.data.frame(df,default=): length of default same as x A sample dataframe is given below xg2 - data.frame(aa=runif(10),bb=sample(runif(100),10)) SASformat(xg2$aa) - 'Numeric2' SASformat(xg2$bb) - 'Numeric2' label(xg2$aa) - test aa label(xg2$bb) - test bb label(xg2) - testa SAStype(xg2) - TestXge write.xport(xg2,file=A1.xpt) Error in label.data.frame(df, default = ) : length of default must same as x Any suggestions/tips are welcome.. Thanks and regards Santosh The code above runs without error and produces an xport file on my Win7 64-bit system running R-3.2.0. You haven't told us anything about your OS, version of R, and packages loaded. Have you tried running the code from a fresh start of R after only loading the SASxport package? Dan Daniel J. Nordlund Research and Data Analysis Division Services Enterprise Support Administration Washington State Department of Social and Health Services [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Convert csv to xpt file in R?
Dear Rxperts.. Was wondering if there is a way in R to read a csv file and generate an XPT file? For some reason the function write.xport() does not seem to work for me i get the following error... error in label.data.frame(df,default=): length of default same as x A sample dataframe is given below xg2 - data.frame(aa=runif(10),bb=sample(runif(100),10)) SASformat(xg2$aa) - 'Numeric2' SASformat(xg2$bb) - 'Numeric2' label(xg2$aa) - test aa label(xg2$bb) - test bb label(xg2) - testa SAStype(xg2) - TestXge write.xport(xg2,file=A1.xpt) Error in label.data.frame(df, default = ) : length of default must same as x Any suggestions/tips are welcome.. Thanks and regards Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Script to workflow conversion
Dear Rxperts.. Sorry.. i don't have data for my query.. Is there a way that an R script can be converted to a workflow? or if not a workflow, converted into a flowchart or anything close to that effect. Regards, Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 a list of trellis objects
Thanks for all your suggestions.. santosh On Tue, Feb 18, 2014 at 4:11 AM, Duncan Mackay dulca...@bigpond.com wrote: Hi Santosh for more control on size and position ?lattice::print.trellis Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh Sent: Tuesday, 18 February 2014 10:41 To: r-help Subject: [R] plot a list of trellis objects Dear Rxperts Is there a way to control the display order (or simplistically control panel layout) of a list of trellis objects without using a for loop (or whatever)? I just realize that gridExtra has that feature.. (grid.arrange)... But, converting each of those elements of the list of trellis objects into an argument to grid.arrange seems to negate the simplicity.. In addition, if I were to use grid.arrange on a list of trellis objects, is there a way to pass the list elements as arguments to grid.arrange? If you have other suggestions, please do.. Regards, Santosh [[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.
Re: [R] plot a list of trellis objects
Thanks for the suggestion.. Is there a way I can include arguments to the *grid.arrange* function? I tried in your example something like... gridar - function(x,ncol=2,...) grid.arrange(x,...) do.call(gridar, lattice.plots); I could not make it work when I try to control number of columns/rows and have multiple pages the way possible using print.trellis Regards, Santosh On Mon, Feb 17, 2014 at 10:38 PM, Frede Aakmann Tøgersen fr...@vestas.comwrote: How about lattice.plots - list(xyplot(rnorm(10) ~ 1:10, type = b), xyplot(rnorm(10) ~ 1:10, type = b), xyplot(rnorm(10) ~ 1:10, type = b), xyplot(rnorm(10) ~ 1:10, type = b)) do.call(grid.arrange, lattice.plots) There is most likely a loop hidden somewhere in the do.call function ;-) Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling Technology Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh Sent: 18. februar 2014 01:41 To: r-help Subject: [R] plot a list of trellis objects Dear Rxperts Is there a way to control the display order (or simplistically control panel layout) of a list of trellis objects without using a for loop (or whatever)? I just realize that gridExtra has that feature.. (grid.arrange)... But, converting each of those elements of the list of trellis objects into an argument to grid.arrange seems to negate the simplicity.. In addition, if I were to use grid.arrange on a list of trellis objects, is there a way to pass the list elements as arguments to grid.arrange? If you have other suggestions, please do.. Regards, Santosh [[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.
Re: [R] plot a list of trellis objects
I forgot to add.. printltrellis seems to take in only one trellis object at a time.. so.. I think I would need to use a loop for varying the column/row indices, etc... Is that the only way (other than grid.arrange)? Is column/row/page control possible through grid.arrange..? On Tue, Feb 18, 2014 at 11:59 AM, Santosh santosh2...@gmail.com wrote: Thanks for the suggestion.. Is there a way I can include arguments to the *grid.arrange* function? I tried in your example something like... gridar - function(x,ncol=2,...) grid.arrange(x,...) do.call(gridar, lattice.plots); I could not make it work when I try to control number of columns/rows and have multiple pages the way possible using print.trellis Regards, Santosh On Mon, Feb 17, 2014 at 10:38 PM, Frede Aakmann Tøgersen fr...@vestas.com wrote: How about lattice.plots - list(xyplot(rnorm(10) ~ 1:10, type = b), xyplot(rnorm(10) ~ 1:10, type = b), xyplot(rnorm(10) ~ 1:10, type = b), xyplot(rnorm(10) ~ 1:10, type = b)) do.call(grid.arrange, lattice.plots) There is most likely a loop hidden somewhere in the do.call function ;-) Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling Technology Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org ] On Behalf Of Santosh Sent: 18. februar 2014 01:41 To: r-help Subject: [R] plot a list of trellis objects Dear Rxperts Is there a way to control the display order (or simplistically control panel layout) of a list of trellis objects without using a for loop (or whatever)? I just realize that gridExtra has that feature.. (grid.arrange)... But, converting each of those elements of the list of trellis objects into an argument to grid.arrange seems to negate the simplicity.. In addition, if I were to use grid.arrange on a list of trellis objects, is there a way to pass the list elements as arguments to grid.arrange? If you have other suggestions, please do.. Regards, Santosh [[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.
Re: [R] plot a list of trellis objects
Thanks for suggestions! I am just getting familiarized with these grid and extra businesses! Now I understand a bit better to find and scour through man/help pages :) santosh On Tue, Feb 18, 2014 at 1:00 PM, Frede Aakmann Tøgersen fr...@vestas.comwrote: Sorry this should of course be for all on R-help. Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling Technology Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender. -Original Message- From: Frede Aakmann Tøgersen Sent: 18. februar 2014 21:55 To: 'arun' Subject: RE: [R] plot a list of trellis objects So are you saying that the coder of do.call do not know the difference between _list_ and _c_?? Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling Technology Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender. -Original Message- From: arun [mailto:smartpink...@yahoo.com] Sent: 18. februar 2014 21:50 To: Frede Aakmann Tøgersen Subject: Re: [R] plot a list of trellis objects If you look at the structure: str(list(lattice.plots,ncol=1)) #List of 2 $ :List of 4 ..$ :List of 45 -- str(c(lattice.plots,ncol=1)) #List of 5 # $ :List of 45 A.K. On Tuesday, February 18, 2014 3:34 PM, Frede Aakmann Tøgersen fr...@vestas.com wrote: Yes of course (why didn't you yourself read the man/help pages? That's the way I learned R). If you see the help to grid.arrange: arrangeGrob package:gridExtra R Documentation arrangeGrob Description: arrange ggplot2, lattice, and grobs on a page Usage: arrangeGrob(..., as.table = FALSE, clip = TRUE, main = NULL, sub = NULL, left = NULL, legend = NULL) Arguments: ...: plots of class ggplot2, trellis, or grobs, and valid arguments to grid.layout For the ellipses: The arguments to to grid.layout is your savior: (here is the help to grid.layout): grid.layoutpackage:gridR Documentation Create a Grid Layout Description: This function returns a Grid layout, which describes a subdivision of a rectangular region. Usage: grid.layout(nrow = 1, ncol = 1, widths = unit(rep(1, ncol), null), heights = unit(rep(1, nrow), null), default.units = null, respect = FALSE, just=centre) Arguments: nrow: An integer describing the number of rows in the layout. And then for the call to do.call do.call package:base R Documentation Execute a Function Call Description: 'do.call' constructs and executes a function call from a name or a function and a list of arguments to be passed to it. Usage: do.call(what, args, quote = FALSE, envir = parent.frame()) Arguments: what: either a function or a non-empty character string naming the function to be called. args: a _list_ of arguments to the function call. The 'names' attribute of 'args' gives the argument names. The args argument saves you: This suggests me to do: lattice.plots - list(xyplot(rnorm(10) ~ 1:10, type = b), xyplot(rnorm(10) ~ 1:10, type = b), xyplot(rnorm(10) ~ 1:10, type = b), xyplot(rnorm(10) ~ 1:10, type = b)) do.call(grid.arrange, list(lattice.plots, ncol = 1)) That does NOT WORK, damn someone, even though the help to do.call says that args should be a _list_ (damn you isn't that a LIST) However this works: do.call(grid.arrange,c(lattice.plots, ncol = 1)) WHAT IS THE DIFFERNCE BETWEEN c() and list() Have a nice day to all of you. And thank you all developers for R. I cannot live without it. Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling Technology Service Solutions T +45 9730 5135 M +45 2547 6050
[R] plot a list of trellis objects
Dear Rxperts Is there a way to control the display order (or simplistically control panel layout) of a list of trellis objects without using a for loop (or whatever)? I just realize that gridExtra has that feature.. (grid.arrange)... But, converting each of those elements of the list of trellis objects into an argument to grid.arrange seems to negate the simplicity.. In addition, if I were to use grid.arrange on a list of trellis objects, is there a way to pass the list elements as arguments to grid.arrange? If you have other suggestions, please do.. Regards, Santosh [[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] Conditional inclusion of an element in an R object
Dear Rxperts... I would like to conditionally include an element (as a column) in a dataframe. Please see the sample code below: a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B),each=5)) lc1 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=R) lc2 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=Ra) a2 - subset(a1, sel=unlist(lc1)) # this works a3 - subset(a1, sel=unlist(lc2)) # this doesn't Is there a way to dynamically include columns in a dataframe? Regards, santosh [[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] Conditional inclusion of an element in an R object
Dear Rxperts... I would like to conditionally include an element (as a column) in a dataframe. Please see the sample code below: There is a correction to the earlier post.. my apologies... a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10], R=rep(c(A,B),each=5)) lc1 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=R) lc2 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)), C3=ifelse(is.element(Ra,names(a1)),Ra,NULL)) *The error for the above:* Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) : replacement has length zero In addition: Warning message: In rep(no, length.out = length(ans)) : 'x' is NULL so the result will be NULL a2 - subset(a1, sel=unlist(lc1)) # this works a3 - subset(a1, sel=unlist(lc2)) # this doesn't work Is there a way to dynamically include columns in a dataframe? Regards, santosh On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts... I would like to conditionally include an element (as a column) in a dataframe. Please see the sample code below: a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B),each=5)) lc1 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=R) lc2 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=Ra) a2 - subset(a1, sel=unlist(lc1)) # this works a3 - subset(a1, sel=unlist(lc2)) # this doesn't Is there a way to dynamically include columns in a dataframe? Regards, santosh [[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] Fwd: Conditional inclusion of an element in an R object
My intention is to include certain columns if they meet certain criteria. For example, if b is one of the columns of a1, then keep otherwise don't. HTH.. santosh On Fri, Jan 10, 2014 at 1:01 PM, MacQueen, Don macque...@llnl.gov wrote: Apologies, but all that ifelse() stuff is too hard to follow. What I would do is compute a character vector of column names to keep, then do a1[ , names.to.keep] -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 1/10/14 12:53 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts... I would like to conditionally include an element (as a column) in a dataframe. Please see the sample code below: There is a correction to the earlier post.. my apologies... a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10], R=rep(c(A,B),each=5)) lc1 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b, NULL)),C3=R) lc2 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b, NULL)), C3=ifelse(is.element(Ra,names(a1)),Ra,NULL)) *The error for the above:* Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) : replacement has length zero In addition: Warning message: In rep(no, length.out = length(ans)) : 'x' is NULL so the result will be NULL a2 - subset(a1, sel=unlist(lc1)) # this works a3 - subset(a1, sel=unlist(lc2)) # this doesn't work Is there a way to dynamically include columns in a dataframe? Regards, santosh On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts... I would like to conditionally include an element (as a column) in a dataframe. Please see the sample code below: a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B), each=5)) lc1 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b ,NULL)),C3=R) lc2 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b ,NULL)),C3=Ra) a2 - subset(a1, sel=unlist(lc1)) # this works a3 - subset(a1, sel=unlist(lc2)) # this doesn't Is there a way to dynamically include columns in a dataframe? Regards, santosh [[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.
Re: [R] Fwd: Conditional inclusion of an element in an R object
I don't think apropos or indexing would help. I am open to your suggestions/tips. I usually get multiple versions of a dataset (even with the same column names). In the source data, I occasionally notice inconsistencies... formatting issues, column naming issues etc.. As shown In the a1 example,.. the values that are supposed to be in column Qr are sometimes in column b. Such differences between versions crop up due to various unknown reasons, e.g. when different programmers prepare the data set or if the existing practices/processes change. Likewise, formats of certain date-time columns (not shown in the example) also vary, the time date format may be in %m/%d/%Y %H:%M, %d %b %Y %H:%M or %d%b%Y %H:%M So, I would like use programming methods to pick the right one if available or don't pick at all. Besides, is there an R equivalent of %m[/][.]%d[/][,]%y [%H[:%M[:%S[.%N]]][%p][[(]%3Z[)]]] available in Splus (?class.timeDate) for tackling time-date format inconsistencies as mentioned above. Thanks, Santosh On Fri, Jan 10, 2014 at 2:32 PM, Bert Gunter gunter.ber...@gene.com wrote: Don's response seems apropos to me. Do you understanding indexing, i.e. the [ operator? If not, you should read An Introduction to R or other tutorial (there are many good ones on the web). If that is not the issue, you need to explain more clearly why his answer does not suffice. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H. Gilbert Welch On Fri, Jan 10, 2014 at 1:59 PM, Santosh santosh2...@gmail.com wrote: My intention is to include certain columns if they meet certain criteria. For example, if b is one of the columns of a1, then keep otherwise don't. HTH.. santosh On Fri, Jan 10, 2014 at 1:01 PM, MacQueen, Don macque...@llnl.gov wrote: Apologies, but all that ifelse() stuff is too hard to follow. What I would do is compute a character vector of column names to keep, then do a1[ , names.to.keep] -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 1/10/14 12:53 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts... I would like to conditionally include an element (as a column) in a dataframe. Please see the sample code below: There is a correction to the earlier post.. my apologies... a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10], R=rep(c(A,B),each=5)) lc1 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b, NULL)),C3=R) lc2 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b, NULL)), C3=ifelse(is.element(Ra,names(a1)),Ra,NULL)) *The error for the above:* Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) : replacement has length zero In addition: Warning message: In rep(no, length.out = length(ans)) : 'x' is NULL so the result will be NULL a2 - subset(a1, sel=unlist(lc1)) # this works a3 - subset(a1, sel=unlist(lc2)) # this doesn't work Is there a way to dynamically include columns in a dataframe? Regards, santosh On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts... I would like to conditionally include an element (as a column) in a dataframe. Please see the sample code below: a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B), each=5)) lc1 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b ,NULL)),C3=R) lc2 - list(C1 = P,C2 = ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b ,NULL)),C3=Ra) a2 - subset(a1, sel=unlist(lc1)) # this works a3 - subset(a1, sel=unlist(lc2)) # this doesn't Is there a way to dynamically include columns in a dataframe? Regards, santosh [[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. [[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
Re: [R] read .slk file
Dear Rxperts.. Thanks for your response... Will keep you posted. Santosh On Thu, Dec 19, 2013 at 10:06 AM, David Winsemius dwinsem...@comcast.netwrote: On Dec 16, 2013, at 3:10 PM, Santosh wrote: Dear Rxperts.. I recently received a data file with the extension .slk. If I save the file as MS Excel file, I am able to read in R without issues. Is it possible to read this .slk file without converting into another R-readable data format? Reading this I wondered if you could use sep=; with read.* functions. http://en.wikipedia.org/wiki/SYmbolic_LinK_%28SYLK%29 That is NOT going to give you a neat dataframe, but you didn't make your goals very clear so it seems possible that you might get what you needed from some selected input lines. -- David Winsemius Alameda, CA, USA [[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] read .slk file
Dear Rxperts.. I recently received a data file with the extension .slk. If I save the file as MS Excel file, I am able to read in R without issues. Is it possible to read this .slk file without converting into another R-readable data format? Regards, Santosh [[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] Read shortcuts of MS Excel files through R
Dear Rxperts, Through Windows OS, I created shortcuts (paste as shortcut) to excel spreadsheets ( with xlsx as the file extension). I wasn't able to read the shortcuts through R and using read functions of xlsx package. exf - a1.xlsx.lnk read.xlsx(exf,1) Error in .jcall(RJavaTools, Ljava/lang/Object;, invokeMethod, cl, : java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream read.xlsx2(exf,1) Error in .jcall(RJavaTools, Ljava/lang/Object;, invokeMethod, cl, : java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream Would truly appreciate your suggestions. Regards, Santosh [[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] Trouble with SASxport in R.3.0. under 32-bit and 64-bit Windows (both 7 and Vista)
Dear Rxperts,.. I am using R 3.0 in both 32- and 64-bit Windows 7 environment and have trouble using SASxport. They seem to work fine under R.2.15.3. The error/warning messages are provided below... Following are the messages obtained when trying to read s SAS transport file (.xpt) library(SASxport) Warning message: package SASxport was built under R version 3.0.1 read.xport(fname) Error in `label-.default`(`*tmp*`, value = c(, , , , , , : value must be character vector of length 1 Any suggestions/assistance is highly welcome! Thanks so much.. Santosh [[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] Using tables package - request for help
Dear Rxperts, Is there a way to exclude NAs while computing the summary statistics using tables package? I would also like the count (length(x,na.rm=T) included for each column ... a - data.frame(p=rep(c(A,B),each=10,len=30), a=rep(c(1,2,3),each=10),id=seq(30), b=round(log(runif(30,-10,20))), c=round(log(runif(30,40,70 tabular(((p=factor(p))*(a=factor(a))+1) ~ (b + c)* ((N=1)+mean+sd),data=a) Thanks so much.. Santosh [[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] Using tables package - request for help
Please ignore my previous message.I was able to figure out a solution.. here it is.. nlen - function(x) length(na.omit(x)) tabular(((p=factor(p))*(a=factor(a))+1) ~ (b + c)* ((N=nlen)+mean+sd),data=a) Thanks, Santosh On Thu, Jun 13, 2013 at 4:16 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts, Is there a way to exclude NAs while computing the summary statistics using tables package? I would also like the count (length(x,na.rm=T) included for each column ... a - data.frame(p=rep(c(A,B),each=10,len=30), a=rep(c(1,2,3),each=10),id=seq(30), b=round(log(runif(30,-10,20))), c=round(log(runif(30,40,70 tabular(((p=factor(p))*(a=factor(a))+1) ~ (b + c)* ((N=1)+mean+sd),data=a) Thanks so much.. Santosh [[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] Using Lattice, LatticeExtra - Hide right and top axes in multipanel plots
Dear Rxperts, How do I hide the top and right axes in multiple panel plots? A couple of examples are provided below.. Would highly appreciate appreciate your assistance.. #Example 1 library(latticeExtra) xyplot((1:200)/20 ~ (1:200)/20, type = c(p, g), scales = list(x = list(log = 2,alternating=0), y = list(log = 10,alternating=0)), xscale.components = xscale.components.log10ticks, yscale.components = yscale.components.log10ticks,top=F,right=F) #Example 2 q - data.frame(G=rep(paste(G,1:3,sep=),each=50),D=rep(paste(D,1:5,sep=),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep=:) q$grp - ordered(q$grp, levels=unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x,D1=orange,D2=blue,D3=red, D4=seagreen, D5=black))) q2 - q[order(q$G,q$D,q$a,q$t),] xyplot(b~t|G,data=q2,groups=grp,type=l,as.table=T, layout=c(3,1), par.strip.text = list(lines = 2), scales=list(x=list(rela='free',alternating=0),y=list(rela='free',alternating=0),col=1,tck=c(1,0)), panel=panel.superpose, panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number) { require(grid) panel.axis(side=top,labels = F,draw.labels = F,ticks = F,line.col=NA, line.lty=NA, line.lwd=0, line.alpha=0) panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type=l, col=q2$dcol[subscripts],lty=1,cex=0.7) }, strip=F, # strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0, var.name=School), xlab=t, ylab=b, main=Overlay of Profiles by Schools and Classes, ) Thanks so much, Santosh [[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] Using Lattice, LatticeExtra - Hide right and top axes in multipanel plots
I updated the code for the second example.. This time.. all the axes disappeared!! xyplot(b~t|G,data=q2,groups=grp,type=l,as.table=T, layout=c(3,1), par.settings=list(axis.line=list(col=0)), scales=list(x=list(rela='free',alternating=0),y=list(rela='free',alternating=0),col=1,tck=c(1,0)), panel=panel.superpose, panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number) { require(grid) panel.axis(side=top,labels = F,draw.labels = F,ticks = F,line.col=NA, line.lty=NA, line.lwd=0, line.alpha=0) panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type=l, col=q2$dcol[subscripts],lty=1,cex=0.7) }, strip=F, # strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0, var.name=School), xlab=t, ylab=b, main=Overlay of Profiles by Schools and Classes, ) On Sun, Jun 9, 2013 at 5:52 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts, How do I hide the top and right axes in multiple panel plots? A couple of examples are provided below.. Would highly appreciate appreciate your assistance.. #Example 1 library(latticeExtra) xyplot((1:200)/20 ~ (1:200)/20, type = c(p, g), scales = list(x = list(log = 2,alternating=0), y = list(log = 10,alternating=0)), xscale.components = xscale.components.log10ticks, yscale.components = yscale.components.log10ticks,top=F,right=F) #Example 2 q - data.frame(G=rep(paste(G,1:3,sep=),each=50),D=rep(paste(D,1:5,sep=),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep=:) q$grp - ordered(q$grp, levels=unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x,D1=orange,D2=blue,D3=red, D4=seagreen, D5=black))) q2 - q[order(q$G,q$D,q$a,q$t),] xyplot(b~t|G,data=q2,groups=grp,type=l,as.table=T, layout=c(3,1), par.strip.text = list(lines = 2), scales=list(x=list(rela='free',alternating=0),y=list(rela='free',alternating=0),col=1,tck=c(1,0)), panel=panel.superpose, panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number) { require(grid) panel.axis(side=top,labels = F,draw.labels = F,ticks = F,line.col=NA, line.lty=NA, line.lwd=0, line.alpha=0) panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type=l, col=q2$dcol[subscripts],lty=1,cex=0.7) }, strip=F, # strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0, var.name=School), xlab=t, ylab=b, main=Overlay of Profiles by Schools and Classes, ) Thanks so much, Santosh [[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] Expression evaluation of Plotting labels containing spaces
Thanks so much!! Would be it be better if in vignette of plotmath, x %~% y and x~~y; likewise, other operations (.e.g., x %*% y, x * y) may be grouped, so that are not missed by a layman like me! - just a thought... Thanks, Santosh On Tue, Jun 4, 2013 at 9:13 PM, David Winsemius dwinsem...@comcast.netwrote: On Jun 4, 2013, at 8:39 PM, Santosh wrote: Dear Rxperts, How do I overcome the anomaly as in the second case of examples below? exc - list(units=list( c(m^2)) ,vars= list(c('asb')), ,label= list(c('abs surf body'))) plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],' (',exc$units[1],')',sep=''))) plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],' (',exc$units[1],')',sep=''))) Mail client mangled this due entirely to your improper use HTML. You have been posting to Rhelp long enough to have had plenty of opportunity to read the Posting Guide. And I know for a fact that it is quite easy to send plain text using gmail. You have no legitimate excuse for continuing this deprecated practice. Anyway, running this code: exc - list(units=list( c(m^2)) ,vars= list(c('asb')), label= list(c('abs surf body'))) # Notice that I quoted the 'units' value plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'(',exc$** units[1],')',sep=''))) # Also note that plotmath cannot handle embedded carriage returns plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'(',exc$** units[1],')',sep=''))) Produces this error: Error in parse(text = paste(exc$label[1], (, exc$units[1], ), sep = )) : text:1:5: unexpected symbol 1: abs surf ^ (You are asked in the Posting Guide exactly your code and also to post your error messages.) So you are trying to parse an expression and the parser is expecting a comma or a tilde or something other than the beginning of another token. You never said what you actually wanted (also a request in the Posting Guide), but try adding tilde's: exc - list(units=list( c(m^2)) ,vars= list(c('asb')), label= list(c('abs~surf~body'))) plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'(',exc$** units[1],')',sep=''))) plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'(',exc$** units[1],')',sep=''))) I know that the plotmath help page is not exactly the most expansive regarding how to form proper expressions for R but at least review it and run the examples: ?plotmath -- David. Thanks so much! Santosh [[alternative HTML version deleted]] Sigh. R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html ^^**^^** ^ and provide commented, minimal, self-contained, reproducible code. --- David Winsemius, MD Alameda, CA, USA [[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] Expression evaluation of Plotting labels containing spaces
Dear Rxperts, How do I overcome the anomaly as in the second case of examples below? exc - list(units=list( c(m^2)) ,vars= list(c('asb')), ,label= list(c('abs surf body'))) plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],' (',exc$units[1],')',sep=''))) plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],' (',exc$units[1],')',sep=''))) Thanks so much! Santosh [[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] Create and read symbolic links in Windows
Dear R experts, This time I am unable create symbolic links to files as I had done last time. I could not replicate what I had successfully tried last time (rerun the same code without any modifications) . I get the following error message.. [1] FALSE Warning message: In file.link(.file1, file2, : cannot link './File1' to './file2', reason 'The specified network name is no longer available' The file.exists, however, results TRUE when I test for source and target folders and the source file.. I tried with mapping of drives , relative folder path,and nothing worked. The R version (on 64-bit Windows 7): version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 3 minor 0.0 year 2013 month 04 day03 svn rev62481 language R version.string R version 3.0.0 (2013-04-03) nickname Masked Marvel Any suggestions are highly welcome! Thanks, Santosh On Fri, May 3, 2013 at 11:30 AM, Santosh santosh2...@gmail.com wrote: Just got it right please ignore the previous posting... It worked! Prof Ripley made my day!! :) THANK YOU! On Fri, May 3, 2013 at 11:23 AM, Santosh santosh2...@gmail.com wrote: Thanks for your suggestion... I upgraded to R.3.0.0 in 64-bit Windows 7 environment.. This time when I use file.link.. I get the following error message: 'Cannot create a file when that file already exists And I don't see the link. The other function, file.copy, correctly copies to the target location. Still confuse with the error msges... Thanks, Santosh On Thu, May 2, 2013 at 11:42 PM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On 03/05/2013 07:33, Santosh wrote: Thanks for the suggestions. In windows (Windows 7, 64-bit), I couldn't get file.symlink to work, but file.link did return the result to be TRUE but at the target location, I did not see any link. Not sure I am missing anything more.. Hope it's nothing to do with administrator accounts and administrator rights... Is it something I should check with my system administrator? You may need to update your R: although the posting guide asked you to do that before posting. There was a relevant bug fix in 2.15.3. Thanks, Santosh On Thu, May 2, 2013 at 12:22 PM, Prof Brian Ripley rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk** wrote: On 02/05/2013 19:50, Santosh wrote: Dear Rxperts.. Got a couple of quick q's.. I am using R in windows environment (both 32-bit and 64-bit) a) Is there a way to create symbolic links to some data files? See ?file.symlink. ??'symbolic link' should have got you there. Note that this is not very useful for files, but that is a Windows and not an R restriction. b) How do I read data from symbolic links? The same ways you read data from files. Thanks so much.. Santosh -- Brian D. Ripley, rip...@stats.ox.ac.uk mailto: rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~__**ripley/http://www.stats.ox.ac.uk/~__ripley/ http://www.stats.ox.ac.uk/~**ripley/http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 tel:%2B44%201865%20272861 (self) 1 South Parks Road, +44 1865 272866 tel:%2B44%201865%20272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 tel:%2B44%201865%20272595 __**__ R-help@r-project.org mailto:R-help@r-project.org mailing list https://stat.ethz.ch/mailman/_**_listinfo/r-helphttps://stat.ethz.ch/mailman/__listinfo/r-help https://stat.ethz.ch/mailman/**listinfo/r-helphttps://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 http://www.R-project.org/**posting-guide.htmlhttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~**ripley/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 [[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 xyplot multipanels
Dear Rxperts, Using the above example, I have been playing around using viewport under panel-function(...) {...} block in conjunction with panel.groups=function(..) {xyplot.} code block.. I have not bee successful so far.. I was wondering if it is possible to pass user-defined functions (including data driven text annotations) in both panel and panel.groups arguments? Thanks so much.. Santosh On Tue, May 21, 2013 at 10:04 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts, Sorry about that..forgot to update the numeric part of the multipanel group indicator... Below is the updated code... in addition to getting rid of the curly braces, is there a better way to control the position of panel.text flexibly instead of hardcoding. Thanks, santosh q - data.frame(GL = rep(paste(G,1:3,sep = ),each = 50), G = rep(1:3,each = 50), D = rep(paste(D,1:5,sep = ),each = 30), a = rep(1:15,each = 10), t = rep(seq(10),15), b = round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep = :) q$grp - ordered(q$grp, levels = unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x, D1 = orange, D2 = blue, D3 = red, D4 = seagreen, D5 = black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) my.theme = list(strip.border = list(col = NA), strip.background = list(col = NA)) # Of course, I can add a series of $.. I don't have too many $s! xyplot(b ~ t | G,data = q2,groups = grp,type = l,as.table = T, layout = c(3,1), par.strip.text = list(lines = 2), panel = panel.superpose, par.settings = my.theme, panel.groups = function(x = x, y = y, subscripts = subscripts, groups = groups,..., group.number) { require(grid) panel.xyplot(x = x,y = y, subscripts = subscripts,pch = NA,lwd = 1,type = l, col = q2$dcol[subscripts],lty = 1,cex = 0.7) rv0- ref3[ref3$G%in%unique(q2$G)[panel.number()],] panel.text(x=5,y=15,label=unique(rv0$GL)) tids - paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty- 1 draw.key(list(columns = 1,between = 1,between.col = 0.5, text = list(lab = tids,col = tcols,cex = 0.8),title = Classes,cex.title = 1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip = strip.custom(strip.names = T,strip.levels = T,par.strip.text = list(cex = 1.7,font = 2),bg = 0,var.name = School), xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), main = Overlay of Profiles by Schools and Classes, ) On Tue, May 21, 2013 at 8:21 PM, David Winsemius dwinsem...@comcast.netwrote: On May 21, 2013, at 5:07 PM, Santosh wrote: Dear Rxperts, Ok The curly braces as we talked before,... They appear if the group argument of xyplot function is entered as a numeric value; and don't when the values are letters. At the moment you are offering an example where the group argument is neither numeric, nor character, but rather is a factor-classed variable. I cannot make any curley items appear if I change the argument to numeric. On my machine (a Mac running R 3.0.0 RC) there are no curley braces ... on the strips (or anywhere else.) I do not know what you mean by keep only side 1 and 2 of the borders. It is possible that you want to avoid alternating tick labels and need to find the switch to suppress ticks labels on the upper and right sides of the plotting borders. Try: ?xyplot # scales section scales=list(alternating=c(1,1,1) ), # 1 choice repeated for the number of columns -- David. I just figured how to hide the strip borders...and also control the ticks in different axes... Any suggestions to remove the *curly braces* are highly welcome. q - data.frame(G = rep(paste(G,1:3,sep = ),each = 50), D = rep(paste(D,1:5,sep = ),each = 30), a = rep(1:15,each = 10), t = rep(seq(10),15), b = round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep = :) q$grp - ordered(q$grp, levels = unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x, D1 = orange, D2 = blue, D3 = red, D4 = seagreen, D5 = black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) my.theme = list(strip.border = list(col = NA), strip.background = list(col = NA)) # Of course, I can add a series of $.. I don't have too many $s! xyplot(b ~ t | G,data = q2,groups = grp,type = l,as.table = T, layout = c(3,1), par.strip.text = list(lines = 2), panel = panel.superpose, par.settings = my.theme, panel.groups = function(x = x, y = y, subscripts = subscripts, groups = groups,..., group.number) { require(grid) panel.xyplot(x = x,y = y, subscripts = subscripts,pch = NA,lwd = 1,type = l, col = q2$dcol[subscripts],lty = 1,cex = 0.7) rv0- ref3[ref3$G%in%unique(q2$G)[panel.number()],] tids - paste(as.character
Re: [R] Lattice xyplot multipanels
Dear Rxperts.. Just figured how to add a text at a custom location in panel.groups.. use grid.text(x=unit(value1,npc),y=unit(value2,npc),label=label content) With this, I hope to stop flogging such a valuable black horse! :) On Wed, May 22, 2013 at 10:35 AM, Santosh santosh2...@gmail.com wrote: Dear Rxperts, Using the above example, I have been playing around using viewport under panel-function(...) {...} block in conjunction with panel.groups=function(..) {xyplot.} code block.. I have not bee successful so far.. I was wondering if it is possible to pass user-defined functions (including data driven text annotations) in both panel and panel.groups arguments? Thanks so much.. Santosh On Tue, May 21, 2013 at 10:04 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts, Sorry about that..forgot to update the numeric part of the multipanel group indicator... Below is the updated code... in addition to getting rid of the curly braces, is there a better way to control the position of panel.text flexibly instead of hardcoding. Thanks, santosh q - data.frame(GL = rep(paste(G,1:3,sep = ),each = 50), G = rep(1:3,each = 50), D = rep(paste(D,1:5,sep = ),each = 30), a = rep(1:15,each = 10), t = rep(seq(10),15), b = round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep = :) q$grp - ordered(q$grp, levels = unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x, D1 = orange, D2 = blue, D3 = red, D4 = seagreen, D5 = black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) my.theme = list(strip.border = list(col = NA), strip.background = list(col = NA)) # Of course, I can add a series of $.. I don't have too many $s! xyplot(b ~ t | G,data = q2,groups = grp,type = l,as.table = T, layout = c(3,1), par.strip.text = list(lines = 2), panel = panel.superpose, par.settings = my.theme, panel.groups = function(x = x, y = y, subscripts = subscripts, groups = groups,..., group.number) { require(grid) panel.xyplot(x = x,y = y, subscripts = subscripts,pch = NA,lwd = 1,type = l, col = q2$dcol[subscripts],lty = 1,cex = 0.7) rv0- ref3[ref3$G%in%unique(q2$G)[panel.number()],] panel.text(x=5,y=15,label=unique(rv0$GL)) tids - paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty- 1 draw.key(list(columns = 1,between = 1,between.col = 0.5, text = list(lab = tids,col = tcols,cex = 0.8),title = Classes,cex.title = 1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip = strip.custom(strip.names = T,strip.levels = T,par.strip.text = list(cex = 1.7,font = 2),bg = 0,var.name = School), xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), main = Overlay of Profiles by Schools and Classes, ) On Tue, May 21, 2013 at 8:21 PM, David Winsemius dwinsem...@comcast.netwrote: On May 21, 2013, at 5:07 PM, Santosh wrote: Dear Rxperts, Ok The curly braces as we talked before,... They appear if the group argument of xyplot function is entered as a numeric value; and don't when the values are letters. At the moment you are offering an example where the group argument is neither numeric, nor character, but rather is a factor-classed variable. I cannot make any curley items appear if I change the argument to numeric. On my machine (a Mac running R 3.0.0 RC) there are no curley braces ... on the strips (or anywhere else.) I do not know what you mean by keep only side 1 and 2 of the borders. It is possible that you want to avoid alternating tick labels and need to find the switch to suppress ticks labels on the upper and right sides of the plotting borders. Try: ?xyplot # scales section scales=list(alternating=c(1,1,1) ), # 1 choice repeated for the number of columns -- David. I just figured how to hide the strip borders...and also control the ticks in different axes... Any suggestions to remove the *curly braces* are highly welcome. q - data.frame(G = rep(paste(G,1:3,sep = ),each = 50), D = rep(paste(D,1:5,sep = ),each = 30), a = rep(1:15,each = 10), t = rep(seq(10),15), b = round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep = :) q$grp - ordered(q$grp, levels = unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x, D1 = orange, D2 = blue, D3 = red, D4 = seagreen, D5 = black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) my.theme = list(strip.border = list(col = NA), strip.background = list(col = NA)) # Of course, I can add a series of $.. I don't have too many $s! xyplot(b ~ t | G,data = q2,groups = grp,type = l,as.table = T, layout = c(3,1), par.strip.text = list(lines = 2), panel = panel.superpose, par.settings = my.theme, panel.groups = function(x = x, y = y, subscripts = subscripts, groups
Re: [R] Lattice xyplot multipanels
Dear Rxperts, Using the same example above, is there a way to remove the borders of multi-panel strips and control the display of the borders of each panel.. for example, I would like to keep only side 1 2 of a panel... Thanks, Santosh On Wed, May 1, 2013 at 11:11 PM, Santosh santosh2...@gmail.com wrote: Thanks for all tips/suggestions.. Just a few more comments.. The same code I use with a different data set in another project does not create those curly braces! Regards, Santosh On Wed, May 1, 2013 at 8:16 PM, Santosh santosh2...@gmail.com wrote: Sorry about the word brackets.. Yes, I meant curly braces! I have not heard of curley braces! :). Curly braces surrounding the values of strip.levels appear on the strip of multipanel plots. Thanks, Santosh On Wed, May 1, 2013 at 7:44 PM, David Winsemius dwinsem...@comcast.netwrote: On May 1, 2013, at 6:16 PM, Santosh wrote: Dear Rxperts, I have a strange situation.. I see curly brackets Wait right here. What do you mean by brackets? In some locales, such as mine, that might mean [ ; in other domains... well, who knows? I don't see any [. The Urban Legends Newsgroup used to have a saying: TWIAVBP, which is an initialism for: The World Is A Very Big Place. Pleas realize that language is local. around strip.levels in multipanel strips while using lattice::xyplot. .How do I get rid of the curly brackets? Curly brackets? You mean curley braces? I see some of them in the code, but why in the world would one want to remove valid curley-braces in code? They just function as delimiters. For some reason, I am not able to reproduce the problem using an example below... What problem? .. are you unable to reproduce? The code runs without error on my machine. Any suggestions are highly welcome! Thanks, Santosh q - data.frame(G=rep(paste(G,1:3,sep=),each=50),D=rep(paste(D,1:5,sep=),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep=:) q$grp - ordered(q$grp, levels=unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x,D1=orange,D2=blue,D3=red, D4=seagreen, D5=black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) xyplot(b~t|G,data=q2,groups=grp,type=l,as.table=T, layout=c(3,1), par.strip.text = list(lines = 2), panel=panel.superpose, panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number) { require(grid) panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type=l, col=q2$dcol[subscripts],lty=1,cex=0.7) rv0 -ref3[ref3$G%in%unique(q2$G)[panel.number()],] tids- paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty- 1 draw.key(list(columns=1,between=1,between.col=0.5, text=list(lab=tids,col=tcols,cex=0.8),title=Classes,cex.title=1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0, var.name=School), xlab=deparse(substitute(x)), ylab=deparse(substitute(y)), main=Overlay of Profiles by Schools and Classes, ) [[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 xyplot multipanels
Dear Rxperts, Ok The curly braces as we talked before,... They appear if the group argument of xyplot function is entered as a numeric value; and don't when the values are letters. I just figured how to hide the strip borders...and also control the ticks in different axes... Any suggestions to remove the *curly braces* are highly welcome. q - data.frame(G = rep(paste(G,1:3,sep = ),each = 50), D = rep(paste(D,1:5,sep = ),each = 30), a = rep(1:15,each = 10), t = rep(seq(10),15), b = round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep = :) q$grp - ordered(q$grp, levels = unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x, D1 = orange, D2 = blue, D3 = red, D4 = seagreen, D5 = black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) my.theme = list(strip.border = list(col = NA), strip.background = list(col = NA)) # Of course, I can add a series of $.. I don't have too many $s! xyplot(b ~ t | G,data = q2,groups = grp,type = l,as.table = T, layout = c(3,1), par.strip.text = list(lines = 2), panel = panel.superpose, par.settings = my.theme, panel.groups = function(x = x, y = y, subscripts = subscripts, groups = groups,..., group.number) { require(grid) panel.xyplot(x = x,y = y, subscripts = subscripts,pch = NA,lwd = 1,type = l, col = q2$dcol[subscripts],lty = 1,cex = 0.7) rv0- ref3[ref3$G%in%unique(q2$G)[panel.number()],] tids - paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty - 1 draw.key(list(columns = 1,between = 1,between.col = 0.5, text = list(lab = tids,col = tcols,cex = 0.8),title = Classes,cex.title = 1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip = strip.custom(strip.names = T,strip.levels = T,par.strip.text = list(cex = 1.7,font = 2),bg = 0,var.name = School), xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), main = Overlay of Profiles by Schools and Classes, ) On Tue, May 21, 2013 at 3:00 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts, Using the same example above, is there a way to remove the borders of multi-panel strips and control the display of the borders of each panel.. for example, I would like to keep only side 1 2 of a panel... Thanks, Santosh On Wed, May 1, 2013 at 11:11 PM, Santosh santosh2...@gmail.com wrote: Thanks for all tips/suggestions.. Just a few more comments.. The same code I use with a different data set in another project does not create those curly braces! Regards, Santosh On Wed, May 1, 2013 at 8:16 PM, Santosh santosh2...@gmail.com wrote: Sorry about the word brackets.. Yes, I meant curly braces! I have not heard of curley braces! :). Curly braces surrounding the values of strip.levels appear on the strip of multipanel plots. Thanks, Santosh On Wed, May 1, 2013 at 7:44 PM, David Winsemius dwinsem...@comcast.netwrote: On May 1, 2013, at 6:16 PM, Santosh wrote: Dear Rxperts, I have a strange situation.. I see curly brackets Wait right here. What do you mean by brackets? In some locales, such as mine, that might mean [ ; in other domains... well, who knows? I don't see any [. The Urban Legends Newsgroup used to have a saying: TWIAVBP, which is an initialism for: The World Is A Very Big Place. Pleas realize that language is local. around strip.levels in multipanel strips while using lattice::xyplot. .How do I get rid of the curly brackets? Curly brackets? You mean curley braces? I see some of them in the code, but why in the world would one want to remove valid curley-braces in code? They just function as delimiters. For some reason, I am not able to reproduce the problem using an example below... What problem? .. are you unable to reproduce? The code runs without error on my machine. Any suggestions are highly welcome! Thanks, Santosh q - data.frame(G=rep(paste(G,1:3,sep=),each=50),D=rep(paste(D,1:5,sep=),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep=:) q$grp - ordered(q$grp, levels=unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x,D1=orange,D2=blue,D3=red, D4=seagreen, D5=black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) xyplot(b~t|G,data=q2,groups=grp,type=l,as.table=T, layout=c(3,1), par.strip.text = list(lines = 2), panel=panel.superpose, panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number) { require(grid) panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type=l, col=q2$dcol[subscripts],lty=1,cex=0.7) rv0 -ref3[ref3$G%in%unique(q2$G)[panel.number()],] tids- paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty- 1 draw.key(list(columns=1,between=1
Re: [R] Lattice xyplot multipanels
Dear Rxperts, Sorry about that..forgot to update the numeric part of the multipanel group indicator... Below is the updated code... in addition to getting rid of the curly braces, is there a better way to control the position of panel.text flexibly instead of hardcoding. Thanks, santosh q - data.frame(GL = rep(paste(G,1:3,sep = ),each = 50), G = rep(1:3,each = 50), D = rep(paste(D,1:5,sep = ),each = 30), a = rep(1:15,each = 10), t = rep(seq(10),15), b = round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep = :) q$grp - ordered(q$grp, levels = unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x, D1 = orange, D2 = blue, D3 = red, D4 = seagreen, D5 = black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) my.theme = list(strip.border = list(col = NA), strip.background = list(col = NA)) # Of course, I can add a series of $.. I don't have too many $s! xyplot(b ~ t | G,data = q2,groups = grp,type = l,as.table = T, layout = c(3,1), par.strip.text = list(lines = 2), panel = panel.superpose, par.settings = my.theme, panel.groups = function(x = x, y = y, subscripts = subscripts, groups = groups,..., group.number) { require(grid) panel.xyplot(x = x,y = y, subscripts = subscripts,pch = NA,lwd = 1,type = l, col = q2$dcol[subscripts],lty = 1,cex = 0.7) rv0- ref3[ref3$G%in%unique(q2$G)[panel.number()],] panel.text(x=5,y=15,label=unique(rv0$GL)) tids - paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty- 1 draw.key(list(columns = 1,between = 1,between.col = 0.5, text = list(lab = tids,col = tcols,cex = 0.8),title = Classes,cex.title = 1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip = strip.custom(strip.names = T,strip.levels = T,par.strip.text = list(cex = 1.7,font = 2),bg = 0,var.name = School), xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), main = Overlay of Profiles by Schools and Classes, ) On Tue, May 21, 2013 at 8:21 PM, David Winsemius dwinsem...@comcast.netwrote: On May 21, 2013, at 5:07 PM, Santosh wrote: Dear Rxperts, Ok The curly braces as we talked before,... They appear if the group argument of xyplot function is entered as a numeric value; and don't when the values are letters. At the moment you are offering an example where the group argument is neither numeric, nor character, but rather is a factor-classed variable. I cannot make any curley items appear if I change the argument to numeric. On my machine (a Mac running R 3.0.0 RC) there are no curley braces ... on the strips (or anywhere else.) I do not know what you mean by keep only side 1 and 2 of the borders. It is possible that you want to avoid alternating tick labels and need to find the switch to suppress ticks labels on the upper and right sides of the plotting borders. Try: ?xyplot # scales section scales=list(alternating=c(1,1,1) ), # 1 choice repeated for the number of columns -- David. I just figured how to hide the strip borders...and also control the ticks in different axes... Any suggestions to remove the *curly braces* are highly welcome. q - data.frame(G = rep(paste(G,1:3,sep = ),each = 50), D = rep(paste(D,1:5,sep = ),each = 30), a = rep(1:15,each = 10), t = rep(seq(10),15), b = round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep = :) q$grp - ordered(q$grp, levels = unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x, D1 = orange, D2 = blue, D3 = red, D4 = seagreen, D5 = black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) my.theme = list(strip.border = list(col = NA), strip.background = list(col = NA)) # Of course, I can add a series of $.. I don't have too many $s! xyplot(b ~ t | G,data = q2,groups = grp,type = l,as.table = T, layout = c(3,1), par.strip.text = list(lines = 2), panel = panel.superpose, par.settings = my.theme, panel.groups = function(x = x, y = y, subscripts = subscripts, groups = groups,..., group.number) { require(grid) panel.xyplot(x = x,y = y, subscripts = subscripts,pch = NA,lwd = 1,type = l, col = q2$dcol[subscripts],lty = 1,cex = 0.7) rv0- ref3[ref3$G%in%unique(q2$G)[panel.number()],] tids - paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty - 1 draw.key(list(columns = 1,between = 1,between.col = 0.5, text = list(lab = tids,col = tcols,cex = 0.8),title = Classes,cex.title = 1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip = strip.custom(strip.names = T,strip.levels = T,par.strip.text = list(cex = 1.7,font = 2),bg = 0,var.name = School), xlab = deparse(substitute(x)), ylab = deparse(substitute(y
Re: [R] Create and read symbolic links in Windows
Thanks for the suggestions. In windows (Windows 7, 64-bit), I couldn't get file.symlink to work, but file.link did return the result to be TRUE but at the target location, I did not see any link. Not sure I am missing anything more.. Hope it's nothing to do with administrator accounts and administrator rights... Is it something I should check with my system administrator? Thanks, Santosh On Thu, May 2, 2013 at 12:22 PM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 02/05/2013 19:50, Santosh wrote: Dear Rxperts.. Got a couple of quick q's.. I am using R in windows environment (both 32-bit and 64-bit) a) Is there a way to create symbolic links to some data files? See ?file.symlink. ??'symbolic link' should have got you there. Note that this is not very useful for files, but that is a Windows and not an R restriction. b) How do I read data from symbolic links? The same ways you read data from files. Thanks so much.. Santosh -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~**ripley/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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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] Create and read symbolic links in Windows
Thanks for your suggestion... I upgraded to R.3.0.0 in 64-bit Windows 7 environment.. This time when I use file.link.. I get the following error message: 'Cannot create a file when that file already exists And I don't see the link. The other function, file.copy, correctly copies to the target location. Still confuse with the error msges... Thanks, Santosh On Thu, May 2, 2013 at 11:42 PM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 03/05/2013 07:33, Santosh wrote: Thanks for the suggestions. In windows (Windows 7, 64-bit), I couldn't get file.symlink to work, but file.link did return the result to be TRUE but at the target location, I did not see any link. Not sure I am missing anything more.. Hope it's nothing to do with administrator accounts and administrator rights... Is it something I should check with my system administrator? You may need to update your R: although the posting guide asked you to do that before posting. There was a relevant bug fix in 2.15.3. Thanks, Santosh On Thu, May 2, 2013 at 12:22 PM, Prof Brian Ripley rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk** wrote: On 02/05/2013 19:50, Santosh wrote: Dear Rxperts.. Got a couple of quick q's.. I am using R in windows environment (both 32-bit and 64-bit) a) Is there a way to create symbolic links to some data files? See ?file.symlink. ??'symbolic link' should have got you there. Note that this is not very useful for files, but that is a Windows and not an R restriction. b) How do I read data from symbolic links? The same ways you read data from files. Thanks so much.. Santosh -- Brian D. Ripley, rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~__**ripley/http://www.stats.ox.ac.uk/~__ripley/ http://www.stats.ox.ac.uk/~**ripley/http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 tel:%2B44%201865%20272861 (self) 1 South Parks Road, +44 1865 272866 tel:%2B44%201865%20272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 tel:%2B44%201865%20272595 __**__ R-help@r-project.org mailto:R-help@r-project.org mailing list https://stat.ethz.ch/mailman/_**_listinfo/r-helphttps://stat.ethz.ch/mailman/__listinfo/r-help https://stat.ethz.ch/mailman/**listinfo/r-helphttps://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 http://www.R-project.org/**posting-guide.htmlhttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~**ripley/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 [[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] Create and read symbolic links in Windows
Just got it right please ignore the previous posting... It worked! Prof Ripley made my day!! :) THANK YOU! On Fri, May 3, 2013 at 11:23 AM, Santosh santosh2...@gmail.com wrote: Thanks for your suggestion... I upgraded to R.3.0.0 in 64-bit Windows 7 environment.. This time when I use file.link.. I get the following error message: 'Cannot create a file when that file already exists And I don't see the link. The other function, file.copy, correctly copies to the target location. Still confuse with the error msges... Thanks, Santosh On Thu, May 2, 2013 at 11:42 PM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 03/05/2013 07:33, Santosh wrote: Thanks for the suggestions. In windows (Windows 7, 64-bit), I couldn't get file.symlink to work, but file.link did return the result to be TRUE but at the target location, I did not see any link. Not sure I am missing anything more.. Hope it's nothing to do with administrator accounts and administrator rights... Is it something I should check with my system administrator? You may need to update your R: although the posting guide asked you to do that before posting. There was a relevant bug fix in 2.15.3. Thanks, Santosh On Thu, May 2, 2013 at 12:22 PM, Prof Brian Ripley rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk** wrote: On 02/05/2013 19:50, Santosh wrote: Dear Rxperts.. Got a couple of quick q's.. I am using R in windows environment (both 32-bit and 64-bit) a) Is there a way to create symbolic links to some data files? See ?file.symlink. ??'symbolic link' should have got you there. Note that this is not very useful for files, but that is a Windows and not an R restriction. b) How do I read data from symbolic links? The same ways you read data from files. Thanks so much.. Santosh -- Brian D. Ripley, rip...@stats.ox.ac.uk mailto:rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~__**ripley/http://www.stats.ox.ac.uk/~__ripley/ http://www.stats.ox.ac.uk/~**ripley/http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 tel:%2B44%201865%20272861 (self) 1 South Parks Road, +44 1865 272866 tel:%2B44%201865%20272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 tel:%2B44%201865%20272595 __**__ R-help@r-project.org mailto:R-help@r-project.org mailing list https://stat.ethz.ch/mailman/_**_listinfo/r-helphttps://stat.ethz.ch/mailman/__listinfo/r-help https://stat.ethz.ch/mailman/**listinfo/r-helphttps://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 http://www.R-project.org/**posting-guide.htmlhttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~**ripley/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 [[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 xyplot multipanels
Thanks for all tips/suggestions.. Just a few more comments.. The same code I use with a different data set in another project does not create those curly braces! Regards, Santosh On Wed, May 1, 2013 at 8:16 PM, Santosh santosh2...@gmail.com wrote: Sorry about the word brackets.. Yes, I meant curly braces! I have not heard of curley braces! :). Curly braces surrounding the values of strip.levels appear on the strip of multipanel plots. Thanks, Santosh On Wed, May 1, 2013 at 7:44 PM, David Winsemius dwinsem...@comcast.netwrote: On May 1, 2013, at 6:16 PM, Santosh wrote: Dear Rxperts, I have a strange situation.. I see curly brackets Wait right here. What do you mean by brackets? In some locales, such as mine, that might mean [ ; in other domains... well, who knows? I don't see any [. The Urban Legends Newsgroup used to have a saying: TWIAVBP, which is an initialism for: The World Is A Very Big Place. Pleas realize that language is local. around strip.levels in multipanel strips while using lattice::xyplot. .How do I get rid of the curly brackets? Curly brackets? You mean curley braces? I see some of them in the code, but why in the world would one want to remove valid curley-braces in code? They just function as delimiters. For some reason, I am not able to reproduce the problem using an example below... What problem? .. are you unable to reproduce? The code runs without error on my machine. Any suggestions are highly welcome! Thanks, Santosh q - data.frame(G=rep(paste(G,1:3,sep=),each=50),D=rep(paste(D,1:5,sep=),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep=:) q$grp - ordered(q$grp, levels=unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x,D1=orange,D2=blue,D3=red, D4=seagreen, D5=black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) xyplot(b~t|G,data=q2,groups=grp,type=l,as.table=T, layout=c(3,1), par.strip.text = list(lines = 2), panel=panel.superpose, panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number) { require(grid) panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type=l, col=q2$dcol[subscripts],lty=1,cex=0.7) rv0 -ref3[ref3$G%in%unique(q2$G)[panel.number()],] tids- paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty- 1 draw.key(list(columns=1,between=1,between.col=0.5, text=list(lab=tids,col=tcols,cex=0.8),title=Classes,cex.title=1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0, var.name=School), xlab=deparse(substitute(x)), ylab=deparse(substitute(y)), main=Overlay of Profiles by Schools and Classes, ) [[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] Create and read symbolic links in Windows
Dear Rxperts.. Got a couple of quick q's.. I am using R in windows environment (both 32-bit and 64-bit) a) Is there a way to create symbolic links to some data files? b) How do I read data from symbolic links? Thanks so much.. Santosh [[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] Lattice xyplot multipanels
Derar Rxperts, I have a strange situation.. I see curly brackets around strip.levels in multipanel strips while using lattice::xyplot. .How do I get rid of the curly brackets? For some reason, I am not able to reproduce the problem using an example below... Any suggestions are highly welcome! Thanks, Santosh q - data.frame(G=rep(paste(G,1:3,sep=),each=50),D=rep(paste(D,1:5,sep=),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep=:) q$grp - ordered(q$grp, levels=unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x,D1=orange,D2=blue,D3=red, D4=seagreen, D5=black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) xyplot(b~t|G,data=q2,groups=grp,type=l,as.table=T, layout=c(3,1), par.strip.text = list(lines = 2), panel=panel.superpose, panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number) { require(grid) panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type=l, col=q2$dcol[subscripts],lty=1,cex=0.7) rv0 -ref3[ref3$G%in%unique(q2$G)[panel.number()],] tids- paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty- 1 draw.key(list(columns=1,between=1,between.col=0.5, text=list(lab=tids,col=tcols,cex=0.8),title=Classes,cex.title=1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0, var.name=School), xlab=deparse(substitute(x)), ylab=deparse(substitute(y)), main=Overlay of Profiles by Schools and Classes, ) [[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 xyplot multipanels
Sorry about the word brackets.. Yes, I meant curly braces! I have not heard of curley braces! :). Curly braces surrounding the values of strip.levels appear on the strip of multipanel plots. Thanks, Santosh On Wed, May 1, 2013 at 7:44 PM, David Winsemius dwinsem...@comcast.netwrote: On May 1, 2013, at 6:16 PM, Santosh wrote: Dear Rxperts, I have a strange situation.. I see curly brackets Wait right here. What do you mean by brackets? In some locales, such as mine, that might mean [ ; in other domains... well, who knows? I don't see any [. The Urban Legends Newsgroup used to have a saying: TWIAVBP, which is an initialism for: The World Is A Very Big Place. Pleas realize that language is local. around strip.levels in multipanel strips while using lattice::xyplot. .How do I get rid of the curly brackets? Curly brackets? You mean curley braces? I see some of them in the code, but why in the world would one want to remove valid curley-braces in code? They just function as delimiters. For some reason, I am not able to reproduce the problem using an example below... What problem? .. are you unable to reproduce? The code runs without error on my machine. Any suggestions are highly welcome! Thanks, Santosh q - data.frame(G=rep(paste(G,1:3,sep=),each=50),D=rep(paste(D,1:5,sep=),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep=:) q$grp - ordered(q$grp, levels=unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x,D1=orange,D2=blue,D3=red, D4=seagreen, D5=black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) xyplot(b~t|G,data=q2,groups=grp,type=l,as.table=T, layout=c(3,1), par.strip.text = list(lines = 2), panel=panel.superpose, panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number) { require(grid) panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type=l, col=q2$dcol[subscripts],lty=1,cex=0.7) rv0 -ref3[ref3$G%in%unique(q2$G)[panel.number()],] tids- paste(as.character(unique(rv0$D))) tcols - unique(rv0$dcol) tlty- 1 draw.key(list(columns=1,between=1,between.col=0.5, text=list(lab=tids,col=tcols,cex=0.8),title=Classes,cex.title=1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0, var.name=School), xlab=deparse(substitute(x)), ylab=deparse(substitute(y)), main=Overlay of Profiles by Schools and Classes, ) [[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] Grouped spaghetti plots in multipanel graphs
Dear Rxperts, Is there a simpler way to generate multipanel grouped individual profile plots? All individuals of a group within a panel have the same color. As of now I am using lattice::xyplot to get the desired effect. Please feel free to suggest other ideas. Also, I am trying to create a generalized function which goes on similar lines like this.. grpPlot - function(dat, mpgrp=quote(G), grp=quote(interaction(D,a,drop=T)) { lines for xyplot as shown below... } Below is the sample code... for illustration purposes... q - data.frame(G=rep(paste(G,1:3,sep=),each=50),D=rep(paste(D,1:5,sep=),each=30),a=rep(1:15,each=10),t=rep(seq(10),15),b=round(runif(150,10,20))) q$grp - paste(q$D,q$a,sep=:) q$grp - ordered(q$grp, levels=unique(q$grp)) q$dcol - unlist(sapply(q$D,function(x) switch(x,D1=orange,D2=blue,D3=red, D4=seagreen, D5=black))) q2 - q[order(q$G,q$D,q$a,q$t),] ref3 - subset(q2, !duplicated(a)) xyplot(b~t|G,data=q2,groups=grp,type=l,as.table=T,par.settings=my.theme, layout=c(3,1), par.strip.text = list(lines = 2), scales=list(x=list(rot=90,rela='free',cex=1.3), y=list(log=F,at=10**c(0:7),labels=10**c(0:7))), panel=panel.superpose, panel.groups=function(x=x,y=y,subscripts=subscripts,groups=groups,...,group.number) { require(grid) panel.xyplot(x=x,y=y,subscripts=subscripts,pch=NA,lwd=1,type=l, col=q2$dcol[subscripts],lty=1,cex=0.7) rv0 -ref3[ref3$G%in%unique(q2$G)[panel.number()],] tids- paste(as.character(unique(rv0$D)))# as.character(rv0$NMID) tcols - unique(rv0$dcol) tlty- 1 draw.key(list(columns=1,between=1,between.col=0.5, lines=list(lty=tlty,col=tcols,size=3),text=list(lab=tids,col=tcols,cex=0.8),title=Classes,cex.title=1.1 ), draw = T,vp = viewport(x = unit(0.8, npc), y = unit(0.9, npc))) }, strip=strip.custom(strip.names=T,strip.levels=T,par.strip.text=list(cex=1.7,font=2),bg=0, var.name=School), xlab=deparse(substitute(x)), ylab=deparse(substitute(y)), main=Overlay of Profiles by Schools and Classes, ) Thanks so much.. Regards, Santosh [[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] RStudio.. text editor
Dear Rxperts/RStudio users, Is there a way to set tabs (the TAB key) in the text editor of RStudio, similar to the way customization can be done in Tinn-R? Thanks and regards, Santosh [[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] RStudio.. text editor
Great Thanks so much! On Thu, Apr 25, 2013 at 12:30 PM, John Kane jrkrid...@inbox.com wrote: I have not use tinn-r in a while but Tools Options Code Editing perhaps? John Kane Kingston ON Canada -Original Message- From: santosh2...@gmail.com Sent: Thu, 25 Apr 2013 12:04:17 -0700 To: r-help@r-project.org Subject: [R] RStudio.. text editor Dear Rxperts/RStudio users, Is there a way to set tabs (the TAB key) in the text editor of RStudio, similar to the way customization can be done in Tinn-R? Thanks and regards, Santosh [[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. FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! Check it out at http://www.inbox.com/earth [[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] Tables package - remove NAs and NaN
Dear Rxperts, Sorry if I am posting a really really dumb request.. I am new to subversion and am trying to use subversion to download the tables package as suggested by Duncan. I installed subversion client(from collabnet) and tried to access tables package using the command below. svn checkout svn://scm.r-forge.r-project.org/svnroot/tables/ I get the following error message: C:\Users\santosh\tempsvn checkout svn:// scm.r-forge.r-project.org/svnroot/tables/ svn: E730060: Unable to connect to a repository at URL 'svn://scm.r-forge.r-proj ect.org/svnroot/tables' svn: E730060: Can't connect to host 'scm.r-forge.r-project.org': A connection at tempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Is there anything additional I need to do with Subversion or with the commands? Regards, Santosh On Tue, Apr 23, 2013 at 5:13 AM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 13-04-23 6:31 AM, Duncan Murdoch wrote: On 13-04-22 10:40 PM, David Winsemius wrote: On Apr 22, 2013, at 5:49 PM, Santosh wrote: Dear Rxperts, q - data.frame(p=rep(c(A,B),**each=10,len=30), a=rep(c(1,2,3),each=10),id=**seq(30), b=round(runif(30,10,20)), c=round(runif(30,40,70))) The operation below... tabular(((p=factor(p))*(a=**factor(a))+1) ~ (N = 1) + (b + c)* (mean+sd),data=q) yields some rows of NAs and NaN as shown below b c p a N mean sdmean sd A 1 10 16.30 2.497 52.30 9.358 20 NaNNA NaN NA 3 10 15.60 2.716 60.30 8.001 B 10 NaNNA NaN NA 2 10 15.40 2.366 57.70 10.414 30 NaNNA NaN NA All 30 15.77 2.473 56.77 9.601 How do I remove the rows having N=0 ? I would like the resulting table look like.. b c p a N mean sdmean sd A 1 10 16.30 2.497 52.30 9.358 3 10 15.60 2.716 60.30 8.001 B 2 10 15.40 2.366 57.70 10.414 All 30 15.77 2.473 56.77 9.601 Here's a bit of a hack: tabular( (`p a`=interaction(p,a, drop=TRUE, sep= )) ~ (N = 1) + (b + c)* (mean+sd),data=q) b c p a N mean sd mean sd A 1 10 12.8 0.7888 52.1 8.020 B 2 10 16.3 3.0569 54.9 8.711 A 3 10 14.6 3.7771 56.5 6.980 I have been rather hoping that Duncan Murdoch would have noticed the earlier thread, but maybe he can comment on whether there is a more direct route/ This isn't something that the package is designed to handle: if you say p*a, it wants all combinations of p and a. If I wanted a table like that, I'd use a different hack. One possibility is to create that interaction column, but display it as just the initial letter, labelled p, and then add another column to contain the a values as data. It would be tricky to get the formatting right. Another possibility is to generate the whole table with the N=0 rows, and then post-process it to remove those rows, and adjust the row labels appropriately. This approach probably gives the nicer result, but the post-processing is quite messy: you need to delete some rows from the table, from its rowLabels attribute, and from the justification attributes of both the table and its rowLabels. (I should add a [ method to the package to hide this messiness.) I've done this now, in version 0.7.54 on R-forge. To leave out the rows with N=0, you can select a subset of the table where N (the first column) is non-zero: tab - tabular(((p=factor(p))*(a=**factor(a))+1) ~ (N = 1) + (b + c)*(mean+sd),data=q) tab[ tab[,1] 0, ] and it produces this: b c p a N mean sdmean sd A 1 10 16.20 3.458 56.3 10.155 3 10 13.60 2.119 58.1 8.075 B 2 10 14.40 2.547 51.2 9.438 All 30 14.73 2.888 55.2 9.419 Indexing of tables isn't as general as indexing of matrices, but most of the simple forms should work. I haven't tested yet, but I expect this will be fine in LaTeX or HTML (also new, not on CRAN yet) output as well. Duncan Murdoch [[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] Tables package - remove NAs and NaN
yes, With Duncan's and Liviu's help, I was able to remove those NAs and NaNs from the tabular summary. svn .. thing has not worked for me yet.. would try this later.. Thanks so much! Regards, Santosh On Wed, Apr 24, 2013 at 1:46 PM, Santosh santosh2...@gmail.com wrote: Thanks so much.. I will try it out. Regards, Santosh On Wed, Apr 24, 2013 at 1:39 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 13-04-24 4:29 PM, Santosh wrote: Dear Duncan, Thanks for your email. For some reason svn does not seem to work on my machine.. not sure if it is due to firewall or due to my company's IS environment settings. I could, however, install the package after pointing the repos to r-forge site as you had suggested. But, yes, the versions installed were 0.7.47 and 0.7.51 and therefore is not the latest one. Could you, please, be able to send it to me as a zipped attachment that I can use in both 32-bit and 64-bit Windows? You can download it from http://www.stats.uwo.ca/**faculty/murdoch/temp/tables_0.**7.57.tar.gzhttp://www.stats.uwo.ca/faculty/murdoch/temp/tables_0.7.57.tar.gz for the source, or http://www.stats.uwo.ca/**faculty/murdoch/temp/tables_0.**7.57.ziphttp://www.stats.uwo.ca/faculty/murdoch/temp/tables_0.7.57.zip for the binary install. I think the latter should work in both 32 and 64 bit Windows, but I haven't tested it. Duncan Murdoch Thanks so much, Santosh On Wed, Apr 24, 2013 at 1:02 PM, Duncan Murdoch murdoch.dun...@gmail.com**wrote: On 13-04-24 3:23 PM, Santosh wrote: Dear Rxperts, Sorry if I am posting a really really dumb request.. I am new to subversion and am trying to use subversion to download the tables package as suggested by Duncan. I installed subversion client(from collabnet) and tried to access tables package using the command below. svn checkout svn://scm.r-forge.r-project.org/svnroot/tables/ http://**scm.r-forge.r-project.org/**svnroot/tables/http://scm.r-forge.r-project.org/svnroot/tables/ I get the following error message: C:\Users\santosh\tempsvn checkout svn:// scm.r-forge.r-project.org/svnroot/tables/http://scm.r-forge.r-project.org/**svnroot/tables/ http://scm.r-**forge.r-project.org/svnroot/**tables/http://scm.r-forge.r-project.org/svnroot/tables/ svn: E730060: Unable to connect to a repository at URL 'svn://scm.r-forge.r-proj ect.org/svnroot/tables' svn: E730060: Can't connect to host 'scm.r-forge.r-project.org': A connection at tempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Is there anything additional I need to do with Subversion or with the commands? The spacing looks funny there: You should have no blanks in the path. Maybe you didn't, it's only the email. In that case, R-forge is probably just responding very slowly. You could try this path instead: svn checkout svn://scm.r-forge.r-project. org/svnroot/tables/pkg/tables**http://scm.r-forge.r-project.** org/svnroot/tables/pkg/tableshttp://scm.r-forge.r-project.org/svnroot/tables/pkg/tables This is the subdirectory that contains everything in the package. And you should be able to install the package directly from R-forge by setting your repository to http://R-forge.r-project.org, but it is very slow on updates, so it hasn't got to the current version yet. Duncan Murdoch Regards, Santosh On Tue, Apr 23, 2013 at 5:13 AM, Duncan Murdoch murdoch.dun...@gmail.com **wrote: On 13-04-23 6:31 AM, Duncan Murdoch wrote: On 13-04-22 10:40 PM, David Winsemius wrote: On Apr 22, 2013, at 5:49 PM, Santosh wrote: Dear Rxperts, q - data.frame(p=rep(c(A,B),**each=10,len=30), a=rep(c(1,2,3),each=10),id=**seq(30), b=round(runif(30,10,20)), c=round(runif(30,40,70))) The operation below... tabular(((p=factor(p))*(a=**factor(a))+1) ~ (N = 1) + (b + c)* (mean+sd),data=q) yields some rows of NAs and NaN as shown below b c p a N mean sdmean sd A 1 10 16.30 2.497 52.30 9.358 20 NaNNA NaN NA 3 10 15.60 2.716 60.30 8.001 B 10 NaNNA NaN NA 2 10 15.40 2.366 57.70 10.414 30 NaNNA NaN NA All 30 15.77 2.473 56.77 9.601 How do I remove the rows having N=0 ? I would like the resulting table look like.. b c p a N mean sdmean sd A 1 10 16.30 2.497 52.30 9.358 3 10 15.60 2.716 60.30 8.001 B 2 10 15.40 2.366 57.70 10.414 All 30 15.77 2.473 56.77 9.601 Here's a bit of a hack: tabular( (`p a`=interaction(p,a, drop=TRUE, sep= )) ~ (N = 1) + (b + c)* (mean+sd),data=q) b c p a N mean sd mean sd A 1 10 12.8 0.7888 52.1 8.020 B 2 10 16.3 3.0569 54.9 8.711 A 3 10 14.6 3.7771 56.5 6.980 I
[R] Hmisc pdflatex
Dear Rxperts, Apologize for posting it to a wrong thread..Hence, the re-post... I am trying to use pdflatex from Hmisc, I get the error message. pdflatex is not available... The version of Hmisc is the latest one (got the warning that it was compiled under R version 2.15.3) . The version of R on my machine is version platform i386-w64-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 15.2 year 2012 month 10 day26 svn rev61015 language R version.string R version 2.15.2 (2012-10-26) nickname Trick or Treat Is it not available anymore? I created a latex file using tables package and am unable to create the pdf file using pdflatex ... I am also not able to use Sweave with the above version of R as it is not available. I also tried texi2dvi (from tools); and it says latex is not available. But, I was earlier able to use latex with tabular to generate a tex file. I am confused with such conflicting messages. Also.. when I tried to use latex again, latex(summ2,title=outfile,file=a1.tex) # summ2 is a tabular output using tables package 'latex' is not recognized as an internal or external command, operable program or batch file. Error in system(cmd, intern = TRUE, wait = TRUE) : 'yap' not found In addition: Warning messages: 1: running command 'C:\Windows\system32\cmd.exe /c cd C:\Users\santosh\AppData\Local\Temp\RtmpsZ3tP9 latex -interaction=scrollmode C:\Users\santosh\AppData\Local\Temp\RtmpsZ3tP9\file13207cb8d2c' had status 1 2: In shell(cmd, wait = TRUE, intern = output) : 'cd C:\Users\santosh\AppData\Local\Temp\RtmpsZ3tP9 latex -interaction=scrollmode C:\Users\santosh\AppData\Local\Temp\RtmpsZ3tP9\file13207cb8d2c' execution failed with error code 1 Any suggestions welcome! Thanks, Santosh [[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] Hmisc pdflatex
Dear expeRts! Thanks for suggestions about getting MiKTeX... I have that installed.. The Sys.getenv(PATH) also reflects the path of pdflatex.. I noticed that the function creates .dvi, .aux files in the current working directory but looks for these files in Sys.getenv(TEMP) folder. Is there away to make latex point to the correct folder? I have similar problems with other functions like texi2dvi. owd - getwd() setwd(../Tables) latex(a1,output=test,file=t1.tex,here=T) This is pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9 64-bit) entering extended mode (C:/Users/santosh/AppData/Local/Temp/RtmpeA78Zj/filefac46aa1ac3.tex LaTeX2e 2011/06/27 Babel v3.8m deleted textloaded. (C:\Program Files\Latex\tex\latex\base\report.cls Document Class: report 2007/10/19 v1.4h Standard LaTeX document class (C:\Program Files\Latex\tex\latex\base\size10.clo)) (C:\Program Files\Latex\tex\latex\geometry\geometry.sty (C:\Program Files\Latex\tex\latex\graphics\keyval.sty) (C:\Program Files\Latex\tex\generic\oberdiek\ifpdf.sty) (C:\Program Files\Latex\tex\generic\oberdiek\ifvtex.sty) (C:\Program Files\Latex\tex\generic\ifxetex\ifxetex.sty) (C:\Program Files\Latex\tex\latex\geometry\geometry.cfg)) No file filefac46aa1ac3.aux. *geometry* driver: auto-detecting *geometry* detected driver: dvips ! Undefined control sequence. l.5 \toprule ! Undefined control sequence. recently read \midrule l.8 \midrule ! Undefined control sequence. recently read \bottomrule l.24 \bottomrule [1] (.\filefac46aa1ac3.aux) ) (see the transcript file for additional information) Output written on filefac46aa1ac3.dvi (1 page, 1664 bytes). Transcript written on filefac46aa1ac3.log. Warning messages: 1: running command 'C:\Windows\system32\cmd.exe /c cd C:\Users\santosh\AppData\Local\Temp\RtmpeA78Zj latex -interaction=scrollmode C:\Users\santosh\AppData\Local\Temp\RtmpeA78Zj\filefac46aa1ac3' had status 1 2: In shell(cmd, wait = TRUE, intern = output) : 'cd C:\Users\santosh\AppData\Local\Temp\RtmpeA78Zj latex -interaction=scrollmode C:\Users\santosh\AppData\Local\Temp\RtmpeA78Zj\filefac46aa1ac3' execution failed with error code 1 On Mon, Apr 22, 2013 at 7:41 AM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 22/04/2013 10:34 AM, Santosh wrote: Dear Rxperts, Apologize for posting it to a wrong thread..Hence, the re-post... I am trying to use pdflatex from Hmisc, I get the error message. pdflatex is not available... The version of Hmisc is the latest one (got the warning that it was compiled under R version 2.15.3) . The version of R on my machine is version platform i386-w64-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 15.2 year 2012 month 10 day26 svn rev61015 language R version.string R version 2.15.2 (2012-10-26) nickname Trick or Treat Is it not available anymore? I created a latex file using tables package and am unable to create the pdf file using pdflatex ... I am also not able to use Sweave with the above version of R as it is not available. In this context, not available means not listed in your system PATH. Use Sys.getenv(PATH) to get your current PATH; it will be a list of directories. If none of those directories contain pdflatex.exe, then pdflatex is not available. Duncan Murdoch I also tried texi2dvi (from tools); and it says latex is not available. But, I was earlier able to use latex with tabular to generate a tex file. I am confused with such conflicting messages. Also.. when I tried to use latex again, latex(summ2,title=outfile,**file=a1.tex) # summ2 is a tabular output using tables package 'latex' is not recognized as an internal or external command, operable program or batch file. Error in system(cmd, intern = TRUE, wait = TRUE) : 'yap' not found In addition: Warning messages: 1: running command 'C:\Windows\system32\cmd.exe /c cd C:\Users\santosh\AppData\**Local\Temp\RtmpsZ3tP9 latex -interaction=scrollmode C:\Users\santosh\AppData\**Local\Temp\RtmpsZ3tP9\**file13207cb8d2c' had status 1 2: In shell(cmd, wait = TRUE, intern = output) : 'cd C:\Users\santosh\AppData\**Local\Temp\RtmpsZ3tP9 latex -interaction=scrollmode C:\Users\santosh\AppData\**Local\Temp\RtmpsZ3tP9\**file13207cb8d2c' execution failed with error code 1 Any suggestions welcome! Thanks, Santosh [[alternative HTML version deleted]] __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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
Re: [R] Hmisc pdflatex
Dear Rxperts.. The problem of latex looking for tex and dvi files in a TEMP folder still persists. As a work around, I changed the options.. options(latexcmd=pdflatex,dviExtension=pdf) After the above change, latex(,file=a1) seems to work but the resulting pdf file is something like...file13207cb8d2c.pdf. When this file was created, a1 tex tile, file13207cb8d2c.aux and file13207cb8d2c.log files were also created in the current working folder. I still get the error message: Windows API error 2: The system cannot find the file specified: Data: C:\Users\santosh\ApptData\Local\Temp\RtmpeGaNYGi\file192183g543.pdf.dvi Looking eagerly forward to your suggestions. Regards, Santosh On Mon, Apr 22, 2013 at 1:27 PM, Santosh santosh2...@gmail.com wrote: Dear expeRts! Thanks for suggestions about getting MiKTeX... I have that installed.. The Sys.getenv(PATH) also reflects the path of pdflatex.. I noticed that the function creates .dvi, .aux files in the current working directory but looks for these files in Sys.getenv(TEMP) folder. Is there away to make latex point to the correct folder? I have similar problems with other functions like texi2dvi. owd - getwd() setwd(../Tables) latex(a1,output=test,file=t1.tex,here=T) This is pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9 64-bit) entering extended mode (C:/Users/santosh/AppData/Local/Temp/RtmpeA78Zj/filefac46aa1ac3.tex LaTeX2e 2011/06/27 Babel v3.8m deleted textloaded. (C:\Program Files\Latex\tex\latex\base\report.cls Document Class: report 2007/10/19 v1.4h Standard LaTeX document class (C:\Program Files\Latex\tex\latex\base\size10.clo)) (C:\Program Files\Latex\tex\latex\geometry\geometry.sty (C:\Program Files\Latex\tex\latex\graphics\keyval.sty) (C:\Program Files\Latex\tex\generic\oberdiek\ifpdf.sty) (C:\Program Files\Latex\tex\generic\oberdiek\ifvtex.sty) (C:\Program Files\Latex\tex\generic\ifxetex\ifxetex.sty) (C:\Program Files\Latex\tex\latex\geometry\geometry.cfg)) No file filefac46aa1ac3.aux. *geometry* driver: auto-detecting *geometry* detected driver: dvips ! Undefined control sequence. l.5 \toprule ! Undefined control sequence. recently read \midrule l.8 \midrule ! Undefined control sequence. recently read \bottomrule l.24 \bottomrule [1] (.\filefac46aa1ac3.aux) ) (see the transcript file for additional information) Output written on filefac46aa1ac3.dvi (1 page, 1664 bytes). Transcript written on filefac46aa1ac3.log. Warning messages: 1: running command 'C:\Windows\system32\cmd.exe /c cd C:\Users\santosh\AppData\Local\Temp\RtmpeA78Zj latex -interaction=scrollmode C:\Users\santosh\AppData\Local\Temp\RtmpeA78Zj\filefac46aa1ac3' had status 1 2: In shell(cmd, wait = TRUE, intern = output) : 'cd C:\Users\santosh\AppData\Local\Temp\RtmpeA78Zj latex -interaction=scrollmode C:\Users\santosh\AppData\Local\Temp\RtmpeA78Zj\filefac46aa1ac3' execution failed with error code 1 On Mon, Apr 22, 2013 at 7:41 AM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 22/04/2013 10:34 AM, Santosh wrote: Dear Rxperts, Apologize for posting it to a wrong thread..Hence, the re-post... I am trying to use pdflatex from Hmisc, I get the error message. pdflatex is not available... The version of Hmisc is the latest one (got the warning that it was compiled under R version 2.15.3) . The version of R on my machine is version platform i386-w64-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 15.2 year 2012 month 10 day26 svn rev61015 language R version.string R version 2.15.2 (2012-10-26) nickname Trick or Treat Is it not available anymore? I created a latex file using tables package and am unable to create the pdf file using pdflatex ... I am also not able to use Sweave with the above version of R as it is not available. In this context, not available means not listed in your system PATH. Use Sys.getenv(PATH) to get your current PATH; it will be a list of directories. If none of those directories contain pdflatex.exe, then pdflatex is not available. Duncan Murdoch I also tried texi2dvi (from tools); and it says latex is not available. But, I was earlier able to use latex with tabular to generate a tex file. I am confused with such conflicting messages. Also.. when I tried to use latex again, latex(summ2,title=outfile,**file=a1.tex) # summ2 is a tabular output using tables package 'latex' is not recognized as an internal or external command, operable program or batch file. Error in system(cmd, intern = TRUE, wait = TRUE) : 'yap' not found In addition: Warning messages: 1: running command 'C:\Windows\system32\cmd.exe /c cd C:\Users\santosh\AppData\**Local\Temp\RtmpsZ3tP9 latex -interaction=scrollmode C:\Users\santosh\AppData\**Local\Temp\RtmpsZ3tP9\**file13207cb8d2c' had status 1 2: In shell(cmd, wait
[R] Tables package - remove NAs and NaN
Dear Rxperts, q - data.frame(p=rep(c(A,B),each=10,len=30), a=rep(c(1,2,3),each=10),id=seq(30), b=round(runif(30,10,20)), c=round(runif(30,40,70))) The operation below... tabular(((p=factor(p))*(a=factor(a))+1) ~ (N = 1) + (b + c)* (mean+sd),data=q) yields some rows of NAs and NaN as shown below b c p a N mean sdmean sd A 1 10 16.30 2.497 52.30 9.358 20 NaNNA NaN NA 3 10 15.60 2.716 60.30 8.001 B 10 NaNNA NaN NA 2 10 15.40 2.366 57.70 10.414 30 NaNNA NaN NA All 30 15.77 2.473 56.77 9.601 How do I remove the rows having N=0 ? I would like the resulting table look like.. b c p a N mean sdmean sd A 1 10 16.30 2.497 52.30 9.358 3 10 15.60 2.716 60.30 8.001 B 2 10 15.40 2.366 57.70 10.414 All 30 15.77 2.473 56.77 9.601 Thanks so much, Santosh [[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] creating dummy variables
R is for dummies (like me, but I don't use dummy variables) or for the non-Dummies like all experts who help us all the time@@.. so dummy variables are not needed! :) QED... On Sat, Apr 20, 2013 at 6:16 PM, Rolf Turner rolf.tur...@xtra.co.nz wrote: On 21/04/13 10:56, Eva Prieto Castro wrote: Hi, Why do you write that dummy variables are not needed in R?. I would like you explain it. As others have said --- do some self-study. But a brief answer is that in any reasonable modelling problem in which dummy variables might arise, R creates the dummy variables that it uses automagically , behind the scenes, from the *factors* whose levels correspond to the dummy variables. Summary: Learn about and understand *factors*; forget about dummy variables. cheers, Rolf Turner __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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] NAMESPACE and imports
Dear Rxperts, I am trying to use pdflatex from Hmisc, I get the error message. pdflatex is not available... The version of R is version platform i386-w64-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 15.2 year 2012 month 10 day26 svn rev61015 language R version.string R version 2.15.2 (2012-10-26) nickname Trick or Treat Is it not available anymore? I created a latex file using tables package and am unable to create the pdf file ... Any suggestions welcome! Thanks, Santosh On Fri, Apr 19, 2013 at 11:30 AM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 19/04/2013 19:16, Frank Harrell wrote: Now I see it. S3method() wants two arguments so I need to create multiple S3method() statements for each generic. Sort of. It actually accepts two or three arguments: see package 'tools' for an example of using three. Frank Frank Harrell wrote Right, I should have said import(Hmisc) instead of importFrom(Hmisc), but that does not explain the error message. Blaser Nello wrote Not sure this fixes your problem, but as far as I can know (and can tell from the manual: http://cran.r-project.org/doc/**manuals/r-release/R-exts.pdfhttp://cran.r-project.org/doc/manuals/r-release/R-exts.pdf), importFrom needs to know what functions you are importing [e.g. importFrom(Hmisc, latex) importFrom(stats, anova)]. -Original Message- From: r-help-bounces@ [mailto: r-help-bounces@ ] On Behalf Of Frank Harrell Sent: Freitag, 19. April 2013 16:26 To: r-help@ Subject: [R] NAMESPACE and imports I am cleaning up the rms package to not export functions not to be called directly by users. rms uses generic functions defined in other packages. For example there is a latex method in the Hmisc package, and rms has a latex method for objects of class anova.rms so there are anova.rms and latex.anova.rms functions in rms. I use: export(asis,bj,bjplot,bootBCa,**bootcov,bootplot,bplot,** calibrate,cph,catg,**combineRelatedPredictors,** confplot,contrast,coxphFit,**cph,cr.setup,datadist,** effective.df,fastbw,formatNP,**gendata,gIndex,GiniMd,Glm,Gls,** groupkm,Hazard,hazard.ratio.**plot,histdensity,%ia%,ie.** setup,interactions.containing,**legend.nomabbrev,lm.pfit,lrm,** lrtest,lsp,matinv,matrx,**Newlabels,Newlevels,nomogram,** num.intercepts,ols,ols.**influence,oos.loglik,pantext,** Penalty.matrix,Penalty.setup,**pentrace,perimeter,perlcode,** plot.xmean.ordinaly,pol,pphsm,**predab.resample,Predict,psm,** rcs,related.predictors,**reVector,robcov,Rq,sascode,** scored,sensuc,setPb,show.**influence,specs,strat,Surv,[.** Surv,survdiffplot,survest,**Survival,survplot,univarLR,** validate,val.prob,val.probg,**val.surv,vif,which.influence) importFrom(Hmisc) S3method(anova, rms) S3method(latex, anova.rms, bj, cph, Glm, Gls, lrm, naprint.delete, ols, pphsm, psm, rms, Rq, summary.rms, validate) When doing R CMD INSTALL I get: [using R 2.15.3] ** preparing package for lazy loading Error : c(bad 'S3method' directive: S3method(latex, anova.rms, bj, cph, Glm, Gls, lrm, naprint.delete, , bad 'S3method' directive: ols, pphsm, psm, rms, Rq, summary.rms, validate)) ERROR: lazy loading failed for package rms Any advice appreciated. Frank - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/**NAMESPACE-and-imports-**tp4664718.htmlhttp://r.789695.n4.nabble.com/NAMESPACE-and-imports-tp4664718.html Sent from the R help mailing list archive at Nabble.com. __** R-help@ mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://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. __** R-help@ mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://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. - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/** NAMESPACE-and-imports-**tp4664718p4664744.htmlhttp://r.789695.n4.nabble.com/NAMESPACE-and-imports-tp4664718p4664744.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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting
[R] tables package - error message of duplicate values
Dear expeRts! when I try summarize data using tabular of tables package.. here is an example.. a - data.frame(a=rep(10,10),b=round(runif(10,10,20)),c=round(runif(10,40,50))) a a b c 1 10 14 44 2 10 17 40 3 10 13 40 4 10 18 40 5 10 11 49 6 10 16 46 7 10 15 43 8 10 19 49 9 10 19 49 10 10 13 45 tabular((a+1)~(n=1)+Format(dig=0)*(b + c) * (mean + sd),data=a) Error in term2table(rows[[i]], cols[[j]], data, n) : Duplicate values: a and b Is there a way to let the function accept the apparently duplicate values? Thanks, Santosh [[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] tables package - error message of duplicate values
Rounding was done to replicate the problem I faced in the original data set... 2 independent identifiers in a group (shown only for 1 of 7 groups) may have same value of b or c. On Fri, Apr 19, 2013 at 1:53 PM, David Winsemius dwinsem...@comcast.netwrote: On Apr 19, 2013, at 1:29 PM, Santosh wrote: Dear expeRts! when I try summarize data using tabular of tables package.. here is an example.. a - data.frame(a=rep(10,10),b=round(runif(10,10,20)),c=round(runif(10,40,50))) a a b c 1 10 14 44 2 10 17 40 3 10 13 40 4 10 18 40 5 10 11 49 6 10 16 46 7 10 15 43 8 10 19 49 9 10 19 49 10 10 13 45 tabular((a+1)~(n=1)+Format(dig=0)*(b + c) * (mean + sd),data=a) Error in term2table(rows[[i]], cols[[j]], data, n) : Duplicate values: a and b Is there a way to let the function accept the apparently duplicate values? I don't consider myself an expert, just one who reads the manuals and makes modest adjustments to the help-page examples. Perhaps if you explained what you thought the correct answer would be ( and can you please explain why you are setting digits=0? tabular( 1~Format(digits=2) *(b+c)* (mean + sd),data=a) #- b c mean sd mean sd All 14.9 3.0 44.3 2.9 #- # Putting a numeric variable on the LHS appears to fail but wrapping it in factor() allows success: a-data.frame(a=rep(c(1,2),10),b=round(runif(10,10,20)),c=round(runif(10,40,50))) tabular( (factor(a) +1)~Format(digits=2) *(b+c)* (mean + sd),data=a) #-- b c factor(a) mean sd mean sd 1 15.2 3.7 45.0 2.6 2 13.0 3.5 48.2 1.2 All 14.1 3.7 46.6 2.6 -- David Winsemius Alameda, CA, USA [[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] tables package - error message of duplicate values
Dear Rxperts! Thanks for the suggestions...(esp. Dr. Mathemedician)! :) I add one more factor level (a level higher to a) in the example.. a - data.frame(p=rep(c(A,B),each=10,len=30), a=rep(c(1,2,3),each=10),id=seq(30), b=round(runif(30,10,20)), c=round(runif(30,40,70))) tabular(((p=factor(p))*(a=factor(a))+1) ~ (N = 1) + (b + c)* (mean+sd),data=a) b c p a N mean sdmean sd A 1 10 16.30 2.497 52.30 9.358 20 NaNNA NaN NA 3 10 15.60 2.716 60.30 8.001 B 10 NaNNA NaN NA 2 10 15.40 2.366 57.70 10.414 30 NaNNA NaN NA All 30 15.77 2.473 56.77 9.601 How do I remove the lines which N=0 or the columns with NaN or NA? I could not make the subsetting I can't generate the above resulting table look like.. b c p a N mean sdmean sd A 1 10 16.30 2.497 52.30 9.358 3 10 15.60 2.716 60.30 8.001 B 2 10 15.40 2.366 57.70 10.414 All 30 15.77 2.473 56.77 9.601 Thanks so much, Santosh On Fri, Apr 19, 2013 at 3:15 PM, David Winsemius dwinsem...@comcast.netwrote: On Apr 19, 2013, at 2:03 PM, Santosh wrote: Rounding was done to replicate the problem I faced in the original data set... I got an error every time I tried to use digits=0. My basic rule is that if a parameter choice consistently errors out ... stop using it. I'm fundamentally a pragmatist. 2 independent identifiers in a group (shown only for 1 of 7 groups) may have same value of b or c. I don't understand what that means or why it should affect the ability of the program to deliver 'a'-level-specific estimates of the mean/sd values of 'b' 'c' in the environment of data.frame-'a'. I showed that the problem was in not using factor() on the LHS of the formula when the grouping variable is numeric. -- David. On Fri, Apr 19, 2013 at 1:53 PM, David Winsemius dwinsem...@comcast.net wrote: On Apr 19, 2013, at 1:29 PM, Santosh wrote: Dear expeRts! when I try summarize data using tabular of tables package.. here is an example.. a - data.frame(a=rep(10,10),b=round(runif(10,10,20)),c=round(runif(10,40,50))) a a b c 1 10 14 44 2 10 17 40 3 10 13 40 4 10 18 40 5 10 11 49 6 10 16 46 7 10 15 43 8 10 19 49 9 10 19 49 10 10 13 45 tabular((a+1)~(n=1)+Format(dig=0)*(b + c) * (mean + sd),data=a) Error in term2table(rows[[i]], cols[[j]], data, n) : Duplicate values: a and b Is there a way to let the function accept the apparently duplicate values? I don't consider myself an expert, just one who reads the manuals and makes modest adjustments to the help-page examples. Perhaps if you explained what you thought the correct answer would be ( and can you please explain why you are setting digits=0? tabular( 1~Format(digits=2) *(b+c)* (mean + sd),data=a) #- b c mean sd mean sd All 14.9 3.0 44.3 2.9 #- # Putting a numeric variable on the LHS appears to fail but wrapping it in factor() allows success: a-data.frame(a=rep(c(1,2),10),b=round(runif(10,10,20)),c=round(runif(10,40,50))) tabular( (factor(a) +1)~Format(digits=2) *(b+c)* (mean + sd),data=a) #-- b c factor(a) mean sd mean sd 1 15.2 3.7 45.0 2.6 2 13.0 3.5 48.2 1.2 All 14.1 3.7 46.6 2.6 -- David Winsemius Alameda, CA, USA David Winsemius Alameda, CA, USA [[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] suggestions about import SAS Transport files to R.
Dear Rxperts! My colleagues used SAS PROC COPY to generate the xpt files that could be read by the available xpt file reading packages in R. However, I am unable to use the R packages for reading SAS transport files generated through SAS PROC CPORT. I have tried SASxport, Hmisc, and foreign. Any ideas/suggestions are more than welcome! Thanks so much! Santosh [[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] Export R generated tables and figures to MS Word
Dear Rxperts.. Awesome responses! Thank you so much for your responses! I think I have a 50-course meal to gobble! If you get more ideas.. Please do continue to share. Santosh On Wed, Mar 13, 2013 at 10:13 AM, David L Carlson dcarl...@tamu.edu wrote: Package xtable will produce html output. If you save the file and then open it with Word, you will get serviceable results. I've had better luck copying the output from xtable and pasting it into Excel. Make necessary changes and then paste the table into Word. Obviously very tedious if you are making more than a few tables. There is also an R2wd package, but I haven't tried it. -- David L Carlson Associate Professor of Anthropology Texas AM University College Station, TX 77843-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of MacQueen, Don Sent: Wednesday, March 13, 2013 11:56 AM To: Santosh; r-help Subject: Re: [R] Export R generated tables and figures to MS Word There's the package rtf Rich Text Format (RTF) Output I've not tried it, but the name is suggestive. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 3/12/13 5:02 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts, I am aware of Sweave that generates reports into a pdf, but do know of any tools to generate to export to a MS Word document... Is there a way to use R to generate and export report/publication quality tables and figures and export them to MS word (for reporting purposes)? Thanks so much, Santosh [[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. [[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] Export R generated tables and figures to MS Word
Dear Rxperts, I am aware of Sweave that generates reports into a pdf, but do know of any tools to generate to export to a MS Word document... Is there a way to use R to generate and export report/publication quality tables and figures and export them to MS word (for reporting purposes)? Thanks so much, Santosh [[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] binning by frequency
Thanks for your response. Was wondering if there are any R functions/packages to perform optimal binning of continuous data. Thanks, again. Santosh. On Tue, Nov 27, 2012 at 9:09 AM, Mark Lamias mlam...@yahoo.com wrote: You might find the binning function in the sm package helpful here. --Mark Lamias -- *From:* Santosh santosh2...@gmail.com *To:* r-help r-help@r-project.org *Sent:* Tuesday, November 27, 2012 9:59 AM *Subject:* [R] binning by frequency Dear Rxperts, is there way to identify intervals from continuous data (having some kind of a pattern) and then pick the value of most frequency? a1 - round(rnorm(50,mean=0,0.1),2) a2 - round(rnorm(50,mean=1,0.2),1) a3 - round(rnorm(50,mean=5,1),0) a4 - round(rnorm(50,mean=14,4),0) a5 - round(rnorm(50,mean=30,8),0) b1 - rbind(a1,a2,a3,a4,a5) hist(b1,brea=100) # shows intervals and values with varying frequency. unlike the mean values of a1 a5 above, I don't know the nominal values. I would like an algorithm to identify intervals and pick the value with most frequency. I tried cut, split and was not successful. Any suggestions/tips are highly welcome. Thanks and regards, Santosh [[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.
[R] Package installation errors
Dear Rxperts.. I am trying to install a few packages in R (version 2.14.2) on a *64-bit Window 7* workstation. Some of the errors are posted below.. Both 32-bit and 64-bit versions of R were installed. I did not get errors while installing packages through *32-bit R*, except that it could not update some of the packages (already installed with 64-bit R) *A*) When I start *64-bit R (2.14.2)* Loading required package: tcltk Loading required package: R2HTML Error in structure(.External(dotTcl, ..., PACKAGE = tcltk), class = tclObj) : [tcl] invalid command name dde. In addition: Warning message: In tclRequire(dde, warn = TRUE) : Tcl package 'dde' not found options(repos='http://cran.stat.ucla.edu') install.packages(dde,dependencies=T) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package dde is not available (for R version 2.14.2) *B)* While installing rJava from *64-bit R (2.14.2)* install.packages(rJava,repos='http://cran.stat.ucla.edu') trying URL ' http://cran.stat.ucla.edu/bin/windows/contrib/2.14/rJava_0.9-3.zip' Content type 'application/zip' length 745867 bytes (728 Kb) opened URL downloaded 728 Kb package rJava successfully unpacked and MD5 sums checked The downloaded packages are in C:\Users\santosh\AppData\Local\Temp\RtmpsJ5HoF\downloaded_packages library(rJava) Error : .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: JAVA_HOME cannot be determined from the Registry Error: package/namespace load failed for rJava *B*) While installing XML *64-bit R (2.14.2)* install.packages(XML,repos='http://www.omegahat.org/R') Warning message: In getDependencies(pkgs, dependencies, available, lib) : package XML is not available (for R version 2.14.2) Using *64-bit R (2.14.2), *I could not install other packages like xlsx that depend on rJava. Installing the latest JRE has not seemed to help. Any suggestions/solutions are most welcome Thanks and regards, Santosh [[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] library XML in R version 2.15.1
Hello Rxperts.. I have a peculiar situation.. XML library is not available with R2.15.1 whereas I was able to install it with R version 2.13.1. Would highly appreciate your suggestions. I am now trying to see if XML works with previous versions of R. Thanks, Santosh [[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] library XML in R version 2.15.1
Thanks for your response. I tried R.2.15 also and just tried R.14.1 in 32-bit Windows Vista. Below is the error message I received. install.packages(XML) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package XML is not available (for R version 2.14.1) Santosh On Fri, Jul 20, 2012 at 8:16 PM, arun smartpink...@yahoo.com wrote: HI, I have XML library installed in R2.15 and is working fine. I used it only a few times, it was working. I am using Ubuntu 12.04. A.K. - Original Message - From: Santosh santosh2...@gmail.com To: r-help r-help@r-project.org Cc: Sent: Friday, July 20, 2012 11:03 PM Subject: [R] library XML in R version 2.15.1 Hello Rxperts.. I have a peculiar situation.. XML library is not available with R2.15.1 whereas I was able to install it with R version 2.13.1. Would highly appreciate your suggestions. I am now trying to see if XML works with previous versions of R. Thanks, Santosh [[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.
Re: [R] library XML in R version 2.15.1
Does not seem to be a good day for me! I am trying to install recent versions of R in Windows Vista. I got the earlier described errors in 2.14.1 and 2.15.1 I tried to install R2.15.1 I get this error now... --- Error --- C:\Program Files\R\R-2.15.0\Tcl\lib\tk8.5\msgs\es.msg An error occurred while trying to read the source file: The source file is corrupted. Click Retry to try again, Ignore to skip this file (not recommended), or Abort to cancel installation. --- Abort Retry Ignore --- santosh On Fri, Jul 20, 2012 at 8:39 PM, arun smartpink...@yahoo.com wrote: Hi, So, you got the same error message for R 2.14.1 and R 2.15? Or is it only for R 2.15? It is always good to install the current version. Try this: install.packages(XML,dependencies=TRUE) #Warning message suggests dependencies. A.K. - Original Message - From: Santosh santosh2...@gmail.com To: R help r-help@r-project.org Cc: Sent: Friday, July 20, 2012 11:24 PM Subject: Re: [R] library XML in R version 2.15.1 Thanks for your response. I tried R.2.15 also and just tried R.14.1 in 32-bit Windows Vista. Below is the error message I received. install.packages(XML) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package XML is not available (for R version 2.14.1) Santosh On Fri, Jul 20, 2012 at 8:16 PM, arun smartpink...@yahoo.com wrote: HI, I have XML library installed in R2.15 and is working fine. I used it only a few times, it was working. I am using Ubuntu 12.04. A.K. - Original Message - From: Santosh santosh2...@gmail.com To: r-help r-help@r-project.org Cc: Sent: Friday, July 20, 2012 11:03 PM Subject: [R] library XML in R version 2.15.1 Hello Rxperts.. I have a peculiar situation.. XML library is not available with R2.15.1 whereas I was able to install it with R version 2.13.1. Would highly appreciate your suggestions. I am now trying to see if XML works with previous versions of R. Thanks, Santosh [[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. [[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] library XML in R version 2.15.1
Thanks for your response! Yes, I uninstalled previous versions this time. Earlier I used to run multiple versions of R without problems. I was finally able to install XML in the Windows Vista R version 2.14.2. I have not been able to install in R 2.15.x versions. Santosh On Fri, Jul 20, 2012 at 9:23 PM, arun smartpink...@yahoo.com wrote: When you installed each version, I assume that you must have uninstalled the previous installations. It's Windows vista. One of the reasons I change from windows vista to a beta version of windows 7 a couple of years ago was due to installation troubles with SAS. So, it may be platform specific. You can uninstall all the R versions. Restart the system and then try fresh install. I am not sure whether it will help, but you can try. A.K. From: Santosh santosh2...@gmail.com To: arun smartpink...@yahoo.com Cc: R help r-help@r-project.org Sent: Saturday, July 21, 2012 12:08 AM Subject: Re: [R] library XML in R version 2.15.1 Does not seem to be a good day for me! I am trying to install recent versions of R in Windows Vista. I got the earlier described errors in 2.14.1 and 2.15.1 I tried to install R2.15.1 I get this error now... --- Error --- C:\Program Files\R\R-2.15.0\Tcl\lib\tk8.5\msgs\es.msg An error occurred while trying to read the source file: The source file is corrupted. Click Retry to try again, Ignore to skip this file (not recommended), or Abort to cancel installation. --- Abort Retry Ignore --- santosh On Fri, Jul 20, 2012 at 8:39 PM, arun smartpink...@yahoo.com wrote: Hi, So, you got the same error message for R 2.14.1 and R 2.15? Or is it only for R 2.15? It is always good to install the current version. Try this: install.packages(XML,dependencies=TRUE) #Warning message suggests dependencies. A.K. - Original Message - From: Santosh santosh2...@gmail.com To: R help r-help@r-project.org Cc: Sent: Friday, July 20, 2012 11:24 PM Subject: Re: [R] library XML in R version 2.15.1 Thanks for your response. I tried R.2.15 also and just tried R.14.1 in 32-bit Windows Vista. Below is the error message I received. install.packages(XML) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package XML is not available (for R version 2.14.1) Santosh On Fri, Jul 20, 2012 at 8:16 PM, arun smartpink...@yahoo.com wrote: HI, I have XML library installed in R2.15 and is working fine. I used it only a few times, it was working. I am using Ubuntu 12.04. A.K. - Original Message - From: Santosh santosh2...@gmail.com To: r-help r-help@r-project.org Cc: Sent: Friday, July 20, 2012 11:03 PM Subject: [R] library XML in R version 2.15.1 Hello Rxperts.. I have a peculiar situation.. XML library is not available with R2.15.1 whereas I was able to install it with R version 2.13.1. Would highly appreciate your suggestions. I am now trying to see if XML works with previous versions of R. Thanks, Santosh [[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. [[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] HLOOKUP in R
Try ?match Adapt it to your need On Saturday, July 14, 2012 12:55:33 AM UTC+5:30, Silje Nord wrote: Hi, Is there a function similar to excel's hlookup in R ? Thanks, Silje __ 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] Process XML files
Please ignore my previous request for clarification. I was able to resolve my problem using getNodeSet. Thanks, Santosh On Thu, Jun 14, 2012 at 10:54 AM, Santosh santosh2...@gmail.com wrote: Dear Rxperts, I am back to favoRite! I would need your favoR, please! Is there a way to use read format arguments for POSIXct or strptime from the xml file without specifying format=... in these functions? The format of data-time values are present in the xml file as shown below. Please see below am example section of XML code: ?xml version=1.0??mso-application progid=Excel.Sheet?Workbook xmlns=urn:schemas-microsoft-com:office:spreadsheet xmlns:o=urn:schemas-microsoft-com:office:office xmlns:x=urn:schemas-microsoft-com:office:excel xmlns:ss=urn:schemas-microsoft-com:office:spreadsheet xmlns:html= http://www.w3.org/TR/REC-html40;StylesStyle ss:ID=s11NumberFormat ss:Format=/mm/dd\ hh:mm;@//StyleStyle ss:ID=s21Font ss:Color=White ss:Bold=1/Interior ss:Color=Black ss:Pattern=Solid//StyleStyle ss:ID=s31BordersBorder ss:Position=Bottom ss:LineStyle=Double ss:Weight=3//Borders/StyleStyle ss:ID=s41Font ss:Size=20//StyleStyle ss:ID=s12NumberFormat ss:Format=hh:mm:ss.000//Style/StylesWorksheet ss:Name=StartTable ss:DefaultColumnWidth=80RowCellData ss:Type=StringID/Data/CellCellData ss:Type=String1/Data/Cell/RowRowCellData ss:Type=StringStart/Data/CellCell ss:StyleID=s11*Data ss:Type=DateTime2012-06-14T09:16:16.512/Data*/Cell/Row/Table /Worksheet/Workbook On Fri, Jun 8, 2012 at 8:08 AM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 06.06.2012 22:44, Santosh wrote: Hello experts, Sorry for posting the SPlus related question here.. I have not found any solution yet after some attempts and hence, sending it to a wider spectrum of users! I was successful in processing files uing R's XML librariy. Not that we know, we just know about an R *package* called XML. Thank you, Rxperts! I know there are libraries like XML and SPXML available in S-Plus. Could anyone please share examples of reading an xml file and save the contents in a data frame? Are there Splus equivalents of getNodeSet, xmlSApply and xmlValue? Most of us do not have S-PLUS available to check (actually, we do have a 13 year old copy S-PLUS 4.5 at our department). You do, obviously, hence why not check it yourself? And if you can't, why not ask the vendor of your statistics software? Best, Uwe Ligges Thanks so much! Santosh [[alternative HTML version deleted]] __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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] Process XML files
Dear Rxperts, I am back to favoRite! I would need your favoR, please! Is there a way to use read format arguments for POSIXct or strptime from the xml file without specifying format=... in these functions? The format of data-time values are present in the xml file as shown below. Please see below am example section of XML code: ?xml version=1.0??mso-application progid=Excel.Sheet?Workbook xmlns=urn:schemas-microsoft-com:office:spreadsheet xmlns:o=urn:schemas-microsoft-com:office:office xmlns:x=urn:schemas-microsoft-com:office:excel xmlns:ss=urn:schemas-microsoft-com:office:spreadsheet xmlns:html= http://www.w3.org/TR/REC-html40;StylesStyle ss:ID=s11NumberFormat ss:Format=/mm/dd\ hh:mm;@//StyleStyle ss:ID=s21Font ss:Color=White ss:Bold=1/Interior ss:Color=Black ss:Pattern=Solid//StyleStyle ss:ID=s31BordersBorder ss:Position=Bottom ss:LineStyle=Double ss:Weight=3//Borders/StyleStyle ss:ID=s41Font ss:Size=20//StyleStyle ss:ID=s12NumberFormat ss:Format=hh:mm:ss.000//Style/StylesWorksheet ss:Name=StartTable ss:DefaultColumnWidth=80RowCellData ss:Type=StringID/Data/CellCellData ss:Type=String1/Data/Cell/RowRowCellData ss:Type=StringStart/Data/CellCell ss:StyleID=s11*Data ss:Type=DateTime2012-06-14T09:16:16.512/Data*/Cell/Row/Table /Worksheet/Workbook On Fri, Jun 8, 2012 at 8:08 AM, Uwe Ligges lig...@statistik.tu-dortmund.dewrote: On 06.06.2012 22:44, Santosh wrote: Hello experts, Sorry for posting the SPlus related question here.. I have not found any solution yet after some attempts and hence, sending it to a wider spectrum of users! I was successful in processing files uing R's XML librariy. Not that we know, we just know about an R *package* called XML. Thank you, Rxperts! I know there are libraries like XML and SPXML available in S-Plus. Could anyone please share examples of reading an xml file and save the contents in a data frame? Are there Splus equivalents of getNodeSet, xmlSApply and xmlValue? Most of us do not have S-PLUS available to check (actually, we do have a 13 year old copy S-PLUS 4.5 at our department). You do, obviously, hence why not check it yourself? And if you can't, why not ask the vendor of your statistics software? Best, Uwe Ligges Thanks so much! Santosh [[alternative HTML version deleted]] __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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.
[R] Process XML files
Hello experts, Sorry for posting the SPlus related question here.. I have not found any solution yet after some attempts and hence, sending it to a wider spectrum of users! I was successful in processing files uing R's XML librariy. Thank you, Rxperts! I know there are libraries like XML and SPXML available in S-Plus. Could anyone please share examples of reading an xml file and save the contents in a data frame? Are there Splus equivalents of getNodeSet, xmlSApply and xmlValue? Thanks so much! Santosh [[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] Splus equivalent of reshape in R
Hello R/Splus users.. I am posting in R discussion group in hope of wider response compared to what I received from Splus user groups Was wondering if there is any function available in Splus 8.2 that is equivalent to reshape of R? Below is a sample dataset. Size [both rows and columns) of the dataset may vary X1Y1Y2Y3 0.25403822 0.5444143 1323258 225 2525 4232617 6101123 810 92 13 241.7 15 4.6 and I would like to have them stacked as shown below.. idxy 10.2540 10.544 1132 1225 1423 1610 1810 1241.7 20.25 38 20.541 2132 2225 2426 2611 2892 22415 30.2522 30.543 3158 3225 3417 3623 3813 3244.6 Thanks.. santosh [[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] number of Excel worksheets
Hello experts!! I apologize for posting SPlus related query here..badly in need of relevant info.. I usually use R (and your advice/tips) for my daily work. Was wondering if there is an equivalent of sheetCount of the package gdata avaailable in Splus 8.2? I would like to get the total number of tabs (aka pages) in an MS Excel workbook. Thanks, Santosh On Fri, Feb 5, 2010 at 6:24 PM, Kevin Wright kw.s...@gmail.com wrote: Sorry, I thought the code was clear, but probably not. As far as I know, the gdata package requires perl. My read.xls function requires RODBC. If you don't have perl, my function works well, but if you have perl, the gdata package can do a better job of reading mixed-type (character/numeric) columns from Excel. The arguments to my read.xls function: file: name of the Excel file sheet: this is the name that appears on the tab at the bottom of the worksheet condition: this is an additional SQL expression that can be passed to the RODBC calls. Kevin On Fri, Feb 5, 2010 at 9:27 AM, Gabor Grothendieck ggrothendi...@gmail.comwrote: Yes. Get it from here: http://www.activestate.com/activeperl/ On Fri, Feb 5, 2010 at 10:10 AM, Gábor Pozsgai pozsg...@gmail.com wrote: Thank you both. Gabor, do I need perl to be installed onj my computer to use those functions? Gabor 2010/2/5 Kevin Wright kw.s...@gmail.com: I have a function to read xls files that tells me the name of the available sheets. See below. Kevin Wright read.xls = function (file, sheet, condition) { if (missing(file)) stop(No file specified.) if (!file.exists(file)) stop(File , file, does not exist in directory , getwd()) if (missing(sheet)) stop(No sheet specified.) if (!require(RODBC, quietly = TRUE)) stop(The RODBC package is required.) channel = odbcConnectExcel(file) if (!RODBC:::odbcValidChannel(channel)) stop(first argument is not an open RODBC channel) tables - sqlTables(channel) tables - if (is.data.frame(tables)) tables[, TABLE_NAME] else tables - gsub(\\$$, , gsub(', , tables)) if (!(sheet %in% tables)) { odbcClose(channel) msg - paste(paste(', tables, ', sep = ), collapse = ) stop(Couldn't find requested sheet.\n, Available sheets are: , msg) } qsheet - paste([, sheet, $], sep = ) if (missing(condition)) data - sqlQuery(channel, paste(select * from, qsheet)) else data - sqlQuery(channel, paste(select * from, qsheet, condition)) odbcClose(channel) if (length(grep(#, names(data))) 0) cat(Caution: Column names may have had '.' changed to '#'.\n) cat(Caution: Be careful with mixed-type columns that begin with\n) cat( some (15?) rows that are only numeric.\n) cat( Use str() and summary() to check the import.\n) return(data) } On Fri, Feb 5, 2010 at 8:13 AM, Gábor Pozsgai pozsg...@gmail.com wrote: Dear All, I would like to count or list the names of the existing worksheets within an .xls file. Any hints? Thaks, Gabor -- Pozsgai Gábor www.coleoptera.hu www.photogabor.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. -- Kevin Wright -- Pozsgai Gábor www.coleoptera.hu www.photogabor.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. -- Kevin Wright [[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
Re: [R] how to cumulate up times
Hello .. A really simple question for you. for some reason I am not getting it right.. How do I add time (in specified units) to a column of observed date/time (say a date-time in ISO 8601 format). For example, 2007-12-05T09:45:00 + 3 days 2007-13-05T09:45:00 + 3 hours Thanks so much! Santosh On Tue, Apr 24, 2012 at 9:15 AM, René Mayer ma...@psychologie.tu-dresden.de wrote: Thanks Michael, cumsum - yes of course! Regards, René Zitat von R. Michael Weylandt michael.weyla...@gmail.com: ? cumsum something like library(chron) # Reporting packages you use is always considerate mt - times(c('00:05:00', '00:15:00', '00:30:00')) # Spaces are legible! times(09:30:00) + cumsum(mt) Michael On Tue, Apr 24, 2012 at 11:35 AM, René Mayer ma...@psychologie.tu-dresden.**de ma...@psychologie.tu-dresden.de wrote: Dear List, given a vecor of times in 5,15 and 30 minutes and a start point in time, lets say 09:30:00, how do I add up those times to the start time getting a cumulative time sequence? mt-times(c('00:05:00', '00:15:00', '00:30:00')) mt wanted 00:05:00 09:35:00 00:15:00 09:50:00 00:30:00 10:20:00 Regards, René __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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.
[R] apply transformation
Hello All, I have the following dataset: Year 2006 2007 Jan Jan 0.0204 0.0065 Feb Feb 0.0145 0.0082 Mar Mar 0.0027 0.0122 dput(d_tmp) structure(list(Year = c(Jan, Feb, Mar), `2006` = c(0.0204, 0.0145, 0.0027), `2007` = c(0.0065, 0.0082, 0.0122)), .Names = c(Year, 2006, 2007), row.names = c(Jan, Feb, Mar), class = data.frame) I am trying to use the apply function but the values seem to be getting coerced to characters. I could recast in my function ... but I suspect there should be an easier way. I can always use a for loop to get the output I need but just wondering if there a way to get the same using apply or some other function ... (the number of years can be changing in my requirement) My final output needs to be as follows: Year20062006-Lbl20072007-Lbl Jan 0.0204 '2.04%' 0.0065 '0.65%' Feb 0.0145 '1.45%' 0.0082 '0.82%' Mar 0.0027 '0.27%' 0.0122 '1.22%' i.e. dput(d_final) structure(list(Year = structure(c(2L, 1L, 3L), .Label = c(Feb, Jan, Mar), class = factor), X2006 = c(0.0204, 0.0145, 0.0027 ), X2006.Lbl = structure(c(3L, 2L, 1L), .Label = c('0.27%', '1.45%', '2.04%'), class = factor), X2007 = c(0.0065, 0.0082, 0.0122), X2007.Lbl = structure(1:3, .Label = c('0.65%', '0.82%', '1.22%'), class = factor)), .Names = c(Year, X2006, X2006.Lbl, X2007, X2007.Lbl), row.names = c(NA, -3L), class = data.frame) Please advise. Santosh __ 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 and polygon in log scale
Dear Experts, When using plot and polygon, I can change the density and angle of the shaded area lines when plotting is done in regular scale. It does not seem to work in 'log' scale. Any suggestions would be highly appreciated! below is an example: plot(1:10,c(1:10)^2*20,log=y) polygon(c(3:7,7:3),c((3:7)^2*20,c(7:3)^2*10),col='grey',angle=45,dens=30) Warning message: In polygon.fullhatch(xy$x[start:(end - 1)], xy$y[start:(end - 1)], : cannot hatch with logarithmic scale active Regards, Santosh [[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] Strplit code
Dear R- Splus experts, In R, I have frequently used do.call with strsplit. and I have a hard time with Splus.. any suggestions? for example, the R code below: do.call(rbind,strsplit(paste(letters[1:10],c(1:10)), )) Thanks so much, Santosh On Fri, Dec 5, 2008 at 8:51 AM, William Dunlap wdun...@tibco.com wrote: [R] Strplit code pomchip at free.fr pomchip at free.fr Wed Dec 3 20:52:21 CET 2008 Dear R-users, The strsplit function does not exist in S-plus and I would like to use it. How could I reproduce the function in Splus or access to its source code? Thank you in advance, Sebastien strsplit() was added to S+ 8.0 (May 2007). At the same time we changed the default regular expression style from 'basic' (a.k.a. 'obsolete') to 'extended' and we added the string functions sub(), gsub(), and sprintf(). S+ 8.1 is now available (as of November 2008). Bill Dunlap TIBCO Software Inc - Spotfire Division wdunlap tibco.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. [[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] how to subtract one string from another in R
Hello Vijayan, Depending on your end goal the following could possibly help substr(string,nchar(string1)+1, nchar(string)) or strsplit(string, ) HTH, Santosh On Sat, Jun 18, 2011 at 2:06 PM, Vijayan Padmanabhan padmanabhan.vija...@gmail.com wrote: Dear R Group Here is what i am trying to do.. but couldnt figure out how.. string-ABC DEFG HIJKLM NOPQ RSTUV WXY string1-substr(string,1,4) I want to create an R object string 2 ( following the logic shown).. R does not allow string subtraction.. any suggestions how to achieve this? string2-string-string1 (it should now hold DEFG HIJKLM NOPQ RSTUV WXY I want to loop this till i reach the end of the original string.. stringn-WXY Any help would be appreciated. Regards Vijayan Padmanabhan [[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] R program writing standard/practices
Dear Experts, Thanks to all those who responded! More requests for suggestions/thoughts: Along with the above conventions/styles of writing code (as provided in your links), there is always a tug of war on agreement on the scope/depth of a program.. Also, there is a carry-over of Java- / C|C++ - style of programming techniques to catch/trap errors. R programming software inherently has very nice error trap mechanisms etc, which obviate explicit error trap programming in many cases. So, while one does agree that programs with error trap mechanisms are more robust, the key question remains about drawing the line between simplicity of a program versus complex robust program. Simplicity helps when there is a resource crunch and verifying/validating robust programs would require users/teams to have deeper knowledge of R, which may not always be available! Would highly appreciate your ideas on ways to improving code quality, easier code verification under resource crunch situations. Regards, Santosh On Fri, Jun 10, 2011 at 10:04 AM, vioravis viora...@gmail.com wrote: Check this out: http://www1.maths.lth.se/help/R/RCC/ -- View this message in context: http://r.789695.n4.nabble.com/R-program-writing-standard-practices-tp3588716p3588911.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. [[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.