Re: [R] [R-sig-ME] Xy plot help

2012-04-29 Thread Hugo . Mildenberger
On Sun, 29 Apr 2012 11:27:06 -0700 (PDT)

arun smartpink...@yahoo.com wrote:

 I tried to get xyplot shrink fit for my mixed model._ But, the mixed model 
 line is not seen in the graph.
 I would like to know if there is anything wrong with my code.

Typo? Try  panel.abline(fixef(fm1),... or panel.abline(ff), ...

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

2011-10-24 Thread Hugo Mildenberger
Dear list members,

what is the reason that one obviously can't do arithmetic operations on
zoo members with different index positions?


require(zoo)
z - zoo(c(1,1,1),order.by=c(1,2,3))
z
   1 2 3
   1 1 1
z[1]   + z[1]
   1
   2
z[1:2] + z[1:2]
   1 2
   2 2
z[1] + z[2]
   Data:
   numeric(0)

   Index:
   numeric(0)

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

2011-06-29 Thread Hugo Mildenberger
Marie,

you did not say if you work on Windows or Unix. The manual from google
belongs to the R package RpostgreSQL. This package makes use the native
PostgreSQL driver. As I read the documentation, the package's DBI
interface must be somehow binary compatible with the Postgres version
installed. It installs and works seamlessly here on Linux, and also
works with Windows Vista, but I remember that I had to shuffle some dlls
from the postgresql directory. So if you provide some more information,
maybe I'll remember what I did to get it running.

Best regards

Hugo

Am 28.06.2011 14:15, schrieb aya74...@gmx.de:
 Dear R-helpers,
 
 I'm an absolute beginner using both R and PostgreSQL, but now I have to work 
 with both programs. I need to connect R and my Postgres-database, but every 
 attempt so far has failed (I tried using the RpgSQL package as well as 
 RdbiPgSQL, the first, following this manual 
 (http://code.google.com/p/rpostgresql/) didn't find any drivers for the 
 database (step no. 1) whereas the second doesn't work with R version 2.13). 
 
 Could someone please be so kind to either provide a step-by-step instruction 
 on how to make this connection work or direct me to a manual?
 
 Thanks in advance.
 
 Yours sincerly,
 
 Marie
 --
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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 on a R script part

2011-06-26 Thread Hugo Mildenberger
Duncan,

it isn't really that difficult to diagnose. A google search for 

ss11=sample(x1, n1, replace=TRUE)   

turned up this documented R-script 

  ttp://www2.latech.edu/~dcahoy/TwoSampleEqualVarTest.R 

as a likely source for his fragmented and mangled post; other variable 
names match as well. But besides  this, Lusk also demanded to be 
provided with a mathematical notation of the R code he posted. While 
he certainly could have followed Dexter O. Cahoy's reference to the 
underlying paper at 
   
   ttp://www.sciencedirect.com/science/article/pii/S016794731000157X

to get the theoretical background and a formal notation, I do imagine 
a tool which takes the R parse tree as input and produces a mathematical 
notation as a nicely formatted (LaTex) output, similar to what Mathematica 
does on the fly.  

At least I like this idea (h/t to Lusk) and think it should be doable for 
some less complex functions at first. Such a translator could greatly 
enhance function documentation, facilitate debugging and so on, but 
may also provide a base implemention for interfaces specific to other 
programs, thus giving R the ability to also export algorithms. 


Best regards

Hugo Mildenberger



On Saturday 25 June 2011 15:55:51 Duncan Murdoch wrote:
 On 11-06-25 11:33 AM, Mike Miller wrote:
  I'm curious about what would cause this (see below), if it isn't a joke.
  Is it possible that it didn't look ridiculous in the deleted HTML but the
  text looked bad?  It's almost unreadable.  I guess the HTML gets deleted
  because it is a waste of space, but I received a 14 MB message from this
  list the other day.
 
 I imagine you need to contact the poster, and find out what they sent. 
 It's hard to diagnose after it's been mangled.
 
 Duncan Murdoch
 
 
  Mike
 
 
  On Fri, 24 Jun 2011, Lusk Aris wrote:
 
  Hi all,
  I need all your help on this. I have the next part of 
  code:e1=x1-mean(x1)e2=x2-mean(x2)n1=length(x1)n2=length(x2N=(n1
   + 
n2)nu2=sum( c(  ( x1 -mean(x1) )^2 , ( x2-mean(x2) )^2  ) )/Nss=c(e1,e2) b3= 
N*sum(ss^4)/ (sum( ss^2)^2)what do lines 6-8 (mathematical 
notation)?Also the, what means part?for(j in 1:B){ ss11=sample(x1, 
n1, replace=TRUE) ss12=sample(x2, n2, replace=TRUE) 
}I would appreciate you could help on my inquiry, 
and I am awaiting for your soon answer Thx in advance, Lusk
 [[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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with lmer

2011-06-26 Thread Hugo Mildenberger
Sophie,

sorry for any possibly duplicate email, my email client currently does not 
work correctly. I understand this snapshot as being a subset of your data only. 
But I do miss the factor Sitename, which appears in your lmer model as a 
random factor. Also, by looking at the subset, Presencebsence  appears be a 
binary response variable. Does your response imply that you tried to call

  (m1-lmer(Presencebsence~Habitatype*Width+(1|Sitename),family=binomial))

and got the same error? (Note: I previously mispelled family)

I also observe that many factors in your data appear to be closely correlated, 
e.g. Habitatype and Width, at least in the subset you passed along. I 
suspect 
this correlation to be the reason for the lmer error. Hence either use Width  
or Habitatype.

Finally I'd propose you to put all your data into a dataframe, e.g.
 
   mydata-NULL
   mydata$PresenceAbsence - as.factor(Presencebsence)
   mydata$Habitattype - as.factor(Habitatype)
   mydata$Substratetype - as.factor(Substratetype)
   mydata$Width - Width  
   mydata$Banktype- as.factor(Banktype)
   mydata$BankIncline - BankIncline 
   mydata$Bankheight - as.factor(Bankheight)
   mydata$Waterdepth- as.factor(Waterdepth)  
   mydata$Sitename- as.factor(Sitename)

and then pass the dataframe to lmer by using data=mydata;  mainly 
because passing a bunch of variables directly from the environment 
hightens the risk of inadvertently using stale copies, but also because 
str(mydata) would then produce a well arranged summary of all your
variables. 


Kind regards

Hugo



On Sunday 26 June 2011 11:26:45 Sophie Higgins wrote:
 
 Hello Hugo,
 Thank you for your reply.  
 This is a snap shot of what my data looks like:
 
  
  
  
  
  
  
   Presencebsence
   Habitatype
   Substratetype
   Width
   Banktype
   BankIncline
   Bankheight
   Waterdepth
  
  
   0
   Lake
   Rocksgravel
   600
   Earth
   0.45
   less1
   greater2
  
  
   0
   Lake
   Rocksgravel
   600
   Earth
   0.45
   less1
   greater2
  
  
   1
   Lake
   Rocksgravel
   600
   Earth
   0.45
   less1
   greater2
  
  
   0
   Lake
   Rocksgravel
   600
   Earth
   0.45
   less1
   greater2
  
  
   0
   Lake
   Rocksgravel
   600
   Earth
   0.45
   less1
   greater2
  
  
   0
   Stream
   Rocksgravel
   1
   Rocks
   0.45
   less1
   025to05
  
  
   0
   Stream
   Rocksgravel
   1
   Rocks
   0.45
   less1
   025to05
  
  
   0
   Stream
   Rocksgravel
   1
   Rocks
   0.45
   less1
   025to05
  
  
   0
 
 
 
   Stream
   Rocksgravel
   1
   Rocks
   0.45
   less1
   025to05
  
  
   
 
 
 
 
 
 
 
 
 
   
 
 
 
 
 
 
 
 I am trying to find out if any off the above factors so substrate type, 
 width, bank type etc have an effect on the presence/absence of the species in 
question.  But as stated below I keep getting an error message up and I have no 
idea how to fix it in order for me to fun the lmer.
 Sophie 
  From: hugo.mildenber...@web.de
  To: r-help@r-project.org
  CC: england...@hotmail.com
  Subject: Re: [R] Help with lmer
  Date: Fri, 24 Jun 2011 17:19:00 +0200
  
  Sophie,
  
  I'm myself quite new to linear mixed effect models, but PresenceAbsence 
  sounds like
  a binary response variable. So  wouldn't be
  
   m1-lmer(Presencebsence~Habitatype*Width+(1|Sitename),familiy=binomial)
  
  the first thing to try?  There is also a special mailing list for linear - 
  mixed -effect 
  models:
  
r-sig-mixed-mod...@r-project.org
  
  But with numeric problems like this one you really should provide a self 
  contained 
  example (i.e. with data),  at least the output of str(yourdata), if ever 
  possible. 
  
  Kind regards
  
  Hugo
  
  On Friday 24 June 2011 13:11:23 Sophie Higgins wrote:
   
   Hey,
   I am having trouble with lmer.  I am looking at the presence/absence of 
   water shrews against habitat and other factors e.g
   so I used this:
   m1-lmer(Presencebsence~Habitatype*Width+(1|Sitename))summary(m1)
   But i keep getting this error up
   Error in mer_finalize(ans) : Downdated X'X is not positive definite, 16. 
   summary(m1)Error in asMethod(object) : matrix is not symmetric [1,2]
   What does this mean and now can I fix it?
   Sophie  
 [[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] On .. glibc detected home/sguha/lib64/R/bin/exec/R: realloc(): invalid next size: 0x000000000209e210 ***

2011-06-25 Thread Hugo Mildenberger
Saptarshi,

if you look at the sheer number of shared libraries involved, heap 
corruption may have happened due to errors in any of these. 
Finding the reason for such problems is usually difficult, but almost 
impossible without a reproducible example. If you could boil it down 
to a minimal example still triggering the access violation, one could 
try to run it under control of a memory guard like valgrind. 

Best

Hugo

On Friday 24 June 2011 17:12:26 Saptarshi Guha wrote:
 Hello,
 
 I'm trying to use rjson to parse a JSON object. The object can be found here
 
 http://pastebin.com/np0s5hgM
 
 (you'll probably need to add quotes around the content)
 
 
 fromJSON returns the error
  glibc detected home/sguha/lib64/R/bin/exec/R: realloc(): invalid next
 size: 0x0209e210 ***
 
 Is there a fix coming soon? Maybe CRAN should also have an outstanding
 bug field  - packages with unfixed bugs could be removed.
 
 
 Cheers
 Joy
 
 
 rjson- 0.2.3
 and
 
 R.version
_
 platform   x86_64-unknown-linux-gnu
 arch   x86_64
 os linux-gnu
 system x86_64, linux-gnu
 status
 major  2
 minor  13.0
 year   2011
 month  04
 day13
 svn rev55427
 language   R
 version.string R version 2.13.0 (2011-04-13)
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 on a R script part

2011-06-25 Thread Hugo Mildenberger
Lusk, 

if I were in your business, I would tackle such a problem with 
help from a little formatting ...

  e1=x1-mean(x1)
  e2=x2-mean(x2)
  n1=length(x1)
  n2=length(x2)
  N=(n1 + n2)
  nu2=sum( c(  ( x1 -mean(x1)  )^2 , ( x2-mean(x2)  )^2  ) )/N
  ss=c(e1,e2) 
  b3=N*sum(ss^4)/(sum( ss^2)^2)

  for(j in 1:B){ ss11=sample(x1, n1, replace=TRUE) 
  ss12=sample(x2, n2, replace=TRUE) } 


... afterwards I'd correct for missing parenthesis and such. But I 
understand that this approach was really not conducive when the 
main intention was to target the public by giving the unhappy college 
student who infelicitously bumped into a mountain of WWI-style 
razor wire. The wire-cutter equivalent tool the R interpreter provides 
you with is the question mark. Here are some examples how to use it:

?mean
?length
?sum
?sample
?^
?for
?in
?:
?=
?-
?+
?*
?/


Hope this helps.

Kind regards




On Friday 24 June 2011 15:31:44 Lusk Aris wrote:
 
 Hi all,
 I need all your help on this. I have the next part of 
 code:e1=x1-mean(x1)e2=x2-mean(x2)n1=length(x1)n2=length(x2N=(n1 + 
n2)nu2=sum( c(  ( x1 -mean(x1) )^2 , ( x2-mean(x2) )^2  ) )/Nss=c(e1,e2) b3= 
N*sum(ss^4)/ (sum( ss^2)^2)what do lines 6-8 (mathematical 
notation)?Also the, what means part?for(j in 1:B){ ss11=sample(x1, 
n1, replace=TRUE) ss12=sample(x2, n2, replace=TRUE) 
}I would appreciate you could help on my inquiry, 
and I am awaiting for your soon answer Thx in advance, Lusk 

   [[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] gcc-4.5.2 and install.packages(glmnet)?

2011-06-24 Thread Hugo Mildenberger

That problem is at least two-fold:
1.  A failing heuristic in glmnet/configure.in
2.  glmnet/src/glmnet/src/newGLMnet_f.f90 does not compile.
  Several problems:
  - gfortran does not recognise lines starting with [c|C] 
comments
  - starting at line 517, a line number column was inserted 
after column 72  
  - long lines had been wrapped by inserting [*], often inside 
parameter names
  - looks very wrong, much like a listing file

Quick fix procedure:
ad  1.  unpack the archive
apply the patch shown below or edit configure.in (replace ${FC} 
by ${F77} in line 38)
delete glmnet/configure
repack the archive
try to install the newly packed archive via R CMD INSTALL (will 
fail)

  ad 2.  I could also attach a patch also for glmnet/src/newGLMnet_f.f90
- but it is rather big (you may contact me)
- while the package will compile and load without error,
   running example(glmnet) results in:
   glmnet fit1=glmnet(x,y)
   Error in validObject(.Object) : 
   invalid class dgCMatrix object: length(Dimnames[[2]])' 
must match Dim[2]
   In addition: Warning message:
   from glmnet Fortran code - Convergence for 1th lambda value 
not reached after 
   maxit=10 iterations; solutions for larger 
lambdas returned 

So there seem to be many problems worth of a bug report to the author(s) of 
glmnet.

Kind regards

Hugo 

--- cut here ---

diff -ur a/glmnet/configure.in b/glmnet/configure.in
--- a/glmnet/configure.in   2011-06-15 20:05:30.0 +0200
+++ b/glmnet/configure.in   2011-06-24 10:08:21.0 +0200
@@ -35,7 +35,7 @@
FC=`basename ${FC}`
 fi
 
-case ${FC} in
+case ${F77} in
 gfortran*)
   echo   R configured for gfortran; Good!
   AC_SUBST(OUR_FCFLAGS, -fdefault-real-8 -ffixed-form)

--- cut here ---


On Thursday 23 June 2011 22:39:33 Juergen Rose wrote:
 Hi,
 
 is there any chance to install glmnet with gcc-4.5.2? For me it fails on
 all systems with:
 
 trying URL
 'http://mirrors.softliste.de/cran/src/contrib/glmnet_1.7.tar.gz'
 Content type 'application/x-gzip' length 522888 bytes (510 Kb)
 opened URL
 ==
 downloaded 510 Kb
 
 * installing *source* package ‘glmnet’ ...
  This package has only been tested with gfortran.
  So some checks are needed.
  R_HOME is /usr/lib64/R
 Attempting to determine R_ARCH...
 R_ARCH is 
 Attempting to detect how R was configured for Fortran 90
 Unsupported Fortran 90 compiler or Fortran 90
 compilers unavailable! Stop!
 ERROR: configuration failed for package ‘glmnet’
 
 How can I get more information, what a problem has happened?
 
 Otherwise I have no problem to compile a small Fortran 90 program:
 root@orca:/home/rose/Txt/src/Test/Fortran(57)# cat hello.f90 
 program Hello
   print *,'Hello world'
 end program Hello
 root@orca:/home/rose/Txt/src/Test/Fortran(58)# gfortran -cpp -dM
 hello.f90
 root@orca:/home/rose/Txt/src/Test/Fortran(59)# ./a.out
  Hello world
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] How to capture console output in a numeric format

2011-06-24 Thread Hugo Mildenberger

One possibility involves applying a regular expression via gsub:

   as.numeric(gsub(^\\[1\\] ,,fvals))


On Friday 24 June 2011 14:39:31 Ravi Varadhan wrote:
 Hi,
 
 I would like to know how to capture the console output from running an 
 algorithm for further analysis.  I can capture this using capture.output() 
 but 
that yields a character vector.  I would like to extract the actual numeric 
values.  Here is an example of what I am trying to do.
 
 fr - function(x) {   ## Rosenbrock Banana function
 on.exit(print(f))
 x1 - x[1]
 x2 - x[2]
 f - 100 * (x2 - x1 * x1)^2 + (1 - x1)^2
 f
 }
 
 fvals - capture.output(ans - optim(c(-1.2,1), fr))
 
 Now, `fvals' contains character elements, but I would like to obtain the 
 actual numerical values.  How can I do this?
 
 Thanks very much for any suggestions.
 
 Best,
 Ravi.
 
 ---
 Ravi Varadhan, Ph.D.
 Assistant Professor,
 Division of Geriatric Medicine and Gerontology School of Medicine Johns 
 Hopkins University
 
 Ph. (410) 502-2619
 email: rvarad...@jhmi.edumailto:rvarad...@jhmi.edu
 
 
   [[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] Help with lmer

2011-06-24 Thread Hugo Mildenberger
Sophie,

I'm myself quite new to linear mixed effect models, but PresenceAbsence 
sounds like
a binary response variable. So  wouldn't be

 m1-lmer(Presencebsence~Habitatype*Width+(1|Sitename),familiy=binomial)

the first thing to try?  There is also a special mailing list for linear - 
mixed -effect 
models:

  r-sig-mixed-mod...@r-project.org

But with numeric problems like this one you really should provide a self 
contained 
example (i.e. with data),  at least the output of str(yourdata), if ever 
possible. 

Kind regards

Hugo

On Friday 24 June 2011 13:11:23 Sophie Higgins wrote:
 
 Hey,
 I am having trouble with lmer.  I am looking at the presence/absence of water 
 shrews against habitat and other factors e.g
 so I used this:
 m1-lmer(Presencebsence~Habitatype*Width+(1|Sitename))summary(m1)
 But i keep getting this error up
 Error in mer_finalize(ans) : Downdated X'X is not positive definite, 16. 
 summary(m1)Error in asMethod(object) : matrix is not symmetric [1,2]
 What does this mean and now can I fix it?
 Sophie  
   [[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] Rmpi fails to install

2011-06-17 Thread Hugo Mildenberger
Juergen,

 I try to install Rmpi as root with install.packages(Rmpi).
 It fails with:
 ...

I encountered a similar problem with openmpi-1.5.3 and 
Rmpi_0.5-9.tar.gz. The reason was an unchecked call to 
dlopen(libmpi.so.0).  At least openmpi-1.5.3 does not provide  
libmpi.so.0 anymore. The patch below corrects for this. 

According to man dlopen, this should work with all POSIX.1-2001 
compliant systems. But possibly R already has an abstraction layer
for loading shared objects?

Here is how to apply this patch locally:

   tar -xvzf Rmpi_0.5-9.tar.gz
   patch -p1  rmpi-check-dlopen-status.patch
   tar -cvzf  Rmpi_0.5-9a.tar.gz
   R CMD INSTALL --preclean Rmpi_0.5-9a.tar.gz


Best 

Hugo  

 cut 

diff -ru a/Rmpi/src/Rmpi.c b/Rmpi/src/Rmpi.c
--- a/Rmpi/src/Rmpi.c   2010-11-30 20:38:01.0 +0100
+++ b/Rmpi/src/Rmpi.c   2011-06-17 12:48:37.0 +0200
@@ -68,7 +68,11 @@
else {
 
 #ifdef OPENMPI
-   dlopen(libmpi.so.0, RTLD_GLOBAL | RTLD_LAZY);
+   if (!dlopen(libmpi.so, RTLD_GLOBAL | RTLD_LAZY)) { 
+Rprintf(%s\n,dlerror());
+return AsInt(0);
+   }
+
 #endif
 
 #ifndef MPI2

--- cut 






On Monday 07 March 2011 21:53:05 r...@uni-potsdam.de wrote:
 I try to install Rmpi as root with install.packages(Rmpi).
 It fails with:
 ...
 checking for x86_64-pc-linux-gnu-gcc -std=gnu99 option to accept ISO
 C89... none needed
 I am here /usr and it is OpenMPI
 Trying to find mpi.h ...
 Found in /usr/include
 Trying to find libmpi.so or libmpich.a ...
 Found libmpi in /usr/lib
 checking for openpty in -lutil... yes
 checking for main in -lpthread... yes
 configure: creating ./config.status
 config.status: creating src/Makevars
 ** libs
 x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include
 -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
 -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2
 -DOPENMPI -I/usr/local/include-fpic  -march=nocona -O2 -pipe
 -fomit-frame-pointer -c RegQuery.c -o RegQuery.o
 x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include
 -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
 -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2
 -DOPENMPI -I/usr/local/include-fpic  -march=nocona -O2 -pipe
 -fomit-frame-pointer -c Rmpi.c -o Rmpi.o
 x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include
 -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
 -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2
 -DOPENMPI -I/usr/local/include-fpic  -march=nocona -O2 -pipe
 -fomit-frame-pointer -c conversion.c -o conversion.o
 x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include
 -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
 -DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2
 -DOPENMPI -I/usr/local/include-fpic  -march=nocona -O2 -pipe
 -fomit-frame-pointer -c internal.c -o internal.o
 x86_64-pc-linux-gnu-gcc -std=gnu99 -shared -Wl,-O1 -Wl,--as-needed -o
 Rmpi.so RegQuery.o Rmpi.o conversion.o internal.o -L/usr/lib -lmpi
 -lutil -lpthread -L/usr/lib64/R/lib -lR
 installing to /usr/lib64/R/library/Rmpi/libs
 ** R
 ** demo
 ** inst
 ** preparing package for lazy loading
 ** help
 *** installing help indices
 ** building package indices ...
 ** testing if installed package can be loaded
 /usr/lib64/R/bin/exec/R: symbol lookup
 error: /usr/lib64/openmpi/mca_paffinity_linux.so: undefined symbol:
 mca_base_param_reg_int
 
 The downloaded packages are in
  ?/tmp/RtmpLvvl9R/downloaded_packages?
 Updating HTML index of packages in '.Library'
 Warning message:
 In install.packages(Rmpi) :
installation of package 'Rmpi' had non-zero exit status
 
 The system is a gentoo system with openmpi-1.5.1. I am thankful for any
 hint.
 
 Juergen
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Rmpi installation

2011-06-16 Thread Hugo Mildenberger
Kristian,

 Another update: I ditched the pre-installed version of openmpi and
 installed openmpi from source (./configure --without-openib).

A very reasonable approach. Remembering my own struggles with SuSE years 
ago, I did not dare to propose that procedure.

 Compiling and running your test programme gives me the following error:
 
 unger@zytosrv01dmi:~/R_projects/OS ./mtest
 [zytosrv01dmi:6094] *** An error occurred in MPI_Send
 [zytosrv01dmi:6094] *** on communicator MPI_COMM_WORLD
 [zytosrv01dmi:6094] *** MPI_ERR_RANK: invalid rank
 [zytosrv01dmi:6094] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort)

Same here. For the moment I can't figure out why this happens, also because the 
parameters of the openmpi functions are scarcely documented. Try one of the 
demo 
programs in the openmpi examples  directory  instead, e.g. the attached one 


 However, Rmpi installs happily and it is also possible to call the package
 in R. When it comes to running a job under snowfall
 
 sfInit( parallel=TRUE,type=MPI, cpus=8) the job is split into eight
 separate processes which all run on the same CPU. So it seems that the
 processes are not distributed across the 8 CPUs available.

sfSetMaxCPUs(number=8) should fix at least the thread distribution. However, on 
my 
notebook all cores are kept busy with 100% load after sfInit(), with nothing 
obvious to 
compute. I don't know if this has to be considered a bug or a feature.

Kind regards

Hugo

 Best wishes
 
 Kristian
 
 
 
 
 
 
 
 
 Am 15.06.11 19:25 schrieb Hugo Mildenberger unter
 hugo.mildenber...@web.de:
 
 Dear Kristian,
 
please run exactly
 
 mpicc mtest.c -o mtest
 
   If you really need it, add -v separately. mpicc is nothing but a
 compiler wrapper.
   The -o switch specifies the outfile name, which has to follow
 immediately after -o,
   with or without a blank character in between. I'm not sure about what
 happens
   with -ov mtest. Probably an output file named v is produced on disk,
 in addition to
   the file mtest stemming from a previous with -o mtest Depending on
   mpicc's, gcc's and ld's version, gcc may instruct the linker to link
 the previously
   produced executable mtest with the object newly compiled from mtest.c
 plus
   several implicit libraries and startup objects, and output the result
 to v.
   ld would then be faced with duplicate defined symbols and output a list
 of these
   doublets.
 
   My proposal was meant as a test for an else correct openmpi
 installation, perhaps
   I should have said this. On successful completion, no message should be
 printed, but
   an executable named mtest should have been produced, which could then
   be run typing ./mtest. If the link process failed, then the openmpi
 installation was
   inconsistent.
 
 Kind regards
 
 Hugo
 
 On Wednesday 15 June 2011 17:45:41 Unger, Kristian, Dr. wrote:
  Dear Hugo
 
  I ran the command with the verbose switch and get the following output:
 
   mpicc mtest.c -ov mtest
  mtest: In function `_start':
 
 /usr/src/packages/BUILD/glibc-2.11.1/csu/../sysdeps/x86_64/elf/start.S:65
 :
  multiple definition of `_start'
 
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crt1.o:/usr/src/pa
 ck
  ages/BUILD/glibc-2.11.1/csu/../sysdeps/x86_64/elf/start.S:65: first
  defined here
  mtest: In function `_fini':
  (.fini+0x0): multiple definition of `_fini'
 
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crti.o:initfini.c:
 (.
  fini+0x0): first defined here
  mtest:(.rodata+0x0): multiple definition of `_IO_stdin_used'
 
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crt1.o:(.rodata.cs
 t4
  +0x0): first defined here
  mtest: In function `__data_start':
  (.data+0x0): multiple definition of `__data_start'
 
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crt1.o:(.data+0x0)
 :
  first defined here
  mtest: In function `main':
  (.text+0xec): multiple definition of `main'
  /tmp/ccUyk8e9.o:mtest.c:(.text+0x0): first defined here
  mtest: In function `_init':
  (.init+0x0): multiple definition of `_init'
 
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crti.o:initfini.c:
 (.
  init+0x0): first defined here
 
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld
 :
  error in mtest(.eh_frame); no .eh_frame_hdr table will be created.
  collect2: ld returned 1 exit status
 
  Not sure if this makes any sense?
 
 
  Best wishes
 
  Kristian
 
  
  Dr. Kristian Unger
 
 
  Arbeitsgruppenleiter Integrative Biologie / Head of Integrative Biology
  Group
  Abteilung für Strahlenzytogenetik / Research Unit of Radiation
  Cytogenetics
 
  Tel.: +49-89-3187-3515
 
  Mob.: +49-160-90641879
 
 
 
 
 
  Am 15.06.11 17:25 schrieb Hugo Mildenberger unter
  hugo.mildenber...@web.de:
 
  Kristian,
  
  these are the usual problems with binary distributions.
  
  Regarding
  
 --with-Rmpi-include=/usr/lib64/mpi/gcc/openmpi/include
  
  and configure output

Re: [R] Rmpi installation

2011-06-15 Thread Hugo Mildenberger
Hmm, 

looks like there was a trailing blank after the backslash and before end of 
line, 
resulting in --with-Rmpi-libpath possibly not recognised: 

   \--with-Rmpi-libpath=/usr/lib64/mpi/gcc/openmpi/lib64 \

I also doubt there is real need to escape newlines within a string. But another 
possible problem source is that according to R CMD INSTALL --help, the 
parameter 
is called  --configure-args, not configure.args. 


$ R CMD INSTALL  
--configure-args=--with-Rmpi-include=/usr/lib64/mpi/gcc/openmpi/include  
--with-Rmpi-libpath=/usr/lib64/mpi/gcc/openmpi/lib64 --
with-Rmpi-type=OPENMPI Rmpi_0.5-4.tar.gz

Best



On Wednesday 15 June 2011 14:25:46 Unger, Kristian, Dr. wrote:
 Hi there
 
 I am trying to install Rmpi (version 0.5-4) on our 8-core SUSE Linux
 Enterprise Server 11 SP1. I read all I could find about Rmpi installation
 but still cannot get it working.
 
 Here the last command that I used:
 
 R CMD INSTALL
 --configure.args=--with-Rmpi-include=/usr/lib64/mpi/gcc/openmpi/include \
 --with-Rmpi-libpath=/usr/lib64/mpi/gcc/openmpi/lib64 \
 --with-Rmpi-type=OPENMPI Rmpi_0.5-4.tar.gz
 
 Resulting in the following:
 
 zytosrv01dmi:/home/unger/R_projects/OS # R CMD INSTALL
 --configure-args=--with-Rmpi-include=/usr/lib64/mpi/gcc/openmpi/include
 \--with-Rmpi-libpath=/usr/lib64/mpi/gcc/openmpi/lib64 \
 --with-Rmpi-type=OPENMPI Rmpi_0.5-4.tar.gz
 * installing to library Œ/usr/local/lib64/R/library¹
 * installing *source* package ŒRmpi¹ ...
 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
 checking how to run the C preprocessor... gcc -E
 checking for grep that handles long lines and -e... /usr/bin/grep
 checking for egrep... /usr/bin/grep -E
 checking for ANSI C header files... yes
 checking for sys/types.h... yes
 checking for sys/stat.h... yes
 checking for stdlib.h... yes
 checking for string.h... yes
 checking for memory.h... yes
 checking for strings.h... yes
 checking for inttypes.h... yes
 checking for stdint.h... yes
 checking for unistd.h... yes
 checking mpi.h usability... no
 checking mpi.h presence... no
 checking for mpi.h... no
 Try to find libmpi or libmpich ...
 checking for main in -lmpi... no
 libmpi not found. exiting...
 ERROR: configuration failed for package ŒRmpi¹
 * removing Œ/usr/local/lib64/R/library/Rmpi¹
 
 So obviously libmpi is not found. Doing a locate search for libmpi
 (straight after updatedb) shows:
 
 zytosrv01dmi:/home/unger/R_projects/OS # locate libmpi
 /opt/mpich/ch-p4/lib64/libmpich.a
 /opt/mpich/ch-p4/lib64/libmpichf90.a
 /opt/mpich/ch-p4/lib64/libmpichf90nc.a
 /opt/mpich/ch-p4/lib64/libmpichfarg.a
 /opt/mpich/ch-p4/lib64/libmpichfsup.a
 /opt/mpich/ch-p4mpd/lib64/libmpich.a
 /opt/mpich/ch-p4mpd/lib64/libmpichf90.a
 /opt/mpich/ch-p4mpd/lib64/libmpichf90nc.a
 /opt/mpich/ch-p4mpd/lib64/libmpichfarg.a
 /opt/mpich/ch-p4mpd/lib64/libmpichfsup.a
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_cxx.la
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_cxx.so
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_cxx.so.0
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_cxx.so.0.0.0
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_f77.la
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_f77.so
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_f77.so.0
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_f77.so.0.0.0
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_f90.la
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_f90.so
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_f90.so.0
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi_f90.so.0.0.0
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi.la
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi.so
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi.so.0
 /usr/lib64/mpi/gcc/openmpi/lib64/libmpi.so.0.0.0
 
 What lets me assume that the path to libmpi is
 /usr/lib64/mpi/gcc/openmpi/lib64 which I already included in the options...
 
 
 How can I get this working?
 
 I would highly appreciate any help on this!
 
 Best wishes
 
 Kristian
 
 
 
 
 Dr. Kristian Unger
 
 
 Arbeitsgruppenleiter Integrative Biologie / Head of Integrative Biology
 Group
 Abteilung für Strahlenzytogenetik / Research Unit of Radiation Cytogenetics
 
 
 Helmholtz Zentrum München
 Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
 Ingolstädter Landstr. 1
 85764 Neuherberg
 www.helmholtz-muenchen.de
 Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
 Geschäftsführer: Prof. Dr. Günther Wess und Dr. Nikolaus Blum
 Registergericht: Amtsgericht München HRB 6466
 USt-IdNr: DE 129521671
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 

Re: [R] Rmpi installation

2011-06-15 Thread Hugo Mildenberger
Kristian,

I just tried that particular command here on a Gentoo system with 
openmpi-1.5.3 installed, because I wondered why the Rmpi configure 
script tests for main function in a shared library ... 

But I got a completly different output from configure. While the 
linker succeeds here, the package load test does not. However, on your 
system, may be the openmpi installation really is a kinda private one of 
gcc? I heard gcc makes use of openmpi internally. So is openmpi really 
installed? 

I just recognize that you are trying to use Rmpi_0.5-4.tar.gz while current 
version on  CRAN is Rmpi_0.5-9.tar.gz.

Best

Hugo

R CMD INSTALL --configure-args=--with-Rmpi-include=/usr/include  
--with-Rmpi-libpath=/usr/lib64/openmpi --with-Rmpi-type=OPENMPI 
Rmpi_0.5-9.tar.gz
* installing to library ‘/home/hm/R/x86_64-pc-linux-gnu-library/2.13’
* installing *source* package ‘Rmpi’ ...
checking for openpty in -lutil... no
checking for main in -lpthread... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
** libs
x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include -DPACKAGE_NAME=\\ 
-DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -
DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2 -DOPENMPI 
-I/usr/local/include-fpic  -O3 -pipe -march=core2 -
mtune=core2 -ggdb -c RegQuery.c -o RegQuery.o
x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include -DPACKAGE_NAME=\\ 
-DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -
DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2 -DOPENMPI 
-I/usr/local/include-fpic  -O3 -pipe -march=core2 -
mtune=core2 -ggdb -c Rmpi.c -o Rmpi.o
x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include -DPACKAGE_NAME=\\ 
-DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -
DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2 -DOPENMPI 
-I/usr/local/include-fpic  -O3 -pipe -march=core2 -
mtune=core2 -ggdb -c conversion.c -o conversion.o
x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include -DPACKAGE_NAME=\\ 
-DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -
DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2 -DOPENMPI 
-I/usr/local/include-fpic  -O3 -pipe -march=core2 -
mtune=core2 -ggdb -c internal.c -o internal.o
x86_64-pc-linux-gnu-gcc -std=gnu99 -shared -Wl,-O1 -Wl,--as-needed -o Rmpi.so 
RegQuery.o Rmpi.o conversion.o internal.o -L/usr/lib64/openmpi -lmpi 
-L/usr/lib64/R/lib -lR
installiert nach /home/hm/R/x86_64-pc-linux-gnu-library/2.13/Rmpi/libs
[...]
  ompi_mpi_init: orte_init failed
  -- Returned Not found (-13) instead of Success (0)


On Wednesday 15 June 2011 15:19:22 Unger, Kristian, Dr. wrote:
 Thank you very much Hugo. Using the command as suggested results exactly
 the same error:
 
 # R CMD INSTALL
 --configure-args=--with-Rmpi-include=/usr/lib64/mpi/gcc/openmpi/include
 --with-Rmpi-libpath=/usr/lib64/mpi/gcc/openmpi/lib64
 --with-Rmpi-type=OPENMPI Rmpi_0.5-4.tar.gz
 * installing to library ‘/usr/local/lib64/R/library’
 * installing *source* package ‘Rmpi’ ...
 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
 checking how to run the C preprocessor... gcc -E
 checking for grep that handles long lines and -e... /usr/bin/grep
 checking for egrep... /usr/bin/grep -E
 checking for ANSI C header files... yes
 checking for sys/types.h... yes
 checking for sys/stat.h... yes
 checking for stdlib.h... yes
 checking for string.h... yes
 checking for memory.h... yes
 checking for strings.h... yes
 checking for inttypes.h... yes
 checking for stdint.h... yes
 checking for unistd.h... yes
 checking mpi.h usability... no
 checking mpi.h presence... no
 checking for mpi.h... no
 Try to find libmpi or libmpich ...
 checking for main in -lmpi... no
 libmpi not found. exiting...
 ERROR: configuration failed for package ‘Rmpi’
 * removing ‘/usr/local/lib64/R/library/Rmpi’
 
 
 Best wishes
 
 Kristian
 
 
 Dr. Kristian Unger
 
 
 Arbeitsgruppenleiter Integrative Biologie / Head of Integrative Biology
 Group
 Abteilung für Strahlenzytogenetik / Research Unit of Radiation
 Cytogenetics
 
 Tel.: +49-89-3187-3515
 
 Mob.: +49-160-90641879
 
 
 
 
 
 Am 15.06.11 15:12 schrieb Hugo Mildenberger unter
 hugo.mildenber...@web.de:
 
 Hmm,
 
 looks like there was a trailing blank after the backslash and before end
 of line,
 resulting in --with-Rmpi-libpath possibly not recognised:
 
\--with-Rmpi-libpath=/usr/lib64/mpi/gcc/openmpi/lib64 \
 
 I also doubt there is real need to escape newlines within a string. But
 another
 possible problem source is that according to R CMD INSTALL --help, the
 parameter
 is called  --configure

Re: [R] Rmpi installation

2011-06-15 Thread Hugo Mildenberger
Kristian,

these are the usual problems with binary distributions.  

Regarding 

   --with-Rmpi-include=/usr/lib64/mpi/gcc/openmpi/include

and configure output

  checking for mpi.h... no

... so does /usr/lib64/mpi/gcc/openmpi/include really exist? At least,
that appears to be a very unusual place to look for mpi.h (normally
to be found in /usr/include ).
 
And if you try to compile  link the attached demo program: does
the link phase succeed? Compile  link using

$ mpicc mtest.c -o mtest

Presumably you have already tried to run install.packages(Rmpi).


Kind regards

Hugo



On Wednesday 15 June 2011 16:22:07 Unger, Kristian, Dr. wrote:
 Thanks Hugo.
 
 I am pretty sure openmpi is installed:
 
 # zypper se openmpi
 Loading repository data...
 Reading installed packages...
 
 S | Name  | Summary | Type
 --+---+-+---
 i | openmpi   | A powerful implementaion of MPI | package
   | openmpi   | A powerful implementaion of MPI | srcpackage
 i | openmpi-devel | A powerful implementaion of MPI | package
 
 
 
 I got the same error message with the latest version available. The reason
 why I took the somewhat older version is that I wanted to make sure that
 it is not related to any libraries used by the newest version.
 
 Best wishes
 
 Kristian
 
 
 Dr. Kristian Unger
 
 
 Arbeitsgruppenleiter Integrative Biologie / Head of Integrative Biology
 Group
 Abteilung für Strahlenzytogenetik / Research Unit of Radiation
 Cytogenetics
 
 Tel.: +49-89-3187-3515
 
 Mob.: +49-160-90641879
 
 
 
 
 
 Am 15.06.11 16:16 schrieb Hugo Mildenberger unter
 hugo.mildenber...@web.de:
 
 Kristian,
 
 I just tried that particular command here on a Gentoo system with
 openmpi-1.5.3 installed, because I wondered why the Rmpi configure
 script tests for main function in a shared library ...
 
 But I got a completly different output from configure. While the
 linker succeeds here, the package load test does not. However, on your
 system, may be the openmpi installation really is a kinda private one of
 gcc? I heard gcc makes use of openmpi internally. So is openmpi really
 installed?
 
 I just recognize that you are trying to use Rmpi_0.5-4.tar.gz while
 current
 version on  CRAN is Rmpi_0.5-9.tar.gz.
 
 Best
 
 Hugo
 
 R CMD INSTALL --configure-args=--with-Rmpi-include=/usr/include
 --with-Rmpi-libpath=/usr/lib64/openmpi --with-Rmpi-type=OPENMPI
 Rmpi_0.5-9.tar.gz
 * installing to library ‘/home/hm/R/x86_64-pc-linux-gnu-library/2.13’
 * installing *source* package ‘Rmpi’ ...
 checking for openpty in -lutil... no
 checking for main in -lpthread... no
 configure: creating ./config.status
 config.status: creating src/Makevars
 ** libs
 ** libs
 x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include
 -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -
 DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2
 -DOPENMPI -I/usr/local/include-fpic  -O3 -pipe -march=core2 -
 mtune=core2 -ggdb -c RegQuery.c -o RegQuery.o
 x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include
 -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -
 DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2
 -DOPENMPI -I/usr/local/include-fpic  -O3 -pipe -march=core2 -
 mtune=core2 -ggdb -c Rmpi.c -o Rmpi.o
 x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include
 -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -
 DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2
 -DOPENMPI -I/usr/local/include-fpic  -O3 -pipe -march=core2 -
 mtune=core2 -ggdb -c conversion.c -o conversion.o
 x86_64-pc-linux-gnu-gcc -std=gnu99 -I/usr/lib64/R/include
 -DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\ -
 DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -I/usr/include  -DMPI2
 -DOPENMPI -I/usr/local/include-fpic  -O3 -pipe -march=core2 -
 mtune=core2 -ggdb -c internal.c -o internal.o
 x86_64-pc-linux-gnu-gcc -std=gnu99 -shared -Wl,-O1 -Wl,--as-needed -o
 Rmpi.so RegQuery.o Rmpi.o conversion.o internal.o -L/usr/lib64/openmpi
 -lmpi
 -L/usr/lib64/R/lib -lR
 installiert nach /home/hm/R/x86_64-pc-linux-gnu-library/2.13/Rmpi/libs
 [...]
   ompi_mpi_init: orte_init failed
   -- Returned Not found (-13) instead of Success (0)
 
 
 On Wednesday 15 June 2011 15:19:22 Unger, Kristian, Dr. wrote:
  Thank you very much Hugo. Using the command as suggested results exactly
  the same error:
 
  # R CMD INSTALL
  --configure-args=--with-Rmpi-include=/usr/lib64/mpi/gcc/openmpi/include
  --with-Rmpi-libpath=/usr/lib64/mpi/gcc/openmpi/lib64
  --with-Rmpi-type=OPENMPI Rmpi_0.5-4.tar.gz
  * installing to library ‘/usr/local/lib64/R/library’
  * installing *source* package ‘Rmpi’ ...
  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

Re: [R] Rmpi installation

2011-06-15 Thread Hugo Mildenberger
Dear Kristian,

   please run exactly

mpicc mtest.c -o mtest 
 
  If you really need it, add -v separately. mpicc is nothing but a compiler 
wrapper. 
  The -o switch specifies the outfile name, which has to follow immediately 
after -o, 
  with or without a blank character in between. I'm not sure about what happens 
  with -ov mtest. Probably an output file named v is produced on disk, in 
addition to 
  the file mtest stemming from a previous with -o mtest Depending on 
  mpicc's, gcc's and ld's version, gcc may instruct the linker to link the 
previously 
  produced executable mtest with the object newly compiled from mtest.c plus 
  several implicit libraries and startup objects, and output the result to v. 
  ld would then be faced with duplicate defined symbols and output a list of 
these 
  doublets.
  
  My proposal was meant as a test for an else correct openmpi installation, 
perhaps
  I should have said this. On successful completion, no message should be 
printed, but
  an executable named mtest should have been produced, which could then
  be run typing ./mtest. If the link process failed, then the openmpi 
installation was 
  inconsistent. 

Kind regards

Hugo
 
On Wednesday 15 June 2011 17:45:41 Unger, Kristian, Dr. wrote:
 Dear Hugo
 
 I ran the command with the verbose switch and get the following output:
 
  mpicc mtest.c -ov mtest
 mtest: In function `_start':
 /usr/src/packages/BUILD/glibc-2.11.1/csu/../sysdeps/x86_64/elf/start.S:65:
 multiple definition of `_start'
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crt1.o:/usr/src/pack
 ages/BUILD/glibc-2.11.1/csu/../sysdeps/x86_64/elf/start.S:65: first
 defined here
 mtest: In function `_fini':
 (.fini+0x0): multiple definition of `_fini'
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crti.o:initfini.c:(.
 fini+0x0): first defined here
 mtest:(.rodata+0x0): multiple definition of `_IO_stdin_used'
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crt1.o:(.rodata.cst4
 +0x0): first defined here
 mtest: In function `__data_start':
 (.data+0x0): multiple definition of `__data_start'
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crt1.o:(.data+0x0):
 first defined here
 mtest: In function `main':
 (.text+0xec): multiple definition of `main'
 /tmp/ccUyk8e9.o:mtest.c:(.text+0x0): first defined here
 mtest: In function `_init':
 (.init+0x0): multiple definition of `_init'
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crti.o:initfini.c:(.
 init+0x0): first defined here
 /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld:
 error in mtest(.eh_frame); no .eh_frame_hdr table will be created.
 collect2: ld returned 1 exit status
 
 Not sure if this makes any sense?
 
 
 Best wishes
 
 Kristian
 
 
 Dr. Kristian Unger
 
 
 Arbeitsgruppenleiter Integrative Biologie / Head of Integrative Biology
 Group
 Abteilung für Strahlenzytogenetik / Research Unit of Radiation
 Cytogenetics
 
 Tel.: +49-89-3187-3515
 
 Mob.: +49-160-90641879
 
 
 
 
 
 Am 15.06.11 17:25 schrieb Hugo Mildenberger unter
 hugo.mildenber...@web.de:
 
 Kristian,
 
 these are the usual problems with binary distributions.
 
 Regarding
 
--with-Rmpi-include=/usr/lib64/mpi/gcc/openmpi/include
 
 and configure output
 
   checking for mpi.h... no
 
 ... so does /usr/lib64/mpi/gcc/openmpi/include really exist? At least,
 that appears to be a very unusual place to look for mpi.h (normally
 to be found in /usr/include ).
 
 And if you try to compile  link the attached demo program: does
 the link phase succeed? Compile  link using
 
 $ mpicc mtest.c -o mtest
 
 Presumably you have already tried to run install.packages(Rmpi).
 
 
 Kind regards
 
 Hugo
 
 
 
 On Wednesday 15 June 2011 16:22:07 Unger, Kristian, Dr. wrote:
  Thanks Hugo.
 
  I am pretty sure openmpi is installed:
 
  # zypper se openmpi
  Loading repository data...
  Reading installed packages...
 
  S | Name  | Summary | Type
  --+---+-+---
  i | openmpi   | A powerful implementaion of MPI | package
| openmpi   | A powerful implementaion of MPI | srcpackage
  i | openmpi-devel | A powerful implementaion of MPI | package
 
 
 
  I got the same error message with the latest version available. The
 reason
  why I took the somewhat older version is that I wanted to make sure that
  it is not related to any libraries used by the newest version.
 
  Best wishes
 
  Kristian
 
  
  Dr. Kristian Unger
 
 
  Arbeitsgruppenleiter Integrative Biologie / Head of Integrative Biology
  Group
  Abteilung für Strahlenzytogenetik / Research Unit of Radiation
  Cytogenetics
 
  Tel.: +49-89-3187-3515
 
  Mob.: +49-160-90641879
 
 
 
 
 
  Am 15.06.11 16:16 schrieb Hugo Mildenberger unter
  hugo.mildenber...@web.de:
 
  Kristian,
  
  I just tried that particular command here

Re: [R] predictive logistic model cell-biology, non-dichotomous data

2011-06-14 Thread Hugo Mildenberger
Andreas,

the jpg files you linked below do not exist, but if all you need
for the moment is a predictive model and graphical displays of 
the fitted model and the calibrated sample data, then the R - 
package calib will do it very well. Usage is very simple. 

Best,

Hugo

On Tuesday 14 June 2011 00:11:37 andreasss wrote:
 Hi everyone,
 
 I would like to fit a predictive model to my data in order to compare
 absorbance readings to a toxin standard. This data was obtained by exposing
 red blood cells to different toxin concentrations, which lead to the lysis
 of the red blood cells, increasing the absorbance (hemoglobin is freed). The
 data has a sigmoid shape (see below), so I thought about fitting a logistic
 model to the data so that I will be able to determine the toxin equivalent
 of new absorbance readings.
 http://r.789695.n4.nabble.com/file/n3595812/Unbenannt.jpg 
  
 The data points for this curve are:
 http://r.789695.n4.nabble.com/file/n3595812/qweqwe.jpg 
 I must admit that I am totally lost. I have done a fair bit of reading on
 logistic regression, but most seem to focus on binary outcomes or
 multinomial analysis. Do I have to somehow assign 'pass' or 'fail' to this
 data, maybe 0 and 100% lysis? Or is the logistic model not suitable for what
 I am planning. All I want to do is to fit a predictive model to this data
 and to graphically represent the 'best fit'. Any help will be greatly
 appreciated.
 
 Thanks in advance,
 
 Andreas
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/predictive-logistic-model-cell-biology-non-dichotomous-data-tp3595812p3595812.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] R-2.10.1 to R-2.13.0

2011-05-26 Thread Hugo Mildenberger
Ogbos,

I don't use Ubunto too, but X-11 headers should be installable running 

   apt-get xorg-dev

and/or (possibly)  

   apt-get  libx11-dev xlibs-dev

Best


On Thursday 26 May 2011 16:13:36 Duncan Murdoch wrote:
 On 26/05/2011 10:05 AM, ogbos okike wrote:
  Hi Duncan,
  Thanks for your time.
  Using ./configure as specified in the installation manual, I attempted to
  install R-2.13.0 but it reported an error message:
 
  checking for IceConnectionNumber in -lICE... no
  checking X11/Intrinsic.h usability... no
  checking X11/Intrinsic.h presence... no
  checking for X11/Intrinsic.h... no
  configure: error: --with-x=yes (default) and X11 headers/libs are not
  available
 
  Could you please advise further. I am attempting this for the first time on
  my laptop (ubuntu os).
 
 I don't use Ubuntu, but that looks as though you don't have the 
 development headers for X11 available.
 
 The usual advice I've seen on this is to install an Ubuntu binary rather 
 than building yourself, but I don't remember the details of where to get 
 it (and I don't remember how to get the X11 headers you need).
 
 Duncan Murdoch
 
  Regards
  Ogbos
 
 
  On 26 May 2011 12:45, Duncan Murdochmurdoch.dun...@gmail.com  wrote:
 
On 26/05/2011 6:02 AM, ogbos okike wrote:
  
Dear List,
I am currently running R-2.10.1. I wish to install R-2.13.0 or update my
R-2.10.1 to the R-2.13.0.
  
I have downloaded R-2.13.0 but wish to seek your advice before 
   installing
that.
  
Please is there a better way of updating to the newer version other than
downloading and installing the version?
Thanks for your suggestions.
  
  
There is some advice on this in the Windows FAQ.  You can see the current
version online at
  
  

   http://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f
  
If you're not using Windows, most of the advice in that FAQ item is still
good (though the paths  filenames will be different).
  
Duncan Murdoch
  
  
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Processing large datasets

2011-05-25 Thread Hugo Mildenberger
With PostgreSQL at least, R can also be used as implementation
language for stored procedures. Hence data transfers between 
processes can be avoided alltogether. 

   http://www.joeconway.com/plr/

Implemention of such a procedure in R appears to be straighforward:
 
   CREATE OR REPLACE FUNCTION overpaid (emp) RETURNS bool AS '
  if (20  arg1$salary) {
  return(TRUE)
  }
  if (arg1$age  30  10  arg1$salary) {
  return(TRUE)
  }
  return(FALSE)
' LANGUAGE 'plr';

  CREATE TABLE emp (name text, age int, salary numeric(10,2));
INSERT INTO emp VALUES ('Joe', 41, 25.00);
INSERT INTO emp VALUES ('Jim', 25, 12.00);
INSERT INTO emp VALUES ('Jon', 35, 5.00);
 

  SELECT name, overpaid(emp) FROM emp;
   name | overpaid
--+--
Joe  | t
Jim  | t
Jon  | f
   (3 rows)


Best 



On Wednesday 25 May 2011 14:12:23 Jonathan Daily wrote:
 In cases where I have to parse through large datasets that will not
 fit into R's memory, I will grab relevant data using SQL and then
 analyze said data using R. There are several packages designed to do
 this, like [1] and [2] below, that allow you to query a database using
 SQL and end up with that data in an R data.frame.
 
 [1] http://cran.cnr.berkeley.edu/web/packages/RMySQL/index.html
 [2] http://cran.cnr.berkeley.edu/web/packages/RSQLite/index.html
 
 On Wed, May 25, 2011 at 12:29 AM, Roman Naumenko ro...@bestroman.com wrote:
  Hi R list,
 
  I'm new to R software, so I'd like to ask about it is capabilities.
  What I'm looking to do is to run some statistical tests on quite big
  tables which are aggregated quotes from a market feed.
 
  This is a typical set of data.
  Each day contains millions of records (up to 10 non filtered).
 
  2011-05-24  750 Bid DELL14130770400
  15.4800 BATS35482391Y   1   1   0   0
  2011-05-24  904 Bid DELL14130772300
  15.4800 BATS35482391Y   1   0   0   0
  2011-05-24  904 Bid DELL14130773135
  15.4800 BATS35482391Y   1   0   0   0
 
  I'll need to filter it out first based on some criteria.
  Since I keep it mysql database, it can be done through by query. Not
  super efficient, checked it already.
 
  Then I need to aggregate dataset into different time frames (time is
  represented in ms from midnight, like 35482391).
  Again, can be done through a databases query, not sure what gonna be faster.
  Aggregated tables going to be much smaller, like thousands rows per
  observation day.
 
  Then calculate basic statistic: mean, standard deviation, sums etc.
  After stats are calculated, I need to perform some statistical
  hypothesis tests.
 
  So, my question is: what tool faster for data aggregation and filtration
  on big datasets: mysql or R?
 
  Thanks,
  --Roman N.
 
 [[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] source and localhost

2011-05-21 Thread Hugo Mildenberger
Thomas,

your example works with R-2.13.0 and Apache running on
Gentoo. You may try to use http://127.0.0.1:5984/path/fn.R;,
just to exclude that this problem has anything to do with 
name resolution.

Best

Hugo

 Dear List,
 
 I have problems with the function source() using a
 url of the kind:
 
 http://localhost:5984/path/fn.R
 
 I receive
 
 Fehler in file(file, r, encoding = encoding) : 
   kann Verbindung nicht öffnen
 Zusätzlich: Warnmeldung:
 In file(file, r, encoding = encoding) :
   Öffnen fehlgeschlagen: HTTP Status war '502 cannotconnect'
 
 The url itself is ok since I can:
 - use a browser
 - use curl
 - use download.file() function
 - use getURL() (out of Duncans RCurl)
 
 furthermore it works, when I use the full host + domain name.
 So I think it is about dns stuff. I get a nice:
 
  Sys.getenv(no_proxy)
 [1] localhost, 127.0.0.1
 
 and work on 32bit opensuse 11.4 with 
 R version 2.13.0 (2011-04-13)
 
 Can someone give me a hint?
 Best regards
 Thomas
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Loop stopping after 1 iteration

2011-05-18 Thread Hugo Mildenberger
William,

num_obs obviously isn't a vector, therefore length(num_obs) will
evaluate to one. Hence your for loop control part will expand to 

for (i in 1:1) 

while it should probably read:

for (i in 1:num_obs)

Best

Hugo

On Wednesday 18 May 2011 17:18:15 armstrwa wrote:
 Hi all,
 
 This is a very basic question, but I just can't figure out why R is handling
 a loop I'm writing the way it is.
 
 Here is the script I have written:
 
 grid_2_series-function(gage_handle,data_type,filename)
 
 series_name-paste(gage_handle,data_type,sep=_)
 data_grid-read.table(file=paste(filename,.txt,sep=))
 
 num_rows_data-nrow(data_grid)-1
 num_cols_data-ncol(data_grid)-4
 num_obs-num_rows_data*num_cols_data
 
 time_series-matrix(nrow=0,ncol=2)
 
 for(i in 1:length(num_obs)){
   rownum-ceiling(i/31)+1
   colnum-if(i%%31==0){
   35
   }else{
   (i%%31)+4
   }
   year-data_grid[rownum,2]
   month-data_grid[rownum,3]
   day-colnum-4
   date_string-paste(month,day,year,sep=/)
   date-as.Date(date_string,format='%m/%d/%Y')
   value-as.character(data_grid[rownum,colnum])
   time_series-rbind(time_series,c(date,value))
 }
 
 The script is working as I intended it to (goes through a matrix of data
 where column 2 is the year, column 3 is the month, and row 1 columns 5-35
 are the day of the month the observation was recorded [I have included a
 screenshot below to help visualize what I'm talking about] and converts the
 grid into a 2 column time series where column 1 is the date and column 2 is
 the value of the observation), but it is stopping after only 1 iteration.
 
 nabble_img src=matrix_screenshot.jpg border=0/
 
 Two questions:
 
 1.) Does anyone know of an existing function to accomplish this task?
 2.) Why is the loop stopping after 1 iteration?  I have it written to
 iterate up to the total number of observations (20,615 in one case).
 
 Thank you for your help and sorry for this question which I'm sure has a
 very simple answer.
 
 Thanks again,
 
 Billy
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Loop-stopping-after-1-iteration-tp3532988p3532988.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] Dotplot (package Hmisc) with groups: colours and symbols

2011-05-11 Thread Hugo Mildenberger
Hello Esther,

you left out the ellipsis argument (...) to the panel function.
That argument serves a placeholder for the rest of the parameters 
you did not want to name and pass explicitely. If you don't pass the
ellipsis to panel.Dotplot, all unnamed parameters will get default 
values. You can see these defaults by typing panel.dotplot or 
edit(panel.dotplot) on the command line.

Dotplot( site~Cbind(yield, yield+5, yield-5)|variety,
 groups = year,
 data   = barley,
 pch= c(1,2),
 panel  = function(x,y,...){
   panel.Dotplot(x,y,col=black,...);
})
 
Best 



On Wednesday 11 May 2011 11:11:50 E Hofstadler wrote:
 Hello all,
 
 This question concerns the function Dotplot from the Hmisc package.
 
 My aim is to compare values between groups in each panel of the
 Dotplot, with the values of different groups clearly distinguishable
 by different symbols. All lines and symbols should be coloured in
 black.
 
 Before adding the panel function to the Dotplot, the groups behaved as
 desired and were marked by different symbols, but the error bands were
 blue instead of black. After adding the panel function and changing
 the trellis colour settings, the error bars are now black, but now the
 groups are suddenly marked by the same rather than different symbols.
 I've tried several ways to change the group symbols but to no avail.
 
 ## set CI lines to black
 t1 = trellis.par.get(plot.line)
 t1$col - black
 trellis.par.set(plot.line,t1)
 
 ## load example data
 require(lattice)
 data(barley)
 
 ## example plot (problem: groups marked by the same symbol)
 
 require(Hmisc)
 Dotplot(site~Cbind(yield, yield+5, yield-5)|variety, groups=year,
 data=barley, pch=c(1,2), col=black,
 panel=function(x,y){
 panel.Dotplot(x,y,col=black)})
 Key()
 
 
 
 
 What am I doing wrong?
 
 Many thanks in advance.
 Esther
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Insert variable in RMySQL-Statement

2011-02-09 Thread Hugo Mildenberger
Arne,

there might be faster or more elegant solutions, but this is a possibility:

for ( a in values ) { 
   Temp - dbGetQuery(con, paste(select * from db where id = ,a,sep=)));
   print(Temp);
}

There must be also a way to make use of the in - operator: 

   select * from db where id in (1,2,3);

but I can't figure it out at the moment.

Best

Hugo

On Wednesday 09 February 2011 10:09:34 Arne H. Schulz wrote:
 Dear list,
 I'm working with a MySQL-Table and would like to extract selected ids that 
 are stored in a vector:
 Ids - c(1,2,3)
 
 How do I insert this variable in a for loop like this:
 
 For (a in values) {
   Temp - dbGetQuery(con,
   select * from db
   Where id = ID;)
 }
 
 My problem is to split the select-statement and insert the current id. How 
 can I handle this problem?
 
 Best regards,
 Arne
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Insert variable in RMySQL-Statement

2011-02-09 Thread Hugo Mildenberger

This should be much faster:

   idx - c(1,2,3)
   res - dbGetQuery(con,paste(select * from db where id in 
(,paste(idx,collapse=,),),sep=));
   print(res);


On Wednesday 09 February 2011 14:13:17 Hugo Mildenberger wrote:
 Arne,
 
 there might be faster or more elegant solutions, but this is a possibility:
 
 for ( a in values ) { 
Temp - dbGetQuery(con, paste(select * from db where id = 
 ,a,sep=)));
print(Temp);
 }
 
 There must be also a way to make use of the in - operator: 
 
select * from db where id in (1,2,3);
 
 but I can't figure it out at the moment.
 
 Best
 
 Hugo
 
 On Wednesday 09 February 2011 10:09:34 Arne H. Schulz wrote:
  Dear list,
  I'm working with a MySQL-Table and would like to extract selected ids that 
  are stored in a vector:
  Ids - c(1,2,3)
  
  How do I insert this variable in a for loop like this:
  
  For (a in values) {
  Temp - dbGetQuery(con,
  select * from db
  Where id = ID;)
  }
  
  My problem is to split the select-statement and insert the current id. How 
  can I handle this problem?
  
  Best regards,
  Arne
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/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] Finding non-normal distributions per row of data frame?

2011-02-04 Thread Hugo Mildenberger
Danny,

sounds like you already have a certain idea how a 'nugget' distribution could 
look like. Maybe you also could intentionally produce some experimental 
data having such distributions, harvest the related patterns from the 
microarray and then apply a method as it was described in 
http://www.cs.uwaterloo.ca/~shai/TALKS/NIPS07_prob_wkshp.pdf
But this is an uneducated guess only.

Best

Hugo


On Saturday 05 February 2011 00:21:01 DB1984 wrote:
 
 Greg, Dennis - thanks for your input, I really appreciate the feedback, as it
 is not easy to source.
 
 In terms of the data; I've described it as 20 columns, which is the smallest
 dataset, but this can run to 320 columns, so in some cases there is likely
 to be enough power to detect non-normality. That said, a better solution
 would be useful.
 
 As a first approximation, I looked at the mean/median ratio to indicate
 simple skew in the data - which suggested that most of the data was normally
 distributed. I took the 'nuggets' to be those with a mean/median ratio in
 the top or bottom 1% of the data. This was a small group - overall the data
 appears relatively normally distributed within rows. 
 
 The aim is really to find those nuggets with significantly non-normal
 distributions. My hope was to be able to take the tails of the p-values for
 Shapiro-Wilk, or some similar test, and find these enriched with nuggets.
 This may not be an appropriately robust approach - but is there a better
 option?
 
 One idea was to sort the data in each row, and perform a linear regression.
 For normal distributions I am expecting the intercept to be close to the
 mean. Using the (intercept-mean) and p-values for the fit of the regression
 was again another way to filter out the nuggets in the dataset.
 
 If it helps, the nuggets I am expecting are either grouped 80% grouped
 around the mean with 20% forming a uni-directional tail, or an approximate
 bimodal distribution. 
 
 As I'd imagine is obvious - I don't have an ideal solution to finding these
 nuggets, and so coming up with the R code to do so is harder still. If
 anybody has insight into this sort of problem, and can point me in the
 direction of further reading, that would be helpful. If there is a
 ready-made solution, even better!
 
 As I said, thanks for your time with this...
 
 


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Fitting ELISA measurements unknowns to 4 parameter logistic model

2011-02-01 Thread Hugo Mildenberger
Hello Chris,

You may also use the R-package calib.

Hugo 


On Tuesday 01 February 2011 17:08:13 Christopher Anderson wrote:
 Hello,
 
 I am trying to fit my Elisa results (absorbance readings)  to a standard
 curve. To create the standard curve model, I performed a 4-parameter
 logistic fit using the 'drc' package (ExpectedConc~Absorbance). This gave me
 the following:
  FourP
 
 A 'drc' model.
 
 Call:
 drm(formula = Response ~ Expected, data = SC, fct = LL.4())
 
 Coefficients:
 b:(Intercept)  c:(Intercept)  d:(Intercept)  e:(Intercept)
 1.336  6.236 85.521 59.598
 
  summary(FourP)
 
 Model fitted: Log-logistic (ED50 as parameter) (4 parms)
 
 Parameter estimates:
 
   Estimate Std. Error  t-value p-value
 b:(Intercept)  1.335960.15861  8.42309  0.0011
 c:(Intercept)  6.235573.18629  1.95700  0.1220
 d:(Intercept) 85.521402.15565 39.67313  0.
 e:(Intercept) 59.598355.18781 11.48815  0.0003
 
 Residual standard error:
 
  1.866876 (4 degrees of freedom)
 
 Now that I have the 4 parameters, how do I fit the absorbance readings for
 the analytical unknowns to the standard curve model (as to estimate the
 concentrations of my unknown analytical samples)?
 I can use the argument 'predict', but this predicts absorbance given
 concentrations (y given x), I need to predict concentrations give absorbance
 (x given y).
 
 Thanks!
 Chris
 
   [[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] using gsarima package with R

2011-01-23 Thread Hugo Mildenberger

On Sunday 23 January 2011 20:52:21 nandan amar wrote:
 I am trying to use function garsim from package gsarima.
 I can download gsarima package from
 http://cran.fyxm.net/web/packages/gsarima/index.html for linux.
 But how I can add it to R.
 

For example by entering

 R CMD INSTALL /path/to/gsarima_0.0-2.tar.gz

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Debian ?Ubuntu version of latest R using synaptic in Ubuntu 10.10

2011-01-22 Thread Hugo Mildenberger

Ajay, 

you may try to run R as root while updating packages. Some
packages insist to install in directories writeable only by root.



On Saturday 22 January 2011 07:50:10 Ajay Ohri wrote:
 Dear List
 
 I use synaptic to download R on my Ubuntu 10.10. It seems latest version of
 R on Ubuntu is 2.11.1
 
 Even when I use debian.cran.r-project.org to update my packages the problem
 remains (latest versions on CRAN are almost always 2 updates ahead of Debian
 packages) This is also true for a lot of other packages as well
 
 My specific problem is while I can use sudo apt-get to update packages from
 Debian repository I get a permission denied when I am trying to update from
 CRAN from within R. I am a Linux newbie
 
 Please help
 
 Regards
 
 Ajay
 
 Websites-
 http://decisionstats.com
 
   [[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] User input in R program

2011-01-21 Thread Hugo Mildenberger
Hello Christian,

for an example of interacting with graphic output, just run

example(getGraphicsEvent)

However, on X11, that feature had ceased to work since a pre-release 
of R-2.12 if Cairo support was enabled at compile time. The reason for 
this defect had already been documented in R's bugs database for long. 
Maybe getGraphicsEvent still runs on Windows.

Best 

Hugo

On Friday 21 January 2011 13:26:26 christiaan pauw wrote:
 HI Everybody
 
 Does anyone know of documentation about different ways of obtaining user
 input in R. I have used readline() but I wondered is there are sophisticated
 packages that does things like validate answers or generate selection
 lists.
 
 bets regards
 Christaan
 
   [[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] cannot allocate vector of size ... in RHLE5 PAE kernel

2011-01-19 Thread Hugo Mildenberger
 I got the following warning:
   memorytest.c: In function ‘main’:
   memorytest.c:5: warning: return type of ‘main’ is not ‘int’
 Is this important ?

Hello Mauricio, 

No, your gcc version is unduly puristic here. The traditional return 
type of the main function in C should be int, and if that is given,
main has to return an integer number explicitly. By convention, 
a main function returning 0 indicates success, and anything other 
is considered as an error or warning condition. Specifying void main() 
normally implies returning zero. But if you are still worried simply 
change void main into int main() and add the statement  return 0;   
just before the last curly bracket (without quotation marks, of course):

  int main() {   
   [...]  
   return 0; 
}

Best 

Hugo  

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] cannot allocate vector of size ... in RHLE5 PAE kernel

2011-01-19 Thread Hugo Mildenberger
Dear Mauricio,

what I do not understand at all is the message:

 Error: cannot allocate vector of size 476.2 Mb

Have you tried to allocate a big matrix in between, whith
the R - statement not being shown in the output? Probably
not. If not, your local R version is buggy for sure. The test shows 
that the OS imposes no artificial constraint on memory consumption, 
at least not up to ~ 1GB. But because you said that you're running a
32 - bit version of R (in a virtual machine?), the question is now 
wether gcc also compiles the test program as a 32 - bit program. I'm 
unsure because a 64 - bit system can be configured to compile and 
run programs using either environment. Regrettably I previously
did not include a test for that. 

--- snip ---
#include stdio.h
int main() {
printf(The size of a pointer is %lu bytes\n, (unsigned 
long)sizeof(void *));
return 0;
}
--- snip ---

If the program says The size of a pointer is 4 bytes then you're 
running the test program in a 32 bit environment.  Then the 
allocation problem could possibly be solved by recompiling/updating 
your R version. The system is called Redhat Enterprise Linux after
all, so  calling in Redhat support at that point and ask them to do 
something for their money should be an option.

Best 

Hugo



On Wednesday 19 January 2011 12:54:38 Mauricio Zambrano wrote:
 Dear Hugo,
 
 I tried your memory test program (without further modifications) just
 after the gc() command:
 
 print(gc())
 print(gcinfo(TRUE))
 system(/mypath/memorytest.out)
 
 and the result that I got was:
 
 Number of simulations read from ' Particles.txt ' : 9000
 ---
   used (Mb) gc trigger  (Mb)  max used   (Mb)
 Ncells  480114 12.91816453  48.6   5543382  148.1
 Vcells 5256970 40.2  119171871 909.3 322607910 2461.4
 [1] TRUE
 Trying to allocate 10 bytes ... success. Now trying to commit
 memory ... succeeded.
 Garbage collection 2667 = 2286+194+187 (level 2) ...
 12.9 Mbytes of cons cells used (26%)
 278.4 Mbytes of vectors used (29%)
 Error: cannot allocate vector of size 476.2 Mb
 
 What do you understand of this result ?
 
 Thanks in advance,
 
 Mauricio
 
  I got the following warning:
memorytest.c: In function ‘main’:
memorytest.c:5: warning: return type of ‘main’ is not ‘int’
  Is this important ?
 
  Hello Mauricio,
 
  No, your gcc version is unduly puristic here. The traditional return
  type of the main function in C should be int, and if that is given,
  main has to return an integer number explicitly. By convention,
  a main function returning 0 indicates success, and anything other
  is considered as an error or warning condition. Specifying void main()
  normally implies returning zero. But if you are still worried simply
  change void main into int main() and add the statement  return 0; 
  just before the last curly bracket (without quotation marks, of course):
 
   int main() {
[...]
return 0;
  }
 
  Best
 
  Hugo
 
 

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

2011-01-18 Thread Hugo Mildenberger
Nicos, 

there are certainly better / faster methods to compare a time range which I 
simply don't know of, but the condensed code below should do it. Your main 
problem was that you can't compare time(x) to 7:55, since the 
latter expression denotes a sequence from 7 to 55 in R. Consequently, such
an expression compares time(x) with all integer numbers between 7 and 55:

time(z[1]) = 7:55 
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
[13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
[25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
[37] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
[49] FALSE

length(z[time(z) = 2  time(z) = 7:55])
[1] 0

Your while loop was therefore equivalent to 

m=vector(numeric,0);
while(m) print(1);


Best 

Hugo

-- snip --
 library(zoo)
library(chron)

Lines- DateTimeOpenHighLow Close
1/2/200517:05   1.3546  1.3553  1.3546  1.35495
1/2/200517:10   1.3553  1.3556  1.3549  1.35525
1/2/200517:15   1.3556  1.35565 1.35515 1.3553
1/2/200517:25   1.355   1.3556  1.355   1.3555
3/14/2006   5:211.18895 2.18925 1.18835 1.1885
3/14/2006   7:562.18895 3.18925 1.18835 1.1885
2/13/2006   5:201.18895 1.18925 1.18835 1.1885

z- read.zoo(con-textConnection(Lines), header = TRUE, index = list(1, 2), FUN 
= function(d,t) as.chron(paste(d, t), format = %m/%d/%Y %H:%M))
close(con);

entrytrade - function(k) { k$Open+k$High }

#Note: A binary and operator () instead a logical () is needed here
new - entrytrade( z[hours(time(z)) = 2  ( hours(time(z)) + 
minutes(time(z))/100 = 7.55 ) ] );

print(new);

--- snip ---

On Tuesday 18 January 2011 22:36:12 rnick wrote:
 
 Hi all,
 
 Gabor came up with a very nice of code for my request:
 
 Lines - DateTimeOpenHighLow Close
 1/2/200517:05   1.3546  1.3553  1.3546  1.35495
 1/2/200517:10   1.3553  1.3556  1.3549  1.35525
 1/2/200517:15   1.3556  1.35565 1.35515 1.3553
 1/2/200517:25   1.355   1.3556  1.355   1.3555
 2/13/2006   5:201.18895 1.18925 1.18835 1.1885
 
 library(zoo)
 library(chron)
 
 z - read.zoo(textConnection(Lines), header = TRUE, index = list(1, 2),
  FUN = function(d,t) as.chron(paste(d, t), format = %m/%d/%Y %H:%M))
 
 z$New - z$Open + z$High
 zz - z[hours(time(z)) = 2  hours(time(z)) = 8]
 
 The result is:
 
  zz
Open High  Low Close  New
 (02/13/06 05:20:00) 1.19 1.19 1.19  1.19 2.38
 
 However, my original code needs a for loop. 
 
 Any ideas on how to identify the z positions where time is between 2:00:00
 and 07:55:00. 
 Could i do it with the following structure?
 
 
 Lines- DateTimeOpenHighLow Close
 1/2/200517:05   1.3546  1.3553  1.3546  1.35495
 1/2/200517:10   1.3553  1.3556  1.3549  1.35525
 1/2/200517:15   1.3556  1.35565 1.35515 1.3553
 1/2/200517:25   1.355   1.3556  1.355   1.3555
 2/13/2006   5:201.18895 1.18925 1.18835 1.1885
 
 library(zoo)
 library(chron)
 
 z- read.zoo(textConnection(Lines), header = TRUE, index = list(1, 2), FUN =
 function(d,t) as.chron(paste(d, t), format = %m/%d/%Y %H:%M))
 
 n=5
 
 entrytrade-function(k)
 
 {
 
new[k]-open[k]+high[k]
 }
 
 for (x in seq(from=1,to=n,by=1))
 {
   while (z[time(x)=2   time(x)=7:55])
   {
   entrytrade(x)
   }
 }
 
 Based on what i have seen the problem lies in the for loop and more
 specifically in the while statement. That's the error i get:
 
 Error in while (z[time(x) = 2  time(x) = 7:55]) { : 
   argument is of length zero
 
 Thanks


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] cannot allocate vector of size ... in RHLE5 PAE kernel

2011-01-17 Thread Hugo Mildenberger
Mauricio,

I tried your matrix allocation on Gentoo-hardened 32 and 
64 bit systems. Both work ok, using R-2.11.1 and R-2.12.2 respectively,
and both use a recent 2.6.36 kernel revision.

This is from the 32 bit system with 512 MB physical memory:

system(free)
  total   used   free sharedbuffers 
cached
Mem:469356  61884 407472  0   1368  21592
-/+ buffers/cache:  38924 430432
Swap:  1927796  360961891700

 gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells   120116  3.3 35  9.4   35  9.4
Vcells 78413  0.6 786432  6.0   391299  3.0

 bs - matrix(NA, nrow=6940,ncol=9000)

 gc()
used  (Mb)gc trigger  (Mb)  max used  (Mb)
Ncells 120123 3.3   35 9.4 359.4
Vcells 31308414 238.9   34854943 266.0 31308428 238.9

 system(free)
 total   used   free sharedbuffers cached
Mem:469356 307528 161828  0   1404  22508
-/+ buffers/cache: 283616 185740
Swap:  1927796  360841891712


MZ I tried to increase the memory limit available for R by using:
MZ $ R --min-vsize=10M --max-vsize=5000M --min-nsize=500k --max-nsize=5000M

Hmm, I wonder if specifying 5000M is a good idea within a 32-bit environment. 
Depending on R's internal implementation, maybe that value could overflow an 
tacitly wrap around on a 32 bit integer. (5000M  2^32 - 1)  You may try to 
specify 
1000M instead. But I think it's more probable that the system or VM 
configuration 
had setup a memory usage limit per user or per process. How to view/change this 
on redhat I don't know. But you may try to compile a small C programm using
malloc() and see what happens if you request say 1Gigabyte:

#include stdlib.h
#include stdio.h

void main() {
 const size_t size = 10LU;
 void* p = malloc(size);
 if ( p ) {
  fprintf(stderr,successfully allocated %lu bytes\n,size);
 }else {
  fprintf(stderr,allocation of %lu bytes failed:%m\n,size);
 }
}

put this into a file named, say, tmalloc.c and compile it using
   
  gcc tmalloc.c -o tmalloc

Hugo







On Monday 17 January 2011 16:42:43 Mauricio Zambrano wrote:
 Following the advice a colleague, I put the gc() and gcinfo(TRUE)
 commands just before the line I got the problem, and their output
 were:
 
  used (Mb) gc trigger  (Mb)  max used   (Mb)
 Ncells  471485 12.61704095  45.6   7920371  211.5
 Vcells 6408885 48.9  113919753 869.2 347651599 2652.4
 
 Garbage collection 538 = 323+101+114 (level 2) ...
 13.0 Mbytes of cons cells used (29%)
 49.0 Mbytes of vectors used (7%)
 
 Error: cannot allocate vector of size 238.1 Mb
 
 
 If I understood correctly, I should have enough memory for allocating
 the new matrix (Q.obs - matrix(NA, nrow=6940,  MZ ncol=9000) ))
 
 Thanks in advance for any help,
 
 Mauricio
 
 
  MZ == Mauricio Zambrano hzambran.newsgro...@gmail.com
  on Mon, 17 Jan 2011 11:46:44 +0100 writes:
 
 MZ Dear R community,
 MZ I'm running R 32 bits in a 64-bits machine (with 16Gb of Ram) using a
 MZ PAE kernel, as you can see here:
 
 MZ $ uname -a
 MZ Linux mymachine 2.6.18-238.el5PAE #1 SMP Sun Dec 19 14:42:44 EST 2010
 MZ i686 i686 i386 GNU/Linux
 
 
 MZ When I try to create a large matrix ( Q.obs - matrix(NA, nrow=6940,
 MZ ncol=9000) ), I got the following error:
 
 
  Error: cannot allocate vector of size 238.3 Mb
 
 
 MZ However, the amount of free memory in my machine seems to be much
 MZ larger than this:
 
 MZ system(free)
 MZ \ total   used   free sharedbuffers 
  cached
 MZ Mem:  1246623663541166112120  0  67596
  2107556
 MZ -/+ buffers/cache:41789648287272
 MZ Swap: 12582904  0   12582904
 
 
 MZ I tried to increase the memory limit available for R by using:
 
 MZ $ R --min-vsize=10M --max-vsize=5000M --min-nsize=500k 
  --max-nsize=5000M
 
 
 MZ but it didn't work.
 
 
 MZ Any hint about how can I get R using all the memory available in the 
  machine ?
 
  Install a 64-bit version of Linux, i.e., ubuntu in your case
  and work from there.
  I don't think there's a way around that.
 
  Martin
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] How to still processing despite bug errors?

2011-01-17 Thread Hugo Mildenberger

Altay, simply run your tests under control of an exception handler:

  help(try)
  help(tryCatch)



On Monday 17 January 2011 22:05:07 Altay wrote:
 Hi, everybody.
 
 I am working  processing EEG data from 1000 pacients. I have a specific
 syntax to perform the Spectral Analysis and a loop to analyse all subjects.
 each subject data are in separate folders (P1, P2 P3...)
 
 My question is: in some cases, some errors can appear in one subject. I want
 to know if is possible to jump to the next subject and perform the same
 syntax , exibiting an error like:
 
 Working on P1
 Error X in P1
 
 Working on P2...
 
 The idea is to let the computer processing continuosly all the subjects and
 at the end only see the problems in the subjects that R could not perform
 the analysis.
 Each Subject takes 20 minutes to perform the analysis and I don't want to
 stay days in front of PC, waiting for the next error in order to start the
 syntax again with the next subject.
 
 Any ideas?
 Thanks in Advance.
 
 Altay Lino de Souza.
 
   [[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] rootogram for normal distributions

2011-01-16 Thread Hugo Mildenberger
Using R-2.12.1 and latticeExtra-0.6-14, I would like to understand 
why a rootogram displaying samples from the Poisson distribution looks like I 
expected it, whereas a rootogram using the normal distribution does not:

library(latticeExtra)
rootogram(~rpois(1000, lambda = 50), dfun = function(x) dpois(x, lambda = 50))

rootogram(~rnorm(1000), dfun = function(x) dnorm(x,mean(x),sd(x)))

I probably can't attach figures here. Thus a textual description of what I get 
may 
suffice: With increasing sample size, the rootogram using random samples 
from the Poisson distribution shows decreasing differences (bars are quickly 
approaching the zero line), whereas the displayed differences for random 
samples of the normal distribution are always large. The differences even 
increase 
with sample size, i.e,  the hanging bars tend to vanish for very large samples.

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


Re: [R] xyplot: modify axis tick marks

2011-01-16 Thread Hugo Mildenberger
Using lattice and the rainfall$Time series as proposed below by Dennis 
gives also a nice result:

rainfall$Time - seq(from = as.Date('1993-01-01'), 
to  = as.Date('2007-12-01'), by = 'month')
xyplot(rainfall~Time,data=rainfall,type=c(g,p,l,smooth))


On Sunday 16 January 2011 17:33:18 Dennis Murphy wrote:
 Hi:
 
 Try this, since your data have no missing months:
 
 rainfall$Time - seq(from = as.Date('1993-01-01'), to =
 as.Date('2007-12-01'), by = 'month')
 g - ggplot(rainfall, aes(x = Time, y = rainfall))
 g + geom_path()
 
 HTH,
 Dennis
 
 On Sun, Jan 16, 2011 at 5:01 AM, Kang Min ngokang...@gmail.com wrote:
 
  Hi,
 
  I would like to plot time against rainfall data (data is at the end)
  using xyplot.
 
  The basic code looks like this: xyplot(rainfall~time, type=a)
  When I do this, the graph looks ok except that the x-axis has too many
  values. I would just like to display the years and not the months on
  the x-axis. I've been fiddling around with 'scales', and read previous
  posts about axis problems but I still can't find the solution.
 
  Thanks in advance.
 
  Kang Min
 
  timerainfall
  Jan1993 176.4
  Feb1993 69.2
  Mar1993 250.5
  Apr1993 283.9
  May1993 129.9
  Jun1993 115.5
  Jul1993 240
  Aug1993 106.8
  Sep1993 61.7
  Oct1993 175.5
  Nov1993 250.8
  Dec1993 308.5
  Jan1994 56.9
  Feb1994 133.5
  Mar1994 288.2
  Apr1994 154
  May1994 169.6
  Jun1994 184.7
  Jul1994 53.8
  Aug1994 45.1
  Sep1994 23.7
  Oct1994 84.7
  Nov1994 322.2
  Dec1994 425.4
  Jan1995 349.4
  Feb1995 334
  Mar1995 67.7
  Apr1995 242.3
  May1995 84.4
  Jun1995 63.7
  Jul1995 173.6
  Aug1995 211.6
  Sep1995 29.5
  Oct1995 101.1
  Nov1995 372.8
  Dec1995 302.5
  Jan1996 173.2
  Feb1996 180.2
  Mar1996 129.7
  Apr1996 178.2
  May1996 107.5
  Jun1996 265.8
  Jul1996 162.3
  Aug1996 258.4
  Sep1996 297
  Oct1996 300
  Nov1996 180.2
  Dec1996 185.5
  Jan1997 15.4
  Feb1997 105.4
  Mar1997 34.3
  Apr1997 118.4
  May1997 41.6
  Jun1997 78.9
  Jul1997 18.6
  Aug1997 86.6
  Sep1997 31.1
  Oct1997 78.4
  Nov1997 158.3
  Dec1997 351.9
  Jan1998 268.8
  Feb1998 32.5
  Mar1998 58.8
  Apr1998 187.7
  May1998 370.8
  Jun1998 198.8
  Jul1998 259.2
  Aug1998 195
  Sep1998 258.2
  Oct1998 222.7
  Nov1998 107.2
  Dec1998 463.4
  Jan1999 193.9
  Feb1999 67.4
  Mar1999 181.4
  Apr1999 88.5
  May1999 157.1
  Jun1999 103.4
  Jul1999 225.4
  Aug1999 204
  Sep1999 125.9
  Oct1999 205
  Nov1999 241.5
  Dec1999 340.5
  Jan2000 275.2
  Feb2000 237.8
  Mar2000 238.3
  Apr2000 311.6
  May2000 96.8
  Jun2000 157.5
  Jul2000 116.1
  Aug2000 113.5
  Sep2000 81.1
  Oct2000 120.9
  Nov2000 385.7
  Dec2000 236
  Jan2001 425.8
  Feb2001 86.6
  Mar2001 297.3
  Apr2001 203.3
  May2001 164.9
  Jun2001 137.1
  Jul2001 111.3
  Aug2001 158.3
  Sep2001 162
  Oct2001 252.2
  Nov2001 175.3
  Dec2001 609
  Jan2002 221.2
  Feb2002 50.8
  Mar2002 55.6
  Apr2002 116.5
  May2002 236.6
  Jun2002 83.1
  Jul2002 233.7
  Aug2002 54.2
  Sep2002 124.2
  Oct2002 10.8
  Nov2002 307.2
  Dec2002 255
  Jan2003 444.2
  Feb2003 172.9
  Mar2003 154.6
  Apr2003 159.9
  May2003 81.8
  Jun2003 50.3
  Jul2003 170.4
  Aug2003 193.6
  Sep2003 205.3
  Oct2003 351.4
  Nov2003 133.8
  Dec2003 273
  Jan2004 600.9
  Feb2004 31.9
  Mar2004 269.4
  Apr2004 57.1
  May2004 137.6
  Jun2004 127.2
  Jul2004 166.6
  Aug2004 185.2
  Sep2004 128.9
  Oct2004 125.6
  Nov2004 166.2
  Dec2004 139.8
  Jan2005 163.2
  Feb2005 8.4
  Mar2005 82.4
  Apr2005 81.7
  May2005 331.1
  Jun2005 82.3
  Jul2005 104
  Aug2005 58.5
  Sep2005 175.7
  Oct2005 314.5
  Nov2005 362.9
  Dec2005 166
  Jan2006 454.4
  Feb2006 115.5
  Mar2006 83.1
  Apr2006 239.8
  May2006 205.7
  Jun2006 236.8
  Jul2006 153.8
  Aug2006 127.3
  Sep2006 83.3
  Oct2006 102
  Nov2006 185.6
  Dec2006 765.9
  Jan2007 450.1
  Feb2007 105.5
  Mar2007 269.1
  Apr2007 240.2
  May2007 127.2
  Jun2007 139
  Jul2007 141.7
  Aug2007 190.7
  Sep2007 149
  Oct2007 237.2
  Nov2007 367.9
  Dec2007 468.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.
 
 
   [[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] rootogram for normal distributions

2011-01-16 Thread Hugo Mildenberger
Thank you very much for your qualified answers, and also for the 
link to the Tukey paper. I appreciate Tukey's writings very much. 

Looking at the lattice code (below), a possible implementation might 
involve  binning, not so?

I see a problematic part here:

   xx - sort(unique(x))

Unique certainly works well with Poisson distributed data, but is 
essentially a no-op when confronted with continous floating-point 
numbers.

Best

Hugo


 prepanel.rootogram
function (x, y = table(x), dfun = NULL, transformation = sqrt, 
hang = TRUE, ...) 
{
plot.line - trellis.par.get(plot.line)
stopifnot(is.function(dfun))
yy - transformation(y/sum(y))
xx - sort(unique(x))
dotArgs - list(...)
dfunArgs - names(formals(dfun))
if (!(... %in% dfunArgs)) 
dotArgs - dotArgs[dfunArgs[-1]]
dd - transformation(do.call(dfun, c(list(xx), dotArgs)))
list(xlim = range(xx), ylim = if (hang) range(dd, dd - yy, 
0) else range(dd, yy, 0), dx = diff(xx), dy = diff(dd))
}


panel.rootogram
function (x, y = table(x), dfun = NULL, col = plot.line$col, 
lty = plot.line$lty, lwd = plot.line$lwd, alpha = plot.line$alpha, 
transformation = sqrt, hang = TRUE, ...) 
{
plot.line - trellis.par.get(plot.line)
ref.line - trellis.par.get(reference.line)
stopifnot(is.function(dfun))
yy - transformation(y/sum(y))
xx - sort(unique(x))
dotArgs - list(...)
dfunArgs - names(formals(dfun))
if (!(... %in% dfunArgs)) 
dotArgs - dotArgs[dfunArgs[-1]]
dd - transformation(do.call(dfun, c(list(xx), dotArgs)))
panel.abline(h = 0, col = ref.line$col, lty = ref.line$lty, 
lwd = ref.line$lwd, alpha = ref.line$alpha)
panel.segments(xx, if (hang) 
dd
else 0, xx, if (hang) 
(dd - yy)
else yy, col = col, lty = lty, lwd = lwd, alpha = alpha, 
...)
panel.lines(xx, dd)
}
environment: namespace:latticeExtra
 





On Sunday 16 January 2011 15:59:58 Achim Zeileis wrote:
 On Sun, 16 Jan 2011, Hadley Wickham wrote:
 
  The normal distribution is a continuous distribution, i.e., the frequency
  for each observed value will essentially be 1/n and not converge to the
  density function. Hence, you would need to look at histogram or smoothed
  densities. Rootograms, on the other hand, are intended for discrete
  distributions.
 
  I don't think that's true - rootograms are useful for both continuous
  and discrete distributions.  See (e.g.) p 314 at
  http://www.edwardtufte.com/tufte/tukey, where Tukey himself uses a
  rootogram with a normal distribution.
 
 OK, let me rephrase: Rootograms as implemented in rootogram() are intended 
 for discrete distributions. At least that's my reading. But maybe I've 
 missed a trick that you can point us to.
 Z
 
  Hadley
 
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/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] a remove question

2011-01-16 Thread Hugo Mildenberger

How about

   ls(pattern=NY)
   #rm(list=ls(pattern=NY))



On Sunday 16 January 2011 22:08:16 Erin Hodgess wrote:
 Dear R People:
 
 I have the following:
 
  ls(pattern=NY*)
  [1] CRAN_df  CRAN_df0 CRAN_df1 CRAN_mat CRAN_sp
  [6] CRAN_spdf1   CRAN_spdf2   CRAN_spdf4   delauney_NY  dist2_NY
 [11] dist3_NY Gabriel_NY   NY8a_nb  rel_neigh_NY scot_BNG
 [16] SOI_NY
  rm(pattern=NY*)
 Warning message:
 In rm(pattern = NY*) : object 'NY*' not found
 
 
 How do I remove all of NY* items, please?  I suspect it might be an sapply 
 issue
 thanks,
 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.