[R] installing "rgl" package

2017-11-23 Thread Santosh
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] installing "rgl" package

2017-11-24 Thread Santosh
nftest.c -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  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.

Re: [R] installing "rgl" package

2017-11-24 Thread Santosh
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 
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,
>>
>> * install

Re: [R] installing "rgl" package

2017-11-24 Thread Santosh
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 
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 

Re: [R] installing "rgl" package

2017-11-24 Thread Santosh
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 
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

2017-11-26 Thread Santosh
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  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 
> 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.

[R] ggplot2 question plot mean/error bars

2017-04-05 Thread Santosh
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] ggplot2 question plot mean/error bars

2017-04-05 Thread Santosh
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  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.


Re: [R] A new -up?

2017-04-19 Thread Santosh
otherwise explain it as unexplained "random variable"/ "residual error" :)

Santosh

On Wed, Apr 19, 2017 at 1:32 AM, Rolf Turner 
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.


[R] Application of "merge" and "within"

2016-05-27 Thread Santosh
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] Application of "merge" and "within"

2016-05-31 Thread Santosh
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 
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.


Re: [R] Application of "merge" and "within"

2016-05-31 Thread Santosh
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 
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  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 
>> 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"

2016-06-04 Thread Santosh
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  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 
> 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"

2016-06-09 Thread Santosh
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  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 
> 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.


[R] Script to workflow conversion

2015-04-22 Thread Santosh
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.


[R] Convert csv to xpt file in R?

2015-05-06 Thread Santosh
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.


Re: [R] Convert csv to xpt file in R?

2015-05-07 Thread Santosh
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] ReporteRs R package installation issues in R.3.2.3 (Windows)

2016-02-22 Thread Santosh
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.

Re: [R] ReporteRs R package installation issues in R.3.2.3 (Windows)

2016-02-22 Thread Santosh
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] Tables, knitr markdown

2016-02-22 Thread Santosh
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] Tables, knitr markdown

2016-02-22 Thread Santosh
Just figured out..

as.data.frame(as.matrix(),stringsAsFactors=F)

could work! :)


On Mon, Feb 22, 2016 at 12:17 PM, Santosh  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.


Re: [R] Tables, knitr markdown

2016-02-22 Thread Santosh
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 
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  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

2016-02-22 Thread Santosh
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  wrote:

> On Mon, Feb 22, 2016 at 1:55 PM, Duncan Murdoch
>  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 
> 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.

[R] Use of "quote" in Windows and Linux..

2016-02-24 Thread Santosh
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] [FORGED] Use of "quote" in Windows and Linux..

2016-02-24 Thread Santosh
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  wrote:

> On Wed, Feb 24, 2016 at 3:47 PM, Rolf Turner 
> 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] Testing installed package of rJava in Linux

2016-03-08 Thread Santosh
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] Testing installed package of rJava in Linux

2016-03-09 Thread Santosh
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  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] fread transforms numbers

2017-03-22 Thread Santosh
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] fread transforms numbers

2017-03-22 Thread Santosh
Thanks so much for your suggestions! Will try them out!

Santosh

On Wed, Mar 22, 2017 at 12:17 PM, Matt Dowle  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 
> 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
>>  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 
>> 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-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/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] fread transforms numbers

2017-03-22 Thread Santosh
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  wrote:

> Thanks so much for your suggestions! Will try them out!
>
> Santosh
>
> On Wed, Mar 22, 2017 at 12:17 PM, Matt Dowle  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 
>> 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
>>>  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 
>>> 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 

[R] Scan and read.table

2009-09-07 Thread Santosh
Dear R experts..

I am trying to read data-sections in a large consolidated dataset,
containing section headers and the data . There are many options available
to implement, I was wondering what optimal function, to extract section
headers and data (w/ columns), could be used on the dataset that looks like
as provided at the end of this email? In each section of a dataset, 1st line
of the section is a table title, followed by names of the columns and rows
of data.

TABLE NO.  4: MCMC Bayesian Analysis
 ITERATIONTHETA1   THETA2 THETA3THETA4
SIGMA(1,1)   OMEGA(1,1)   OMEGA(2,2)   OBJ
   -1  1.63523E+00  1.56116E+00  7.51601E-01  2.35158E+00
5.71097E-02  1.66941E-01  1.39843E-01   -2573
-  1.60770E+00  1.48763E+00  7.25607E-01  2.41005E+00
4.15829E-02  1.75023E-01  1.14078E-01   -2588
-9998  1.67015E+00  1.50197E+00  8.04380E-01  2.32958E+00
4.60430E-02  1.68910E-01  1.70382E-01   -2548
-9997  1.60714E+00  1.56161E+00  7.36944E-01  2.37716E+00
4.96144E-02  1.35797E-01  1.62153E-01   -2539

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] Scan and read.table

2009-09-08 Thread Santosh
As you see in the data.. each section has table header followed by a row of
table column headers and then rows of data. I felt read.table may not be the
optimal function to extract both the texts (headers) and numerics
(rows&columns of data). As of now, I use "scan" to get the text boundaries
and use read.table to read the data within those boundaries. I wanted to
know if there is more efficient way of handling disparate sets of data

Thanks,
Santosh

On Tue, Sep 8, 2009 at 6:37 PM, jim holtman  wrote:

> How do you want to extract the data?  You can use 'readLines' to read
> in the data and then 'grep' to find the header lines and delete them.
> On the other hand, do you want to separate each section into a
> differnet object/list?  You can again use readLines and determine
> where the breaks are and then split the data into different segments
> to read in.
>
> On Mon, Sep 7, 2009 at 4:00 AM, Santosh wrote:
> > Dear R experts..
> >
> > I am trying to read data-sections in a large consolidated dataset,
> > containing section headers and the data . There are many options
> available
> > to implement, I was wondering what optimal function, to extract section
> > headers and data (w/ columns), could be used on the dataset that looks
> like
> > as provided at the end of this email? In each section of a dataset, 1st
> line
> > of the section is a table title, followed by names of the columns and
> rows
> > of data.
> >
> > TABLE NO.  4: MCMC Bayesian Analysis
> >  ITERATIONTHETA1   THETA2 THETA3THETA4
> > SIGMA(1,1)   OMEGA(1,1)   OMEGA(2,2)   OBJ
> >   -1  1.63523E+00  1.56116E+00  7.51601E-01  2.35158E+00
> > 5.71097E-02  1.66941E-01  1.39843E-01   -2573
> >-  1.60770E+00  1.48763E+00  7.25607E-01  2.41005E+00
> > 4.15829E-02  1.75023E-01  1.14078E-01   -2588
> >-9998  1.67015E+00  1.50197E+00  8.04380E-01  2.32958E+00
> > 4.60430E-02  1.68910E-01  1.70382E-01   -2548
> >-9997  1.60714E+00  1.56161E+00  7.36944E-01  2.37716E+00
> > 4.96144E-02  1.35797E-01  1.62153E-01   -2539
> >
> > 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.
> >
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] using filter while Reading files -

2009-09-14 Thread Santosh
Dear R'sians..
I apologize if this topic has been beaten to death and hope that hawks don't
pounce on me!

Could you please suggest an efficient way to filter rows from 500+ text
files (some with 3+ rows with multiple section table headers) residing
in several folders?  I guess probably "scan" is the fastest way to scan a
file, but, I noticed it sometimes takes a long time when reading large text
files.

Would really 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.


Re: [R] using filter while Reading files -

2009-09-15 Thread Santosh
Yes, my current program uses both scan and readLines. I was hoping for an
R-based implementation similar to the Splus function   ImportData(file,
filter=xxx)

Is similar option available in R?
Thanks,
Santosh

On Mon, Sep 14, 2009 at 4:39 PM, David Winsemius wrote:

>
> On Sep 14, 2009, at 6:25 PM, Santosh wrote:
>
>  Dear R'sians..
>> I apologize if this topic has been beaten to death and hope that hawks
>> don't
>> pounce on me!
>>
>> Could you please suggest an efficient way to filter rows from 500+ text
>> files (some with 3+ rows with multiple section table headers) residing
>> in several folders?  I guess probably "scan" is the fastest way to scan a
>> file, but, I noticed it sometimes takes a long time when reading large
>> text
>> files.
>>
>
> scan would attempt to parse the files while you could create a long
> character vector composed of entire lines with readLines.
>
>
>>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>

[[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 filter while Reading files -

2009-09-16 Thread Santosh
Hi R'sians
As the experts here suggested, I am using "scan" and "readLines" to read
text files. I notice that read.table takes a long time read and process
character vectors of 3+ rows.

How do I separate out the columns in the resulting character vector? The
function "read.fwf" appears to be a bit cumbersome to use as number of
columns in the text files is not constant, and some preprocessing to obtain
number of columns is needed.

Would really appreciate your ideas!!

Below is the embedded data from the attached text file
"TABLE NO. 1: Gold"
" R1   T1   T2   T3   T4
T5  "
"0  3.68000E+01  1.41000E+03  4.94000E+03  2.33000E+01
4.9E+01"
"   43  3.77870E+01  2.46260E+03  4.44227E+03  2.31390E+01
4.84272E+01"
"   -1  3.67870E+01  1.46260E+03  4.44227E+03  2.31390E+01
4.84271E+01"
"TABLE NO. 2: Silver"
" R1   T1   T2   T3   T4
T5  "
"0  3.68000E+01  1.41660E+03  4.54000E+03  2.89000E+01
4.9E+01"
"   56  3.67870E+01  5.46260E+03  4.94227E+03  2.42390E+01
4.84272E+01"
"   -1  8.67870E+01  9.46260E+03  4.94227E+03  2.31390E+01
4.84271E+01"

Thanks,
Santosh
"TABLE NO. 1: Gold" 
" R1   T1   T2   T3   T4   T5  
" 
"0  3.68000E+01  1.41000E+03  4.94000E+03  2.33000E+01  4.9E+01"
"   43  3.77870E+01  2.46260E+03  4.44227E+03  2.31390E+01  4.84272E+01"
"   -1  3.67870E+01  1.46260E+03  4.44227E+03  2.31390E+01  4.84271E+01"
"TABLE NO. 2: Silver" 
" R1   T1   T2   T3   T4   T5  
" 
"0  3.68000E+01  1.41660E+03  4.54000E+03  2.89000E+01  4.9E+01"
"   56  3.67870E+01  5.46260E+03  4.94227E+03  2.42390E+01  4.84272E+01"
"   -1  8.67870E+01  9.46260E+03  4.94227E+03  2.31390E+01  4.84271E+01"
__
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] Re-order columns

2009-09-19 Thread Santosh
Dear R'sians,
Would really appreciate if you could suggest a more efficient way to order
the columns of a dataset. The column names of the dataset contain indices
separated by a period. Following are examples of my code and the dataset.

oC <- function(tg=x2) {
lth<- length(grep("T",names(tg)))
thix   <- match(paste("T",seq(lth),sep=""),names(tg))
soi<- c(grep("O",names(tg),fixed=T),grep("S",names(tg),fixed=T))
oi <-
data.frame(t(data.frame(strsplit(names(tg)[soi],"\\."),stringsAsFactors=F)),stringsAsFactors=F)
names(oi) <- c("par","ix1","ix2");row.names(oi) <- NULL
oi$cnm <- sub("^\\s+((.*\\S)\\s+)?$", "\\2", paste("
",paste(oi$par,oi$ix1,oi$ix2," ",sep="."),sep=""))
oi1<- oi[order(oi$par,as.integer(oi$ix1),as.integer(oi$ix2)),]
return(list(oi1=oi1,thix=thix))
 }

x1 <- c("TABLE NO. 1: Gold" ,
" RT2   T1   O.4.1.   O.3.1.
S.1.1.  " ,
"0  3.68000E+01  1.41000E+03  4.94000E+03  2.33000E+01
4.9E+01",
"   43  3.77870E+01  2.46260E+03  4.44227E+03  2.31390E+01
4.84272E+01",
"   -1  3.67870E+01  1.46260E+03  4.44227E+03  2.31390E+01
4.84271E+01")
x2 <- read.table(textConnection(x1),as.is=T,head=T,skip=1)
x3 <- oC(x2)
pcols  <- c(names(x2)[x3$thix],x3$oi1$cnm)
x4 <- x2[,match(c(setdiff(names(x2),pcols),pcols),names(x2))]

Thanks a TON

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] sapply, lattice functions

2010-03-19 Thread Santosh
Dear R-gurus

aa <- data.frame(a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5))
sapply(aa,function(x) histogram(x,breaks=NULL))

or px <- sapply(aa,function(x) histogram(x,breaks=NULL))
print(px,split=c(1,1,1,1),more=F)

The above code does not seem to work. am I missing something?

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] sapply, lattice functions

2010-03-19 Thread Santosh
Thanks for your response.
how do I print them in an ordered manner, akin to using
print(px,split=c(2,2,1,1),more=T)) or par(mfrow=c(x,y))?

-Santosh

On Fri, Mar 19, 2010 at 2:58 PM, Gabor Grothendieck  wrote:

> Try this:
>
> junk <- sapply(aa,function(x) print(histogram(x,breaks=NULL)))
>
> or, shorter:
>
> for(a in aa) print(histogram(a, breaks = NULL)
>
>
> On Fri, Mar 19, 2010 at 5:44 PM, Santosh  wrote:
> > Dear R-gurus
> >
> > aa <- data.frame(a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5))
> > sapply(aa,function(x) histogram(x,breaks=NULL))
> >
> > or px <- sapply(aa,function(x) histogram(x,breaks=NULL))
> > print(px,split=c(1,1,1,1),more=F)
> >
> > The above code does not seem to work. am I missing something?
> >
> > 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] sapply, lattice functions

2010-03-21 Thread Santosh
Dear R-gurus..

How do I implement the following:
a) Overlay frequency(instead of density) with line of density plot, vertical
lines of confidence intervals and reference levels?
b) Control the breaks (using "nint?"), order of the panel, and the layout,
place units for each conditioning variable?

Is there more efficient way than lines provided below? Please feel free to
suggest other ways of displaying the above information.

library(reshape)
# The data frame below is an example of a subset of results from bootstrap
runs. From the results of bootstrap, I would like to  # display
frequency histogram with overlay of density,confidence intervals, and point
estimates.

aa <- data.frame(id=seq(20),a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5))
aa1 <- rbind(aa,c( -99, -0.02,1.09,  0.23)) # record of reference values for
each distribution, set "id" = -99
ab <- melt(aa1,measure=names(aa1)[-match("id",names(aa1)])
uns <- unlist(list(id="",a1="mL/h",b1="L",c1="L"))
uns1 <- data.frame(var=names(uns),uni=(uns))
ab1 <- merge(ab,uns1,by="variable",all.x=T)
 ab2 <- ab1[order(ab1$variable,ab1$id),]

histogram(~value|paste(as.character(variable),"
(",uni,")",sep=""),breaks=NULL,nint=10,ab2,layout=c(2,2),as.table=T,type="density",scales=list(relation='free'),
panel=function(x,lqp=c(0.025,0.975),...) { # lqp indicate
confidence intervals
x1 <- x[-1]
 vs <- x[1]
panel.histogram(x1,col='light blue',...)
panel.densityplot(x1,col.line='blue',lwd=1.75,...)
panel.abline(v=c(quantile(as.vector(x1),prob=lqp,na.rm = T),vs),
col=c("blue","blue","dark green"),lwd=2,lty=c(2,2,1))},
strip=strip.custom( strip.names=F, strip.levels=T)
)

Thanks so much for your help!
Santosh

On Sat, Mar 20, 2010 at 10:56 AM, Sundar Dorai-Raj wrote:

> You're right. It's necessary for xyplot though to prevent grouping.
>
> On Mar 20, 2010 10:43 AM, "Dieter Menne" 
> wrote:
>
>
>
> Sundar Dorai-Raj-2 wrote:
> >
> > Or perhaps more clearly,
> >
> > histogram(~a1 + b1 + c1, data = aa, o...
> Why outer=TRUE? Looks same for me without:
> Dieter
>
> library(lattice)
>
> aa <- data.frame(a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5))
> histogram(~a1 + b1 + c1, data = aa)
>
>
> --
> View this message in context:
> http://n4.nabble.com/sapply-lattice-functions-tp1618134p1676043.html
> Sent from the R help mailing list archive at Nabble.com.
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz
>
>[[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] Correlation question (from a newbie)

2009-07-14 Thread Santosh
Hi R-users,

Was wondering if there is a way to quickly compute correlations between
continuous variables grouped by some categorical variables?

What function do I use?

Thanks much in advance.

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] Correlation question (from a newbie)

2009-07-14 Thread Santosh
Dear R-users..

I hope the following scenario is more explanatory of my question..

Continuous variables: AGE, WEIGHT, HEIGHT
Categorical variables: Group, Sex, Race
I would like to find a correlation between WEIGHT and AGE, grouped by
"Group","Sex", and "Race".

Is the following formula correct?
tapply(dat$WEIGHT,
by=list(dat$AGE,as.factor(dat$Group),as.factor(dat$EX),as.factor(dat$RACE)),cor)


Thanks,
Santosh

On Tue, Jul 14, 2009 at 7:34 PM, Santosh  wrote:

> Hi R-users,
>
> Was wondering if there is a way to quickly compute correlations between
> continuous variables grouped by some categorical variables?
>
> What function do I use?
>
> Thanks much in advance.
>
> 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] Correlation question (from a newbie)

2009-07-14 Thread Santosh
Dear R-users please ignore my most recent posting..

Found the solution.. Thanks to David Winsemius..


Thanks,
Santosh

On Tue, Jul 14, 2009 at 9:14 PM, Santosh  wrote:

> Dear R-users..
>
> I hope the following scenario is more explanatory of my question..
>
> Continuous variables: AGE, WEIGHT, HEIGHT
> Categorical variables: Group, Sex, Race
> I would like to find a correlation between WEIGHT and AGE, grouped by
> "Group","Sex", and "Race".
>
> Is the following formula correct?
> tapply(dat$WEIGHT,
> by=list(dat$AGE,as.factor(dat$Group),as.factor(dat$EX),as.factor(dat$RACE)),cor)
>
>
> Thanks,
> Santosh
>
>
> On Tue, Jul 14, 2009 at 7:34 PM, Santosh  wrote:
>
>> Hi R-users,
>>
>> Was wondering if there is a way to quickly compute correlations between
>> continuous variables grouped by some categorical variables?
>>
>> What function do I use?
>>
>> Thanks much in advance.
>>
>> 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] histogram

2010-04-14 Thread Santosh
Dear R gurus...

How do I control "smoothing" of a density plot in panel.densityplot when
using histogram?

Thanks 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] histogram

2010-04-15 Thread Santosh
Thanks for your email... yes, I had tried that "bw" thing.. for some reason
it does not seem to work.. could not figure out where I am wrong...

Below is an example for your convenience.. you might notice that the density
plots appear to be a curve of connected segments. Changing breaks, nint or
bw didn't seem to help.


library(reshape)
set.seed(13454)
aa <-
data.frame(a1=rnorm(500),b1=rnorm(500,0.8),c1=rnorm(500,0.5),cat1=rep(1:5,each=100))
ab <- melt(aa,measure.vars=c("a1","b1","c1"))
histogram(~
value|variable,ab,breaks=NULL,nint=10,type="density",layout=c(2,2),as.table=T,scales=list(relation='free'),
panel=function(x,lqp=c(0.05,0.975),...) {
panel.histogram(x,col='lightblue',...)
panel.densityplot(x,col.line='blue',lwd=1.75,bw=2,...)
panel.abline(v=c(quantile(as.vector(x),prob=lqp,na.rm = T)),
col="dark green",lwd=2,lty=2)
},
strip=strip.custom( strip.names=F,
strip.levels=T,
    par.strip.text=list(cex=0.75)),
)



Thanks again,
Santosh
On Thu, Apr 15, 2010 at 12:41 AM, Paul Hiemstra wrote:

> Santosh wrote:
>
>> Dear R gurus...
>>
>> How do I control "smoothing" of a density plot in panel.densityplot when
>> using histogram?
>>
>> Thanks 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.
>>
>>
> Hi,
>
> From ?panel.densityplot, argument darg, I was referred to ?density. I think
> the 'bw' argument is what you need. Pass it to panel.densityplot in the darg
> argument.
>
> cheers,
> Paul
>
>
> --
> Drs. Paul Hiemstra
> Department of Physical Geography
> Faculty of Geosciences
> University of Utrecht
> Heidelberglaan 2
> P.O. Box 80.115
> 3508 TC Utrecht
> Phone:  +3130 274 3113 Mon-Tue
> Phone:  +3130 253 5773 Wed-Fri
> http://intamap.geo.uu.nl/~paul <http://intamap.geo.uu.nl/%7Epaul>
> http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
>
>

[[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] histogram

2010-04-15 Thread Santosh
yes.. that now works! thank you so much, Paul & Peter!!
-santosh

On Thu, Apr 15, 2010 at 3:11 AM, Paul Hiemstra  wrote:

> Santosh wrote:
>
>> Thanks for your email... yes, I had tried that "bw" thing.. for some
>> reason it does not seem to work.. could not figure out where I am wrong...
>>
>> Below is an example for your convenience.. you might notice that the
>> density plots appear to be a curve of connected segments. Changing breaks,
>> nint or bw didn't seem to help.
>>
>> 
>> library(reshape)
>> set.seed(13454)
>> aa <-
>> data.frame(a1=rnorm(500),b1=rnorm(500,0.8),c1=rnorm(500,0.5),cat1=rep(1:5,each=100))
>> ab <- melt(aa,measure.vars=c("a1","b1","c1"))
>> histogram(~
>> value|variable,ab,breaks=NULL,nint=10,type="density",layout=c(2,2),as.table=T,scales=list(relation='free'),
>>panel=function(x,lqp=c(0.05,0.975),...) {
>>panel.histogram(x,col='lightblue',...)
>>panel.densityplot(x,col.line='blue',lwd=1.75,bw=2,...)
>>
> replace bw = 2 by darg = list(bw = 2), then it works for me. Read the
> documentation of panel.densityplot carefully, it says that you need to use
> darg = list().
>
> cheers,
> Paul
>
>>panel.abline(v=c(quantile(as.vector(x),prob=lqp,na.rm = T)),
>>col="dark green",lwd=2,lty=2)
>>},
>>strip=strip.custom( strip.names=F,
>>strip.levels=T,
>>par.strip.text=list(cex=0.75)),
>> )
>>
>> 
>>
>> Thanks again,
>> Santosh
>> On Thu, Apr 15, 2010 at 12:41 AM, Paul Hiemstra > p.hiems...@geo.uu.nl>> wrote:
>>
>>Santosh wrote:
>>
>>Dear R gurus...
>>
>>How do I control "smoothing" of a density plot in
>>panel.densityplot when
>>using histogram?
>>
>>Thanks much,
>>Santosh
>>
>>   [[alternative HTML version deleted]]
>>
>>
>>__
>>R-help@r-project.org <mailto:R-help@r-project.org> mailing list
>>
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
>>and provide commented, minimal, self-contained, reproducible code.
>>
>>Hi,
>>
>>From ?panel.densityplot, argument darg, I was referred to
>>?density. I think the 'bw' argument is what you need. Pass it to
>>panel.densityplot in the darg argument.
>>
>>cheers,
>>Paul
>>
>>
>>-- Drs. Paul Hiemstra
>>Department of Physical Geography
>>Faculty of Geosciences
>>University of Utrecht
>>Heidelberglaan 2
>>P.O. Box 80.115
>>3508 TC Utrecht
>>Phone:  +3130 274 3113 Mon-Tue
>>Phone:  +3130 253 5773 Wed-Fri
>>http://intamap.geo.uu.nl/~paul <http://intamap.geo.uu.nl/%7Epaul> <
>> http://intamap.geo.uu.nl/%7Epaul>
>>
>>http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
>>
>>
>>
>
> --
> Drs. Paul Hiemstra
> Department of Physical Geography
> Faculty of Geosciences
> University of Utrecht
> Heidelberglaan 2
> P.O. Box 80.115
> 3508 TC Utrecht
> Phone:  +3130 274 3113 Mon-Tue
> Phone:  +3130 253 5773 Wed-Fri
> http://intamap.geo.uu.nl/~paul <http://intamap.geo.uu.nl/%7Epaul>
> http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
>
>

[[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 Groups

2010-04-29 Thread Santosh
Dear R experts..
Related to the example below, (which was discussed earlier)...
How do I control the graphical elements of box, whiskers etc?  I would like
their colors go with specific groups. i tried changing
par.settings(box.umbrella, box.rectangle etc)..and could not make them
work.. Sample dataset and example code is given below.

tmp <- data.frame(
y=rnorm(100),
category=rep(factor(letters[1:
5]),each=20),
level=rep(factor(0:1), length=100))

barchart(y~factor(category),groups=level,
data=tmp,jitter.x=F,
panel=function(...){
panel.superpose( ...)
panel.superpose(panel.groups=panel.bwplot,
alpha=c(0.5,0.5),
varwidth=T,notch=T,
col=c("red","blue"),
fill=c("pink","lightblue"),pch=16,

par.settings=list(box.umbrella=list(col=c("red","blue"),box.dot=list(col=c("red","blue",...)

panel.superpose(panel.groups=panel.loess,lwd=2,col.line=c("red","blue"),alpha=0.2,lty=1,...)
panel.abline(h=0,col="black",lty=2)},
xlab="time bin (week)",
auto.key=list(space="right",text=c("A","H"),points=T))

Thanks,
Santosh
_
On Wed, Apr 8, 2009 at 12:07 PM, Deepayan Sarkar
wrote:

> On Wed, Apr 8, 2009 at 10:36 AM, Lyman, Mark  wrote:
> > I don't understand your first question, but, since no one else has
> > responded I can answer your second question. panel.bwplot, unlike
> > panel.xyplot doesn't use panel.superpose when groups is not NULL. In
> > order to get an analogous result you need to specify that you want to
> > use panel.superpose.
> >
> > cols <- c("Sepal.Width", "Petal.Length", "Petal.Width")
> > stackedData <- stack(iris[, cols])
> > df <- data.frame(y = stackedData$values, x = rep(iris$Species, 3), which
> > = gl(3, nrow(iris)))
> >
> > bwplot(y ~ x:which, data = df, groups = which, panel=panel.superpose,
> > panel.groups = panel.bwplot)
> >
> > If you don't like the default colors, you can set the fill colors with
> > par.settings like:
> >
> > bwplot(y ~ x:which, data = df, groups = which, panel=panel.superpose,
> > panel.groups = panel.bwplot,
> > par.settings=list(superpose.symbol=list(fill=2:4)))
>
> And to answer the first question: using panel.superpose hijacks the
> parameters of the median spot, but they can be supplied explicity:
>
> bwplot(y ~ x:which, data = df, groups = which, panel=panel.superpose,
>panel.groups = panel.bwplot,
> par.settings=list(superpose.symbol=list(fill=2:4)), col = "black", pch
> = 16)
>
> -Deepayan
>
> >
> > Without the groups, the fill colors are controlled like this
> > bwplot(y~x:which, data = df,
> > par.settings=list(box.rectangle=list(fill=2:4)))
> >
> > Although if you have groups, using the groups argument is probably
> > better.
> >
> > Mark Lyman
> >
> >
> > Message: 41
> > Date: Tue, 7 Apr 2009 10:50:33 +0100
> > From: Richard Weeks 
> > Subject: [R] Lattice Groups
> > To: 
> > Message-ID: 
> > Content-Type: text/plain
> >
> >
> > Hi all,
> >
> >
> >
> > I'm trying to achieve a few things using the lattice package but am
> > failing miserably.
> >
> > I am plotting side by side box plots and using a grouping variable, e.g.
> >
> >
> >
> > cols <- c("Sepal.Width", "Petal.Length", "Petal.Width")
> > stackedData <- stack(iris[, cols])
> > df <- data.frame(y = stackedData$values, x = rep(iris$Species, 3), which
> > = gl(3, nrow(iris)))
> >
> > bwplot(y ~ x:which, data = df, group = which, panel.groups =
> > panel.bwplot)
> >
> >
> >
> > My questions are
> >
> > 1) How am I able to retain the median spot in the boxes?
> >
> > 2) How can I change the fill using the par.settings argument rather than
> > fill =1:3 say?
> >
> >
> >
> > Best wishes,
> >
> >
> >
> > Biff
> >
> > __
> > 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] control span in panel.loess in xyplot

2010-04-29 Thread Santosh
Dear R gurus..

Is it possible to control span settings for different values of a grouping
variable, when using xyplot? an example code shown below
d=data.frame(x=rep(sample(1:5,rep=F),10),y=rnorm(50),z=rep(sample(LETTERS[1:2],rep=F),25))
xyplot(y~x,data=d,groups=z,panel=panel.superpose,panel.groups=panel.loess(span=c(2/3,
3/4,1/2))
or something like..
xyplot(y~x,data=d,groups=z,panel=function(...)
{panel.superpose(...);panel.groups=panel.loess(span=3/4,...)})

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] Lattice Groups

2010-04-29 Thread Santosh
Richard,
Thanks for your email. I am not looking for that kind of plot as you had
suggested. I would like to see overlaid boxplots. Deepayan had earlier shown
the method of overlay of boxplots (using panel.groups=panel.bwplot)...

I have seen in some packages like ggplot2, where the overlapped plots are
automatically shown as a mix of overlapping colors, and was wondering if
similar features can be implemented in lattice package...

**Reproducing the earlier posted code for convenience..**

tmp <- data.frame(
y=rnorm(100),
category=rep(factor(letters[1:
5]),each=20),
level=rep(factor(0:1), length=100))

barchart(y~factor(category),
groups=level,
data=tmp,jitter.x=F,
panel=function(...){
panel.superpose( ...)
panel.superpose(panel.groups=panel.bwplot,
alpha=c(0.5,0.5),
varwidth=T,notch=T,
col=c("red","blue"),
fill=c("pink","lightblue"),pch=16,

par.settings=list(box.umbrella=list(col=c("red","blue"),box.dot=list(col=c("red","blue",...)

panel.superpose(panel.groups=panel.loess,lwd=2,col.line=c("red","blue"),alpha=0.2,lty=1,...)
panel.abline(h=0,col="black",lty=2)},
xlab="time bin (week)",
auto.key=list(space="right",text=c("A","H"),points=T))

Thanks,
Santosh


On Thu, Apr 29, 2010 at 1:58 PM, RICHARD M. HEIBERGER wrote:

> Santosh,
>
> continuing with your example, I recommend several functions in the HH
> package.
>
> ## install.packages("HH") ## needed once, if you don't already have it
>
> require(HH)
>
> tmp <- data.frame(y=rnorm(100),
>   category=rep(factor(letters[1:5]), each=20),
>   level=rep(factor(0:1), length=100))
> bwplot(y ~ interaction(level, category), data=tmp, col=c("red","blue"),
>panel=panel.bwplot.intermediate.hh)
> tmp$lv <- with(tmp, interaction(level, category))
> position(tmp$lv) <- outer(c(-.3,.3), seq(1.5, 9.5, 2), `+`)
> bwplot(y ~ lv, data=tmp, col=c("red","blue"),
>panel=panel.bwplot.intermediate.hh,
>scales=list(x=list(at=seq(1.5, 9.5, 2), labels=letters[1:5])))
>
> Rich
>
>

[[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] Controlling panel.text

2010-05-03 Thread Santosh
Dear R gurus,
A re-post due to suggestions from moderators.

Thanks to tips from Gabor and Felix, I was able to make some progress.. How
do I control the position of panel.text? I would like the text appear at a
specific position (say, top right corner) inside a panel.

Below is the sample code...

d=data.frame(x=rep(sample(1:5,rep=F),10),y=rnorm(50),z=rep(sample(LETTERS[1:2],rep=F),25))
xyplot(y ~ x, data = d, groups = z,subscripts=T,
panel = panel.superpose,
panel.groups = function(x=x,y=y,subscripts=
subscripts,..., group.number) {
require(grid)
   panel.xyplot(x=x,y=y,subscripts=subscripts,...)
   span <- switch(group.number, 2/3, 1/4, 1/2)
   panel.loess(x=x,y=y,subscripts=subscripts,..., span = span)

panel.text(x=max(x),y=max(y),lab=paste(round(cor(x,y),2)),col=trellis.par.get("superpose.symbol")$col[group.number])
  }, auto.key = list(lines = TRUE,space="right"))

Thanks a TON!!
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] Tunnelling X for R graphics

2009-10-14 Thread Santosh
In an ssh client, under connections section, there is an option for
tunneling. Please ensure that the tunneling options are turned on.. and if
applicable, incoming/outgoing tunnels, listen/destination ports, etc. are
set.

Thanks,
Santosh

On Tue, Feb 3, 2009 at 2:03 PM, Adam D. I. Kramer wrote:

> Thanks very much for the reassurance.
>
> Really, I can just open a new X11 device on the same display, since the
> display (localhost:10) is effectively "reconnected" when I ssh in again.
>
> I'll reply again to this post if I find other parts of R working poorly
> after the disconnection.
>
> --Adam
>
>
> On Tue, 3 Feb 2009, Prof Brian Ripley wrote:
>
>  To answer your basic question, you do need to shut down everything
>> involivng X, that is X11() devices and the X11 dataeditor.  If you do that
>> (and graphics.off() will suffice for the first), you should be able to
>> re-open an X11 device on another display (which is what presumably a new VNC
>> connection gives you).
>>
>> The warning comes from any X erorr, and it is not possible to know how
>> serious it is without external information.
>>
>> On Mon, 2 Feb 2009, Adam D. I. Kramer wrote:
>>
>>
>>> On Tue, 3 Feb 2009, Patrick Connolly wrote:
>>>
>>> The problem, and maybe I'm just whining here, is that because the
>>>>> data sets are large this takes several minutes where I'm basically just
>>>>> sitting around.  This happens once every other day as the VPN software
>>>>> I'm using "times out" after about 24 hours and thus the ssh session
>>>>> dies.
>>>>>
>>>>
>>>> Is it possible to do anything about the VPN software?  I use tightVNC to
>>>> do something similar and it doesn't time out after 24 hours.  Even
>>>> closing
>>>> the desktop machine down altogether does not lose the ssh connexion.
>>>> Restarting the desktop a week later will still find the X session without
>>>> loss.
>>>>
>>>
>>> The VPN software is managed and maintained by the company I'm doing
>>> statistical computing work for...out of my control. Your comments about
>>> TightVNC are pretty impressive, though--I'm not really sure how that
>>> would
>>> work...though if you set your ssh connection to not push any data towards
>>> your computer, I gather the server would have no reason to believe you
>>> were
>>> unresponsive?
>>>
>>> In any case, this sadly doesn't help me, but many thanks!
>>>
>>> For now, I'm just trying my hardest to remeber to dev.off() when I'm done
>>> using graphics.
>>>
>>> --Adam
>>>
>>> __
>>> 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.
>>>
>>>
>> --
>> 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/%7Eripley/>
>> University of Oxford, Tel:  +44 1865 272861 (self)
>> 1 South Parks Road, +44 1865 272866 (PA)
>> Oxford OX1 3TG, UKFax:  +44 1865 272595
>>
>>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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] "subset" or "condition" as argument to a function

2009-11-20 Thread Santosh
Dear Rxperts!

I was wondering if it is possible to write a function which can take in
argument of a subset or condition.. Of course, I am aware of the alternate
methods like coplot, par.plot, xyplot etc... I am specifically interested in
using conditions/subsets with "plot"..

A simple fragmented example is shown here..

pltit <- function(y,x,dat,dat1,dat2,sbst) {
plot(y~x, data=dat, subset=sbst)
lines(y~x,data=dat1, subset=subst)
points(y~x,data=dat2,subset=subst)
}

pltit(profit,weeks,dat=zone1, sbst='group==1&sales>200')

Could you also suggest pointers/references/examples on efficient ways to
plot simulated data overlaid with observed data?

Have a good weekend!

Thanx,
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] "subset" or "condition" as argument to a function

2009-11-20 Thread Santosh
To further explain my case..

am reproducing one of the examples.from one of contributors' guides..
___
attach(ais)
here<- sex=="f"
plot(pcBfat[here]~ht[here], xlab = “Height”, ylab = “% Body fat”)
panel.smooth(ht[here],pcBfat[here])
detach(ais)
__
A condition is in "here",... I am not able to use a similar conditioning as
an argument to a function..

Any suggestions will be highly appreciated!
Thnx..
Santosh
On Fri, Nov 20, 2009 at 5:40 PM, Santosh  wrote:

> Dear Rxperts!
>
> I was wondering if it is possible to write a function which can take in
> argument of a subset or condition.. Of course, I am aware of the alternate
> methods like coplot, par.plot, xyplot etc... I am specifically interested in
> using conditions/subsets with "plot"..
>
> A simple fragmented example is shown here..
>
> pltit <- function(y,x,dat,dat1,dat2,sbst) {
> plot(y~x, data=dat, subset=sbst)
> lines(y~x,data=dat1, subset=subst)
> points(y~x,data=dat2,subset=subst)
> }
>
> pltit(profit,weeks,dat=zone1, sbst='group==1&sales>200')
>
> Could you also suggest pointers/references/examples on efficient ways to
> plot simulated data overlaid with observed data?
>
> Have a good weekend!
>
> Thanx,
> 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] "subset" or "condition" as argument to a function

2009-12-01 Thread Santosh
Dear R gurus..
I had tried out some suggestions sent to me privately..and unfortunately,
they did not work..

To use a condiition in a subset, the associated dataframe needs to be
attached and detached, which I found cumbersome to use if using more than 1
dataframe (with different dimensions) with same condition. I would highly
appreciate your suggestions to overcome this problem.. Please see my example
of usage I am trying to implement. Please note that the "cond' takes in the
character instead of logical values...

cond1 <- 'group==1&sales>200'
cond2 <- 'group==2&sales>200'
cond3 <- 'group==3&sales>200'

d1 <- subset(dat,subset=cond1)
plot(y~x,data=dat,subset=cond1,type='b')
lines(y~x,data=dat,subset=cond2)
points(y~x,data=dat,subset=paste(cond1,cond2,sep='&'),col='blue')
points(y~x,data=d1,subset=cond3,col='red')

If I try the above, I get the following error message:
*Error in subset.data.frame(dat, cond) : 'subset' must evaluate to logical*

If you could also suggest references implementing similar code, I would
highly appreciate it.
Thanks so much,

Santosh

On Mon, Nov 23, 2009 at 6:38 PM, Santosh  wrote:

> Thanks... I would try it out..
>  -santosh
>
>
> On Sat, Nov 21, 2009 at 12:04 AM, Bernardo Rangel Tura <
> t...@centroin.com.br> wrote:
>
>> On Fri, 2009-11-20 at 17:40 -0800, Santosh wrote:
>> > Dear Rxperts!
>> >
>> > I was wondering if it is possible to write a function which can take in
>> > argument of a subset or condition.. Of course, I am aware of the
>> alternate
>> > methods like coplot, par.plot, xyplot etc... I am specifically
>> interested in
>> > using conditions/subsets with "plot"..
>> >
>> > A simple fragmented example is shown here..
>> >
>> > pltit <- function(y,x,dat,dat1,dat2,sbst) {
>> > plot(y~x, data=dat, subset=sbst)
>> > lines(y~x,data=dat1, subset=subst)
>> > points(y~x,data=dat2,subset=subst)
>> > }
>> >
>> > pltit(profit,weeks,dat=zone1, sbst='group==1&sales>200')
>> >
>> > Could you also suggest pointers/references/examples on efficient ways to
>> > plot simulated data overlaid with observed data?
>> >
>> > Have a good weekend!
>>
>>
>>
>

[[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] Statistical question and implementation

2009-12-10 Thread Santosh
Dear R/Statistics-gurus!

I tried to find answer to my hypothetical question and in vain. Sorry, I
don't have a dataset that fits into this hypothetical question and pardon me
if my explanations/use of statistical terms are not accurate.

It does sound a weird question, but I want to rule out that line of thought.
Is it possible to develop a model (or a simulation) such that the upper
variability is different from lower variability? e.g, the upper variability
in the data above a model predicted value may be less than the variability
in the data below a model predicted value. I guess mixture model is not
applicable here

Around a population estimate (say, mean or maximum likelihood) one of the
following may apply:
total standard deviation (SD) = SD(lower) + SD(upper)
total variance (var) = var(lower) + var(upper);

If it is possible, how do I assign variability in parameters and residual
(additive + proportional) errors?
To fit the observed,
Y = F + (a^2 +b^2/F^2)
F = f(x,Ai, var(Ai)); where Ai = a matrix of parameters; x = a vector
independent variables; var(Ai) = variability in the parameter (Ai)

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] "subset" or "condition" as argument to a function

2009-12-11 Thread Santosh
Thanks so much for the tips, I was able to use both parse() and eval()... I
found eval(), quote(), bquote() easier and more flexible to use and to pass
as arguments to a function.

I can't say enough that you really made my day! :)

Thanks,
Santosh

On Tue, Dec 1, 2009 at 9:36 AM, baptiste auguie <
baptiste.aug...@googlemail.com> wrote:

> Hi,
>
> an alternative to parse() is to use quote and bquote,
>
> set.seed(123)
> d = data.frame(a=letters[1:5], b=1:10, c=sample(0:1, 10, repl=TRUE))
>
> cond1 <- quote(a=="b")
> cond2 <- quote(b < 6)
> cond3 <- bquote(.(cond1) & .(cond2))
>
> subset(d, eval(cond1))
> subset(d, eval(cond2))
> subset(d, eval(cond3))
>
> HTH,
>
> baptiste
>
>
>
> 2009/12/1 William Dunlap :
> >> -Original Message-
> >> From: r-help-boun...@r-project.org
> >> [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh
> >> Sent: Tuesday, December 01, 2009 7:39 AM
> >> To: r-help@r-project.org
> >> Subject: Re: [R] "subset" or "condition" as argument to a function
> >>
> >> Dear R gurus..
> >> I had tried out some suggestions sent to me privately..and
> >> unfortunately,
> >> they did not work..
> >>
> >> To use a condiition in a subset, the associated dataframe needs to be
> >> attached and detached, which I found cumbersome to use if
> >> using more than 1
> >> dataframe (with different dimensions) with same condition. I
> >> would highly
> >> appreciate your suggestions to overcome this problem.. Please
> >> see my example
> >> of usage I am trying to implement. Please note that the
> >> "cond' takes in the
> >> character instead of logical values...
> >>
> >> cond1 <- 'group==1&sales>200'
> >> cond2 <- 'group==2&sales>200'
> >> cond3 <- 'group==3&sales>200'
> >>
> >> d1 <- subset(dat,subset=cond1)
> >> plot(y~x,data=dat,subset=cond1,type='b')
> >
> > The subset argument to plot (and many similar functions)
> > must be given as a literal expression, not a string that
> > could be parsed into an expression nor the name of an object
> > containing an expression nor a function call that evaluates
> > to an expression.  This design is handy for interactive
> > use but painful in programatic use.  One way to deal with
> > it is to use do.call, which evaluates all the arguments to
> > the function and then calls the function with the arguments
> > given literally.  Replace the above plot call with
> >  do.call("plot", list(y~x,data=dat,subset=parse(text=cond1),type='b'))
> > and see if you get what you want.
> >
> > Bill Dunlap
> > Spotfire, TIBCO Software
> > wdunlap tibco.com
> >
> >> lines(y~x,data=dat,subset=cond2)
> >> points(y~x,data=dat,subset=paste(cond1,cond2,sep='&'),col='blue')
> >> points(y~x,data=d1,subset=cond3,col='red')
> >>
> >> If I try the above, I get the following error message:
> >> *Error in subset.data.frame(dat, cond) : 'subset' must
> >> evaluate to logical*
> >>
> >> If you could also suggest references implementing similar
> >> code, I would
> >> highly appreciate it.
> >> Thanks so much,
> >>
> >> Santosh
> >>
> >> On Mon, Nov 23, 2009 at 6:38 PM, Santosh
> >>  wrote:
> >>
> >> > Thanks... I would try it out..
> >> >  -santosh
> >> >
> >> >
> >> > On Sat, Nov 21, 2009 at 12:04 AM, Bernardo Rangel Tura <
> >> > t...@centroin.com.br> wrote:
> >> >
> >> >> On Fri, 2009-11-20 at 17:40 -0800, Santosh wrote:
> >> >> > Dear Rxperts!
> >> >> >
> >> >> > I was wondering if it is possible to write a function
> >> which can take in
> >> >> > argument of a subset or condition.. Of course, I am aware of the
> >> >> alternate
> >> >> > methods like coplot, par.plot, xyplot etc... I am specifically
> >> >> interested in
> >> >> > using conditions/subsets with "plot"..
> >> >> >
> >> >> > A simple fragmented example is shown here..
> >> >> >
> >> >> > pltit <- function(y,x,dat,dat1,dat2,sbst) {
> >> >> > plot(y~x, data=dat, subset=sbst)
> &g

[R] Installation of R in Redhat Linux (64 bit)

2009-06-05 Thread Santosh
Dear R experts..
I would highly appreciate your help in troubleshooting errors as shown
below..
When I type R at shell prompt, I get the following error:

The version of R in 64bit Linux is: R version 2.9.0 (2009-04-17)
***
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared library '/usr/lib64/R/library/stats/libs/stats.so':
  /usr/lib64/R/library/stats/libs/stats.so: undefined symbol:
_gfortran_copy_string
During startup - Warning message:
package stats in options("defaultPackages") was not found


When I run the following:
nm /usr/lib64/R/library/stats/libs/stats.so | grep _gfortran_copy_string

gives  the result:
 U _gfortran_copy_string

Thanks so much in advance..

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] Installation of R in Redhat Linux (64 bit)

2009-06-06 Thread Santosh
Thanks for your responses!
I guess R was installed using the enterprise version (not fedora) rpm
package. The version of libgfortran is "libgfortran43-4.3.2-7.el5" and I
have libgfortran.so.3.

>From your email, I understand that libgfortran.so.1 is different from
libgfortran.so.3, and that _gfortran_copy_string is not used in the
libgfortran.so.3. Is that correct?

I see the libgfortran.so.1 is available for Fedora. would it work on RHEL5?
If not, where can I download libgfortran.so.1 for RHEL5?

Thanks much in advance.
Santosh


On Fri, Jun 5, 2009 at 11:49 PM, Prof Brian Ripley wrote:

> On Sat, 6 Jun 2009, Zeljko Vrba wrote:
>
>  On Fri, Jun 05, 2009 at 08:27:45PM -0700, Santosh wrote:
>>
>>>
>>> When I run the following:
>>> nm /usr/lib64/R/library/stats/libs/stats.so | grep _gfortran_copy_string
>>>
>>>  You probably need to install libraries related to gfortran.
>>
>
> Yes, specifically libgfortran.  Look at rpm -qa | grep libgfortran to see
> what versions are installed (if any).
>
> But how was R installed?  If this was installed from an RPM it should have
> satisfied such dependencies (and R-sig-fedora would be a more appropriate
> list).
>
> I think the issue relates to the version of libgfortran, and I've seen it
> using binaries compiled on an older version of Fedora. Maybe that symbol is
> used by gfortran 4.1.x and not by 4.3.x, so is in libgfortran.so.1 but not
> in libgfortran.so.3.  If this were Fedora, I would be sugggesting installing
> the compat-libgfortran-41 RPM.
>
> --
> 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/%7Eripley/>
> 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.


[R] Boxplots: side-by-side

2009-06-24 Thread Santosh
Dear R-sians..

I am trying to plot boxplots with side-by-side option.. I tried some of the
posted suggestions and could not make it work due to unequal sizes of
categories...

e.g.
weekly measured water depth values are categorized into 5 levels based on
their values
such measurement is again categorized into dichotomous levels - based on the
result of a test

I would like generate boxplot of water depth, with side-by-side display at
dichotomous levels (0,1), for each category (1-5).

However, dichotomous levels are not always available in each
category.e.g. category 1 may have all categorized as 0s, category 5 may
have all categorized as 1s, category 3 may have 0s and 1s, and so on...

I tried to use at=1:5+/- 0.1, add=T,xaxt="n" with complementary
(subset(dichot=0) & subset(dichot=1)) datasets  and it did not work..

I would highly appreciate your suggestions...

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] using xyplot

2009-03-22 Thread Santosh
Dear R-sians!
I am trying generate a bunch of xyplots

library(lattice)
myPanel <- function(x,y,xl=range(x),yl=range(y),...) {
  panel.xyplot(x,y,pch=20,col='blue',cex=0.7,xlim=xl,ylim=yl,...)
  panel.abline(v=0, col='gray30',lty=2,lwd=1.5,...)
  panel.loess(x,y,
span=2/3,family='gaussian',normalize=T,col='red',lwd=1.5,...)
#  panel.lmline(x,y, col='red',lwd=1.5,...)
  }

nms <- names(tmp7)[c(3:7,9)]
for (i in nms) {
 tmp1  <- xyplot(i~pk, data=tmp7, # different y's in the loop; x is same for
all
  as.table=T,panel=myPanel,main=paste('PK vs',i,'- overall'))
  pdf(paste("pkvs",i,"a.pdf",sep=""),w=10,h=8)
   print(tmp1)
  dev.off()
}

The above code does not seem to work. I was not able to use sapply with a
FUN=xyplot, either.
I was, however, able to generate the plots (with xyplot) when I hard-code
the index value!

Could you please help me troubleshooting the above code? If you can also
help with an alternate code using sapply, it would be helpful!


Thanks much in advance!

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] Binning

2009-03-29 Thread Santosh
Dear useRs...

How do you all do binning of an independent variable using R? For example,
observations of a dependent variable at times different from a nominal time.


Are there any R functions that help with binning?

Thanks much in advance!
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] Reading files

2009-04-25 Thread Santosh
Dear R-sians
Quick question...

1) From a flat (data) file with 100+ columns, how do I read specific columns
instead of reading the entire dataset? I am trying to avoid reading the
entire file followed by "subsetting".

2) is the a way to a call a column of dataframe through a variable.. e.g.

e,g
var="date"

something like...
data${var} <- "02 Oct 2009?

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] locating rcmd.exe through a batch script

2009-05-01 Thread Santosh
Dear R-sians!
The following command works fine on Dos Prompt, but not in a windows batch
script...

dir /S /B C:\Progra~1\R\R* |findstr /I "rcmd.exe" |findstr /I "2.8.1"


how do I implement the above in a windows batch script? I tried to use:
for /F "usebackq tokens=*" %%i in (`dir /S /B C:\Progra~1\R\R* |findstr /I
"rcmd.exe" |findstr /I "2.8.1"`) do @echo %%i

and it does not seem to work! Where am I doing wrong?


THANKS A TON in advance!

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] locating rcmd.exe through a batch script

2009-05-01 Thread Santosh
Dear R-sians...
Installing libraries through RCMD INSTALL does not seem to work.. Is the
following command c

R CMD install -l "C:\Program Files\R\R-2.8.1\library"
"C:\temp\xpose4_4.0.4_win32
.zip"

I get the following error message.
'C:\temp\xpose4_4.0.4_win32.zip':Windows binary packages in zipfiles are not
supported: skipping


On Fri, May 1, 2009 at 3:51 PM, Santosh  wrote:

> Dear R-sians!
> The following command works fine on Dos Prompt, but not in a windows batch
> script...
>
> dir /S /B C:\Progra~1\R\R* |findstr /I "rcmd.exe" |findstr /I "2.8.1"
>
>
> how do I implement the above in a windows batch script? I tried to use:
> for /F "usebackq tokens=*" %%i in (`dir /S /B C:\Progra~1\R\R* |findstr /I
> "rcmd.exe" |findstr /I "2.8.1"`) do @echo %%i
>
> and it does not seem to work! Where am I doing wrong?
>
>
> THANKS A TON in advance!
>
> 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] xyplot - help with multiple Y's vs. X of a member data in multiple panels

2009-12-31 Thread Santosh
Dear R experts,
Wish you all a HAPPY NEW YEAR!

How do I go about plotting (using lattice) overlays of an ID (group=ID)
observed, fitted data in each panel of a multiple panel plot (each panel
identified by DS1 + DS2 + DS3)? "x" variable is X1 in the accompanying
section of a dataset. each individual is identified by color and Y's are
identified by "pch" or "lty".

I guess the code goes something like the one below, but could not get the
proper use of panel functions

xyplot(Y1+Y2+Y3~X1|DS1+DS2+DS3,data=d1,group=ID,...)

A sample section of  the data is given below..
DS3,DS2,DS1,ID,X1,TYPE,Y1,Y2,Y3
1,1,1,1,6.087,1,1.81,1.64,1.82
1,1,1,1,6.337,1,2.61,2.48,2.56
1,1,1,1,6.837,1,3.14,3.10,3.08
1,1,1,1,7.837,1,3.39,3.50,3.36
1,1,1,1,8.837,1,3.34,3.62,3.39
1,1,1,1,9.837,1,3.27,3.63,3.34
1,1,1,1,10.837,1,3.25,3.59,3.25
1,1,1,1,12.862,1,2.96,3.44,3.04
1,1,1,1,15.837,1,2.72,3.15,2.68
1,1,1,1,19.844,1,2.21,2.69,2.18
1,1,1,1,26.837,1,1.29,1.79,1.28
1,1,1,1,33.858,1,0.40,0.88,0.41
1,1,1,1,40.886,1,-0.43,0.03,-0.41
1,0.1,1,2,8.092,1,0.03,-0.67,0.04
1,0.1,1,2,8.342,1,0.78,0.14,0.57
1,0.1,1,2,8.842,1,0.90,0.71,0.84
1,0.1,1,2,9.842,1,0.79,1.00,0.84
1,0.1,1,2,10.842,1,0.76,1.02,0.73
1,0.1,1,2,11.842,1,0.45,0.95,0.60
1,0.1,1,2,12.842,1,0.37,0.86,0.48
1,0.1,1,2,14.873,1,0.07,0.63,0.24
1,0.1,1,2,17.842,1,-0.21,0.29,-0.10
1,0.1,1,2,21.842,1,-0.17,-0.15,-0.52
1,0.1,1,3,7.208,1,-0.22,-0.77,-0.15
1,0.1,1,3,7.458,1,0.70,0.03,0.53
1,0.1,1,3,7.958,1,0.98,0.60,0.90
1,0.1,1,3,8.958,1,0.83,0.89,0.93
1,0.1,1,3,9.958,1,0.73,0.91,0.79
1,0.1,1,3,10.958,1,0.65,0.84,0.63
1,0.1,1,3,11.958,1,0.37,0.75,0.46
1,0.1,1,3,13.958,1,0.26,0.53,0.14
1,0.1,1,3,16.958,1,-0.34,0.19,-0.32
1,0.1,1,4,7.305,1,-1.09,0.24,-1.16
1,0.1,1,4,7.805,1,-0.61,0.80,-0.44
1,0.1,1,4,8.805,1,-0.03,1.10,0.04
1,0.1,1,4,9.805,1,0.14,1.12,0.20
1,0.1,1,4,10.805,1,0.26,1.05,0.25
1,0.1,1,4,11.805,1,0.28,0.96,0.25
1,0.1,1,4,13.817,1,0.30,0.73,0.18
1,0.1,1,4,16.805,1,0.10,0.39,-0.01
1,0.1,1,4,20.805,1,-0.47,-0.06,-0.31
1,0.1,1,5,8.307,1,-0.36,0.03,-0.48
1,0.1,1,5,8.807,1,-0.17,0.60,-0.02
1,0.1,1,5,9.807,1,0.05,0.89,0.17
1,0.1,1,5,10.807,1,0.18,0.91,0.14
1,0.1,1,5,11.807,1,0.03,0.84,0.06
1,0.1,1,5,12.807,1,0.10,0.75,-0.04
1,0.1,1,5,14.817,1,-0.28,0.53,-0.26
0,0.1,1,5,17.807,1,-0.65,0.19,-0.60
0,0.1,1,6,6.133,1,-0.41,-0.67,-0.42
0,0.1,1,6,6.383,1,0.41,0.14,0.55
0,0.1,1,6,6.883,1,1.36,0.71,1.21
0,0.1,1,6,7.883,1,1.52,1.00,1.44
0,0.1,1,6,8.883,1,1.40,1.02,1.33
0,0.1,1,6,9.883,1,1.05,0.95,1.12
0,0.1,1,6,10.883,1,0.91,0.86,0.89
0,0.1,1,6,12.89,1,0.42,0.63,0.44
0,0.1,1,6,15.883,1,-0.19,0.29,-0.14
1,5,1,7,9.983,1,3.27,3.02,3.20
1,5,1,7,10.233,1,3.94,3.88,3.87
1,5,1,7,10.733,1,4.35,4.54,4.40
1,5,1,7,11.733,1,4.68,5.00,4.76
1,5,1,7,12.733,1,4.87,5.16,4.87
1,5,1,7,13.733,1,4.80,5.21,4.91
1,5,1,7,14.733,1,4.97,5.22,4.92
1,5,1,7,16.733,1,4.87,5.16,4.90
1,5,1,7,19.754,1,4.72,5.02,4.82
1,5,1,7,23.733,1,4.67,4.78,4.68
1,5,1,7,30.733,1,4.31,4.29,4.35
1,5,1,7,37.733,1,4.01,3.68,3.90
1,5,1,7,44.733,1,3.40,2.92,3.31
1,5,1,7,51.749,1,2.53,2.01,2.52
1,5,1,7,58.733,1,1.57,1.10,1.57
1,5,1,7,65.733,1,0.54,0.23,0.62
1,5,1,7,72.733,1,-0.23,-0.54,-0.24
1,5,1,7,79.733,1,-1.03,-1.14,-0.94

Please let me know if you need additional info.

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] xyplot - help with multiple Y's vs. X of a member data in multiple panels

2010-01-04 Thread Santosh
Hi Jim and others,

I tried suggestions and somehow the graphs do not seem to be aligned on
X-axis (i.e. they appear to be shifted on x-axis).. I guess panel.xyplot or
panel.superpose is needed? I am not sure what the "group" variable be
panel.xyplot, whether it is the "ID" or the "newFactor". I tried
panel.xyplot(x,y,) with "group=ID" and "group=newFactor" and it did not
work.

Your suggestions would be highly appreciated!!

Regards,
Santosh

On Thu, Dec 31, 2009 at 6:59 PM, jim holtman  wrote:

> I am not too sure if this is what you are after, but I just created a new
> factor for the panel:
>
> # create a new factor
> d1$newFactor <- factor(paste(d1$DS1, "+", d1$DS2, "+", d1$DS3))
> xyplot(Y1+Y2+Y3~X1|newFactor,data=d1,group=ID)
>
>
> On Thu, Dec 31, 2009 at 6:25 AM, Santosh  wrote:
>
>> Dear R experts,
>> Wish you all a HAPPY NEW YEAR!
>>
>> How do I go about plotting (using lattice) overlays of an ID (group=ID)
>> observed, fitted data in each panel of a multiple panel plot (each panel
>> identified by DS1 + DS2 + DS3)? "x" variable is X1 in the accompanying
>> section of a dataset. each individual is identified by color and Y's are
>> identified by "pch" or "lty".
>>
>> I guess the code goes something like the one below, but could not get the
>> proper use of panel functions
>>
>> xyplot(Y1+Y2+Y3~X1|DS1+DS2+DS3,data=d1,group=ID,...)...
>>[[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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xyplot - help with multiple Y's vs. X of a member data in multiple panels

2010-01-04 Thread Santosh
Hi,
Thanks for your email..

Each panel (in a multiple panel) is identified by "DS1, DS2 & DS3" in the
dataset sent earlier. I would like an overlay of Y1, Y2 & Y3 (each by
different lines) for each ID in the group. Each ID in the group is
represented by a color.

Regards & Thanks,
Santosh

On Mon, Jan 4, 2010 at 5:07 PM, Peter Ehlers  wrote:

> Can you clarify how many curves you want in each panel?
> You have 3 Ys and your original email indicated at least
> 7 ID values. Do you really want 21 curves in each panel?
> Or do you want separate panels for the Ys?
>
> Re your code: note that, regarding a formula of the
> type y1 + y2 ~ x, ?xyplot says:
>
> "This feature cannot be used in conjunction with
> the groups argument."
>
>  -Peter Ehlers
>
> Santosh wrote:
>
>> Hi Jim and others,
>>
>> I tried suggestions and somehow the graphs do not seem to be aligned on
>> X-axis (i.e. they appear to be shifted on x-axis).. I guess panel.xyplot
>> or
>> panel.superpose is needed? I am not sure what the "group" variable be
>> panel.xyplot, whether it is the "ID" or the "newFactor". I tried
>> panel.xyplot(x,y,) with "group=ID" and "group=newFactor" and it did not
>> work.
>>
>> Your suggestions would be highly appreciated!!
>>
>> Regards,
>> Santosh
>>
>> On Thu, Dec 31, 2009 at 6:59 PM, jim holtman  wrote:
>>
>>  I am not too sure if this is what you are after, but I just created a new
>>> factor for the panel:
>>>
>>> # create a new factor
>>> d1$newFactor <- factor(paste(d1$DS1, "+", d1$DS2, "+", d1$DS3))
>>> xyplot(Y1+Y2+Y3~X1|newFactor,data=d1,group=ID)
>>>
>>>
>>> On Thu, Dec 31, 2009 at 6:25 AM, Santosh  wrote:
>>>
>>>  Dear R experts,
>>>> Wish you all a HAPPY NEW YEAR!
>>>>
>>>> How do I go about plotting (using lattice) overlays of an ID (group=ID)
>>>> observed, fitted data in each panel of a multiple panel plot (each panel
>>>> identified by DS1 + DS2 + DS3)? "x" variable is X1 in the accompanying
>>>> section of a dataset. each individual is identified by color and Y's are
>>>> identified by "pch" or "lty".
>>>>
>>>> I guess the code goes something like the one below, but could not get
>>>> the
>>>> proper use of panel functions
>>>>
>>>> xyplot(Y1+Y2+Y3~X1|DS1+DS2+DS3,data=d1,group=ID,...)...
>>>>   [[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<
>>>> http://www.r-project.org/posting-guide.html>
>>>>
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>>
>>>
>>> --
>>> Jim Holtman
>>> Cincinnati, OH
>>> +1 513 646 9390
>>>
>>> What is the problem that you are trying to solve?
>>>
>>>
>>[[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
> --
> Peter Ehlers
> University of Calgary
> 403.202.3921
>

[[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] xyplot - help with multiple Y's vs. X of a member data in multiple panels

2010-01-05 Thread Santosh
Thanks for your email.. Yes, I am looking for lattice version of matplot...
Attached are some codes for simplicity for rapid testing..Any suggestions
would be highly appreciated...

library(lattice)
dat <- data.frame(x = rep(1:10,2),
  y1 = rnorm(20),
  y2=rnorm(20,sd=1.3),
  y3=rnorm(20,sd=0.3),
  gp1 = rep(letters[1:8],each=10),
  gp2=rep(LETTERS[1:4],each=20),
  gp3=rep(c("P","Q"),each=40))

pset <- simpleTheme(lty = c(0,1,2), col=c("blue","red","green"))
xyplot(y1+y2+y3~x|factor(gp3)+factor(gp2),
data=dat,
groups=gp1,
allow.multiple=T,
panel=panel.superpose,
distribute.type=T,
type=c("b","l","l"),
par.settings=pset,
strip=strip.custom(strip.names=F,strip.levels=T))

Thanks..
Santosh


On Mon, Jan 4, 2010 at 11:16 PM, Dennis Murphy  wrote:

> Hi:
>
> I think Santosh wants a Lattice version of matplot. I didn't find anything
> with help.search(), though...
>
> Dennis
>
>
> On Mon, Jan 4, 2010 at 8:14 PM, Santosh  wrote:
>
>> Hi,
>> Thanks for your email..
>>
>> Each panel (in a multiple panel) is identified by "DS1, DS2 & DS3" in the
>> dataset sent earlier. I would like an overlay of Y1, Y2 & Y3 (each by
>> different lines) for each ID in the group. Each ID in the group is
>> represented by a color.
>>
>> Regards & Thanks,
>> Santosh
>>
>> On Mon, Jan 4, 2010 at 5:07 PM, Peter Ehlers  wrote:
>>
>> > Can you clarify how many curves you want in each panel?
>> > You have 3 Ys and your original email indicated at least
>> > 7 ID values. Do you really want 21 curves in each panel?
>> > Or do you want separate panels for the Ys?
>> >
>> > Re your code: note that, regarding a formula of the
>> > type y1 + y2 ~ x, ?xyplot says:
>> >
>> > "This feature cannot be used in conjunction with
>> > the groups argument."
>> >
>> >  -Peter Ehlers
>> >
>> > Santosh wrote:
>> >
>> >> Hi Jim and others,
>> >>
>> >> I tried suggestions and somehow the graphs do not seem to be aligned on
>> >> X-axis (i.e. they appear to be shifted on x-axis).. I guess
>> panel.xyplot
>> >> or
>> >> panel.superpose is needed? I am not sure what the "group" variable be
>> >> panel.xyplot, whether it is the "ID" or the "newFactor". I tried
>> >> panel.xyplot(x,y,) with "group=ID" and "group=newFactor" and it did not
>> >> work.
>> >>
>> >> Your suggestions would be highly appreciated!!
>> >>
>> >> Regards,
>> >> Santosh
>> >>
>> >> On Thu, Dec 31, 2009 at 6:59 PM, jim holtman 
>> wrote:
>> >>
>> >>  I am not too sure if this is what you are after, but I just created a
>> new
>> >>> factor for the panel:
>> >>>
>> >>> # create a new factor
>> >>> d1$newFactor <- factor(paste(d1$DS1, "+", d1$DS2, "+", d1$DS3))
>> >>> xyplot(Y1+Y2+Y3~X1|newFactor,data=d1,group=ID)
>> >>>
>> >>>
>> >>> On Thu, Dec 31, 2009 at 6:25 AM, Santosh 
>> wrote:
>> >>>
>> >>>  Dear R experts,
>> >>>> Wish you all a HAPPY NEW YEAR!
>> >>>>
>> >>>> How do I go about plotting (using lattice) overlays of an ID
>> (group=ID)
>> >>>> observed, fitted data in each panel of a multiple panel plot (each
>> panel
>> >>>> identified by DS1 + DS2 + DS3)? "x" variable is X1 in the
>> accompanying
>> >>>> section of a dataset. each individual is identified by color and Y's
>> are
>> >>>> identified by "pch" or "lty".
>> >>>>
>> >>>> I guess the code goes something like the one below, but could not get
>> >>>> the
>> >>>> proper use of panel functions
>> >>>>
>> >>>> xyplot(Y1+Y2+Y3~X1|DS1+DS2+DS3,data=d1,group=ID,...)...
>> >>>>   [[alternative HTML version deleted]]
>> >>>>
>> >>>> __
>> >>>>
>> >>>> R-help@r-project.org mailing list
>> >>>> https://stat.et

Re: [R] xyplot - help with multiple Y's vs. X of a member data in multiple panels

2010-01-05 Thread Santosh
Hi.. thanks for the tips.. that variation works. How can I control "pch",
"lty" and "col" for each member (gp1) in the group (paste(gp2, gp3))?
Regards,Santosh

On Tue, Jan 5, 2010 at 2:15 AM, Felix Andrews  wrote:

> You should reshape the data into a long format, and an easy way to do
> that is to use the 'reshape' package:
>
> library(reshape)
> mdat <- melt(dat, measure.vars = c("y1", "y2", "y3"))
>
> I'm still not sure what you want in the plot. Confusingly, your last
> example dropped the "ID" you referred to earlier, and appears to use
> "grp1" in the same role.
>
> Maybe something like this:
>
> xyplot(value ~ x | paste(gp2, gp3), mdat,
>   groups = paste(variable, gp1), type = "l",
>   auto.key = list(lines = TRUE, columns = 3),
>   par.settings = simpleTheme(col = 1:8, lty = rep(1:3, each = 8)))
>
>
>
> 2010/1/5 Santosh :
> > Thanks for your email.. Yes, I am looking for lattice version of
> matplot...
> > Attached are some codes for simplicity for rapid testing..Any suggestions
> > would be highly appreciated...
> >
> > library(lattice)
> > dat <- data.frame(x = rep(1:10,2),
> >  y1 = rnorm(20),
> >  y2=rnorm(20,sd=1.3),
> >  y3=rnorm(20,sd=0.3),
> >  gp1 = rep(letters[1:8],each=10),
> >  gp2=rep(LETTERS[1:4],each=20),
> >  gp3=rep(c("P","Q"),each=40))
> >
> > pset <- simpleTheme(lty = c(0,1,2), col=c("blue","red","green"))
> > xyplot(y1+y2+y3~x|factor(gp3)+factor(gp2),
> >data=dat,
> >groups=gp1,
> >    allow.multiple=T,
> >panel=panel.superpose,
> >distribute.type=T,
> >type=c("b","l","l"),
> >    par.settings=pset,
> >strip=strip.custom(strip.names=F,strip.levels=T))
> >
> > Thanks..
> > Santosh
> >
> >
> > On Mon, Jan 4, 2010 at 11:16 PM, Dennis Murphy 
> wrote:
> >
> >> Hi:
> >>
> >> I think Santosh wants a Lattice version of matplot. I didn't find
> anything
> >> with help.search(), though...
> >>
> >> Dennis
> >>
> >>
> >> On Mon, Jan 4, 2010 at 8:14 PM, Santosh  wrote:
> >>
> >>> Hi,
> >>> Thanks for your email..
> >>>
> >>> Each panel (in a multiple panel) is identified by "DS1, DS2 & DS3" in
> the
> >>> dataset sent earlier. I would like an overlay of Y1, Y2 & Y3 (each by
> >>> different lines) for each ID in the group. Each ID in the group is
> >>> represented by a color.
> >>>
> >>> Regards & Thanks,
> >>> Santosh
> >>>
> >>> On Mon, Jan 4, 2010 at 5:07 PM, Peter Ehlers 
> wrote:
> >>>
> >>> > Can you clarify how many curves you want in each panel?
> >>> > You have 3 Ys and your original email indicated at least
> >>> > 7 ID values. Do you really want 21 curves in each panel?
> >>> > Or do you want separate panels for the Ys?
> >>> >
> >>> > Re your code: note that, regarding a formula of the
> >>> > type y1 + y2 ~ x, ?xyplot says:
> >>> >
> >>> > "This feature cannot be used in conjunction with
> >>> > the groups argument."
> >>> >
> >>> >  -Peter Ehlers
> >>> >
> >>> > Santosh wrote:
> >>> >
> >>> >> Hi Jim and others,
> >>> >>
> >>> >> I tried suggestions and somehow the graphs do not seem to be aligned
> on
> >>> >> X-axis (i.e. they appear to be shifted on x-axis).. I guess
> >>> panel.xyplot
> >>> >> or
> >>> >> panel.superpose is needed? I am not sure what the "group" variable
> be
> >>> >> panel.xyplot, whether it is the "ID" or the "newFactor". I tried
> >>> >> panel.xyplot(x,y,) with "group=ID" and "group=newFactor" and it did
> not
> >>> >> work.
> >>> >>
> >>> >> Your suggestions would be highly appreciated!!
> >>> >>
> >>> >> Regards,
> >>> >> Santosh
> >>> >>
> >>> >> On Thu, Dec 31, 2009 at 6:59 PM, j

[R] Barplot/Histogram (lattice)

2010-01-28 Thread Santosh
Dear Rxperts..

what settings in barplot and histogram do I use, to show bars in an
monotonously increasing or decreasing order of the frequency of a
categorical variable?

an example is provided below..

histogram(~factor(sample(letters,200,rep=T)))

I was able to get it in 3 - 4 steps.. l
a1 <- sample(letter,200,rep=T)
a2 <- table(a1)
barplot(a2); barplot(sort(a2)) # all variables are not displayed on the
x-axis in the barplot
histogram(factor(a1)) # the resulting bars are not shown in seqentially
increasing or decreasing order

how do I use similar plots if I have data.frame...
example is shown below..

b1 <- data.frame(lets=sample(letters,200,rep=T),n=seq(200))
barplot(sort(table(b1$lets))
histogram(b1$lets)

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] lattice key inside panel

2010-02-02 Thread Santosh
Dear R-experts..

I am trying to generate legend inside panels of lattice barplots..
Following is a sample dataset..
   Sno DN  EP Y1 Y2
11 D1 A20 19 19
21 D1 A50  8  9
31 D1 A70  3  4
42 D2 A20 22 22
52 D2 A50 13 14
62 D2 A70  6  7
73 D2 A20 23 23
83 D2 A50 12 13
94 D1 A20 19 19
10   4 D1 A50 10 10
11   4 D1 A70  3  4
12   5 D1 A20 28 28
13   5 D1 A50 16 16
14   5 D1 A70  7  7
15   5 D3 A20 24 24
16   5 D3 A50 14 14
17   5 D3 A70  6  6
18   6 D4 A20 15 15
19   6 D4 A50  7  8
20   6 D4 A70  3  3
21   7 D5 A20 19 20
22   7 D5 A50  5  6
23   7 D5 A70  3  3
24   8 D6 A20 26 26
25   8 D6 A50 10 10
26   9 D7 A20 30 30
27   9 D7 A50 10  9
28  10 D7 A20 21 22
29  10 D7 A50 10 10
30  10 D7 A70  4  4

I am trying to generate barplot with legend inside each panel..where the
rectangular colors indicate the values for "DN". I have not been successful
in generating labels inside.. what am I missing?

barchart(Y1~factor(as.character(EP))|Sno,
groups=DN,
orgin=0,
subscripts=T,
panel = function(x,y,groups=groups, ...) {
  require(grid)
  panel.barchart(x,y,groups=groups,...)
  #panel.text(...)
  draw.key(list(
  rectangles=list(col=rainbow(6)),
  text=list(lab='DN'),
  draw = TRUE,
   vp = viewport(x = unit(0.5, "npc"), y = unit(0.5, "npc"},
data=x1,
distribute.type=T,
layout=c(3,3),
scales=list(rot=45,relation="free"))

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.


[R] Fwd: lattice key inside panel

2010-02-02 Thread Santosh
Dear R-experts..
It is a re-post, as I am not sure if I sent it to the right address... sorry
if it is a duplicate...

I am trying to generate barchart with legend inside each panel..where the
rectangular colors indicate the values for "DN". I have not been successful
in generating labels inside.. what am I missing?

Following is a sample dataset..
   Sno DN  EP Y1 Y2
11 D1 A20 19 19
21 D1 A50  8  9
31 D1 A70  3  4
42 D2 A20 22 22
52 D2 A50 13 14
62 D2 A70  6  7
73 D2 A20 23 23
83 D2 A50 12 13
94 D1 A20 19 19
10   4 D1 A50 10 10
11   4 D1 A70  3  4
12   5 D1 A20 28 28
13   5 D1 A50 16 16
14   5 D1 A70  7  7
15   5 D3 A20 24 24
16   5 D3 A50 14 14
17   5 D3 A70  6  6
18   6 D4 A20 15 15
19   6 D4 A50  7  8
20   6 D4 A70  3  3
21   7 D5 A20 19 20
22   7 D5 A50  5  6
23   7 D5 A70  3  3
24   8 D6 A20 26 26
25   8 D6 A50 10 10
26   9 D7 A20 30 30
27   9 D7 A50 10  9
28  10 D7 A20 21 22
29  10 D7 A50 10 10
30  10 D7 A70  4  4


barchart(Y1~factor(as.character(EP))|Sno,
groups=DN,
orgin=0,
subscripts=T,
panel = function(x,y,groups=groups, ...) {
  require(grid)
  panel.barchart(x,y,groups=groups,...)
  #panel.text(...)
  draw.key(list(
  rectangles=list(col=rainbow(6)),
  text=list(lab='DN'),
  draw = TRUE,
   vp = viewport(x = unit(0.5, "npc"), y = unit(0.5, "npc"},
data=x1,
distribute.type=T,
layout=c(3,3),
scales=list(rot=45,relation="free"))

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] lattice key inside panel

2010-02-03 Thread Santosh
Dear R-experts..

Thanks to Dennis and Deepayan for the valuable tips; I used a work-around to
indicate grouping variable inside a panel of a lattice. I am yet to get the
legends properly. Is "subscripts" needed for generating the legends inside a
lattice panel?

The work-around R code for the earlier provided dataset is included below..

mysymbols <- LETTERS[1:6]
barchart(Y1~factor(as.character(EP))|factor(Sno),
data=ex1,
groups=factor(DN),
panel=function(x,y,groups,subscripts, ...)
{panel.superpose(x,y,groups=groups,subscripts,

panel.groups="panel.barchart",pch=mysymbols,distribute.type=T,col=rainbow(20))
x1<- x; y1<- y; subs <- subscripts
ltext(x1,y1,subscripts=subs,lab=ex1$DN)},
layout = c(3, 3), aspect = 1,
distribute.type=T,
scales=list(rot=45,relation="free"),
strip=strip.custom(list(strip.names=T,strip.levels=T)))

Your assistance is very highly appreciated.

Thanks
Santosh

On Wed, Feb 3, 2010 at 1:16 AM, Deepayan Sarkar
wrote:

> On Wed, Feb 3, 2010 at 10:50 AM, Santosh  wrote:
> > Dear R-experts..
> >
> > I am trying to generate legend inside panels of lattice barplots..
> > Following is a sample dataset..
> >   Sno DN  EP Y1 Y2
> > 11 D1 A20 19 19
> > 21 D1 A50  8  9
> > 31 D1 A70  3  4
> > 42 D2 A20 22 22
> > 52 D2 A50 13 14
> > 62 D2 A70  6  7
> > 73 D2 A20 23 23
> > 83 D2 A50 12 13
> > 94 D1 A20 19 19
> > 10   4 D1 A50 10 10
> > 11   4 D1 A70  3  4
> > 12   5 D1 A20 28 28
> > 13   5 D1 A50 16 16
> > 14   5 D1 A70  7  7
> > 15   5 D3 A20 24 24
> > 16   5 D3 A50 14 14
> > 17   5 D3 A70  6  6
> > 18   6 D4 A20 15 15
> > 19   6 D4 A50  7  8
> > 20   6 D4 A70  3  3
> > 21   7 D5 A20 19 20
> > 22   7 D5 A50  5  6
> > 23   7 D5 A70  3  3
> > 24   8 D6 A20 26 26
> > 25   8 D6 A50 10 10
> > 26   9 D7 A20 30 30
> > 27   9 D7 A50 10  9
> > 28  10 D7 A20 21 22
> > 29  10 D7 A50 10 10
> > 30  10 D7 A70  4  4
> >
> > I am trying to generate barplot with legend inside each panel..where the
> > rectangular colors indicate the values for "DN". I have not been
> successful
> > in generating labels inside.. what am I missing?
>
> You should have
>
> draw.key(list(
>   rectangles=list(col=rainbow(6)),
>   text=list(lab='DN')),
>  draw = TRUE,
>  vp = viewport(x = unit(0.5, "npc"), y = unit(0.5,
> "npc")))
>
> whereas you had
>
> draw.key(list(
>   rectangles=list(col=rainbow(6)),
>   text=list(lab='DN'),
>   draw = TRUE,
>   vp = viewport(x = unit(0.5, "npc"), y =
> unit(0.5, "npc"
>
> -Deepayan
>
> >
> > barchart(Y1~factor(as.character(EP))|Sno,
> >groups=DN,
> >orgin=0,
> >subscripts=T,
> >panel = function(x,y,groups=groups, ...) {
> >      require(grid)
> >  panel.barchart(x,y,groups=groups,...)
> >  #panel.text(...)
> >  draw.key(list(
> >  rectangles=list(col=rainbow(6)),
> >  text=list(lab='DN'),
> >  draw = TRUE,
> >   vp = viewport(x = unit(0.5, "npc"), y = unit(0.5, "npc"},
> >data=x1,
> >distribute.type=T,
> >layout=c(3,3),
> >scales=list(rot=45,relation="free"))
> >
> > 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.


[R] Export R generated tables and figures to MS Word

2013-03-12 Thread Santosh
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] Export R generated tables and figures to MS Word

2013-03-13 Thread Santosh
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  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 A&M 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"  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.


Re: [R] suggestions about import SAS Transport files to R.

2013-03-26 Thread Santosh
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.


[R] tables package - error message of "duplicate values"

2013-04-19 Thread Santosh
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"

2013-04-19 Thread Santosh
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 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
>
>

[[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"

2013-04-19 Thread Santosh
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 wrote:

>
> 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 
> 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] creating dummy variables

2013-04-20 Thread Santosh
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  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-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] NAMESPACE and imports

2013-04-21 Thread Santosh
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
wrote:

> 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.pdf<http://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/

[R] Hmisc & pdflatex

2013-04-22 Thread Santosh
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

2013-04-22 Thread Santosh
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  loaded.
("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.
 \midrule

l.8 \midrule

! Undefined control sequence.
 \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 wrote:

> 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
>> 

Re: [R] Hmisc & pdflatex

2013-04-22 Thread Santosh
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  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  loaded.
> ("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.
>  \midrule
>
> l.8 \midrule
>
> ! Undefined control sequence.
>  \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 
> wrote:
>
>> 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.

[R] Tables package - remove NAs and NaN

2013-04-22 Thread Santosh
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] Tables package - remove NAs and NaN

2013-04-24 Thread Santosh
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\temp>svn 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 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 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

2013-04-24 Thread Santosh
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  wrote:

> Thanks so much.. I will try it out.
> Regards,
> Santosh
>
>
> On Wed, Apr 24, 2013 at 1:39 PM, Duncan Murdoch 
> wrote:
>
>> 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.gz<http://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.zip<http://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\temp>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/<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/tables<http://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.
>>>>
>>>> 

[R] RStudio.. text editor

2013-04-25 Thread Santosh
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

2013-04-25 Thread Santosh
Great Thanks so much!



On Thu, Apr 25, 2013 at 12:30 PM, John Kane  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.


[R] Grouped spaghetti plots in multipanel graphs

2013-04-30 Thread Santosh
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] Lattice xyplot multipanels

2013-05-01 Thread Santosh
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

2013-05-01 Thread Santosh
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 wrote:

>
> 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

2013-05-01 Thread Santosh
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  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 wrote:
>
>>
>> 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

2013-05-02 Thread Santosh
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.


Re: [R] Create and read symbolic links in Windows

2013-05-02 Thread Santosh
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 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
> 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-help<https://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

2013-05-03 Thread Santosh
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 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
>> 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
>>  (self)
>> 1 South Parks Road, +44 1865 272866  (PA)
>>
>> Oxford OX1 3TG, UKFax: +44 1865 272595
>> 
>>
>> __**__
>> R-help@r-project.org <mailto:R-help@r-project.org> mailing list
>> 
>> https://stat.ethz.ch/mailman/_**_listinfo/r-help<https://stat.ethz.ch/mailman/__listinfo/r-help>
>>
>> 
>> <https://stat.ethz.ch/mailman/**listinfo/r-help<https://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>
>>
>> 
>> <http://www.R-project.org/**posting-guide.html<http://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

2013-05-03 Thread Santosh
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  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 
> 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
>>> 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
>>>  (self)
>>> 1 South Parks Road, +44 1865 272866  (PA)
>>>
>>> Oxford OX1 3TG, UKFax: +44 1865 272595
>>> 
>>>
>>> __**__
>>> R-help@r-project.org <mailto:R-help@r-project.org> mailing list
>>> 
>>> https://stat.ethz.ch/mailman/_**_listinfo/r-help<https://stat.ethz.ch/mailman/__listinfo/r-help>
>>>
>>> 
>>> <https://stat.ethz.ch/mailman/**listinfo/r-help<https://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>
>>>
>>> 
>>> <http://www.R-project.org/**posting-guide.html<http://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

2013-05-21 Thread Santosh
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  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  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 
>> wrote:
>>
>>>
>>> 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

2013-05-21 Thread Santosh
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  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  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  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 
>>> wrote:
>>>
>>>>
>>>> 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...
>>>>
>>>&g

Re: [R] Lattice xyplot multipanels

2013-05-21 Thread Santosh
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 wrote:

>
> 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,
&

Re: [R] Lattice xyplot multipanels

2013-05-22 Thread Santosh
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  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 
> wrote:
>
>>
>> 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   2   3   >