Re: [R] barplots and missing xlabels

2008-01-14 Thread Jim Lemon
Geoff Russell wrote:
 Dear useRs,
 
 The following plots only print 2 of the 4 labels under the bars, is there
 a way please to force all 4 labels to print?
 
 par(mfrow=c(1,2),mar=c(2,7,3,1))
 dat-data.frame(AgeGroup=c(2-15,16-20,21-25,26-39),
 Aorta=c(20,8,30,60),
 Coronary=c(7,30,55,65))
 barplot(dat$Aorta,ylim=c(0,100),names=as.vector(dat$AgeGroup),ylab=c(Prevalence
 (%)))
 title(main=list(Aorta,font=0))
 barplot(dat$Coro,names=as.vector(dat$Age),ylim=c(0,100))
 title(main=list(Coronary Artery,font=0))
 
Hi Geoff,

Try this:

barplot(dat$Aorta,ylim=c(0,100),
  names=rep(,length(dat$AgeGroup)),
  ylab=c(Prevalence (%)))
mtext(dat$AgeGroup,1,2)

Jim

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


Re: [R] is it safe to replace every - by = in R code?

2008-01-14 Thread Jim Lemon
Charilaos Skiadas wrote:
 And of course let's not forget that a particularly twisted individual  
 could overwrite =:
 
   `=` - function(x,y) print(x+y)
   3 = 4
 [1] 7
   3 - 4
 Error in 3 - 4 : invalid (do_set) left-hand side to assignment
 
 
 I also was for a while mystified by the - assignment, and preferred  
 = instead, but have since grown out of it, and now find - more clear  
 (especially since it makes the separation between function arguments  
 and assignments clear).
 
 I now have a problem whenever I switch to another programming  
 language 
 
Except APL, of course.

Jim

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


Re: [R] barplots and missing xlabels

2008-01-14 Thread Geoff Russell
See below

On 1/14/08, Jim Lemon [EMAIL PROTECTED] wrote:
 Geoff Russell wrote:
  Dear useRs,
 
  The following plots only print 2 of the 4 labels under the bars, is there
  a way please to force all 4 labels to print?
 
  par(mfrow=c(1,2),mar=c(2,7,3,1))
  dat-data.frame(AgeGroup=c(2-15,16-20,21-25,26-39),
  Aorta=c(20,8,30,60),
  Coronary=c(7,30,55,65))
  barplot(dat$Aorta,ylim=c(0,100),names=as.vector(dat$AgeGroup),ylab=c(Prevalence
  (%)))
  title(main=list(Aorta,font=0))
  barplot(dat$Coro,names=as.vector(dat$Age),ylim=c(0,100))
  title(main=list(Coronary Artery,font=0))
 
 Hi Geoff,

 Try this:

 barplot(dat$Aorta,ylim=c(0,100),
   names=rep(,length(dat$AgeGroup)),
   ylab=c(Prevalence (%)))
 mtext(dat$AgeGroup,1,2)

Thanks, but this puts all the labels overlaying each other in the
2nd line on the bottom of the plot. But

mtext(as.vector(dat$AgeGroup),1,at=c(1,2,3,4))

sort of works and if I play with the at argument I could make it work, but I'm
sure there must be a better way.

Geoff.



 Jim



-- 
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] clusterwise regression from fpc (fixed point clustering) package

2008-01-14 Thread Stefan Habermehl

hi there, whenever i try the clusterwise regression from the fpc package, there 
occurs the following problem:
 
the first cluster is always designed in a way, that when i run a normal linear 
regression on the independent variables to describe the dependent variable 
(only on those respondents from the first cluster) - then the regression uses 
only one independent variable that describes the whole variance of the dep 
variable.
this seems interesting, but doesnt make sense. (it seems as if he is searching 
for a variable, that has identical values as the dependent var and gives this 
variable the whole power of explanation.
 
some words to the clusterwise regression:
it seems to me as if it is a very interesting method that combines clustering 
and regression in that way, that it clusters the respondents in n clusters, in 
a way, that their n regressions (one individual for every cluster) have a high 
explanation power.
 
my data looks that way: (just an example - it wouldnt make sense to post the 
whole table)
dep__i1__i2__i3__i4...
32__1___5__2
22__3___1__1
55__3___4__411__2___1__2
 
in other words: 1 dep var (1-5) and a couple of indep vars (1-5) ... so pretty 
standart (and about 4000 respondents)
 
 
the result of the clusterwise regression seems to be the following (when i use 
it):
 
for the first cluster he just looks if there is a ind var that is identiacal 
with the dep var (among a lot of respondents)
 
in this case he would choose i1 since it is approx. identical to the dep var 
(expect of the first respondent)
 
so in the result he gives me this clustering:
 
dep__i1__i2__i3__i4__cl
32__1___5__2___2
22__3___1__1___1
55__3___4__4___111__2___1__2___1
 
when i run a linear reg for cluster one - explaining dep on i1-i4 he uses 
almost only i1 for explaining dep with 100% explained variance but often the 
model is insignificant and it is not a kind of cluster i am looking for)
 
this is my code:
 
library(fpc)unabh - read.table(G:/Data_Files/SPSS Files/unabh.csv, sep=;, 
header=TRUE)abh - read.table(G:/Data_Files/SPSS Files/abh.csv, sep=;, 
header=TRUE)m - as.matrix(unabh)attach(abh)rmt1 - regmix(m, VVV, ir=1, 
nclus=1:2,icrit=1.e-5, minsig=1.e-6, warning=TRUE)write.table(rmt1$g)
 
 
this is just an example i have tried other nclusters and without the 
warning=TRUE and without any instruction beyond the variables but when trying 
more clusters he never stops calculating (maybe there are too many respondents 
r.b. 4000 ???)
 
 
my objective:
i want a couple of meaningful clusters with meaningful regressions
 
 
does anybody know what to change?
 
thanks a lot for any kind of recommendation
stafan
_


[[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] background colour

2008-01-14 Thread Prof Brian Ripley
'bg' is both a graphics parameter and an argument to plot.default: the two 
usages have different meanings.  Please study the help (e.g. ?par, 
?plot.default, ?points) carefully, since you are confusing the two 
meanings in your examples.

On Mon, 14 Jan 2008, Daniel Stepputtis wrote:

 Dear list,

 I am using R 2.6 on a Windows XP machine.

 I divided my device window and tried to set the backgroundcolor for each plot 
 region/figure region separately. This seems not possible?? A simple example:

 # create random numbers
 a - rnorm(100)
 # divide device window
 par(mfrow=c(1,2))
 # set the backgroundcolour to red
 # this always affect the total device

Yes, as documented.

 par(bg=red)
 #two plots should be plotted
 plot(a)
 hist(a)


 I have tried to call bg within the high-level-graphic function 
 (plot(bg=red)). Whereas there was no error-message, this has no effect on 
 the background of this singe plot.

 I found a meaningfull answer I have found here: 
 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/21384.html but I was 
 wondering, whether there is a more easy and explicit way to do it 
 directly for a given plot in a multiplot environment. Are there 
 possibilities to do it specifically for the complete figure region or 
 solely for the complete plot region?

Yes, but this would be part of the figure whereas what par(bg=) does is 
not.  So it's down to you to colour the box you want, most easily with 
rect() as Marc showed in the post you cite.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] 4 dimensional graphics

2008-01-14 Thread Petr PIKAL
Why heretical. I will look and see if I can use it or not. If it does what 
I want in easier way then why not to use better tool

Thank you
Pest regards
Petr
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 12.01.2008 01:39:53:

  Petr == Petr PIKAL [EMAIL PROTECTED] writes:
 
  Thank you Basically I have a rectangular space (like an
  aquarium) in which I made some analysis. I can make
 
  image(lat, long, value) for each height but what I dream
  about is to make something like scatterplot3d(lat, long,
  height) with points set according to a value.
 
 This is a bit heretical for this list, but have you looked into
 non-R things like paraview?  (www.paraview.org)
 
 Mike
 
 -- 
 Michael A. Miller   [EMAIL PROTECTED]
   Imaging Sciences, Department of Radiology, IU School of Medicine
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] 4 dimensional graphics

2008-01-14 Thread Mark Difford

Hi Petr,

Mike Prager has implemented a 4D contour plot in R.  You might find this
useful.  Find an example and the code at:

http://addictedtor.free.fr/graphiques/graphcode.php?graph=90

HTH,
Mark.


Petr Pikal wrote:
 
 Dear all
 
 I want to display 4 dimensional space by some suitable way. I searched 
 CRAN and found miscellaneous 3 dim graphics packages which I maybe can 
 modify but anyway I am open to any hint how to efficiently display data 
 like:
 
 longitude, latitude, height, value
 
 Thank you
 
 Petr Pikal
 [EMAIL PROTECTED]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/4-dimensional-graphics-tp14735631p14800537.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] 4 dimensional graphics

2008-01-14 Thread Petr PIKAL
Thank you but this is not exactly what I wanted. I have seen this graph 
and checked that it is a plot of 2 response variables plotted according to 
2 control variables. e.g. it shall be 
lat, log, value1, value2 data
However I have fixed
lat, long, height as a control variables and value as dependent variable 
so I either end with slices of contours in fixed height or I try to 
accomadate other suggestions.

Thank you again.
Best regards

Petr
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 14.01.2008 13:12:21:

 
 Hi Petr,
 
 Mike Prager has implemented a 4D contour plot in R.  You might find this
 useful.  Find an example and the code at:
 
 http://addictedtor.free.fr/graphiques/graphcode.php?graph=90
 
 HTH,
 Mark.
 
 
 Petr Pikal wrote:
  
  Dear all
  
  I want to display 4 dimensional space by some suitable way. I searched 

  CRAN and found miscellaneous 3 dim graphics packages which I maybe can 

  modify but anyway I am open to any hint how to efficiently display 
data 
  like:
  
  longitude, latitude, height, value
  
  Thank you
  
  Petr Pikal
  [EMAIL PROTECTED]
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
  
  
 
 -- 
 View this message in context: 
http://www.nabble.com/4-dimensional-graphics-
 tp14735631p14800537.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] Install RSPerl in Leopard

2008-01-14 Thread David Ochoa
Hi,

I am having problems installing RSPerl 0.92-1 in my Mac OSX 10.5.1.
I´ve installed correctly R-2.6.1 with the .mpkg.
I run the next command: R CMD INSTALL --configure-args='  --with-in- 
perl ' RSPerl
And the next error message appears:



  RSPerl
* Installing to library '/Library/Frameworks/R.framework/Resources/ 
library'
* Installing *source* package 'RSPerl' ...
checking for perl... /usr/bin/perl
No support for any of the Perl modules from calling Perl from R.
*

Set PERL5LIB to /Library/Frameworks/R.framework/Resources/ 
library/RSPerl/perl

*
Testing: -F/Library/Frameworks/R.framework/.. -framework R
Using '/usr/bin/perl' as the perl executable
Perl modules (no):
Adding R package to list of Perl modules to enable callbacks to R from  
Perl
Creating the C code for dynamically loading modules with native code  
for Perl:  R
modules:   R; linking:
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
Support R in Perl: yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating inst/scripts/RSPerl.csh
config.status: creating inst/scripts/RSPerl.bsh
config.status: creating src/RinPerlMakefile
config.status: creating src/Makefile.PL
config.status: creating cleanup
config.status: creating src/R.pm
config.status: creating R/perl5lib.R
making target all in RinPerlMakefile
RinPerlMakefile:5: /Library/Frameworks/R.framework/Resources/etc/ 
Makeconf: No such file or directory
make: *** No rule to make target `/Library/Frameworks/R.framework/ 
Resources/etc/Makeconf'.  Stop.
calling make -f Makefile.perl install
make: Makefile.perl: No such file or directory
make: *** No rule to make target `Makefile.perl'.  Stop.
chmod: blib/lib/R.pm: No such file or directory
Finished configuration
** libs
** arch - i386
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx- 
version-min=10.4 -std=gnu99 -no-cpp-precomp -I/Library/Frameworks/ 
R.framework/Resources/include -I/Library/Frameworks/R.framework/ 
Resources/include/i386 -I.  -arch i386 -arch ppc -g -pipe -fno-common - 
DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after- 
statement -I/usr/local/include  -I/System/Library/Perl/5.8.8/darwin- 
thread-multi-2level/CORE  -DPERL_POLLUTE   -D_R_=1 -DUSE_R=1 - 
DUSE_TOPLEVEL_EXEC=1 -DWITH_R_IN_PERL=1 -msse3-fPIC  -g -O2 - 
march=nocona -c Converters.c -o Converters.o
cc1: error: invalid option ‘arch=nocona’
lipo: can't open input file: /var/folders/qc/qcR--kvAHYGoOkmr3ZNtvk++ 
+TM/-Tmp-//cclHWEBN.out (No such file or directory)
make: *** [Converters.o] Error 1
chmod: /Library/Frameworks/R.framework/Resources/library/RSPerl/libs/ 
i386/*: No such file or directory
ERROR: compilation failed for package 'RSPerl'
** Removing '/Library/Frameworks/R.framework/Resources/library/RSPerl'




Have I will changed any enviroment variable?
Can anybody help me?
Thanks



David

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] question about order selection of ar

2008-01-14 Thread tom soyer
Hi,

I have an AR(1) series, so I thought that the order of the series should be
1. A simple lm fit with one period lag predicts the series pretty well. But
when I tried ar, I got different orders: ar.mle selected order 6,
ar.burgselected order 14, and
ar.yw selected order 6. So I am wondering maybe I miss understood what
order means in R? Does anyone know why would ar select order 6 or even 14
for an AR(1) series?

Thanks,

-- 
Tom

[[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] Permutations of variables in a dataframe

2008-01-14 Thread Serguei Kaniovski
Hallo All,

I would like to apply a function to all permutations of variables in a 
dataframe (except the first). What is the best way to achieve this?

I produce the permutations using:

nvar - ncol(dat) - 1
perms - as.matrix( expand.grid(rep( list(1:0) , nvar ))[ , nvar:1] )

Thanks in advance
Serguei

Test-dataframe, comma-delimited:

code,wav,w,area,gdp,def,pop,coast,milspend,agr
aut,5,10,83.87,26.39,-1.29,8.07,0,0.72,1.81
bel,1,12,30.53,24.87,-0.28,10.29,0.07,1.29,1.09
bul,7,10,110.91,2.14,1.22,8.03,0.35,1.46,10.88
cyp,6,4,9.25,14.65,-3.26,0.7,0.65,2.11,3.2
cze,6,12,78.87,6.88,-4.44,10.26,0,2,3.19
dnk,2,7,43.09,32.75,2.05,5.34,7.31,1.53,1.98
est,6,4,45.23,5.15,0.82,1.38,3.79,1.58,3.91
fin,5,7,338.15,25.5,3.52,5.18,1.25,1.33,2.87
fra,1,29,547.03,23.99,-2.63,61.05,3.43,2.61,2.39

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] stochastic growth rate (package biopop)

2008-01-14 Thread privalan

Dear all,

I am running matrix population models using package popbio.

In a deterministic model {i.e., transition matrix is defined as A -
matrix(c(0.70, 0.70,0.35,0.50), nrow=2,byrow=TRUE}, population growth rate
can be estimated from the dominant eigenvalue {command eigen.analysis}.

However, I cannot figure out the way to compute the asymptotic stochastic
population growth rate using “popbio”. I would like to perform a stochastic
model in which my demographic rates are sampled from beta distribution with
known mean and SD. For example, rather than 0.50 (4th term of my matrix), I
want to sample this parameter from a beta function at each time-step {e.g.,
betaval(0.5, 0.05)}. Then I want to run the model for 1000 time steps (or
more) and estimate the asymptotic stochastic growth rate. Is there a command
that enable this kind of modelling?

Thank you,

Best wishes,

Privalan

-- 
View this message in context: 
http://www.nabble.com/stochastic-growth-rate-%28package-biopop%29-tp14800951p14800951.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Permutations of variables in a dataframe

2008-01-14 Thread Henrique Dallazuanna
If I understand your question use apply

?apply

On 14/01/2008, Serguei Kaniovski [EMAIL PROTECTED] wrote:
 Hallo All,

 I would like to apply a function to all permutations of variables in a
 dataframe (except the first). What is the best way to achieve this?

 I produce the permutations using:

 nvar - ncol(dat) - 1
 perms - as.matrix( expand.grid(rep( list(1:0) , nvar ))[ , nvar:1] )

 Thanks in advance
 Serguei

 Test-dataframe, comma-delimited:

 code,wav,w,area,gdp,def,pop,coast,milspend,agr
 aut,5,10,83.87,26.39,-1.29,8.07,0,0.72,1.81
 bel,1,12,30.53,24.87,-0.28,10.29,0.07,1.29,1.09
 bul,7,10,110.91,2.14,1.22,8.03,0.35,1.46,10.88
 cyp,6,4,9.25,14.65,-3.26,0.7,0.65,2.11,3.2
 cze,6,12,78.87,6.88,-4.44,10.26,0,2,3.19
 dnk,2,7,43.09,32.75,2.05,5.34,7.31,1.53,1.98
 est,6,4,45.23,5.15,0.82,1.38,3.79,1.58,3.91
 fin,5,7,338.15,25.5,3.52,5.18,1.25,1.33,2.87
 fra,1,29,547.03,23.99,-2.63,61.05,3.43,2.61,2.39

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



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

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


[R] zoo object

2008-01-14 Thread Vishal Belsare
I have an ordered series of 3 month t-bill rates (annual). I transform
this to a daily series, however, the observations are constructed only
from the dates on which the t-bills were issued, which is every week.

So now I have ordered observations of the daily 'risk-free rate' for
one day every week. I want to expand this zoo object to give a value
for every day, and to do so, copy the previous value to the next date
(which is as yet not in the zoo object).

For example:

head(rf)
 1993-01-01  1993-01-09  1993-01-16  1993-01-23  1993-01-30  1993-02-06
0.007306621 0.007659046 0.007681013 0.007817548 0.007847579 0.007867313

I want to insert values between each of the dates, and copy the
previous value for those days. Any suggestions would be greatly
appreciated. Thanks in anticipation.


Regards,

Vishal Belsare

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] barplots and missing xlabels

2008-01-14 Thread John Kane
It is printing all four labels, The window is just not
large enough to show them.  In Windows anyway,grab the
window and stretch it (to the left probably) .  

--- Geoff Russell [EMAIL PROTECTED] wrote:

 Dear useRs,
 
 The following plots only print 2 of the 4 labels
 under the bars, is there
 a way please to force all 4 labels to print?
 
 par(mfrow=c(1,2),mar=c(2,7,3,1))

dat-data.frame(AgeGroup=c(2-15,16-20,21-25,26-39),
 Aorta=c(20,8,30,60),
 Coronary=c(7,30,55,65))

barplot(dat$Aorta,ylim=c(0,100),names=as.vector(dat$AgeGroup),ylab=c(Prevalence
 (%)))
 title(main=list(Aorta,font=0))

barplot(dat$Coro,names=as.vector(dat$Age),ylim=c(0,100))
 title(main=list(Coronary Artery,font=0))
 
 
 Many thanks,
 Geoff Russell
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.


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


Re: [R] grep(): returning the matched value

2008-01-14 Thread Macnamara, Aidan
Apologies, that should be 
 
grep([[:digit:]]{2}, x, value=T) returns pjhj24jhjhd
 
obviously.  
 



From: [EMAIL PROTECTED] on behalf of Macnamara, Aidan
Sent: Mon 1/14/2008 14:04
To: r-help@r-project.org
Subject: [R] grep(): returning the matched value



Hi,

I'm looking to use the grep function (or something else) to return the matched 
pattern as opposed to the whole element. For example:

x - c(pjhj24jhjhd)
grep([[:digit:]]{2}, x, value=T) returns people, whereas I simply want 
24. 

Any help would be appreciated,

Thanks, Aidan

[[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] grep(): returning the matched value

2008-01-14 Thread Romain Francois
Macnamara, Aidan wrote:
 Hi, 
  
 I'm looking to use the grep function (or something else) to return the 
 matched pattern as opposed to the whole element. For example:
  
 x - c(pjhj24jhjhd)
 grep([[:digit:]]{2}, x, value=T) returns people, whereas I simply want 
 24.  
  
 Any help would be appreciated, 
  
 Thanks, Aidan
   
Hi,

You need gsub, as in:

R gsub(^.*([[:digit:]]{2}).*$,\\1, x )
[1] 24

Cheers,

Romain

-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 latex() does not want to work

2008-01-14 Thread John Kane

--- Richard M. Heiberger [EMAIL PROTECTED] wrote:

 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On
 Behalf Of John Kane
 Sent: Sunday, January 13, 2008 03:56 PM
 
 ## Not run: 
 latex(x)   # creates x.tex in working directory
 w - latex(x, file='/tmp/my.tex')
 -
 
 I think there is an unclarity in the documentation. 
 The documentation
 is correct and everything that Frank and Gabor wrote
 is also correct.  The issue is side-effects, which I
 think need a bit more
 explanation.  I would revise the first example above
 to read:
 
 
 latex(x)   ## 1. creates x.tex in working directory
 and 
##
## 2. The result of the command is an
 object of class latex
##which is automatically printed by
 the latex print method.
##The latex print method prepends and
 appends latex headers
 and
##calls the latex program in the
 PATH.  If the latex program
 is
##not in the PATH, you will get error
 messages from the
 operating
##system.
 
 Since you didn't have latex in the PATH, you got an
 error from the print
 method.  The x.tex file was probably correctly
 generated and might still be
 sitting
 in your default getwd() directory.
 

You're right about the file.  I had changed my working
directory and was in the wrong one.  I'll have to have
another look at the latex path. I thought I had it
correct but obviously I don't.

Thanks


 The second example,
 w - latex(x, file='/tmp/my.tex')
 doesn't give an error message because the result of
 the latex() command is
 saved in the object w and not automatically printed.
 
 
 Rich
 
 


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] grep(): returning the matched value

2008-01-14 Thread Macnamara, Aidan
Hi, 
 
I'm looking to use the grep function (or something else) to return the matched 
pattern as opposed to the whole element. For example:
 
x - c(pjhj24jhjhd)
grep([[:digit:]]{2}, x, value=T) returns people, whereas I simply want 
24.  
 
Any help would be appreciated, 
 
Thanks, Aidan

[[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] Derby House Fabrics

2008-01-14 Thread tomas cooper
Derby House Fabrics
Derby House,
59 Derby Street,
Manchester
M8 8HW.
Dear sir/madam,

COMPANY REPRESENTATIVE/BOOK-KEEPER NEEDED

Our company produces various clothing materials, batiks, assorted fabrics and 
traditional costume which we supply weekly to clients in the
 states.Our clients make payments for our supplies in form of Money Orders 
which are not readily cash able outside the United States. So we need
someone in the States to work as our representative and assist us in processing 
the payments from our clients and he will be paid on
 percentages(10%).

Your job detail is to is receive these payments from our clients in the U.S,get 
it cashed at your bank, then deduct your percentage of
 (10%)and forward the rest company funds to us vis (WESTERN UNION MONEY 
TRANSFER).Payments will be issued out in your full name and address,and they
 can be easily cashed at your bank.All I need is for you to forward your 
informations so that your employment process can begin earnestly,and
 also for it to be sent to our clients and for them to issue payments.

Also note that it will be sent to you through regular mails or courier 
services. As soon as we confirm any payment coming to you, I will let
 you know and I will give you the information you will need to be able to send 
funds to the company via western union money transfer. You can
 visit our website on(www.derbyhousefabrics.co.uk) .

Looking forward to hear from you.

Email directly to:[EMAIL PROTECTED]

Warmest Regards,
Tomas Cooper
Recruitment Manager
(Human Resources Dept)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Derby House Fabrics

2008-01-14 Thread tomas cooper
Derby House Fabrics
Derby House,
59 Derby Street,
Manchester
M8 8HW.
Dear sir/madam,

COMPANY REPRESENTATIVE/BOOK-KEEPER NEEDED

Our company produces various clothing materials, batiks, assorted fabrics and 
traditional costume which we supply weekly to clients in the
 states.Our clients make payments for our supplies in form of Money Orders 
which are not readily cash able outside the United States. So we need
someone in the States to work as our representative and assist us in processing 
the payments from our clients and he will be paid on
 percentages(10%).

Your job detail is to is receive these payments from our clients in the U.S,get 
it cashed at your bank, then deduct your percentage of
 (10%)and forward the rest company funds to us vis (WESTERN UNION MONEY 
TRANSFER).Payments will be issued out in your full name and address,and they
 can be easily cashed at your bank.All I need is for you to forward your 
informations so that your employment process can begin earnestly,and
 also for it to be sent to our clients and for them to issue payments.

Also note that it will be sent to you through regular mails or courier 
services. As soon as we confirm any payment coming to you, I will let
 you know and I will give you the information you will need to be able to send 
funds to the company via western union money transfer. You can
 visit our website on(www.derbyhousefabrics.co.uk) .

Looking forward to hear from you.

Email directly to:[EMAIL PROTECTED]

Warmest Regards,
Tomas Cooper
Recruitment Manager
(Human Resources Dept)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] barplots and missing xlabels

2008-01-14 Thread -Halcyon-

Hi,

I'd say just stretch the plot window. The code works fine and labels are all
present

Gz


Jim Lemon-2 wrote:
 
 Geoff Russell wrote:
 Dear useRs,
 
 The following plots only print 2 of the 4 labels under the bars, is there
 a way please to force all 4 labels to print?
 
 par(mfrow=c(1,2),mar=c(2,7,3,1))
 dat-data.frame(AgeGroup=c(2-15,16-20,21-25,26-39),
 Aorta=c(20,8,30,60),
 Coronary=c(7,30,55,65))
 barplot(dat$Aorta,ylim=c(0,100),names=as.vector(dat$AgeGroup),ylab=c(Prevalence
 (%)))
 title(main=list(Aorta,font=0))
 barplot(dat$Coro,names=as.vector(dat$Age),ylim=c(0,100))
 title(main=list(Coronary Artery,font=0))
 
 Hi Geoff,
 
 Try this:
 
 barplot(dat$Aorta,ylim=c(0,100),
   names=rep(,length(dat$AgeGroup)),
   ylab=c(Prevalence (%)))
 mtext(dat$AgeGroup,1,2)
 
 Jim
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/barplots-and-missing-xlabels-tp14796430p14802702.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Permutations of variables in a dataframe

2008-01-14 Thread Henrique Dallazuanna
Is this you want?

apply(apply(perms, 1, as.logical), 2, function(x)df[x])



On 14/01/2008, Serguei Kaniovski [EMAIL PROTECTED] wrote:
 Henrique, I know I have to use apply, but how do I select the columns of
 the dataframe using the permutation vectors produced by

 nvar - ncol(dat) - 1
 perms - as.matrix( expand.grid(rep( list(1:0) , nvar ))[ , nvar:1] )

 Serguei




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

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


Re: [R] savehistory in OSX version

2008-01-14 Thread Rob Goedman
Roger,

The history features on Mac OS's R.app are handled by R.app
and is a (small) superset of R's facilties, e.g. it supports multi-line
history recalls.

A disadvantage of this approach is that it's not possible to use
R's history() and savehistory() nor make usage completely
identical. The actual history files do 'interoperate', although
you will loose the multiline feature.

A good list for Mac OS specific discussions is [EMAIL PROTECTED]

Hope this helps,
Rob


On Jan 13, 2008, at 6:47 PM, Day, Roger S. wrote:

 Running Version 2.6.0  GUI 1.21.
 Generally, I enjoy working with the OSX GUI,
 which has some very pleasant features.
 Kudos to the developers!

 There is a nice history panel which slides out of the
 Console window.  The buttons on the panel work as expected.
 I am puzzled by the behavior of history() and savehistory()
 run from the Console window.  I would think that these functions
 would view and save the same set of commands as those seen in
 the history panel, but they don't.
 Can someone explain why, and how to fix it?

 Perhaps relevant:   I generally have performed a setwd() , or  
 started R
 by launching
 a Rdata file.

 Thanks.

 Roger Day
 University of Pittsburgh Departments of Biomedical Informatics and
 Biostatistics
 University of Pittsburgh Cancer Institute
 University of Pittsburgh Molecular Medicine Institute
 **
 Room 310, Suite 301
 Cancer Pavilion (CNPAV)
 5150 Centre Ave.
 Pittsburgh, PA 15232
 e-mail:  [EMAIL PROTECTED]
 cell phone 412-609-3918
 assistant:
Lucy Cafeo:   (412) 623-2952
 ***





   [[alternative HTML version deleted]]

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

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


Re: [R] zoo object

2008-01-14 Thread Achim Zeileis
On Mon, 14 Jan 2008, Gabor Grothendieck wrote:

 Create a sequence of dates, dd, spanning the data and
 then merge the data with a zero width zoo object
 having those dates.  Finally na.locf will fill in the
 NAs just generated with the last ocurrence carried forward.

 z - zoo(c(0.007306621, 0.007659046, 0.007681013,
   0.007817548, 0.007847579, 0.007867313),
   as.Date(c(1993-01-01, 1993-01-09, 1993-01-16,
   1993-01-23, 1993-01-30, 1993-02-06)))

 dd - seq(min(time(z)), max(time(z)), day)
 na.locf(merge(z, zoo(, dd)))

I was just writing a reply with virtually identical code. The only
difference ist that
  start(z), end(z)
might be a bit more evocative thatn
  min(time(z)), max(time(z))
but leads, of course, to identical results.
Z


 On Jan 14, 2008 9:02 AM, Vishal Belsare [EMAIL PROTECTED] wrote:
  I have an ordered series of 3 month t-bill rates (annual). I transform
  this to a daily series, however, the observations are constructed only
  from the dates on which the t-bills were issued, which is every week.
 
  So now I have ordered observations of the daily 'risk-free rate' for
  one day every week. I want to expand this zoo object to give a value
  for every day, and to do so, copy the previous value to the next date
  (which is as yet not in the zoo object).
 
  For example:
 
  head(rf)
   1993-01-01  1993-01-09  1993-01-16  1993-01-23  1993-01-30  1993-02-06
  0.007306621 0.007659046 0.007681013 0.007817548 0.007847579 0.007867313
 
  I want to insert values between each of the dates, and copy the
  previous value for those days. Any suggestions would be greatly
  appreciated. Thanks in anticipation.
 
 
  Regards,
 
  Vishal Belsare
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 

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



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] savehistory in OSX version

2008-01-14 Thread Peter Dalgaard
Rob Goedman wrote:
 Roger,

 The history features on Mac OS's R.app are handled by R.app
 and is a (small) superset of R's facilties, e.g. it supports multi-line
 history recalls.

 A disadvantage of this approach is that it's not possible to use
 R's history() and savehistory() nor make usage completely
 identical. The actual history files do 'interoperate', although
 you will loose the multiline feature.

   
That is actually the same in the readline-based terminal interface on
Unix/Linux: If you terminate a line with C-v C-j, then it is recalled
along with the subsequent line(s) by up-arrow. And history() et al. also
discard the grouping of lines there.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


Re: [R] zoo object

2008-01-14 Thread Gabor Grothendieck
Create a sequence of dates, dd, spanning the data and
then merge the data with a zero width zoo object
having those dates.  Finally na.locf will fill in the
NAs just generated with the last ocurrence carried forward.

z - zoo(c(0.007306621, 0.007659046, 0.007681013,
0.007817548, 0.007847579, 0.007867313),
as.Date(c(1993-01-01, 1993-01-09, 1993-01-16,
1993-01-23, 1993-01-30, 1993-02-06)))

dd - seq(min(time(z)), max(time(z)), day)
na.locf(merge(z, zoo(, dd)))


On Jan 14, 2008 9:02 AM, Vishal Belsare [EMAIL PROTECTED] wrote:
 I have an ordered series of 3 month t-bill rates (annual). I transform
 this to a daily series, however, the observations are constructed only
 from the dates on which the t-bills were issued, which is every week.

 So now I have ordered observations of the daily 'risk-free rate' for
 one day every week. I want to expand this zoo object to give a value
 for every day, and to do so, copy the previous value to the next date
 (which is as yet not in the zoo object).

 For example:

 head(rf)
  1993-01-01  1993-01-09  1993-01-16  1993-01-23  1993-01-30  1993-02-06
 0.007306621 0.007659046 0.007681013 0.007817548 0.007847579 0.007867313

 I want to insert values between each of the dates, and copy the
 previous value for those days. Any suggestions would be greatly
 appreciated. Thanks in anticipation.


 Regards,

 Vishal Belsare

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


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


Re: [R] binning data

2008-01-14 Thread Marc Schwartz
Robert Terwilliger wrote:
 I would like to 'bin' a vector of of values (10 values) in much
 the same way as 'hist' does for plotting, but I just want a result
 with the bins and the frequencies.

 Is there a 'quick and dirty' (built-in) way to do this, or do I need
 to write some code?

 Many thanks,

 Robert Terwilliger

If you want the SAME bins as used by hist(), you can use:

   hist(Vec, breaks = ..., plot = FALSE)$counts

Another alternative is to use cut() to bin a vector and return a factor, 
upon which you can then use table() to get the counts. For example:

   table(cut(Vec, breaks = ...))

See ?hist and ?cut for more information.

HTH,

Marc Schwartz

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


Re: [R] Error on distance matrix

2008-01-14 Thread Martin Maechler
 GS == Gavin Simpson [EMAIL PROTECTED]
 on Thu, 10 Jan 2008 14:16:36 + writes:

GS On Thu, 2008-01-10 at 10:48 +, Marc Moragues wrote:
 Hi,
 
 I am trying to calculate a distance matrix on a binary
 data frame using dist.binary() {ade4}. This is the code I
 run and the error I get:
 
  sjlc.dist - dist.binary(as.data.frame(data), method=2)
 #D = (a+d) / (a+b+c+d) Error in if (any(df  0))
 stop(non negative value expected in df) : missing value
 where TRUE/FALSE needed
 
 I don't know if the problem are the missing values in my
 data. If so how can I handle them?

GS Marc,

GS Take a look at distance in package analogue and method =
GS mixed which implements Gower's general dissimilarity
GS coefficient for mixed data. 

daisy() in recommended package 'cluster' has been doing this
forever. Has there been a reason for reimplementing that?

GS It can deal quite happily
GS with binary data and where there is missing-ness.
GS Binary data are handled through a simple matching
GS coefficient, 1 if variable i present in both samples, 0
GS otherwise, and then summed over all variables i. You
GS should probably read up on how the missing-ness is
GS handled with this method and what properties the
GS resulting dissimilarity has.

GS Note that distance() outputs full dissimilarity
GS matrices. To get something to plug into functions that
GS require a dist object, just use as.dist() on the output
GS from distance().

GS HTH

GS G

 
 Thank you, Marc.  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 
 SCRI, Invergowrie, Dundee, DD2 5DA.  The Scottish Crop
 Research Institute is a charitable company limited by
 guarantee.  Registered in Scotland No: SC 29367.
 Recognised by the Inland Revenue as a Scottish Charity
 No: SC 006662.
 
 
 DISCLAIMER:
 
 This email is from the Scottish Crop Research Institute,
 but the views expressed by the sender are not necessarily
 the views of SCRI and its subsidiaries.  This email and
 any files transmitted with it are confidential to the
 intended recipient at the e-mail address to which it has
 been addressed.  It may not be disclosed or used by any
 other than that addressee.  If you are not the intended
 recipient you are requested to preserve this
 confidentiality and you must not use, disclose, copy,
 print or rely on this e-mail in any way. Please notify
 [EMAIL PROTECTED] quoting the name of the sender and
 delete the email from your system.
 
 Although SCRI has taken reasonable precautions to ensure
 no viruses are present in this email, neither the
 Institute nor the sender accepts any responsibility for
 any viruses, and it is your responsibility to scan the
 email and the attachments (if any).
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
 read the posting guide
 http://www.R-project.org/posting-guide.html and provide
 commented, minimal, self-contained, reproducible code.
GS --
GS %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
GS Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL
GS Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e]
GS gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w]
GS http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT.  [w]
GS http://www.freshwaters.org.uk
GS %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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

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


[R] binning data

2008-01-14 Thread Robert Terwilliger
I would like to 'bin' a vector of of values (10 values) in much
the same way as 'hist' does for plotting, but I just want a result
with the bins and the frequencies.

Is there a 'quick and dirty' (built-in) way to do this, or do I need
to write some code?

Many thanks,

Robert Terwilliger

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


Re: [R] How to fit a Tobit model with observations censored at different values

2008-01-14 Thread Terry Therneau
 I am a new user of R. I have a dataset with a dependent variable (DV) censored
 at different values. The dataset looks like, 
conditions .IDV1 IDV2DV
12  4  89
16  6  75
14  5  0  ( DV=70)
...
I do not know how to ajust the code in the VGAM pacakage. I would like to get
 some some suggestions. Thank you very much.

  I do not know how to adjust the VGAM package, but it is very easy to fit 
Tobit 
models using survreg.  Let DV1 = the value of DV or the lower threshold and DV2 
= 1 if the value is exact and 0 if it is censored.  So for the above data
DV1   DV2
89 1
75 1
70 0

Then the following will fit a Tobit regression

survreg(Surv(DV1, DV2, type='left') ~ x1 + x2 + ..., data=mydata,
   dist='gaussian')
   
Terry Therneau

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Install RSPerl in Leopard

2008-01-14 Thread Prof Brian Ripley
This is not the most appropriate list.  But the first answer is that the 
package is not aware of sub-architectures, introduced a while back in R.


The best thing is to follow the posting guide and contact the author: if 
that fails, people on R-sig-mac might be able to walk you through the 
changes needed.  It perhaps is as simple as editing

RSPerl/src/RinPerlMakefile.in to say

include $(R_HOME)/etc$(R_ARCH)/Makeconf

That should fix the first problem.  But


cc1: error: invalid option ?arch=nocona?


suggests there might be a further problem (for which use R-sig-mac).



On Mon, 14 Jan 2008, David Ochoa wrote:


Hi,

I am having problems installing RSPerl 0.92-1 in my Mac OSX 10.5.1.
I´ve installed correctly R-2.6.1 with the .mpkg.
I run the next command: R CMD INSTALL --configure-args='  --with-in-
perl ' RSPerl
And the next error message appears:



 RSPerl
* Installing to library '/Library/Frameworks/R.framework/Resources/
library'
* Installing *source* package 'RSPerl' ...
checking for perl... /usr/bin/perl
No support for any of the Perl modules from calling Perl from R.
*

   Set PERL5LIB to /Library/Frameworks/R.framework/Resources/
library/RSPerl/perl

*
Testing: -F/Library/Frameworks/R.framework/.. -framework R
Using '/usr/bin/perl' as the perl executable
Perl modules (no):
Adding R package to list of Perl modules to enable callbacks to R from
Perl
Creating the C code for dynamically loading modules with native code
for Perl:  R
modules:   R; linking:
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
Support R in Perl: yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating inst/scripts/RSPerl.csh
config.status: creating inst/scripts/RSPerl.bsh
config.status: creating src/RinPerlMakefile
config.status: creating src/Makefile.PL
config.status: creating cleanup
config.status: creating src/R.pm
config.status: creating R/perl5lib.R
making target all in RinPerlMakefile
RinPerlMakefile:5: /Library/Frameworks/R.framework/Resources/etc/
Makeconf: No such file or directory
make: *** No rule to make target `/Library/Frameworks/R.framework/
Resources/etc/Makeconf'.  Stop.
calling make -f Makefile.perl install
make: Makefile.perl: No such file or directory
make: *** No rule to make target `Makefile.perl'.  Stop.
chmod: blib/lib/R.pm: No such file or directory
Finished configuration
** libs
** arch - i386
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-
version-min=10.4 -std=gnu99 -no-cpp-precomp -I/Library/Frameworks/
R.framework/Resources/include -I/Library/Frameworks/R.framework/
Resources/include/i386 -I.  -arch i386 -arch ppc -g -pipe -fno-common -
DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-
statement -I/usr/local/include  -I/System/Library/Perl/5.8.8/darwin-
thread-multi-2level/CORE  -DPERL_POLLUTE   -D_R_=1 -DUSE_R=1 -
DUSE_TOPLEVEL_EXEC=1 -DWITH_R_IN_PERL=1 -msse3-fPIC  -g -O2 -
march=nocona -c Converters.c -o Converters.o
cc1: error: invalid option ?arch=nocona?
lipo: can't open input file: /var/folders/qc/qcR--kvAHYGoOkmr3ZNtvk++
+TM/-Tmp-//cclHWEBN.out (No such file or directory)
make: *** [Converters.o] Error 1
chmod: /Library/Frameworks/R.framework/Resources/library/RSPerl/libs/
i386/*: No such file or directory
ERROR: compilation failed for package 'RSPerl'
** Removing '/Library/Frameworks/R.framework/Resources/library/RSPerl'




Have I will changed any enviroment variable?
Can anybody help me?
Thanks



David

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] 4 dimensional graphics

2008-01-14 Thread Malte Brockmann
You could try GGobi (www.ggobi.org) to explore the dataset, nevertheless
it is not useful for charts that are to be printed  . There is an
R-Plugin (rggobi) as well.


 Thank you but this is not exactly what I wanted. I have seen this
graph 
 and checked that it is a plot of 2 response variables plotted
according to 
 2 control variables. e.g. it shall be 
 lat, log, value1, value2 data
 However I have fixed
 lat, long, height as a control variables and value as dependent
variable 
 so I either end with slices of contours in fixed height or I try to 
 accomadate other suggestions.

 Thank you again.
 Best regards

 Petr
 [EMAIL PROTECTED]

 [EMAIL PROTECTED] napsal dne 14.01.2008 13:12:21:

  
  Hi Petr,
  
  Mike Prager has implemented a 4D contour plot in R.  You might find
this
  useful.  Find an example and the code at:
  
  http://addictedtor.free.fr/graphiques/graphcode.php?graph=90
  
  HTH,
  Mark.
  
  
  Petr Pikal wrote:
   
   Dear all
   
   I want to display 4 dimensional space by some suitable way. I
searched 

   CRAN and found miscellaneous 3 dim graphics packages which I maybe
can 

   modify but anyway I am open to any hint how to efficiently display

 data 
   like:
   
   longitude, latitude, height, value
   
   Thank you
   
   Petr Pikal
   [EMAIL PROTECTED]
   
   __
   R-help@r-project.org mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
   http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
   
   
  
  -- 
  View this message in context: 
 http://www.nabble.com/4-dimensional-graphics-
  tp14735631p14800537.html
  Sent from the R help mailing list archive at Nabble.com.
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] stochastic growth rate (package popbio)

2008-01-14 Thread Chris Stubben


privalan wrote:
 
 However, I cannot figure out the way to compute the asymptotic stochastic
 population growth rate using “popbio”. I would like to perform a
 stochastic model in which my demographic rates are sampled from beta
 distribution with known mean and SD. For example, rather than 0.50 (4th
 term of my matrix), I want to sample this parameter from a beta function
 at each time-step {e.g., betaval(0.5, 0.05)}. 
 

I guess you can't do this right now, but it shouldn't be too difficult to
add an option to accept an expression as input to stoch.growth.rate or
stoch.projection in the next version of popbio.

Maybe this will get you started.

A-expression(c(0.70, 0.70,0.35, betaval(0.5, 0.05)))

## stoch.growth.rate(A)  ## this doesn't work yet, so try...

matrix(eval(A), nrow=2,byrow=TRUE)
 
## code from simulation section in stoch.growth.rate 
##  just replace A with matrix(eval(A), nrow=2,byrow=TRUE) 
maxt-1
r-numeric(maxt)
n0-c(1,1)

 for (t in 1:maxt)
   {
  n0- matrix(eval(A), nrow=2,byrow=TRUE)  %*% n0
  N-sum(n0)
  r[t]-log(N)
  n0-n0/N
   }
   loglsim-mean(r)
   dse-1.96*sqrt(var(r)/maxt)
   CI-c(loglsim-dse, loglsim+dse)

 loglsim
#[1] 0.09982282
 CI
#[1] 0.0994700 0.1001757


# check
 eigen.analysis( matrix(c(0.70, 0.70,0.35,0.50), nrow=2,byrow=TRUE))$lambda1
 exp(loglsim)


Thanks,

Chris





-- 
View this message in context: 
http://www.nabble.com/stochastic-growth-rate-%28package-biopop%29-tp14800951p14806622.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Ceiling to the nearest ten?

2008-01-14 Thread Lauri Nikkinen
R-users,

Is there a function for ceiling to the nearest ten?

a - 1:10*4
a
[1]  4  8 12 16 20 24 28 32 36 40

The resulting vector should look like this (ceiling to the nearest ten)
[1] 10 10 20 20 20 30 30 40 40 40

Thanks in advance
Lauri

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Ceiling to the nearest ten?

2008-01-14 Thread Barry Rowlingson
Lauri Nikkinen wrote:
 R-users,
 
 Is there a function for ceiling to the nearest ten?
 
 a - 1:10*4
 a
 [1]  4  8 12 16 20 24 28 32 36 40
 
 The resulting vector should look like this (ceiling to the nearest ten)
 [1] 10 10 20 20 20 30 30 40 40 40
 

Divide and conquer:

   a
   [1]  4  8 12 16 20 24 28 32 36 40
   ceiling(a/10)*10
   [1] 10 10 20 20 20 30 30 40 40 40

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Ceiling to the nearest ten?

2008-01-14 Thread Jim Price

A suggestion for a family of such functions:


ceilGenerator - function(num)
function(x) num * ceiling(x / num)


ceil10 - ceilGenerator(10)
ceil20 - ceilGenerator(20)


ceil10(1:10 * 4)
ceil20(1:10 * 4)




Lauri Nikkinen wrote:
 
 R-users,
 
 Is there a function for ceiling to the nearest ten?
 
 a - 1:10*4
 a
 [1]  4  8 12 16 20 24 28 32 36 40
 
 The resulting vector should look like this (ceiling to the nearest ten)
 [1] 10 10 20 20 20 30 30 40 40 40
 
 Thanks in advance
 Lauri
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Ceiling-to-the-nearest-ten--tp14806582p14806624.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Ceiling to the nearest ten?

2008-01-14 Thread Richard M. Heiberger
 a - 1:10*4
 ceiling(a/10)*10
 [1] 10 10 20 20 20 30 30 40 40 40


-Original Message-
Lauri Nikkinen

Is there a function for ceiling to the nearest ten?

a - 1:10*4
a
[1]  4  8 12 16 20 24 28 32 36 40

The resulting vector should look like this (ceiling to the nearest ten)
[1] 10 10 20 20 20 30 30 40 40 40

Thanks in advance
Lauri

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Ceiling to the nearest ten?

2008-01-14 Thread Lauri Nikkinen
Oh, yeah, too simple...
Thank you all!

2008/1/14, Richard M. Heiberger [EMAIL PROTECTED]:
  a - 1:10*4
  ceiling(a/10)*10
  [1] 10 10 20 20 20 30 30 40 40 40
 

 -Original Message-
 Lauri Nikkinen

 Is there a function for ceiling to the nearest ten?

 a - 1:10*4
 a
 [1]  4  8 12 16 20 24 28 32 36 40

 The resulting vector should look like this (ceiling to the nearest ten)
 [1] 10 10 20 20 20 30 30 40 40 40

 Thanks in advance
 Lauri



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Ceiling to the nearest ten?

2008-01-14 Thread Barry Rowlingson
Rob Robinson wrote:
 Perhaps not the most elegant but 10*ceiling(x/10) usually works for me...

  I thought maybe adding five and rounding to the nearest -1 decimal 
places might be quicker:

   round(a+5,-1)
   [1] 10 10 20 20 20 30 30 40 40 40

  gives same as:

   ceiling(a/10)*10
   [1] 10 10 20 20 20 30 30 40 40 40

but it's not quicker:

   system.time(for(i in 1:100){round(a+5,-1)})
  [1] 17.505  0.116 19.538  0.000  0.000
   system.time(for(i in 1:100){ceiling(a/10)*10})
  [1] 5.212 0.048 5.726 0.000 0.000

which surprised me, given that the ceiling example has a multiply and a 
divide to do before working out the ceiling, whereas the round just has 
an add to do before working out the rounding, and I can't immediately 
see why ceilinging should be faster than roundinging:

   system.time(for(i in 1:100){ceiling(a)})
  [1] 2.724 0.044 3.053 0.000 0.000
   system.time(for(i in 1:100){round(a)})
  [1] 12.397  0.092 14.339  0.000  0.000

  but maybe if I think about it a bit more I'll see...

Barry

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


Re: [R] Error in solve.default message using lme

2008-01-14 Thread Bert Gunter
What it probably means is that you can't make a silk purse out of a sow's
ear: all those missings in your your data do not allow you to estimate the
model(s) that you've specified. 

If you don't know what this means, I suggest you seek the help of a local
statistician.

-- 
Bert Gunter
Genentech


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Leonardo
Sent: Monday, January 14, 2008 8:51 AM
To: r-help@r-project.org
Subject: [R] Error in solve.default message using lme

Dear All,

 

I’m using lme to analyze a time series gene expression data. I don’t have
all animals in all times, the number of animals in each time is different
and I have lots of NA values.

An example file can be downloaded at lbmp.fcav.unesp.br/leonardo and the
code used is the following:

 

teste-read.table(file='example.csv',sep=',',header=T)

B-1366

library(nlme)

pValueTime-matrix(nrow=B,ncol=2)

colnames(pValueTime)-c('geneID','pValue.Time')

 

for (i in 1:B) {

print(i)

gene = teste$gene [i]

keep-teste$gene==gene

MTemp =as.numeric( teste$M [keep])

timeTemp = as.factor(teste$time [keep])

animalTemp = as.factor(teste$animal [keep])

 

  tempMM.HA-lme(MTemp~timeTemp,random=~1|animalTemp,method='ML',
na.action=na.omit)

  tempMM.H0-lme(MTemp~1,random=~1|animalTemp,method='ML',
na.action=na.omit)

   pValueTime[i,1]-gene

   pValueTime[i,2]-anova(tempMM.HA,tempMM.H0)[2,9]

}

 

I’m getting the following error message:

 

Error in solve.default(estimates[dimE[1] - (p:1), dimE[2] - (p:1), drop =
FALSE]) : 

  system is computationally singular: reciprocal condition number =
1.64483e-17

 

I don’t know what this message means, so any help/suggestion will be very
appreciated.

 

sessionInfo()

R version 2.6.0 (2007-10-03) 

i386-pc-mingw32 

 

locale:

LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

 

attached base packages:

[1] stats graphics  grDevices utils datasets  methods   base 

 

other attached packages:

[1] nlme_3.1-86

 

loaded via a namespace (and not attached):

[1] grid_2.6.0 lattice_0.17-2 tools_2.6.0   

 

 

Best regards,

 

Leonardo

 



MSc. Leonardo Bernardes da Rocha

Doctorate Student - Animal Science

Department of Tecnology

College of Agricultural and Veterinary Sciences

São Paulo State University

Jaboticabal, SP - Brazil

Phone: +55 16 32092675 (Ext. 206)

Email: [EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] problems with .svg

2008-01-14 Thread Mag. Ferri Leberl
Dear everybody!
I am making a graph in R and employ pstoedit to expot the .pdf-output
to .svg.
When I open the .svg with firefox I get the .svg-code shown wit the
following header:
Mit dieser XML-Datei sind anscheinend keine Style-Informationen
verknüpft. Nachfolgend wird die Baum-Ansicht des Dokuments angezeigt.
Which information should how be included?
Thank you in advance.
Yours,
Mag. Ferri Leberl

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] problems with .svg

2008-01-14 Thread Gabor Csardi
Are you sure this is an R problem? I guess it is not, but 
rather a pstoedit problem. 

You can use the RSVGDevice package, or the Cairo package to
export your graphics directly into SVG from R.

Gabor

On Mon, Jan 14, 2008 at 07:10:13PM +0100, Mag. Ferri Leberl wrote:
 Dear everybody!
 I am making a graph in R and employ pstoedit to expot the .pdf-output
 to .svg.
 When I open the .svg with firefox I get the .svg-code shown wit the
 following header:
 Mit dieser XML-Datei sind anscheinend keine Style-Informationen
 verknüpft. Nachfolgend wird die Baum-Ansicht des Dokuments angezeigt.
 Which information should how be included?
 Thank you in advance.
 Yours,
 Mag. Ferri Leberl
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor [EMAIL PROTECTED]UNIL DGM

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Ceiling to the nearest ten?

2008-01-14 Thread hadley wickham
On 1/14/08, Jim Price [EMAIL PROTECTED] wrote:

 A suggestion for a family of such functions:


 ceilGenerator - function(num)
 function(x) num * ceiling(x / num)


 ceil10 - ceilGenerator(10)
 ceil20 - ceilGenerator(20)


 ceil10(1:10 * 4)
 ceil20(1:10 * 4)

libraray(reshape)
round_any(100, 40, floor)
round_any(100, 40, ceiling)
round_any(101, 40)

# in reshape package
round_any - function (x, accuracy, f = round) {
f(x/accuracy) * accuracy
}

which is a pretty similar idea.

Hadley
-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] lm predict warning: prediction from a rank-deficient fit may be misleading

2008-01-14 Thread José Augusto M. de Andrade Junior
Hi all,

I´m getting this warning with predict form lm.fit model, but the
prediction still works.

I have read some old messages, and Prof. Ripley said that the matrix
is collinear.

Interestingly,  when i make a regression like lag2 ~ lag1 + lag0 i do
not get this message. Only with higher dimensions, like lag3 ~ lag2 +
lag1 + lag0.
It´s difficult to me to debug, because the regression is done with 45
or more points. Any suggestion?

I used SVD matrix to reduce the space dimensionality and it works
fine, but i want to make lm and rlm work too.

Thanks for your attention.

José Augusto M. de Andrade Jr.

Undergraduate Student
Business Administration
University of São Paulo

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Is R on Windows multi-threaded

2008-01-14 Thread Luke Tierney
I hope to get a new version of snow released in a couple of weeks that
will work on Windows using a Windows Rmpi version or, at least on a
local machine, a socket interface.

luke

On Sat, 12 Jan 2008, Prof Brian Ripley wrote:

 On Fri, 11 Jan 2008, Greg Snow wrote:

 Someone else suggested the snow package, but I don't think it is available 
 for windows.

 It is.  From http://cran.r-project.org/bin/windows/contrib/2.6/ReadMe

  Although the packages
ROracle, and snow
  pass make check, it seems to be dangerous to distribute them:
  I do not have the software available these packages depend on.

 It compiles from the sources, and using snow alone you can run socket 
 clusters on Windows (by default it expects ssh to be running, and Windows 
 machines rarely run an ssh daemon so as to accept incoming ssh).  The caution 
 is that the packages runs no tests so needs manual intervention to test it, 
 and in particular most people will want to run snow over Rmpi which does not 
 compile on Windows without more software (and some effort).

 It might be worth modifying snow to more easily run multiple processes on a 
 single machine.


 I have been able to get the nws package to work on a duel core machine 
 using windows and it did speed up my tests (and was fairly straight forward 
 to use).

 Dueling cores can be apt 

 
 
 From: [EMAIL PROTECTED] on behalf of Rees, David
 Sent: Fri 1/11/2008 7:28 AM
 To: r-help@r-project.org
 Subject: [R] Is R on Windows multi-threaded
 
 
 
 Hi,
 
 A previous thread suggests that R on Windows is multi-threaded
 
 http://tolstoy.newcastle.edu.au/R/help/03b/6946.html
 
 When I'm running R 2.5.1 on a dual core pc I get Rgui.exe uses up to 50%
 of the available cpu and the rest is not used. i.e. it only uses one
 cpu. I'm soon going to get a nice shiny new 8 cpu machine which it would
 be very nice to fully utilize.
 
 Is there any way to get R to use all the cpus - should this happen
 automatically?
 
 Many thanks,
 
 Regards,
 David
 

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



-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Ceiling to the nearest ten?

2008-01-14 Thread Greg Snow
Well the help page for ceiling and round states that ceiling only works
on numeric vectors, but round can work on complex vectors as well.
Perhaps the extra overhead of checking for complex numbers is part of
the extra time taken by round.  

Also, ceiling rounds up to an integer, round needs to deal with the
digits specification and that will add some overhead as well.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Barry Rowlingson
 Sent: Monday, January 14, 2008 10:48 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]; 'Lauri Nikkinen'
 Subject: Re: [R] Ceiling to the nearest ten?
 
 Rob Robinson wrote:
  Perhaps not the most elegant but 10*ceiling(x/10) usually 
 works for me...
 
   I thought maybe adding five and rounding to the nearest -1 
 decimal places might be quicker:
 
round(a+5,-1)
[1] 10 10 20 20 20 30 30 40 40 40
 
   gives same as:
 
ceiling(a/10)*10
[1] 10 10 20 20 20 30 30 40 40 40
 
 but it's not quicker:
 
system.time(for(i in 1:100){round(a+5,-1)})
   [1] 17.505  0.116 19.538  0.000  0.000
system.time(for(i in 1:100){ceiling(a/10)*10})
   [1] 5.212 0.048 5.726 0.000 0.000
 
 which surprised me, given that the ceiling example has a 
 multiply and a divide to do before working out the ceiling, 
 whereas the round just has an add to do before working out 
 the rounding, and I can't immediately see why ceilinging 
 should be faster than roundinging:
 
system.time(for(i in 1:100){ceiling(a)})
   [1] 2.724 0.044 3.053 0.000 0.000
system.time(for(i in 1:100){round(a)})
   [1] 12.397  0.092 14.339  0.000  0.000
 
   but maybe if I think about it a bit more I'll see...
 
 Barry
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

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


[R] multinomial confidence interval

2008-01-14 Thread eugen pircalabelu
Hi R users!

Is there a function that extracts the simultaneous confidence intervals for  
multinomial proportions as described by Sison and Glaz 1995? or anyone else for 
that matter?  
I have seen that SAS has macro for this  ( http://www.jstatsoft.org/v05/i06) 
and i was wondering if R had something similar?


Thank you and have a great day ahead!


   
-

[[alternative HTML version deleted]]

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


Re: [R] binning data

2008-01-14 Thread Rolf Turner

On 15/01/2008, at 5:13 AM, Robert Terwilliger wrote:

 I would like to 'bin' a vector of of values (10 values) in much
 the same way as 'hist' does for plotting, but I just want a result
 with the bins and the frequencies.

 Is there a 'quick and dirty' (built-in) way to do this, or do I need
 to write some code?

?hist

(Hint:  Look at ``Value''.  Also look at the ``plot'' argument.)

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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


Re: [R] is it safe to replace every - by = in R code?

2008-01-14 Thread Mark Wardle
Thank you (all) for the helpful explanations! My own R code tends to
simpler constructs, but now perhaps we can start having obfuscated
code competitions: something common in Perl, but I have not seen in R
(yet). Anyone up for the challenge?

Best wishes,

Mark


-- 
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK

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


[R] Need help with xspline error message in R 2.6.1 on Windows XP

2008-01-14 Thread Anderson, Walter
I am attempting to generate a series of plots with cubic B-Splines and
the code I am using is generating the following error message that I
have been unable to resolve.

Error in grid.Call.graphics(L_xspline, x$x, x$y, x$shape, x$open,
x$arrow,  :   add_point - reached MAXNUMPTS (25200)

This is the code that generates this error.

plot.results - function(dfn) {
dt - read.table(dfn)
shp - rep(1, as.numeric(length(dt$year)))
shp[1] - shp[as.numeric(length(dt$year))] - 0
grid.rect()
pushViewport(plotViewport(c(5.1, 4.1, 4.1, 2.1)))
pushViewport(dataViewport(dt$year, dt$mean))
grid.rect()
grid.xaxis()
grid.yaxis()
grid.points(dt$year, dt$mean, pch=16)
grid.xspline(dt$year, dt$mean, shape=shp, open=TRUE,
gp=gpar(col=red))
popViewport(2)
}

plot.results(section01_model_results.dat)

And here is the data that is being used:

  year  mean
1 2010  6738
2 2015  8793
3 2020 11699
4 2025 15951
5 2030 22492
6 2035 33289
7 2040 52917

I have tried changing the values in the shape vector and have noticed
that a value of 0 does not generate the error; however, it also does not
plot a line or curve.  I have also tried values for the shape vector of
-1, 0.1, 0.2, and 0.5.  

I think my problem may be unit related, but am unclear how to specify
that my control points are user units (or to convert user units to what
ever xspline might prefer).

Walter Anderson

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] is it safe to replace every - by = in R code?

2008-01-14 Thread Jeffrey J. Hallman
Jonathan Baron [EMAIL PROTECTED] writes:
 I think it is worth pointing out that, if you use ESS with (X)emacs,
  -  (with spaces) is produced when you type _.  It requires only two
 keystrokes (shift and -), and the spaces are done for you. The = sign
 requires three because you need to type the spaces on each side.

Is there a way to turn this off?  I sometimes have to use variable names with
underscores in them (not by my choice) and having to defeat ESS's attempts to
replace the underscores with '-' can really be annoying.

-- 
Jeff

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


Re: [R] is it safe to replace every - by = in R code?

2008-01-14 Thread Richard M. Heiberger
The answer in emacs is always Yes.

Type _ twice, and it will become an underscore.  See
C-h k _
For the full help page.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Jeffrey J. Hallman

Is there a way to turn this off?  I sometimes have to use variable names
with
underscores in them (not by my choice) and having to defeat ESS's attempts
to
replace the underscores with '-' can really be annoying.

-- 
Jeff

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


[R] Listing the data contents of a package

2008-01-14 Thread Gregory Gentlemen
Hi R users,

Simply question: On the command line, how do I list the datasets contained 
within a package, e.g. MASS?

I scanned the mailing list history but was unable to find the answer.

Thanks in advance.
Gregory


   
 
  
-

   


[[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] Listing the data contents of a package

2008-01-14 Thread Henrique Dallazuanna
data(package=MASS)


On 14/01/2008, Gregory Gentlemen [EMAIL PROTECTED] wrote:
 Hi R users,

 Simply question: On the command line, how do I list the datasets contained 
 within a package, e.g. MASS?

 I scanned the mailing list history but was unable to find the answer.

 Thanks in advance.
 Gregory





 -




 [[alternative HTML version deleted]]

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



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

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


Re: [R] Listing the data contents of a package

2008-01-14 Thread Greg Snow
?data

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Gregory Gentlemen
 Sent: Monday, January 14, 2008 1:18 PM
 To: r-help@r-project.org
 Subject: [R] Listing the data contents of a package
 
 Hi R users,
 
 Simply question: On the command line, how do I list the 
 datasets contained within a package, e.g. MASS?
 
 I scanned the mailing list history but was unable to find the answer.
 
 Thanks in advance.
 Gregory
 
 

  
   
 -
 

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

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


Re: [R] Need help with xspline error message in R 2.6.1 on Windows XP

2008-01-14 Thread Erik Iverson
Walter,

Try adding the argument default.units = native to your grid.xspline call.


Erik Iverson


Anderson, Walter wrote:
 I am attempting to generate a series of plots with cubic B-Splines and
 the code I am using is generating the following error message that I
 have been unable to resolve.
 
 Error in grid.Call.graphics(L_xspline, x$x, x$y, x$shape, x$open,
 x$arrow,  :   add_point - reached MAXNUMPTS (25200)
 
 This is the code that generates this error.
 
 plot.results - function(dfn) {
   dt - read.table(dfn)
   shp - rep(1, as.numeric(length(dt$year)))
   shp[1] - shp[as.numeric(length(dt$year))] - 0
   grid.rect()
   pushViewport(plotViewport(c(5.1, 4.1, 4.1, 2.1)))
   pushViewport(dataViewport(dt$year, dt$mean))
   grid.rect()
   grid.xaxis()
   grid.yaxis()
   grid.points(dt$year, dt$mean, pch=16)
   grid.xspline(dt$year, dt$mean, shape=shp, open=TRUE,
 gp=gpar(col=red))
   popViewport(2)
 }
 
 plot.results(section01_model_results.dat)
 
 And here is the data that is being used:
 
   year  mean
 1 2010  6738
 2 2015  8793
 3 2020 11699
 4 2025 15951
 5 2030 22492
 6 2035 33289
 7 2040 52917
 
 I have tried changing the values in the shape vector and have noticed
 that a value of 0 does not generate the error; however, it also does not
 plot a line or curve.  I have also tried values for the shape vector of
 -1, 0.1, 0.2, and 0.5.  
 
 I think my problem may be unit related, but am unclear how to specify
 that my control points are user units (or to convert user units to what
 ever xspline might prefer).
 
 Walter Anderson
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Need help with xspline error message in R 2.6.1 on Windows XP

2008-01-14 Thread Anderson, Walter
Erik,

That worked perfectly!  Thank you very much! 


Walter Anderson

-Original Message-
From: Erik Iverson
Sent: Monday, January 14, 2008 2:37 PM
To: Anderson, Walter
Cc: r-help@r-project.org
Subject: Re: [R] Need help with xspline error message in R 2.6.1 on
Windows XP

Walter,

Try adding the argument default.units = native to your grid.xspline
call.


Erik Iverson

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Some simple questions about neural networks

2008-01-14 Thread Ken Spriggs

Have you ever gotten any response from this post?  I have similar questions
regarding the AMORE package.  



Efferz wrote:
 
 Hi,
 
  
 
 I have some simple questions and annotations about neural networks:
 
  
 
 1) Which R-package (or which software) would you use to train and validate
 a
 multilayer (2 hidden layers) feed forward neural network. I think AMORE
 is
 the only one that can do this task in R.
 
  
 
 2) When using neural networks for time series prediction (macroeconomic 
 financial time series), how would you precede to avoid overfitting? Split
 the sample in two subsamples, train the NN in the first subsample and then
 test it on the validation set? What is a good split ratio 1/2, 2/3, 3/4?
 Are
 there procedureces which endogenize this step.
 
  
 
 3) How to select the parameters like the global.learnging.rate, the
 momentum.global, the activation functions of the hidden layer neurons, the
 training method, the n.shows and show.step numbers, the probability
 vector,... when setting up a neural net with AMORE or
 
 the initial weights, decay,... when setting up a neural net with NNET?
 
  
 
 Are these all econometrican choice variables and must be exogenously
 specified. My own experience shows that the results are far from robust
 and
 highly sensitive to an alternative parameter choice.  Even when using the
 same parameter setup re-training and re-validation delivers different
 results (unless you use the set.seed command). How to get results that are
 replicable? I think there is a great danger of getting spurious results
 when
 snooping the parameter space. Or are there any reasons why to use a decay
 of
 0.1 instead 0.11 or a momentum of 0.4 instead of 0.5, or ...
 
 Is it a good choice to use if possible the default values?  Therefore I am
 very skeptical if those new and  highly sophisticated non-linear methods
 (neural networks, svm, etc.) perform really better in time series
 prediction
 than the classical linear methods. Besides the problem which variables to
 use as predictors, how to choose the calibration window (rolling
 expanding,
 rolling fixed), one faces the additional choice of model parameters.
 
  
 
 How do you think about it? Any ideas? Any experiences?
 
  
 
 Best
 
 Martin
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Some-simple-questions-about-neural-networks-tp12898957p14814193.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] barplots and missing xlabels

2008-01-14 Thread Geoff Russell
On 1/15/08, -Halcyon- [EMAIL PROTECTED] wrote:

 Hi,

 I'd say just stretch the plot window. The code works fine and labels are all
 present

The labels didn't appear on my pdf output but the following code worked fine

xpos-barplot(dat$Aorta,ylim=c(0,100),
 names=rep(,length(dat$AgeGroup)),
 ylab=c(Prevalence (%)))
mtext(as.vector(dat$AgeGroup),1,2,at=xpos)

Many thanks,

Geoff.



 Gz


 Jim Lemon-2 wrote:
 
  Geoff Russell wrote:
  Dear useRs,
 
  The following plots only print 2 of the 4 labels under the bars, is there
  a way please to force all 4 labels to print?
 
  par(mfrow=c(1,2),mar=c(2,7,3,1))
  dat-data.frame(AgeGroup=c(2-15,16-20,21-25,26-39),
  Aorta=c(20,8,30,60),
  Coronary=c(7,30,55,65))
  barplot(dat$Aorta,ylim=c(0,100),names=as.vector(dat$AgeGroup),ylab=c(Prevalence
  (%)))
  title(main=list(Aorta,font=0))
  barplot(dat$Coro,names=as.vector(dat$Age),ylim=c(0,100))
  title(main=list(Coronary Artery,font=0))
 
  Hi Geoff,
 
  Try this:
 
  barplot(dat$Aorta,ylim=c(0,100),
names=rep(,length(dat$AgeGroup)),
ylab=c(Prevalence (%)))
  mtext(dat$AgeGroup,1,2)
 
  Jim
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 

 --
 View this message in context: 
 http://www.nabble.com/barplots-and-missing-xlabels-tp14796430p14802702.html
 Sent from the R help mailing list archive at Nabble.com.

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



-- 
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] savehistory in OSX version

2008-01-14 Thread Day, Roger S.
Thanks, Rob,

I'm still unsure on the key question. 
Is there any way in R.app to save the commands run 
in the Console into a *.history or .Rhistory file,
by running a command on the Console,
whether savehistory() or some other function call?
(I'm trying to semi-automate a regular backup procedure while
in a very long interactive session at risk of hanging.)
Can you say more what you mean by interoperate here?

Roger



-Original Message-
From: Rob Goedman [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 14, 2008 10:21 AM
To: Day, Roger S.
Cc: r-help@r-project.org
Subject: Re: [R] savehistory in OSX version

Roger,

The history features on Mac OS's R.app are handled by R.app and is a
(small) superset of R's facilties, e.g. it supports multi-line history
recalls.

A disadvantage of this approach is that it's not possible to use R's
history() and savehistory() nor make usage completely identical. The
actual history files do 'interoperate', although you will loose the
multiline feature.

A good list for Mac OS specific discussions is [EMAIL PROTECTED]

Hope this helps,
Rob


On Jan 13, 2008, at 6:47 PM, Day, Roger S. wrote:

 Running Version 2.6.0  GUI 1.21.
 Generally, I enjoy working with the OSX GUI, which has some very 
 pleasant features.
 Kudos to the developers!

 There is a nice history panel which slides out of the Console window.

 The buttons on the panel work as expected.
 I am puzzled by the behavior of history() and savehistory() run from 
 the Console window.  I would think that these functions would view and

 save the same set of commands as those seen in the history panel, but 
 they don't.
 Can someone explain why, and how to fix it?

 Perhaps relevant:   I generally have performed a setwd() , or  
 started R
 by launching
 a Rdata file.

 Thanks.

 Roger Day
 University of Pittsburgh Departments of Biomedical Informatics and 
 Biostatistics University of Pittsburgh Cancer Institute University of 
 Pittsburgh Molecular Medicine Institute
 **
 Room 310, Suite 301
 Cancer Pavilion (CNPAV)
 5150 Centre Ave.
 Pittsburgh, PA 15232
 e-mail:  [EMAIL PROTECTED]
 cell phone 412-609-3918
 assistant:
Lucy Cafeo:   (412) 623-2952
 ***





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


[R] R from within a web page

2008-01-14 Thread David Galligani
Hi all ,
I need to create some graphics from/for an Apache server .
With php I extract data from a PostgreSQL db , and i'd like to create 
some graphic from the data .
I have 2 questions :
1) I've tried with an exec(/usr/local/bin/R --vanilla  myfile.R) and 
exec(/usr/local/bin/R  --no-save  myfile.R  myfile.out.R ) . Both 
command work from a shell but not called from within a php page .
Myfile.R is generated by the php code and is actually something like this :

y - c(16.0938,16.1562,16.0938,16.1875,[...]);
x-c(0.29,0.34,0.39,0.44,0.49,0.54,0.59,[...]);
png(file=/var/www/htdocs/temp.png,bg=transparent);
plot(x,y,type=h,col=2,xlab=Time,ylab=Temperature,lwd=3);
dev.off()

The resulting image is 0 byte .

2)One axis represent time , so actually I have some empties spaces ( 
when I execute myfile.R from shell )  because the graphic is built in 
100 basis and not 60 .

Could someone please help ?

Thx in advance

David

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Problem using ROracle

2008-01-14 Thread Shuping Zhang
Hi,

 

I am trying to use ROracle installed on a Solaris (i386 platform) with
Oracle client 10.2. The installation took quite some troubleshooting,
but eventually I could load ROracle library from R, but here is the
trace and error:

 

 library(ROracle)

Loading required package: DBI

 drv-dbDriver(Oracle)

 con-dbConnect(drv,username/[EMAIL PROTECTED])

Error in oraNewConnection(drv, ...) :

 RS-DBI driver: (ORA-12154: TNS:could not resolve the connect identifier
specified)

 

However, when I try to connect to oracle thru sqlplus, I have no
problem:

 

sqlplus username/[EMAIL PROTECTED] 

 

would work, I could retrieve data from the database.

 

By google this error, I was trying everything in TNSNAMES.ORA file, I
tried a numeric ip, tried directly copy the connection string from
TNSNAMES.ORA, none seems to work.

 

Also, error messages will be recorded in sqlnet.log if I use sqlplus and
intentionally use a wrong connection string. But with the ROracle error
message above, it is not recoded in sqlnet.log.

 

Can some guru help?

 

Thanks I advance.

 

Shuping Zhang 


[[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] Listing the data contents of a package

2008-01-14 Thread John Fox
Dear Gregory,

data(package=MASS) will do what you want.

Regards,
 John

On Mon, 14 Jan 2008 15:17:54 -0500 (EST)
 Gregory Gentlemen [EMAIL PROTECTED] wrote:
 Hi R users,
 
 Simply question: On the command line, how do I list the datasets
 contained within a package, e.g. MASS?
 
 I scanned the mailing list history but was unable to find the answer.
 
 Thanks in advance.
 Gregory
 


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Heatmap problem

2008-01-14 Thread Davendra Sohal
Hi all,

I am making a heatmap using gplots. I have two problems; a solution to any
one will be greatly appreciated:

1. I have a file with genes and samples from two groups of patients. I don't
want to cluster samples; just the genes. The samples should stay in the same
order as in the datafile. Any way to do this?
2. Or, I can split the datafile into the two patient groups and make
heatmaps and present two pictures, but the ranges of values are different.
Therefore, I want to adjust the range on the color key to be the same in
both heatmaps. That is, instead of being 0 to 800 and 0 to 1500, both should
have 0 to 1500.

Please help!!

Many thanks,
-Davendra Sohal, MD, MPH
Research Fellow
Albert Einstein College of Medicine, Bronx, NY, 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] re adline detection problems

2008-01-14 Thread deegs_ca

I ran into identical readline problems.  For me appealing to the sysadmin to
install readline correctly with rpms or the like was not an option.  I
needed a personal copy of R which I could update and add packages to at my
own discretion. So I

1. got readline 5.2 from gnu.org.   
2. From readline extracted distribution root folder, called ./configure
--prefix=/myreadlinehome; make; make install
3. From R extracted distribution root folder, executed the following
configure command
./configure LDFLAGS=-L/myreadlinehome/lib  --prefix=/myrhome
CPPFLAGS=-I/myreadlinehome/include/

Performing those steps allowed me to build a version of R with all the
familiar up/down arrow tab completion etc.
-- 
View this message in context: 
http://www.nabble.com/readline-detection-problems-tp2719581p14816968.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Loading only particular columns from csv file...

2008-01-14 Thread Marko Milicic
Dear all,

I'm trying to process HUGE datasets with R. It's very fast, but I would like
to optimize it a bit more, by focusing one one column at time. say file
is 1GB big and has 100 columns. In order to prevent out of memory
problems I need to load one column at the time the only problem is
that read.table doesn't support this feature


Is there some thick which will do the magic?


Thank you in advance.

-- 
This e-mail and any files transmitted with it are confid...{{dropped:14}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Loading only particular columns from csv file...

2008-01-14 Thread Gabor Grothendieck
See the colClasses= argument of read.table where you can use NULL.

On Jan 14, 2008 6:02 PM, Marko Milicic [EMAIL PROTECTED] wrote:
 Dear all,

 I'm trying to process HUGE datasets with R. It's very fast, but I would like
 to optimize it a bit more, by focusing one one column at time. say file
 is 1GB big and has 100 columns. In order to prevent out of memory
 problems I need to load one column at the time the only problem is
 that read.table doesn't support this feature


 Is there some thick which will do the magic?


 Thank you in advance.

 --
 This e-mail and any files transmitted with it are confid...{{dropped:14}}

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


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


Re: [R] R from within a web page

2008-01-14 Thread David Galligani
Hello Professor Ripley


 Have you read ?png ?  You almost certainly don't have an X11 server 
 accessible, and alternatives are described there.

There ?
 2)One axis represent time , so actually I have some empties spaces (
 when I execute myfile.R from shell )  because the graphic is built in
 100 basis and not 60 .

 I don't even understand the words here.


I'm sorry but I'm not a native english speaker ... so maybe I was not 
very clear ...
I'll try again .
The axis represents values from 1 to 100 , while I use just values from 
1 to 60 ( 1 hour ) . So I get  white spaces for those 40 values left .


David

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


[R] plot POSIXct format data

2008-01-14 Thread Jingru Dai
Hi, everyone

I've been trying to make a scatter plot of POSIXct format data to see 
the difference between two start time.
Like X:
[1] 1995-05-26 19:00:00 1995-05-27 01:00:00 1995-05-27 07:00:00
[4] 1995-06-29 01:00:00 1995-06-29 07:00:00 1995-06-30 13:00:00
[7] 1995-06-30 19:00:00 1995-07-01 01:00:00 1995-07-01 07:00:00
..
Y:
[1] 1995-05-26 19:00:00 1995-05-27 01:00:00 1995-05-27 07:00:00
[4] 1995-06-29 01:00:00 1995-06-29 07:00:00 1995-06-30 13:00:00
[7] 1995-06-30 19:00:00 1995-07-01 01:00:00 1995-07-01 07:00:00
...

But it seems plot(x,y) doesn't work, y have to be numeric format.  Is 
there any special command for that or I should change the format of the 
data?
Thanks

Jingru Dai

School of Mathematical Sciences
Rm 454, Building 28
Monash University, 3800
Victoria, Australia

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


Re: [R] R from within a web page

2008-01-14 Thread Prof Brian Ripley
On Tue, 15 Jan 2008, David Galligani wrote:

 Hello Professor Ripley

 
 Have you read ?png ?  You almost certainly don't have an X11 server 
 accessible, and alternatives are described there.
 
 There ?

On the web page.

 2)One axis represent time , so actually I have some empties spaces (
 when I execute myfile.R from shell )  because the graphic is built in
 100 basis and not 60 .
 
 I don't even understand the words here.
 
 
 I'm sorry but I'm not a native english speaker ... so maybe I was not very 
 clear ...
 I'll try again .
 The axis represents values from 1 to 100 , while I use just values from 1 to 
 60 ( 1 hour ) . So I get  white spaces for those 40 values left .

Without knowing how you got 100 


 David


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] plot POSIXct format data

2008-01-14 Thread Gabor Grothendieck
When I try this:

 x - as.POSIXct(Sys.Date() + 0:9)
 plot(x, x)
 plot(x ~ x)

The first one does give me dates on both axes but the second one gives
numbers on the Y axis.

Note that you can always not print the axis with plot and then do it yourself
with axis or Axis.  This works for me:

 plot(x ~ x, yaxt = n)
 Axis(x, side = 2)

 R.version.string # Windows Vista
[1] R version 2.6.1 Patched (2007-12-06 r43610)

On Jan 14, 2008 6:37 PM, Jingru Dai [EMAIL PROTECTED] wrote:
 Hi, everyone

 I've been trying to make a scatter plot of POSIXct format data to see
 the difference between two start time.
 Like X:
 [1] 1995-05-26 19:00:00 1995-05-27 01:00:00 1995-05-27 07:00:00
 [4] 1995-06-29 01:00:00 1995-06-29 07:00:00 1995-06-30 13:00:00
 [7] 1995-06-30 19:00:00 1995-07-01 01:00:00 1995-07-01 07:00:00
 ..
 Y:
 [1] 1995-05-26 19:00:00 1995-05-27 01:00:00 1995-05-27 07:00:00
 [4] 1995-06-29 01:00:00 1995-06-29 07:00:00 1995-06-30 13:00:00
 [7] 1995-06-30 19:00:00 1995-07-01 01:00:00 1995-07-01 07:00:00
 ...

 But it seems plot(x,y) doesn't work, y have to be numeric format.  Is
 there any special command for that or I should change the format of the
 data?
 Thanks

 Jingru Dai
 
 School of Mathematical Sciences
 Rm 454, Building 28
 Monash University, 3800
 Victoria, Australia

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


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


Re: [R] savehistory in OSX version

2008-01-14 Thread Rob Goedman
Roger,

On Jan 14, 2008, at 1:14 PM, Day, Roger S. wrote:

 Thanks, Rob,

 I'm still unsure on the key question.
 Is there any way in R.app to save the commands run
 in the Console into a *.history or .Rhistory file,
 by running a command on the Console,
 whether savehistory() or some other function call?

Right now, there isn't in R.app.

 (I'm trying to semi-automate a regular backup procedure while
 in a very long interactive session at risk of hanging.)
 Can you say more what you mean by interoperate here?

The history file is updated on exiting R, which is clearly of no
use to you. The updated history file can be read by both R
and R.app, this is the interoperable part.

If I recall correctly (it has been a few years!), to do what you
need, would require a call back from R. I seem to remember
this would not be hard to do but at that time was not
available. Don't think it is today either.

A possible approach is to run long interactive sessions from
within the editor. Add a couple of statements and submit selection
to R. If you're using the internal editor, save the file before
submitting. From within an external editor, saving is less critical.

Rob


 Roger



 -Original Message-
 From: Rob Goedman [mailto:[EMAIL PROTECTED]
 Sent: Monday, January 14, 2008 10:21 AM
 To: Day, Roger S.
 Cc: r-help@r-project.org
 Subject: Re: [R] savehistory in OSX version

 Roger,

 The history features on Mac OS's R.app are handled by R.app and is a
 (small) superset of R's facilties, e.g. it supports multi-line history
 recalls.

 A disadvantage of this approach is that it's not possible to use R's
 history() and savehistory() nor make usage completely identical. The
 actual history files do 'interoperate', although you will loose the
 multiline feature.

 A good list for Mac OS specific discussions is [EMAIL PROTECTED] 
 project.org.

 Hope this helps,
 Rob


 On Jan 13, 2008, at 6:47 PM, Day, Roger S. wrote:

 Running Version 2.6.0  GUI 1.21.
 Generally, I enjoy working with the OSX GUI, which has some very
 pleasant features.
 Kudos to the developers!

 There is a nice history panel which slides out of the Console window.

 The buttons on the panel work as expected.
 I am puzzled by the behavior of history() and savehistory() run from
 the Console window.  I would think that these functions would view  
 and

 save the same set of commands as those seen in the history panel, but
 they don't.
 Can someone explain why, and how to fix it?

 Perhaps relevant:   I generally have performed a setwd() , or
 started R
 by launching
 a Rdata file.

 Thanks.

 Roger Day
 University of Pittsburgh Departments of Biomedical Informatics and
 Biostatistics University of Pittsburgh Cancer Institute University of
 Pittsburgh Molecular Medicine Institute
 **
 Room 310, Suite 301
 Cancer Pavilion (CNPAV)
 5150 Centre Ave.
 Pittsburgh, PA 15232
 e-mail:  [EMAIL PROTECTED]
 cell phone 412-609-3918
 assistant:
   Lucy Cafeo:   (412) 623-2952
 ***





  [[alternative HTML version deleted]]

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


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


Re: [R] Loading only particular columns from csv file...

2008-01-14 Thread Charles C. Berry
On Mon, 14 Jan 2008, Marko Milicic wrote:

 Dear all,

 I'm trying to process HUGE datasets with R. It's very fast, but I would like
 to optimize it a bit more, by focusing one one column at time. say file
 is 1GB big and has 100 columns. In order to prevent out of memory
 problems I need to load one column at the time the only problem is
 that read.table doesn't support this feature


 Is there some thick which will do the magic?

There is a unix utility called 'cut' that enables stuff like

   columns.1.3.5.to.7 - read.table( pipe( cut -f1,3,5-7 myfile  ) )

and if you have numeric data only, using scan() directly will save some space.

HTH,

Chuck



 Thank you in advance.

 -- 
 This e-mail and any files transmitted with it are confid...{{dropped:14}}

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


Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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


Re: [R] plot POSIXct format data

2008-01-14 Thread Prof Brian Ripley
On Tue, 15 Jan 2008, Jingru Dai wrote:

 Hi, everyone

 I've been trying to make a scatter plot of POSIXct format data to see
 the difference between two start time.
 Like X:
 [1] 1995-05-26 19:00:00 1995-05-27 01:00:00 1995-05-27 07:00:00
 [4] 1995-06-29 01:00:00 1995-06-29 07:00:00 1995-06-30 13:00:00
 [7] 1995-06-30 19:00:00 1995-07-01 01:00:00 1995-07-01 07:00:00
 ..
 Y:
 [1] 1995-05-26 19:00:00 1995-05-27 01:00:00 1995-05-27 07:00:00
 [4] 1995-06-29 01:00:00 1995-06-29 07:00:00 1995-06-30 13:00:00
 [7] 1995-06-30 19:00:00 1995-07-01 01:00:00 1995-07-01 07:00:00
 ...

 But it seems plot(x,y) doesn't work, y have to be numeric format.  Is
 there any special command for that or I should change the format of the
 data?

It's possible, but there is not a canned solution.  You could look at the 
code of graphics:::plot.POSIXct and modify to treat x the same way as y. 
Or simply use

plot(x,y, xaxt=n, yaxt=n)
axis.POSIXct(1, x)
axis.POSIXct(2, y)


 Thanks

 Jingru Dai
 
 School of Mathematical Sciences
 Rm 454, Building 28
 Monash University, 3800
 Victoria, Australia

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Overlay plots from different data sets using the Lattice package

2008-01-14 Thread Erin Steiner
#After spending the entire day working on this question, I have
decided to reach out for support:

#I am trying to overlay a densityplot from one data set over a
histogram of another, if I were to plot the two individually, they
would look like:

# data frame construction

data.frame.A - data.frame(rnorm(12*8), c(rep(one, 4), rep(two,
4), rep(three, 4)), c(red, orange, yellow, green))
names(data.frame.A) - c(vals, factor.1, factor.2)
data.frame.B - data.frame(rnorm(12*15), c(rep(one, 4), rep(two,
4), rep(three, 4)), c(red, orange, yellow, green))
names(data.frame.B) - names(data.frame.A)

# stand alone plots
histogram(~ vals|factor.1*factor.2, data.frame.A, type = density)
densityplot(~ vals | factor.1*factor.2, data.frame.B, plot.points = F)

# I found http://www.ats.ucla.edu/STAT/R/faq/overlay_trellis.htm

xyplot(write~read | ses.f, hsb2,
  panel=function(x, y, subscripts){
panel.xyplot(x, y, pch=16)
panel.lmline(x, y, lty=4)
panel.xyplot(hsb2$science[subscripts], hsb2$math[subscripts], pch=3)
panel.lmline(hsb2$science[subscripts], hsb2$math[subscripts])
}, as.table=T, subscripts=T)

# but it seems that the overlay only works in cases where the data
comes from the same data.frame and has the same subscripting.

# I have attempted a variety of incarnations of:

histogram(~ vals|factor.1*factor.2, data.frame.A, type = density,
  panel=function(x, ...){
panel.histogram(x,...)
panel.densityplot(~ vals | factor.1*factor.2, data.frame.B,
plot.points = F) })

# which obviously doesn't work.

# I'm not sure if the problem lies in my poor understanding of writing
functions or my poor understanding of Lattice. Is it indeed possible?

# Thank you for your time.

# Erin

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Overlay plots from different data sets using the Lattice package

2008-01-14 Thread hadley wickham
On Jan 14, 2008 7:30 PM, Erin Steiner [EMAIL PROTECTED] wrote:
 #After spending the entire day working on this question, I have
 decided to reach out for support:

 #I am trying to overlay a densityplot from one data set over a
 histogram of another, if I were to plot the two individually, they
 would look like:

 # data frame construction

 data.frame.A - data.frame(rnorm(12*8), c(rep(one, 4), rep(two,
 4), rep(three, 4)), c(red, orange, yellow, green))
 names(data.frame.A) - c(vals, factor.1, factor.2)
 data.frame.B - data.frame(rnorm(12*15), c(rep(one, 4), rep(two,
 4), rep(three, 4)), c(red, orange, yellow, green))
 names(data.frame.B) - names(data.frame.A)

 # stand alone plots
 histogram(~ vals|factor.1*factor.2, data.frame.A, type = density)
 densityplot(~ vals | factor.1*factor.2, data.frame.B, plot.points = F)

It isn't lattice, but this is pretty easy to do with ggplot2:

install.packages(ggplot2)
library(ggplot2)

qplot(vals, ..density.., data = data.frame.A, geom=histogram, facets
= factor.1 ~ factor.2, binwidth = 1) + geom_density(data=data.frame.B)

In ggplot2, every layer on the plot can have a different dataset.
You can find out more about ggplot2 at http://had.co.nz/ggplot2/, but
I'm still working on the documentation for these more advanced
features.

Hadley


-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Overlay plots from different data sets using the Lattice package

2008-01-14 Thread Deepayan Sarkar
On 1/14/08, Erin Steiner [EMAIL PROTECTED] wrote:
 #After spending the entire day working on this question, I have
 decided to reach out for support:

 #I am trying to overlay a densityplot from one data set over a
 histogram of another, if I were to plot the two individually, they
 would look like:

 # data frame construction

 data.frame.A - data.frame(rnorm(12*8), c(rep(one, 4), rep(two,
 4), rep(three, 4)), c(red, orange, yellow, green))
 names(data.frame.A) - c(vals, factor.1, factor.2)
 data.frame.B - data.frame(rnorm(12*15), c(rep(one, 4), rep(two,
 4), rep(three, 4)), c(red, orange, yellow, green))
 names(data.frame.B) - names(data.frame.A)

The first step would be to combine the two data sources:

df.comb - make.groups(data.frame.A, data.frame.B)

I would then just overlay two density plots:

densityplot(~vals | factor.1 * factor.2, df.comb,
groups = which, plot.points=FALSE,
auto.key = TRUE)

but you could do a histogram and a densityplot too:

histogram(~vals | factor.1 * factor.2, df.comb,
  type = density,
  groups = which,
  panel = panel.superpose,
  panel.groups = function(x, group.number, col, ...) {
  if (group.number == 1)
  panel.histogram(x, ...)
  else
  panel.densityplot(x, ..., plot.points = FALSE)
  })

-Deepayan

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


Re: [R] plot POSIXct format data

2008-01-14 Thread Jingru Dai
Hi, Gabor

It works now, thanks.  The tricky part is I imported my data from Excel 
and converted the data into POSIXct format using command strptime().
So I thought they were already converted into dates and times class.  I 
added as.POSIct, now it works alright.

Thanks for that



Gabor Grothendieck wrote:
 When I try this:

   
 x - as.POSIXct(Sys.Date() + 0:9)
 plot(x, x)
 plot(x ~ x)
 

 The first one does give me dates on both axes but the second one gives
 numbers on the Y axis.

 Note that you can always not print the axis with plot and then do it yourself
 with axis or Axis.  This works for me:

   
 plot(x ~ x, yaxt = n)
 Axis(x, side = 2)
 

   
 R.version.string # Windows Vista
 
 [1] R version 2.6.1 Patched (2007-12-06 r43610)

 On Jan 14, 2008 6:37 PM, Jingru Dai [EMAIL PROTECTED] wrote:
   
 Hi, everyone

 I've been trying to make a scatter plot of POSIXct format data to see
 the difference between two start time.
 Like X:
 [1] 1995-05-26 19:00:00 1995-05-27 01:00:00 1995-05-27 07:00:00
 [4] 1995-06-29 01:00:00 1995-06-29 07:00:00 1995-06-30 13:00:00
 [7] 1995-06-30 19:00:00 1995-07-01 01:00:00 1995-07-01 07:00:00
 ..
 Y:
 [1] 1995-05-26 19:00:00 1995-05-27 01:00:00 1995-05-27 07:00:00
 [4] 1995-06-29 01:00:00 1995-06-29 07:00:00 1995-06-30 13:00:00
 [7] 1995-06-30 19:00:00 1995-07-01 01:00:00 1995-07-01 07:00:00
 ...

 But it seems plot(x,y) doesn't work, y have to be numeric format.  Is
 there any special command for that or I should change the format of the
 data?
 Thanks

 Jingru Dai
 
 School of Mathematical Sciences
 Rm 454, Building 28
 Monash University, 3800
 Victoria, Australia

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



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


[R] navigating ggplot viewports

2008-01-14 Thread Felix Andrews
list(...)

I can not get at the grid viewports in a ggplot2 plot.
I know there is supposed to be a viewport called panel_1_1 but
downViewport() can't find it. Has the viewport been popped?
I had a quick look at the functions involved (eg ggplot_plot)
but there is no obvious problem there.

 library(ggplot2)
 qplot(1:10, 1:10)
 current.viewport()
viewport[ROOT]
 downViewport(panel_1_1)
Error in downViewport.vpPath(vpPathDirect(name), strict, recording =
recording) :
  Viewport 'panel_1_1' was not found
 current.vpTree()
viewport[ROOT]-(viewport[GRID.VP.1])
 grid.ls(viewports=T, grob=F)
ROOT
  GRID.VP.2
1
  GRID.VP.3
layout
  strip_h_1_1
1
  strip_v_1_1
1
  axis_h_1_1
1
  axis_v_1_1
1
  panel_1_1
2
layout
  panel_1_1
2
layout
  axis_v_1_1
left_axis
  labels
1
  ticks
2
left_axis
  ticks
2
left_axis
  labels
2
2
layout
  axis_h_1_1
bottom_axis
  labels
1
  ticks
2
bottom_axis
  ticks
2
bottom_axis
  labels
2
2
layout
  panel_1_1
2
layout
  panel_1_1
2
layout
  panel_1_1
2
1
  GRID.VP.4
1
  GRID.VP.5
1
  GRID.VP.6
1

 sessionInfo()
R version 2.6.1 (2007-11-26)
i386-pc-mingw32

locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252

attached base packages:
[1] splines   grid  stats graphics  grDevices utils datasets
[8] methods   base

other attached packages:
[1] ggplot2_0.5.7  colorspace_0.95RColorBrewer_1.0-2 MASS_7.2-38
[5] proto_0.3-8reshape_0.8.0

loaded via a namespace (and not attached):
[1] tools_2.6.1


-- 
Felix Andrews / 安福立
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
3358 543D AAC6 22C2 D336  80D9 360B 72DD 3E4C F5D8

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


[R] how to go to a line in R

2008-01-14 Thread Jack Luo
Hi, List

When I was writing R code, I notice that there is no number indicating how
many lines of codes you are writing. Is there a way to go to a line with
defined number? say I want to go to the 20th line.

Thanks,

Jack

[[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] unload reload a (new version of a) package

2008-01-14 Thread Henrik Bengtsson
On 14/01/2008, hadley wickham [EMAIL PROTECTED] wrote:
 On Jan 14, 2008 5:48 PM, Harte, Thomas P [EMAIL PROTECTED] wrote:
  i'm putting the final touches on a package that i'm developing and i
  noticed
  that if i detach the package, and then re-build  re-install it (using R
  CMD)
  then I can't get the newer version of the package to load in the
  existing R
  session (i have to close it out and start a new session, then the newer
  version of the package is loaded).
 
  looking through the source of 'detach'  i see :
 
.Call(R_lazyLoadDBflush, paste(libpath, /R/, pkgname,
  .rdb, sep = ), PACKAGE = base)
 
  is there some absolute way similar to the above to flush the package db
  and ensure that a newer version of the package can be loaded into the
  existing R session? detach calls .Last.lib and seems to go through the
  motions of purging the loaded package; why, then, is the package still
  lurking around in the existing R session?

 For testing, I usually just resource all of my code:

 lapply(dir(~/documents/ggplot/ggplot/R, full.name=T), source)

 obviously it's no good for testing data, namespaces or compiled code,
 but 95% of the time it's good enough for me.

In R.utils, there is sourceDirectory(), which in turn calls sourceTo()
on each file, and it (actually the latter) takes an argument
'modifiedOnly' that allows you to only source those files modified
since last time you source them, e.g.

 sourceDirectory(~/documents/ggplot/ggplot/R, modifiedOnly=TRUE)

/Henrik


 Hadley

 --
 http://had.co.nz/

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


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


Re: [R] Retrieve results from chisq.test programmatically

2008-01-14 Thread Jingru Dai
Hi, Coyne

chisq.test(x)$p.value can retrieve the p-value of the test.
chisq.test(x)$statistic will give you the x-squared result, if you only 
want the number chisq.test(x)$statistic[[1]] can retrieve the numeric 
value.  So you can simply write a loop to do the test and save the 
results in some matrix.

I hope it helps

Jingru Dai

My Coyne wrote:
 Hello,

  

 I would like to run a series of chisq.test() and store results (x-square,
 df, p-value) in a matrix for further analysis, but don't know how to do
 such.  Currently I run the command line for each set of data at a time and
 it is time consuming.

  

 Thank you for your help.

  

 --My Coyne

  

  

  

  


   [[alternative HTML version deleted]]

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


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


Re: [R] Retrieve results from chisq.test programmatically

2008-01-14 Thread My Coyne
Thanks a bunch.

-Original Message-
From: Jingru Dai [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 14, 2008 10:25 PM
To: [EMAIL PROTECTED]; r-help@r-project.org
Subject: Re: [R] Retrieve results from chisq.test programmatically

Hi, Coyne

chisq.test(x)$p.value can retrieve the p-value of the test.
chisq.test(x)$statistic will give you the x-squared result, if you only 
want the number chisq.test(x)$statistic[[1]] can retrieve the numeric 
value.  So you can simply write a loop to do the test and save the 
results in some matrix.

I hope it helps

Jingru Dai

My Coyne wrote:
 Hello,

  

 I would like to run a series of chisq.test() and store results (x-square,
 df, p-value) in a matrix for further analysis, but don't know how to do
 such.  Currently I run the command line for each set of data at a time and
 it is time consuming.

  

 Thank you for your help.

  

 --My Coyne

  

  

  

  


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


[R] EMACS and ESS

2008-01-14 Thread John Sorkin
Fedora Linux 8
R 2.6.1
Intel CPU

I am trying to get started with R under Linux. It has been suggested to me that 
I run R under EMACS. I have looked at the CRAN website, and several other 
places to try to find an RPM for EMACS and, if I need it for ESS. I have not 
succeeded in finding one. Can someone tell me where to go to get the RPMs? If 
anyone would have a suggestion for an editor other than EMACS to use with R, I 
would appreciate any suggestions.
Thanks,
John

John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] In chisq.test(x) : Chi-squared approximation may be incorrect

2008-01-14 Thread My Coyne
Hello,

 

I received the following warning when running chi-square;

n  Is there a way to catch the 'error' code of 'warning' after run
chisq.test(x)?

n  What does this error mean?

 

Thank you for your help.

 

 


[[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 with the generic function [

2008-01-14 Thread Gregory Wall

Hello Everyone:

I'm hoping to get some suggestions on this problem i'm having with
subsetting on an R object i've created. I would really appreciate any advice. 

I've created this simple S3 class:

str(ans)
Class 'myObj'  atomic [1:45000] 0.0428 0.0423 0.0554 0.0338 0.0345 ...
  ..- attr(*, Size)= int 10
  ..- attr(*, Region)= chr EXON


I create instances of this class by doing something like this:

ans - structure(x,class=myObj, Size=length(i), Region=attr(x,UTR))

where x is a vector of reals. 

When I subset it via ans[c(2,3,4),c(2,4,8)] I get the result I want (my
subsetting works as if its a two dimensional object for reasons I'll omit
since I don't think its pertinent to the problem).

I've written my subsetting code in C, so my R function is basically just a
wrapper function to a .Call. 

[.myObj - function(x, i=NA, j=NA, ...){

.. do some parameter checking...
.. then pass the data on to my C routine...

ans - .Call(foo,as.numeric(x),as.integer(i),as.integer(j))
ans - structure(ans,class=myObj, Size=length(i), Region=attr(x,UTR))

return(ans)
}

One of my main goals is to do this subsetting quickly (which is why i do
the subsetting in C) However, when I look at my results returned from
summaryRprof I see these 3 lines that are troubling:

$by.total
  total.time total.pct self.time self.pct
[41.54  50.3  0.22  0.3
[.myObj  41.32  50.0  0.32  0.4
as.numeric   38.58  46.7 38.58 46.7

these times are much much longer than they should be. I'm not sure why [
is called twice.

I'm guessing that its being called once for the myObj class, and once for
the underlying atomic structure of a vector of reals. 

I've been looking at this issue for a while and trying to mimic other
subsetting packages but with no luck. I think the solution involves
understanding NextMethod([) but then again I'm not so sure.

Again, I really appreciate any comments or advice!

Thanks a bunch,

Greg W.

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