[Rd] plot.POSIXct uses wrong x axis (PR#14016)

2009-10-20 Thread karl
Full_Name: Karl Ove Hufthammer
Version: 2.10.0 beta
OS: Windows
Submission from: (NULL) (93.124.134.66)


When plotting a single POSIXct variable, 'plot' uses a nonsensical x axis. Here
is some example code:

set.seed(1)
x=seq(1,1e8,length=100)+round(runif(100)*1e8)
y=as.POSIXct(x,origin="2001-01-01")
plot(y)

The y axis correctly shows appropriate labels (years 2002 to 2006), but the x
axis show the single time '59:58' in the lower left corner.

Expected behaviour: The indices should be shown on the x axis, just like for
plot(x), where x is the x variable in the above example code.

Additional notes: While ?plot.POSIXct does not explicitly say that the second
variable ('y') is optional, the help for the generic, ?plot, does. And it seems
reasonable that it should be. Also plot(POSIXct.variable) does produce a
'correct' plot, except for the labels on the x axis.

Output of sessionInfo():

R version 2.10.0 beta (2009-10-17 r50136) 
i386-pc-mingw32 

locale:
[1] LC_COLLATE=Norwegian-Nynorsk_Norway.1252 
[2] LC_CTYPE=Norwegian-Nynorsk_Norway.1252   
[3] LC_MONETARY=Norwegian-Nynorsk_Norway.1252
[4] LC_NUMERIC=C 
[5] LC_TIME=Norwegian-Nynorsk_Norway.1252

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

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] to connect R from ejb

2009-10-20 Thread pragathichi

how to add Reengine and Rserveengine jar files in ejb?
I am using eclipse, plz suggest.

Romain Francois-2 wrote:
> 
> On 10/19/2009 10:57 AM, pragathichi wrote:
>> How to call R from ejb, can i use Rserve?
> 
> yes
> 
> -- 
> Romain Francois
> Professional R Enthusiast
> +33(0) 6 28 91 30 30
> http://romainfrancois.blog.free.fr
> |- http://tr.im/BcPw : celebrating R commit #5
> |- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
> `- http://tr.im/yw8E : New R package : sos
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
View this message in context: 
http://www.nabble.com/to-connect-R-from-ejb-tp25955127p25969189.html
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Changing options in R CMD SHLIB

2009-10-20 Thread Fabio Mathias Corrêa
I use linux Mint and R.2.9.2

Thank you!

   Fábio Mathias Corrêa
Estatística e Experimentação Agropecuária/UFLA



--- Em ter, 20/10/09, Prof Brian Ripley  escreveu:

> De: Prof Brian Ripley 
> Assunto: Re: [Rd] Changing options in R CMD SHLIB
> Para: "Fabio Mathias Corrêa" 
> Cc: r-devel@r-project.org
> Data: Terça-feira, 20 de Outubro de 2009, 5:08
> Please see the manual -- 'Writing R
> Extensions'.  If you want to use 
> custom compiler flags, you use a Makevars or personal
> .Makevars file.
> Something like
> 
> PKG_FCFLAGS=-fopenmp
> 
> (you haven't told us your OS or version of R).
> 
> On Mon, 19 Oct 2009, Fabio Mathias Corrêa wrote:
> 
> > Dear,
> >
> > When trying to use directive OpenMP in my code, I
> observed that the directive ones were being considered as
> commentaries.
> > Compiling with command R CMD SHLIB xxx.f95 - fopenmp
> and calling the function in the R verified that threads was
> not being considered.
> > I was to observe the options of the compiler
> >
> > R CMD SHLIB --help
> >
> > Usage: R CMD SHLIB [options] files | linker options
> >
> > Build a shared library for dynamic loading from the
> specified source or
> > object files (which are automagically made from their
> sources) or
> > linker options.  If not given via '--output', the
> name for the shared
> > library is determined from the first source or object
> file.
> >
> > Options:
> >   -h, --help        print short help message
> and exit
> >   -v, --version        print version info and
> exit
> >   -o, --output=LIB    use LIB as (full) name for
> the built library
> >   -c, --clean        remove files created
> during compilation
> >   --preclean        remove files created during
> a previous run
> >   -n, --dry-run        dry run, showing
> commands that would be used
> >
> > Windows only:
> >   -d, --debug        build a debug DLL
> >
> >
> > How can I enable -fopenmp for use with R CMD SHLIB?
> >
> >
> >    Fábio Mathias Corrêa
> > Estatística e Experimentação Agropecuária/UFLA
> 
> -- 
> Brian D. Ripley,           
>       rip...@stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,         
>    Tel:  +44 1865 272861 (self)
> 1 South Parks Road,         
>            +44 1865
> 272866 (PA)
> Oxford OX1 3TG, UK           
>     Fax:  +44 1865 272595


  

Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] to connect R from ejb

2009-10-20 Thread Romain Francois
The same way you would add any other jar, please go to an ejb forum. 
Alternatively, use this more appropriate mailing list :


http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel

One way or another, please take the time to formulate a proper question, 
showing what you tried, what did not work, and so on.


On 10/20/2009 05:22 AM, pragathichi wrote:

how to add Reengine and Rserveengine jar files in ejb?
I am using eclipse, plz suggest.

Romain Francois-2 wrote:


On 10/19/2009 10:57 AM, pragathichi wrote:

How to call R from ejb, can i use Rserve?


yes


--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/BcPw : celebrating R commit #5
|- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
`- http://tr.im/yw8E : New R package : sos

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Bug with .First in R 2.10

2009-10-20 Thread luke

On Mon, 19 Oct 2009, Duncan Murdoch wrote:


On 10/18/2009 6:58 PM, mark.braving...@csiro.au wrote:
I started the same version of R in my usual starting directory (where 
there's a larger .RData, whose .First is running OK right now) and then did


save( .First, file=<>)

I'm not sure exactly where the .First came from before that; I use a couple 
of different machines and (in the runup to 2.10) a couple of R versions.


I've tracked this down to a problem when the .First is loaded from the image 
file, likely due to a change on Sept 29.  Hopefully it will be fixed before 
release.


Not actually due to that change but an older bug unmasked by that
change.  Should be fixed on the trunk and 2.10 branches now.

luke



Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Bug with .First in R 2.10

2009-10-20 Thread Duncan Murdoch

On 10/18/2009 6:20 PM, mark.braving...@csiro.au wrote:

Under R2.10.0 beta (2009-10-14 r50082) my .First does not run reliably. I 
reported this last week, but not reproducibly, and it seemed to go away, so I 
thought it might be installation-related. But it has now recurred reproducibly, 
at least on my machine.

The website ftp://ftp.csiro.au/MarkBravington contains two .RData files each containing 
(only) a .First. One of them does what it should, and one of them doesn't. Confusingly, 
the OK one will actually trigger an error message for you, because it tries to do things 
that are specific to my machines. The not-OK one says "skipping .First", as 
below, and you'll see why it shouldn't be doing that. Obvioulsy, the files need renaming 
before you can test them.

I haven't been able to condense the .First to something more succinct that 
shows the same fault; saving a modified .First frequently makes the problem go 
away, seemingly regardless of what the change is.

The transcript from the not-OK version is given below


Luke Tierney tracked this down and fixed it.  It's actually a fairly old 
bug, but was being masked by another; when he fixed the other one in 
September, this one started to manifest itself.


It should be okay in RC builds newer than r50178 (which should show up 
by tomorrow on most platforms).


Thanks for making this reproducible!

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] isFALSE

2009-10-20 Thread Martin Maechler
> "RF" == Romain Francois 
> on Sun, 11 Oct 2009 01:00:24 +0200 writes:

RF> Hello, Just wondering why there is "isTRUE" and not
RF> "isFALSE".

Probably because it's slightly more natural to have

  if(isTRUE()) {
 ..
  }

rather than the corrsponding  isFALSE()

Further, e.g.  all.equal()  and  validObject()
return *either*  TRUE or a string,
and hence isTRUE(.) is usefully applied to their return values.

Are there other opinions on this?

Martin

> -- 
> Romain Francois
> Professional R Enthusiast
> +33(0) 6 28 91 30 30
> http://romainfrancois.blog.free.fr
> |- http://tr.im/BcPw : celebrating R commit #5
> |- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
> `- http://tr.im/yw8E : New R package : sos

> Index: src/library/base/R/identical.R
> ===
> --- src/library/base/R/identical.R(revision 50027)
> +++ src/library/base/R/identical.R(working copy)
> @@ -18,3 +18,5 @@
> .Internal(identical(x,y, num.eq, single.NA, attrib.as.set))
 
> isTRUE <- function(x) identical(TRUE, x)
> +
> +isFALSE <- function(x) identical(FALSE, x)
> Index: src/library/base/man/Logic.Rd
> ===
> --- src/library/base/man/Logic.Rd (revision 50027)
> +++ src/library/base/man/Logic.Rd (working copy)
> @@ -14,6 +14,7 @@
> xor(x, y)
 
> isTRUE(x)
> +isFALSE(x)
> }
> \alias{!}
> \alias{&}
> @@ -23,6 +24,7 @@
> \alias{xor}
> \alias{Logic}
> \alias{isTRUE}
> +\alias{isFALSE}
> \description{
> These operators act on logical and number-like vectors.
> }
> @@ -48,7 +50,11 @@
> \code{isTRUE(x)} is an abbreviation of \code{identical(TRUE, x)}, and
> so is true if and only if \code{x} is a length-one logical vector with
> no attributes (not even names).
> -
> +  
> +  \code{isFALSE(x)} is an abbreviation of \code{identical(FALSE, x)}, and
> +  so is true if and only if \code{x} is a length-one logical vector with
> +  no attributes (not even names).
> +  
> Numeric and complex vectors will be coerced to logical values, with
> zero being false and all non-zero values being true.  Raw vectors are
> handled without any coercion for \code{!}, \code{&}, \code{|} and
> @@ -87,7 +93,7 @@
> used.  For arrays (and an array result) the dimensions and dimnames
> are taken from first argument if it is an array, otherwise the second.
 
> -  For \code{||}, \code{&&} and \code{isTRUE}, a length-one logical 
vector.
> +  For \code{||}, \code{&&}, \code{isFALSE} and \code{isTRUE}, a 
length-one logical vector.
> }
> \section{S4 methods}{
> \code{!}, \code{&} and \code{|} are S4 generics, the latter two part
> Index: src/library/base/man/identical.Rd
> ===
> --- src/library/base/man/identical.Rd (revision 50027)
> +++ src/library/base/man/identical.Rd (working copy)
> @@ -85,7 +85,8 @@
> \seealso{
> \code{\link{all.equal}} for descriptions of how two objects differ;
> \link{Comparison} for operators that generate elementwise comparisons.
> -  \code{\link{isTRUE}} is a simple wrapper based on \code{identical}.
> +  \code{\link{isTRUE}} and \code{\link{isFALSE}} are simple 
> +  wrappers based on \code{identical}.
> }
> \examples{
> identical(1, NULL) ## FALSE -- don't try this with ==
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] isFALSE

2009-10-20 Thread William Dunlap

> -Original Message-
> From: r-devel-boun...@r-project.org 
> [mailto:r-devel-boun...@r-project.org] On Behalf Of Martin Maechler
> Sent: Tuesday, October 20, 2009 7:56 AM
> To: Romain Francois
> Cc: R-devel@r-project.org
> Subject: Re: [Rd] isFALSE
> 
> > "RF" == Romain Francois 
> > on Sun, 11 Oct 2009 01:00:24 +0200 writes:
> 
> RF> Hello, Just wondering why there is "isTRUE" and not
> RF> "isFALSE".
> 
> Probably because it's slightly more natural to have
> 
>   if(isTRUE()) {
>  ..
>   }
> 
> rather than the corrsponding  isFALSE()
> 
> Further, e.g.  all.equal()  and  validObject()
> return *either*  TRUE or a string,
> and hence isTRUE(.) is usefully applied to their return values.
> 
> Are there other opinions on this?

I avoid isTRUE because it is too restrictive, insisting
that the TRUE be unadorned with names or other stray attributes.
E.g.,
   > x<-c(One=1,Two=2)
   > isTRUE(x[1]>0) # <=> isTRUE(c(One=TRUE))
   [1] FALSE
I would avoid a similar isFALSE.  It would be nice to have
a isScalarTRUE function and a isScalarFALSE, both of which
would return FALSE for NA, non-scalars, and non-logicals.
Then I would use them in the form
if (isScalarTRUE(x))
  doSomething()
else if (isScalarFALSE(x))
  doSomethingElse()
else stop("expected scalar TRUE or FALSE, not ", class(x), "(",
length(x), ")")
One might want to separate out the length(x)==1,is.logical,
and !is.na(x) tests to avoid duplicating computations, but that would
make
the if-else logic more complicated.

By the way, I sometimes use locally defined is.true() and is.false
functions that are vectorized and return FALSE for NA's:
   is.true <- function(x) x & !is.na(x)
   is.false <- function(x) !x & !is.na(x)
   is.true(c(NA,T,F))
   # [1] FALSE  TRUE FALSE
   is.true(c(NA,1,0))
   # [1] FALSE  TRUE FALSE
The idiom is in functions like ifelse().  Is there/should there be
a standard function to do that?

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  
> 
> Martin
> 
> > -- 
> > Romain Francois
> > Professional R Enthusiast
> > +33(0) 6 28 91 30 30
> > http://romainfrancois.blog.free.fr
> > |- http://tr.im/BcPw : celebrating R commit #5
> > |- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
> > `- http://tr.im/yw8E : New R package : sos
> 
> > Index: src/library/base/R/identical.R
> > 
> ===
> > --- src/library/base/R/identical.R  (revision 50027)
> > +++ src/library/base/R/identical.R  (working copy)
> > @@ -18,3 +18,5 @@
> > .Internal(identical(x,y, num.eq, single.NA, attrib.as.set))
>  
> > isTRUE <- function(x) identical(TRUE, x)
> > +
> > +isFALSE <- function(x) identical(FALSE, x)
> > Index: src/library/base/man/Logic.Rd
> > 
> ===
> > --- src/library/base/man/Logic.Rd   (revision 50027)
> > +++ src/library/base/man/Logic.Rd   (working copy)
> > @@ -14,6 +14,7 @@
> > xor(x, y)
>  
> > isTRUE(x)
> > +isFALSE(x)
> > }
> > \alias{!}
> > \alias{&}
> > @@ -23,6 +24,7 @@
> > \alias{xor}
> > \alias{Logic}
> > \alias{isTRUE}
> > +\alias{isFALSE}
> > \description{
> > These operators act on logical and number-like vectors.
> > }
> > @@ -48,7 +50,11 @@
> > \code{isTRUE(x)} is an abbreviation of 
> \code{identical(TRUE, x)}, and
> > so is true if and only if \code{x} is a length-one 
> logical vector with
> > no attributes (not even names).
> > -
> > +  
> > +  \code{isFALSE(x)} is an abbreviation of 
> \code{identical(FALSE, x)}, and
> > +  so is true if and only if \code{x} is a length-one 
> logical vector with
> > +  no attributes (not even names).
> > +  
> > Numeric and complex vectors will be coerced to logical 
> values, with
> > zero being false and all non-zero values being true.  
> Raw vectors are
> > handled without any coercion for \code{!}, \code{&}, 
> \code{|} and
> > @@ -87,7 +93,7 @@
> > used.  For arrays (and an array result) the dimensions 
> and dimnames
> > are taken from first argument if it is an array, 
> otherwise the second.
>  
> > -  For \code{||}, \code{&&} and \code{isTRUE}, a 
> length-one logical vector.
> > +  For \code{||}, \code{&&}, \code{isFALSE} and 
> \code{isTRUE}, a length-one logical vector.
> > }
> > \section{S4 methods}{
> > \code{!}, \code{&} and \code{|} are S4 generics, the 
> latter two part
> > Index: src/library/base/man/identical.Rd
> > 
> ===
> > --- src/library/base/man/identical.Rd   (revision 50027)
> > +++ src/library/base/man/identical.Rd   (working copy)
> > @@ -85,7 +85,8 @@
> > \seealso{
> > \code{\link{all.equal}} for descriptions of how two 
> 

[Rd] Suggestion for exception handling: More informative error message for "no applicable method..." (S3)

2009-10-20 Thread Henrik Bengtsson
I'd like to suggest that whenever there is no S3 method implementation
available for a particular class, that the error message would also
report the class structure of the object dispatched on.

Example:

foo <- function(...) UseMethod("foo")
foo.ClassA <- function(object, ...) { cat("foo() for ClassA called.\n") }

> foo(structure(1, class="ClassA"))
foo() for ClassA called.

Now:

> foo(NULL)
Error in UseMethod("foo") : no applicable method for "foo"

> foo(Sys.time())
Error in UseMethod("foo") : no applicable method for "foo"

Suggestion:

> foo(NULL)
Error in UseMethod("foo") : no applicable foo() method: list

> foo(Sys.time())
Error in UseMethod("foo") : no applicable foo() method: POSIXt, POSIXct

This would really help troubleshooting, especially when running in
batch mode where you don't have direct access to the object without
modifying the script and/or functions.

/Henrik

PS. I know that one as a workaround can create a "default" method that
reports this, but I believe it is much better that the builtin
exception handling should report this/carry this information.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Changing options in R CMD SHLIB

2009-10-20 Thread Fabio Mathias Corrêa
Dear,

I managed to use directives OpenMP in R.
To compile I used the gfortran directly. For example:

gfortran-shared-O2 teste.f90-fopenmp-fPIC

By using the code in R, it works perfectly!

However, I need to use some specific libraries of R, for use in C functions in 
Fortran 95.

When compiling using the command:

gfortran-shared-O2-o teste.f90 myrandom.c func.out -fopenmp -fPIC

However, I need to indicate the path for the compiler to use the files of the 
type: Rmath.h, R.h and others.

I observed the project ROMP and the library Rcsdp. The developers of the 
library Rcsdp in the installation file present the following modification in 
the compiler for enable the OpenMP. 


CFLAGS=CFLAGS=-O3 -march=nocona -m64 -fprefetch-loop-arrays -ftree-vectorize 
-ftree-vectorizer-verbose=1 -fopenmp  -ansi -Wall -DNOSHORTS -DBIT64 
-DUSEOPENMP -I../include


LIBS=LIBS=-static -L../lib -lsdp -llapack -lptf77blas -lptcblas -latlas -lgomp 
-lrt -lpthread -lgfortran -lm 



 I already tried

~/Fortran/parallel/tri $ export PKG_FCFLAGS= -fopenmp
bash: export: `-fopenmp': not a valid identifier


I could indicate the path of the files R.h, Rmath.h and other to the gfortran? 
How? 

Thank you!

   Fábio Mathias Corrêa
Estatística e Experimentação Agropecuária/UFLA




  

Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Changing options in R CMD SHLIB

2009-10-20 Thread Fabio Mathias Corrêa
Thank you very much!!!

Problem solved!!

I use

export PKG_FCFLAGS=-fopenmp

> dyn.load("teste.so")
> system.time(abc3 <- .Fortran("mxv", as.integer(m), as.integer(n), 
> as.double(a), b, as.double(c)))
 In parallel region - Thread ID1
 In parallel region - Thread ID1
 In parallel region - Thread ID1
 In parallel region - Thread ID1
 In parallel region - Thread ID1
 In parallel region - Thread ID0
 In parallel region - Thread ID0
 In parallel region - Thread ID0
 In parallel region - Thread ID0
 In parallel region - Thread ID0
   user  system elapsed
  0   0   0 



   Fábio Mathias Corrêa
Estatística e Experimentação Agropecuária/UFLA



--- Em ter, 20/10/09, Prof Brian Ripley  escreveu:

> De: Prof Brian Ripley 
> Assunto: Re: [Rd] Changing options in R CMD SHLIB
> Para: "Fabio Mathias Corrêa" 
> Cc: r-devel@r-project.org
> Data: Terça-feira, 20 de Outubro de 2009, 5:08
> Please see the manual -- 'Writing R
> Extensions'.  If you want to use 
> custom compiler flags, you use a Makevars or personal
> .Makevars file.
> Something like
> 
> PKG_FCFLAGS=-fopenmp
> 
> (you haven't told us your OS or version of R).
> 
> On Mon, 19 Oct 2009, Fabio Mathias Corrêa wrote:
> 
> > Dear,
> >
> > When trying to use directive OpenMP in my code, I
> observed that the directive ones were being considered as
> commentaries.
> > Compiling with command R CMD SHLIB xxx.f95 - fopenmp
> and calling the function in the R verified that threads was
> not being considered.
> > I was to observe the options of the compiler
> >
> > R CMD SHLIB --help
> >
> > Usage: R CMD SHLIB [options] files | linker options
> >
> > Build a shared library for dynamic loading from the
> specified source or
> > object files (which are automagically made from their
> sources) or
> > linker options.  If not given via '--output', the
> name for the shared
> > library is determined from the first source or object
> file.
> >
> > Options:
> >   -h, --help        print short help message
> and exit
> >   -v, --version        print version info and
> exit
> >   -o, --output=LIB    use LIB as (full) name for
> the built library
> >   -c, --clean        remove files created
> during compilation
> >   --preclean        remove files created during
> a previous run
> >   -n, --dry-run        dry run, showing
> commands that would be used
> >
> > Windows only:
> >   -d, --debug        build a debug DLL
> >
> >
> > How can I enable -fopenmp for use with R CMD SHLIB?
> >
> >
> >    Fábio Mathias Corrêa
> > Estatística e Experimentação Agropecuária/UFLA
> 
> -- 
> Brian D. Ripley,           
>       rip...@stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,         
>    Tel:  +44 1865 272861 (self)
> 1 South Parks Road,         
>            +44 1865
> 272866 (PA)
> Oxford OX1 3TG, UK           
>     Fax:  +44 1865 272595


  

Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Buglet in optim() SANN

2009-10-20 Thread Prof. John C Nash
I think SANN method in optim() is failing to report that it has not 
converged. Here is an example


genrose.f<- function(x, gs=NULL){ # objective function
## One generalization of the Rosenbrock banana valley function (n 
parameters)

n <- length(x)
if(is.null(gs)) { gs=100.0 }
fval<-1.0 + sum (gs*(x[1:(n-1)]^2 - x[2:n])^2 + (x[2:n] - 1)^2)
return(fval)
}

xx<-rep(pi,10)
test<-optim(xx,genrose.f,method="SANN",control=list(maxit=1000,trace=1))
print(test)


Output is:

> source("tsann.R")
sann objective function values
initial   value 40781.805639
iter  999 value 29.969529
final value 29.969529
sann stopped after 999 iterations
$par
 [1] 1.0135254 0.9886862 1.1348609 1.0798927 1.0327997 1.1087146 1.1642130
 [8] 1.3038754 1.8628391 3.7569285

$value
[1] 29.96953

$counts
function gradient
1000   NA

$convergence
[1] 0  <-- THIS SHOULD BE 1 ACCORDING TO THE DOCS

$message
NULL

Note terribly important, but maybe fixable.

Cheers,

John Nash

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Problem/anomalous behavior with image() function (and ReadImages?)

2009-10-20 Thread Dominick Samperi

When an RGB photo is displayed using R's image() function with
the help of the pixmap (or rimage) package it is common to see
an anomalous white line running across the picture (either
horizontally or vertically). The line can
be removed by simply stretching the image frame a little in the
direction perpendicular to the anomalous line, or by maximizing the
image frame (tested under Fedora 10; Windows could not be
tested because ReadImages package does not load properly under
Windows/Vista, and rimage is not available for Windows).

It does not help to use x11(width=10,hight=10) before the call to
image() with the hope that the frame will already be
large enough: image() just draws a larger image with an
anomalous white line (which can be removed in the way just
described).

Here is code that produces an image with anomalous white lines
on under Fedora 10:

library(rimage)
x <- read.jpeg(system.file("data", "cat.jpg", package="rimage"))
plot(x) # calls plot.imagematix(), which in turn calls image()

Alternatively, you can copy cat.jpg from the rimage package to
the data directory of ReadImages and do this:
library(pixmap)
library(ReadImages)
x <- read.jpeg(system.file("data", "cat.jpg", package="ReadImages")
catpixmap <- pixmapRGB(x) # convert imagemap to pixmap
plot(catpixmap) # plot.pixmap is an S4 method that also calls image()

(This alternative method is provided because rimage has an
irrelevant dependency on an external library FFTW2 that
complicates the process of installing rimage. The use of
cat.jpg is not essential. The same problem appears with
most jpg photo images.)

Dominick

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Problem/anomalous behavior with image() function (and ReadImages?)

2009-10-20 Thread Dominick Samperi

Following up on my previous question: I managed test under Windows
and the anomalous behavior does NOT occur there, so this is apparently
a system-dependent issue.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Error when compiling code in C

2009-10-20 Thread Fabio Mathias Corrêa
Dear,


I used the command in the terminal to compile code FORTRAN with directive OpenMP

export PKG_FCFLAGS=-fopenmp

It functioned perfectly for pure code FORTRAN.

However, when I call a function in C in code FORTRAN, the function in C is not 
compiled.

The following error appears

~/Fortran/parallel $ R CMD SHLIB para.f95 myrandom.c -o func.so -fopenmp

gfortran -fopenmp -fpic -g -O -c  para.f95 -o para.o
gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c myrandom.c -o 
myrandom.c@
gfortran -shared -o func.so para.o myrandom.o -fopenmp -L/usr/lib64/R/lib -lR
gfortran: myrandom.o: No such file or directory
make: *** [func.so] Error 1

When compile only the function in code FORTRAN. The archive is compiled!

If compile only the function in C, the error I appear!

What it is occurring is that instead of generating an archive myrandom.o the 
compiler is generating an archive myrandom.c@

What I must make?

Thank you very much!


   Fábio Mathias Corrêa
Estatística e Experimentação Agropecuária/UFLA





  

Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] odd evaluation within correlation argument of glmmPQL

2009-10-20 Thread Bolker,Benjamin Michael

  [I think I've seen this reported before but can't locate it any more.
I believe this oddity (glitch? feature?) is behind a query that
Jean-Baptiste Ferdy asked a year ago 
]

  It appears that glmmPQL looks in the global workspace, not
within the data frame specified by the "data" argument, for
the variables specified in the "form" argument of spatial
correlation structures provided to the "correlation" argument.
This is potentially confusing/dangerous, because you can easily
(1) get an error saying that the variable is not found (the least
dangerous and confusing), (2) get an error saying the variable
is of the wrong length, if there is a variable with a matching
name but the wrong length in the global environment,
(3) get completely misled if there is a *different* variable with
a matching name in the global environment with the right
length (in which case glmmPQL will ignore the element in the data
frame you specified and use the one from the global environment).

  The following patch (to MASS 7.3-3, retrieved from CRAN src/contrib
2.10.0 directory) appears to fix the problem.  A quick look suggests that
the same version of MASS is in 2.11.0 as well.

*** glmmPQL.R.orig  2009-10-20 23:48:38.0 -0400
--- glmmPQL.R   2009-10-20 23:51:33.0 -0400
***
*** 39,44 
--- 39,47 
  off <- attr(Terms, "offset")
  if(length(off<- attr(Terms, "offset"))) allvars <-
  c(allvars, as.character(attr(Terms, "variables"))[off+1])
+ ## add variables in correlation formula, if any
+ if (!missing(correlation) && !is.null(attr(correlation,"formula")))
+   allvars <- c(allvars,all.vars(attr(correlation,"formula")))
  ## substitute back actual formula (rather than a variable name)
  Call$fixed <- eval(fixed); Call$random <- eval(random)
  m$formula <- as.formula(paste("~", paste(allvars, collapse="+")))

 code below shows the problem.

Ben Bolker


## set up data
set.seed(1001)
d = data.frame(x = runif(100),
  y = runif(100),
  z = rpois(100,2),
  f = factor(rep(letters[1:20],each=5)))

library(MASS)
## without correlation structure: fine
glmmPQL(z~1,random=~1|f,data=d,family="poisson")

## with correlation structure,
##   but x and y not defined outside of 'd'
glmmPQL(z~1,random=~1|f,data=d,
correlation=corExp(form=~x+y),
family="poisson")
## Error in eval(expr, envir, enclos) : object 'x' not found

x = y = runif(10)
glmmPQL(z~1,random=~1|f,data=d,
correlation=corExp(form=~x+y),
family="poisson")
## Error in ...
##   variable lengths differ (found for 'f')

## this is what we probably wanted
x = d$x
y = d$y
glmmPQL(z~1,random=~1|f,data=d,
correlation=corExp(form=~x+y),
family="poisson")

## this is dangerous!
x = y = runif(100)
glmmPQL(z~1,random=~1|f,data=d,
correlation=corExp(form=~x+y),
family="poisson")

## proof that glmmPQL really is looking
## outside of the data frame for its
## correlation variables ...
x = y = rep(0,100)
glmmPQL(z~1,random=~1|f,data=d,
correlation=corExp(form=~x+y),
family="poisson")
## Error in getCovariate.corSpatial(object, data = data) : 
##   Cannot have zero distances in "corSpatial"



> sessionInfo()
R version 2.9.2 (2009-08-24) 
i486-pc-linux-gnu 

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

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

other attached packages:
[1] nlme_3.1-95   MASS_7.2-49   reshape_0.8.3 plyr_0.1.9proto_0.3-8  

loaded via a namespace (and not attached):
[1] ggplot2_0.8.4   lattice_0.17-26
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] to connect R from ejb

2009-10-20 Thread pragathichi

Sorry for not being clear. Than you . i successfully connected R to ejb by
adding the jar files in the server directly.

Romain Francois-2 wrote:
> 
> The same way you would add any other jar, please go to an ejb forum. 
> Alternatively, use this more appropriate mailing list :
> 
> http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel
> 
> One way or another, please take the time to formulate a proper question, 
> showing what you tried, what did not work, and so on.
> 
> On 10/20/2009 05:22 AM, pragathichi wrote:
>> how to add Reengine and Rserveengine jar files in ejb?
>> I am using eclipse, plz suggest.
>>
>> Romain Francois-2 wrote:
>>>
>>> On 10/19/2009 10:57 AM, pragathichi wrote:
 How to call R from ejb, can i use Rserve?
>>>
>>> yes
> 
> -- 
> Romain Francois
> Professional R Enthusiast
> +33(0) 6 28 91 30 30
> http://romainfrancois.blog.free.fr
> |- http://tr.im/BcPw : celebrating R commit #5
> |- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
> `- http://tr.im/yw8E : New R package : sos
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
View this message in context: 
http://www.nabble.com/to-connect-R-from-ejb-tp25955127p25973788.html
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel