[Rd] as.matrix.data.frame( Date ) -> character

2009-10-10 Thread Romain Francois

Hello,

Is this intended:

> m <- data.frame( date = seq.Date( as.Date("2000-01-01"), 
as.Date("2000-01-05"), by = "day" ) )

> sapply( m, typeof )
date
"double"
> as.matrix( m )
 date
[1,] "2000-01-01"
[2,] "2000-01-02"
[3,] "2000-01-03"
[4,] "2000-01-04"
[5,] "2000-01-05"
> typeof( as.matrix( m ) )
[1] "character"

In particular :

> m <- data.frame( date = seq.Date( as.Date("2000-01-01"), by = "day", 
length.out = 50 ), x = rnorm(50) )

> loess( x ~ date, data= m)
Error: NA/NaN/Inf in foreign function call (arg 2)
In addition: Warning message:
NAs introduced by coercion
> loess( x ~ as.double(date), data= m)
Call:
loess(formula = x ~ as.double(date), data = m)

Number of Observations: 50
Equivalent Number of Parameters: 4.42
Residual Standard Error: 0.9712


Replacing this line in loess :

x <- as.matrix(x)

by this :

x <- tryCatch( do.call( cbind, lapply( x, as.double ) ), error = 
function(e){

stop( "predictors must all be numeric" )
} )

does the trick for me.

Romain

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


[Rd] Possible bug in the Rd parser?

2009-10-10 Thread Mathieu Ribatet
Dear list,

I got an automatic email complaining than some of my packages didn't
pass 'R CMD check' for R-2.10.0 alpha anymore. Both of them make use of
the "cases" LaTeX environment.

Inspecting the log outputs I got:

LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! Misplaced alignment tab character &.

I noticed that the Rd parser changed quite recently and that '#', '_'
and '&' must not be escaped according to "Writing R extensions".
However, the problematic .Rd portion seems (to me) OK

\deqn{\theta(h) =
\begin{cases}
u_\beta \left(\mu +  \frac{\nu(h)}{\Gamma(1 - \xi)}
\right),&\xi \neq 0\\
\exp\left(\frac{\nu(h)}{\sigma}\right),&\xi = 0
\end{cases}
  }{u_beta (mu + nu(h) / Gamma(1 - \xi)), if \xi < 1,
exp(nu(h)/sigma), otherwise}

Removing the alignment tab character '&' solves the issue but doesn't
produce the expected LaTeX output. Do I miss something with the new Rd
parser requirements?

I'm not 100% sure but it also seems like that "\\' symbol isn't
interpreted as a break line - in the "cases" environment at least. This
might be one reason why the alignment tab '&' is misplaced.

Best,
Mathieu


-- 
Institute of Mathematics
Ecole Polytechnique Fédérale de Lausanne
STAT-IMA-FSB-EPFL, Station 8
CH-1015 Lausanne   Switzerland
http://stat.epfl.ch/
Tel: + 41 (0)21 693 7907

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


[Rd] installing any package fails using 'install.packages()' (PR#13993)

2009-10-10 Thread lmramba
Dear all,
I  installed my R-2.9.2 on my ubuntu version 9.04 successfully  using the
command

   sudo apt-get install r-base-dev

The problem is that I cannot install any package.

See my details below:



> install.packages("epicalc")
Warning in install.packages("epicalc") :
  argument 'lib' is missing: using
'/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
Error in read.dcf(file = tmpf) : Line starting ' ...' is malformed!
>
> install.packages("lattice")
Warning in install.packages("lattice") :
  argument 'lib' is missing: using
'/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
Error in read.dcf(file = tmpf) : Line starting ' ...' is malformed!
>
> sessionInfo()
R version 2.9.2 (2009-08-24)
i486-pc-linux-gnu

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

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

loaded via a namespace (and not attached):
[1] tcltk_2.9.2 tools_2.9.2
>

[[alternative HTML version deleted]]

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


[Rd] Errors in installing package "rJava" on Ubuntu (PR#13992)

2009-10-10 Thread lmramba
*Hello,
I have had this serious problem while trying to install package rJava. It is
a requirement by the package JGR and it cannot be downloaded due to the
error indicated below.

I have googled and looked at the FAQ but no solution yet.

Please advise.
Kind regards,
Lazarus

> install.packages("rJava")*
Warning in install.packages("rJava") :
  argument 'lib' is missing: using
'/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
*Error in read.dcf(file = tmpf) : Line starting ' ...' is malformed!*
>
*> install.packages("JGR")*
Warning in install.packages("JGR") :
  argument 'lib' is missing: using
'/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
*Error in read.dcf(file = tmpf) : Line starting ' ...' is malformed!
*
*> sessionInfo()*
R version 2.9.2 (2009-08-24)
i486-pc-linux-gnu

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

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

loaded via a namespace (and not attached):
[1] tcltk_2.9.2 tools_2.9.2
>

[[alternative HTML version deleted]]

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


[Rd] rJava downloads but cannot load, when I run R as root (PR#13994)

2009-10-10 Thread lmramba
> library(rJava)
Error in library(rJava) : there is no package called 'rJava'
> install.packages("rJava")
Warning in install.packages("rJava") :
  argument 'lib' is missing: using '/usr/local/lib/R/site-library'
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://cran.uk.r-project.org/src/contrib/rJava_0.7-0.tar.gz'
Content type 'application/x-gzip' length 249486 bytes (243 Kb)
opened URL
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
downloaded 243 Kb

* Installing *source* package =91rJava=92 ...
checking for gcc... gcc -std=3Dgnu99
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 -std=3Dgnu99 accepts -g... yes
checking for gcc -std=3Dgnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=3Dgnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... 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 for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=3Dgnu99 supports static inline...
yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver: '/usr/bin/jar'
compiler: '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : ''
java libs   : '-L/usr/lib/jvm/java-6-openjdk/jre/lib/i386/server
-L/usr/lib/jvm/java-6-openjdk/jre/lib/i386
-L/usr/lib/jvm/java-6-openjdk/jre/../lib/i386 -L
-L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm'
configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.

ERROR: configuration failed for package =91rJava=92
* Removing =91/usr/local/lib/R/site-library/rJava=92

The downloaded packages are in
=91/tmp/RtmpOjM9hY/downloaded_packages=92
Warning message:
In install.packages("rJava") :
  installation of package 'rJava' had non-zero exit status
>


I went ahead and did this:

r...@lmramba-laptop:/home/lmramba# R CMD javareconf
Java interpreter : /usr/bin/java
Java version : 1.6.0_0
Java home path   : /usr/lib/jvm/java-6-openjdk/jre
Java compiler: /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Java library path:
$(JAVA_HOME)/lib/i386/server:$(JAVA_HOME)/lib/i386:$(JAVA_HOME)/../lib/i386=
::/usr/java/packages/lib/i386:/lib:/usr/lib
JNI linker flags : -L$(JAVA_HOME)/lib/i386/server -L$(JAVA_HOME)/lib/i386
-L$(JAVA_HOME)/../lib/i386 -L -L/usr/java/packages/lib/i386 -L/lib
-L/usr/lib -ljvm
JNI cpp flags:

Updating Java configuration in /etc/R
Done.


But still installing rJava fails


Plz help

Regards,
Lazarus

[[alternative HTML version deleted]]

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


[Rd] Setting a mirror "permanently" on R on ubuntu (PR#13995)

2009-10-10 Thread lmramba
Dear all,

I seem to have many problems as I run R on my ubuntu system.
want to set a mirror so that anytime I use the command "install.packages",
it does not ask me for which mirror to use but go direct.
This is because of the error I keep on getting below and I dont know how to
solve it.

Please help.

Kind regards,
Lazarus


> library(epicalc)
Loading required package: foreign
Loading required package: survival
Loading required package: splines
> install.packages("lattice")
Warning in install.packages("lattice") :
  argument 'lib' is missing: using
'/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
Error in contrib.url(repos, type) :
  trying to use CRAN without setting a mirror
Calls: install.packages -> grep -> contrib.url
Execution halted

Exited: 256

[[alternative HTML version deleted]]

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


Re: [Rd] Errors in installing package "rJava" on Ubuntu (PR#13992)

2009-10-10 Thread Dirk Eddelbuettel


On 10 October 2009 at 04:15, lmra...@gmail.com wrote:
| *Hello,
| I have had this serious problem while trying to install package rJava. It is
| a requirement by the package JGR and it cannot be downloaded due to the
| error indicated below.

a) Problems with packages should go to the maintainer, not the lists.  So
   this one is for Simon.

b) That said, also wrong list. 

   Debian and Ubuntu questions go to the r-sig-debian list.

| I have googled and looked at the FAQ but no solution yet.
| 
| Please advise.
| Kind regards,
| Lazarus
| 
| > install.packages("rJava")*

c) "Wrong" (in the 'you are making your life to complicated' sense) as

   $ sudo apt-get install r-cran-rjava 

   works:

   e...@joe:~$ sudo apt-get install r-cran-rjava
   Reading package lists... Done
   Building dependency tree
   Reading state information... Done
   The following NEW packages will be installed:
 r-cran-rjava
   0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
   Need to get 225kB of archives.
   After this operation, 836kB of additional disk space will be used.
   Get:1 http://archive.ubuntu.com jaunty/universe r-cran-rjava 0.6-2-1 [225kB]
   Fetched 225kB in 1s (146kB/s)
   Selecting previously deselected package r-cran-rjava.
   (Reading database ... 397686 files and directories currently installed.)
   Unpacking r-cran-rjava (from .../r-cran-rjava_0.6-2-1_i386.deb) ...
   Setting up r-cran-rjava (0.6-2-1) ...
   e...@joe:~$

   Having this installed should provide the base for installed RWeka, JGR,
   ... and other users of rJava.

So in sum: not a bug in R and you just created extra work for R Core to
maintain the bug database.

Dirk

| Warning in install.packages("rJava") :
|   argument 'lib' is missing: using
| '/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
| *Error in read.dcf(file = tmpf) : Line starting ' ...' is malformed!*
| >
| *> install.packages("JGR")*
| Warning in install.packages("JGR") :
|   argument 'lib' is missing: using
| '/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
| *Error in read.dcf(file = tmpf) : Line starting ' ...' is malformed!
| *
| *> sessionInfo()*
| R version 2.9.2 (2009-08-24)
| i486-pc-linux-gnu
| 
| locale:
| 
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C
| 
| attached base packages:
| [1] stats graphics  grDevices utils datasets  methods   base
| 
| loaded via a namespace (and not attached):
| [1] tcltk_2.9.2 tools_2.9.2
| >
| 
|   [[alternative HTML version deleted]]
| 
| __
| R-devel@r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Three out of two people have difficulties with fractions.

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


Re: [Rd] installing any package fails using 'install.packages()' (PR#13993)

2009-10-10 Thread Dirk Eddelbuettel

On 10 October 2009 at 05:25, lmra...@gmail.com wrote:
| Dear all,
| I  installed my R-2.9.2 on my ubuntu version 9.04 successfully  using the
| command
| 
|sudo apt-get install r-base-dev
| 
| The problem is that I cannot install any package.

Huh?  This has _nothing_ to do with the error below.
 
| See my details below:
| 
| 
| 
| > install.packages("epicalc")
| Warning in install.packages("epicalc") :
|   argument 'lib' is missing: using
| '/home/lmramba/R/i486-pc-linux-gnu-library/2.9'

This is suspicuous. 

If you used the Ubuntu package, it would use /usr/local/lib/R/site-library by
default.  So if you have a locally built version *you* need to figure out
what you broke there.

| --- Please select a CRAN mirror for use in this session ---
| Loading Tcl/Tk interface ... done
| Error in read.dcf(file = tmpf) : Line starting ' ...' is malformed!
| >
| > install.packages("lattice")
| Warning in install.packages("lattice") :
|   argument 'lib' is missing: using
| '/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
| Error in read.dcf(file = tmpf) : Line starting ' ...' is malformed!

No idea but you busted there. But it looks suspiciously like a local error on
your end.

Set an explicit argument for the repos, e.g. via ~/.Rprofile

options("repos"="http://cran.us.r-project.org";)## US mirror

(as I am in the US, adapt accordingly for a close mirror for you) to avoid
the tcl/tk query.  

That, again, works like a charm here on Ubuntu 9.10:

R> install.packages("epicalc")
Warning in install.packages("epicalc") :
  argument 'lib' is missing: using '/usr/local/lib/R/site-library'
trying URL 'http://cran.us.r-project.org/src/contrib/epicalc_2.9.2.5.tar.gz'
Content type 'application/x-gzip' length 201849 bytes (197 Kb)  
opened URL  
==  
downloaded 197 Kb   

* Installing *source* package ‘epicalc’ ...
** R   
** data
** demo
** preparing package for lazy loading  
Loading required package: splines  
** help
*** installing help indices
 >>> Building/Updating help pages for package 'epicalc'
 Formats: text html latex example  
  ANCdata   texthtmllatex
[...]
  use   texthtmllatex   example
  zap   texthtmllatex   example
** building package indices ...
* DONE (epicalc)

The downloaded packages are in
‘/tmp/RtmpydkfiZ/downloaded_packages’
R>

If you install into /usr/local/lib/R/site-library, I recommend making that
directory's group mode one of the ones you have and set it to group-write.  I
typically make myself member of group 'staff' (or 'admin').

Again, in sum: not a bug in R and you just created extra work for R Core to
maintain the bug database.

Dirk


| > sessionInfo()
| R version 2.9.2 (2009-08-24)
| i486-pc-linux-gnu
| 
| locale:
| 
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C
| 
| attached base packages:
| [1] stats graphics  grDevices utils datasets  methods   base
| 
| loaded via a namespace (and not attached):
| [1] tcltk_2.9.2 tools_2.9.2
| >
| 
|   [[alternative HTML version deleted]]
| 
| __
| R-devel@r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Three out of two people have difficulties with fractions.

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


Re: [Rd] rJava downloads but cannot load, when I run R as root (PR#13994)

2009-10-10 Thread Dirk Eddelbuettel

On 10 October 2009 at 05:40, lmra...@gmail.com wrote:
| > library(rJava)
| Error in library(rJava) : there is no package called 'rJava'
| > install.packages("rJava")
| Warning in install.packages("rJava") :
|   argument 'lib' is missing: using '/usr/local/lib/R/site-library'
| --- Please select a CRAN mirror for use in this session ---
| Loading Tcl/Tk interface ... done
| trying URL 'http://cran.uk.r-project.org/src/contrib/rJava_0.7-0.tar.gz'
| Content type 'application/x-gzip' length 249486 bytes (243 Kb)
| opened URL
| =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
| =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
| downloaded 243 Kb
| 
| * Installing *source* package =91rJava=92 ...
| checking for gcc... gcc -std=3Dgnu99
| checking for C compiler default output file name... a.out
[...]
| configure: checking whether gcc -std=3Dgnu99 supports static inline...
| yes
| checking Java support in R... present:
| interpreter : '/usr/bin/java'
| archiver: '/usr/bin/jar'
| compiler: '/usr/bin/javac'
| header prep.: '/usr/bin/javah'
| cpp flags   : ''
| java libs   : '-L/usr/lib/jvm/java-6-openjdk/jre/lib/i386/server
| -L/usr/lib/jvm/java-6-openjdk/jre/lib/i386
| -L/usr/lib/jvm/java-6-openjdk/jre/../lib/i386 -L
| -L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm'
| configure: error: One or more Java configuration variables are not set.
| Make sure R is configured with full Java support (including JDK). Run
| R CMD javareconf
| as root to add Java support to R.

R tells you your Java setup is not right. This *is* difficult, which is why I
have offered to maintain and provide the rJava in Debian / Ubuntu as 
r-cran-rjava.

As demonstrated to you two emails ago, it also works.  I would use that.
Otherwise, fix your Java setup first as R told you to here.


| 
| If you don't have root privileges, run
| R CMD javareconf -e
| to set all Java-related variables and then install rJava.
| 
| ERROR: configuration failed for package =91rJava=92
| * Removing =91/usr/local/lib/R/site-library/rJava=92
| 
| The downloaded packages are in
| =91/tmp/RtmpOjM9hY/downloaded_packages=92
| Warning message:
| In install.packages("rJava") :
|   installation of package 'rJava' had non-zero exit status
| >
| 
| 
| I went ahead and did this:
| 
| r...@lmramba-laptop:/home/lmramba# R CMD javareconf
| Java interpreter : /usr/bin/java
| Java version : 1.6.0_0
| Java home path   : /usr/lib/jvm/java-6-openjdk/jre
| Java compiler: /usr/bin/javac
| Java headers gen.: /usr/bin/javah
| Java archive tool: /usr/bin/jar
| Java library path:
| $(JAVA_HOME)/lib/i386/server:$(JAVA_HOME)/lib/i386:$(JAVA_HOME)/../lib/i386=
| ::/usr/java/packages/lib/i386:/lib:/usr/lib
| JNI linker flags : -L$(JAVA_HOME)/lib/i386/server -L$(JAVA_HOME)/lib/i386
| -L$(JAVA_HOME)/../lib/i386 -L -L/usr/java/packages/lib/i386 -L/lib
| -L/usr/lib -ljvm
| JNI cpp flags:
| Updating Java configuration in /etc/R
| Done.
| 
| 
| But still installing rJava fails

As before: not a bug in R and you just created extra work for R Core to
maintain the bug database.

Dirk


| Plz help
| 
| Regards,
| Lazarus
| 
|   [[alternative HTML version deleted]]
| 
| __
| R-devel@r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Three out of two people have difficulties with fractions.

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


Re: [Rd] rJava downloads but cannot load, (PR#13997)

2009-10-10 Thread edd

On 10 October 2009 at 05:40, lmra...@gmail.com wrote:
| > library(rJava)
| Error in library(rJava) : there is no package called 'rJava'
| > install.packages("rJava")
| Warning in install.packages("rJava") :
|   argument 'lib' is missing: using '/usr/local/lib/R/site-library'
| --- Please select a CRAN mirror for use in this session ---
| Loading Tcl/Tk interface ... done
| trying URL 'http://cran.uk.r-project.org/src/contrib/rJava_0.7-0.tar.gz'
| Content type 'application/x-gzip' length 249486 bytes (243 Kb)
| opened URL
| =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
| =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
| downloaded 243 Kb
| 
| * Installing *source* package =91rJava=92 ...
| checking for gcc... gcc -std=3Dgnu99
| checking for C compiler default output file name... a.out
[...]
| configure: checking whether gcc -std=3Dgnu99 supports static inline...
| yes
| checking Java support in R... present:
| interpreter : '/usr/bin/java'
| archiver: '/usr/bin/jar'
| compiler: '/usr/bin/javac'
| header prep.: '/usr/bin/javah'
| cpp flags   : ''
| java libs   : '-L/usr/lib/jvm/java-6-openjdk/jre/lib/i386/server
| -L/usr/lib/jvm/java-6-openjdk/jre/lib/i386
| -L/usr/lib/jvm/java-6-openjdk/jre/../lib/i386 -L
| -L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm'
| configure: error: One or more Java configuration variables are not set.
| Make sure R is configured with full Java support (including JDK). Run
| R CMD javareconf
| as root to add Java support to R.

R tells you your Java setup is not right. This *is* difficult, which is why I
have offered to maintain and provide the rJava in Debian / Ubuntu as 
r-cran-rjava.

As demonstrated to you two emails ago, it also works.  I would use that.
Otherwise, fix your Java setup first as R told you to here.


| 
| If you don't have root privileges, run
| R CMD javareconf -e
| to set all Java-related variables and then install rJava.
| 
| ERROR: configuration failed for package =91rJava=92
| * Removing =91/usr/local/lib/R/site-library/rJava=92
| 
| The downloaded packages are in
| =91/tmp/RtmpOjM9hY/downloaded_packages=92
| Warning message:
| In install.packages("rJava") :
|   installation of package 'rJava' had non-zero exit status
| >
| 
| 
| I went ahead and did this:
| 
| r...@lmramba-laptop:/home/lmramba# R CMD javareconf
| Java interpreter : /usr/bin/java
| Java version : 1.6.0_0
| Java home path   : /usr/lib/jvm/java-6-openjdk/jre
| Java compiler: /usr/bin/javac
| Java headers gen.: /usr/bin/javah
| Java archive tool: /usr/bin/jar
| Java library path:
| $(JAVA_HOME)/lib/i386/server:$(JAVA_HOME)/lib/i386:$(JAVA_HOME)/../lib/i386=
| ::/usr/java/packages/lib/i386:/lib:/usr/lib
| JNI linker flags : -L$(JAVA_HOME)/lib/i386/server -L$(JAVA_HOME)/lib/i386
| -L$(JAVA_HOME)/../lib/i386 -L -L/usr/java/packages/lib/i386 -L/lib
| -L/usr/lib -ljvm
| JNI cpp flags:
| Updating Java configuration in /etc/R
| Done.
| 
| 
| But still installing rJava fails

As before: not a bug in R and you just created extra work for R Core to
maintain the bug database.

Dirk


| Plz help
| 
| Regards,
| Lazarus
| 
|   [[alternative HTML version deleted]]
| 
| __
| R-devel@r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Three out of two people have difficulties with fractions.

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


Re: [Rd] Setting a mirror "permanently" on R on ubuntu (PR#13995)

2009-10-10 Thread Dirk Eddelbuettel

On 10 October 2009 at 05:55, lmra...@gmail.com wrote:
| Dear all,
| 
| I seem to have many problems as I run R on my ubuntu system.
| want to set a mirror so that anytime I use the command "install.packages",
| it does not ask me for which mirror to use but go direct.
| This is because of the error I keep on getting below and I dont know how to
| solve it.

Can you _please stop abusing the bug tracking system_ by asking these
beginner questions?

This is answered, inter alia, in

 help(install.packages)   # telling you about option("repos")
 help(options)# telling you about the repos option
 help(Startup)# telling you about R's inits

as well as the different manuals.

Also, see one of the emails I just sent you for the concrete example:

 e...@joe:~$ cat .Rprofile
 options("width"=160)
 #options("pdfviewer"="kpdf")
 # as in AER by Zeileis and Kleiber
 options(prompt="R> ", digits=4, show.signif.stars=FALSE)
 options("repos"="http://cran.us.r-project.org";)## US mirror

Lastly, *please* switch to r-sig-debian for help with your Debian / Ubuntu
system and stop abusing the r-devel list and the bug tracker.

Dirk


| Please help.
| 
| Kind regards,
| Lazarus
| 
| 
| > library(epicalc)
| Loading required package: foreign
| Loading required package: survival
| Loading required package: splines
| > install.packages("lattice")
| Warning in install.packages("lattice") :
|   argument 'lib' is missing: using
| '/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
| Error in contrib.url(repos, type) :
|   trying to use CRAN without setting a mirror
| Calls: install.packages -> grep -> contrib.url
| Execution halted
| 
| Exited: 256
| 
|   [[alternative HTML version deleted]]
| 
| __
| R-devel@r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Three out of two people have difficulties with fractions.

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


Re: [Rd] installing any package fails using 'install.packages()' (PR#13996)

2009-10-10 Thread edd

On 10 October 2009 at 05:25, lmra...@gmail.com wrote:
| Dear all,
| I  installed my R-2.9.2 on my ubuntu version 9.04 successfully  using=
 the
| command
|=20
|sudo apt-get install r-base-dev
|=20
| The problem is that I cannot install any package.

Huh?  This has _nothing_ to do with the error below.
=20
| See my details below:
|=20
|=20
|=20
| > install.packages("epicalc")
| Warning in install.packages("epicalc") :
|   argument 'lib' is missing: using
| '/home/lmramba/R/i486-pc-linux-gnu-library/2.9'

This is suspicuous.=20

If you used the Ubuntu package, it would use /usr/local/lib/R/site-libr=
ary by
default.  So if you have a locally built version *you* need to figure o=
ut
what you broke there.

| --- Please select a CRAN mirror for use in this session ---
| Loading Tcl/Tk interface ... done
| Error in read.dcf(file =3D tmpf) : Line starting ' ...' is malf=
ormed!
| >
| > install.packages("lattice")
| Warning in install.packages("lattice") :
|   argument 'lib' is missing: using
| '/home/lmramba/R/i486-pc-linux-gnu-library/2.9'
| Error in read.dcf(file =3D tmpf) : Line starting ' ...' is malf=
ormed!

No idea but you busted there. But it looks suspiciously like a local er=
ror on
your end.

Set an explicit argument for the repos, e.g. via ~/.Rprofile

options("repos"=3D"http://cran.us.r-project.org";)## US mirror

(as I am in the US, adapt accordingly for a close mirror for you) to av=
oid
the tcl/tk query. =20

That, again, works like a charm here on Ubuntu 9.10:

R> install.packages("epicalc")
Warning in install.packages("epicalc") :
  argument 'lib' is missing: using '/usr/local/lib/R/site-library'
trying URL 'http://cran.us.r-project.org/src/contrib/epicalc_2.9.2.5.ta=
r.gz'
Content type 'application/x-gzip' length 201849 bytes (197 Kb) =
=20
opened URL =
=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D =20
downloaded 197 Kb  =
=20

* Installing *source* package =E2=80=98epicalc=E2=80=99 ...
** R  =20
** data   =20
** demo   =20
** preparing package for lazy loading =20
Loading required package: splines =20
** help   =20
*** installing help indices   =20
 >>> Building/Updating help pages for package 'epicalc'
 Formats: text html latex example =20
  ANCdata   texthtmllatex
[...]
  use   texthtmllatex   example
  zap   texthtmllatex   example
** building package indices ...
* DONE (epicalc)

The downloaded packages are in
=E2=80=98/tmp/RtmpydkfiZ/downloaded_packages=E2=80=99
R>

If you install into /usr/local/lib/R/site-library, I recommend making t=
hat
directory's group mode one of the ones you have and set it to group-wri=
te.  I
typically make myself member of group 'staff' (or 'admin').

Again, in sum: not a bug in R and you just created extra work for R Cor=
e to
maintain the bug database.

Dirk


| > sessionInfo()
| R version 2.9.2 (2009-08-24)
| i486-pc-linux-gnu
|=20
| locale:
| LC_CTYPE=3Den_GB.UTF-8;LC_NUMERIC=3DC;LC_TIME=3Den_GB.UTF-8;LC_COLLAT=
E=3Den_GB.UTF-8;LC_MONETARY=3DC;LC_MESSAGES=3Den_GB.UTF-8;LC_PAPER=3Den=
_GB.UTF-8;LC_NAME=3DC;LC_ADDRESS=3DC;LC_TELEPHONE=3DC;LC_MEASUREMENT=3D=
en_GB.UTF-8;LC_IDENTIFICATION=3DC
|=20
| attached base packages:
| [1] stats graphics  grDevices utils datasets  methods   base
|=20
| loaded via a namespace (and not attached):
| [1] tcltk_2.9.2 tools_2.9.2
| >
|=20
| =09[[alternative HTML version deleted]]
|=20
| __
| R-devel@r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

--=20
Three out of two people have difficulties with fractions.

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


Re: [Rd] [R-SIG-Mac] rnorm.halton

2009-10-10 Thread Christophe Dutang

Hi all,

I need to transform classic 32bit Fortran code to 64bit Fortran code,  
see the discussion [R-SIG-Mac] rnorm.halton. But I'm clearly a  
beginner in Fortran...


Does someone already do this for his package?

From here, http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=bks&fname=/SGI_Developer/Porting_Guide/ch03.html 
 , I identify the following changes (Fortran types) to the Fortran  
code:


  - INTEGER to INTEGER*8
  - REAL*8 to REAL*16

The code I would like to change is available on R forge here : 
http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/randtoolbox/src/LowDiscrepancy.f?rev=4229&root=rmetrics&view=markup

Another question I have is how do I tell the R code to use the 64bit  
version of my code on 64bit machine?


In the current implementation, the file quasiRNG.R calls directly the  
Fortran code with .Fortran.

How could I use the 64bit version directly in the R code?

I suspect I need to have a quasiRNG.c file where I will use  
preprocessor statement that will select the good version of the  
function to call. Is that correct?


Thanks in advance

Christophe


Le 15 sept. 2009 à 18:25, Anirban Mukherjee a écrit :


Sorry, what I should have said was Halton numbers are quasi-random,
and not pseudo-random. Quasi-random is the technically appropriate
terminology.

Halton sequences are low discrepancy: the subsequence looks/smells
random. Hence, they are often used in quasi monte carlo simulations.
To be precise, there is only 1 Halton sequence for a particular prime.
Repeated calls to Halton should return the same numbers. The first
column is the Halton sequence for 2. the second for 3, the third for 5
and so on using the first M primes (for M columns). (You can also
scramble the sequence to avoid this.)

I am using them to integrate over a multivariate normal space. If you
take 1000 random draws, then sum f() over the draws is the expectation
of f(). If f() is very non-linear (and/or multi-variate) then even
with large N, its often hard to get a good integral. With quasi-random
draws, the integration is better for the same N. (One uses the inverse
distribution function.) For an example, you can look at Train's paper
(page 4 and 5 have a good explanation) at:

http://elsa.berkeley.edu/wp/train0899.pdf

In the context of simulated maximum likelihood estimation, such
integrals are very common. Of course true randomness has its own
place/importance: its just that quasi-random numbers can be very
useful in certain contexts.

Regards,
Anirban

PS: qnorm(halton()) gets around the problem of the random deviates  
not working.


On Tue, Sep 15, 2009 at 11:37 AM, David Winsemius
 wrote:


On Sep 15, 2009, at 11:10 AM, Anirban Mukherjee wrote:


Thanks everyone for your replies. Particularly David.

The numbers are pseudo-random. Repeated calls should/would give the
same output.


As I said, this package is not one with which I have experience. It
has _not_ however the case that repeated calls to (typical?) random
number functions give the same output when called repeatedly:

 > rnorm(10)
  [1] -0.8740195  2.1827411 -0.1473012 -1.4406262  0.1820631
-1.3151244 -0.4813703  0.8177692
  [9]  0.2076117  1.8697418
 > rnorm(10)
  [1] -0.7725731  0.8696742 -0.4907099  0.1561859  0.5913528
-0.8441891  0.2285653 -0.1231755
  [9]  0.5190459 -0.7803617
 > rnorm(10)
  [1] -0.9585881 -0.0458582  1.1967342  0.6421980 -0.5290280
-1.0735112  0.6346301  0.2685760
  [9]  1.5767800  1.0864515
 > rnorm(10)
  [1] -0.60400852 -0.06611533  1.00787048  1.48289305  0.5465
-0.67630052  0.52664127 -0.36449997
  [9]  0.88039397  0.56929333

I cannot imagine a situation where one would _want_ the output to be
the same on repeated calls unless one reset a seed. Unless perhaps I
am not understanding the meaning of "random" in the financial domain?

--
David


  Currently, Halton works fine when used to just get the
Halton sequence, but the random deviates call is not working in 64  
bit

R. For now, I will generate the numbers in 32 bit R, save them and
then load them back in when using 64 bit R. The package maintainers
can look at it if/when they get a chance and/or access to 64 bit R.

Thanks!

Best,
Anirban

On Tue, Sep 15, 2009 at 9:01 AM, David Winsemius 
wrote:
I get very different output from the two versions of Mac OSX R as
well. The 32 bit version puts out a histogram that has an expected,
almost symmetric unimodal distribution. The 64 bit version  
created a

bimodal distribution with one large mode near 0 and another smaller
mode near 10E+37. Postcript output attached.





--
Anirban Mukherjee | Assistant Professor, Marketing | LKCSB, SMU
5062 School of Business, 50 Stamford Road, Singapore 178899 |
+65-6828-1932

___
R-SIG-Mac mailing list
r-sig-...@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


David Winsemius, MD
Heritage Laboratories
West Hartford, CT






--
Anirban Mukherjee | Assistant Professor, Marketing 

Re: [Rd] [R-SIG-Mac] rnorm.halton

2009-10-10 Thread Simon Urbanek

Christophe,

you're looking at the wrong docs -- normally there is nothing you need  
to change FORTRAN code when switching between 32-bit and 64-bit. There  
is no separate "64-bit code" or "32-bit code". None of the scalar  
types used by R in interfaces changes (int, double and INTEGER, REAL*8  
are both the same). You only need to change your code if you make  
assumptions about the size of pointers which increases from 4 bytes to  
8 bytes (and normally you should not be making those assumptions). I  
don't think you should touch any Fortran code.


For the C code, the only thing that changes (beside pointer size) is  
"long" data types. If you use those in your code, you must be aware  
that the corresponding size change. I suspect that if you have a  
discrepancy in your 32/64-bit binaries then you either have a bug  
somewhere (Fortran or C) or your C code is not 64-bit clean (i.e.  
makes some 32-bit assumptions that are not true in 64-bit environment  
- check the use of "long" data types and pointers). Again, the  
solution is to fix the code to be clean, it will still be the same for  
both 32-bit and 64-bit.


Cheers,
Simon



On Oct 10, 2009, at 12:04 PM, Christophe Dutang wrote:


Hi all,

I need to transform classic 32bit Fortran code to 64bit Fortran  
code, see the discussion [R-SIG-Mac] rnorm.halton. But I'm clearly a  
beginner in Fortran...


Does someone already do this for his package?

From here, http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=bks&fname=/SGI_Developer/Porting_Guide/ch03.html 
 , I identify the following changes (Fortran types) to the Fortran  
code:


 - INTEGER to INTEGER*8
 - REAL*8 to REAL*16

The code I would like to change is available on R forge here : 
http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/randtoolbox/src/LowDiscrepancy.f?rev=4229&root=rmetrics&view=markup

Another question I have is how do I tell the R code to use the 64bit  
version of my code on 64bit machine?


In the current implementation, the file quasiRNG.R calls directly  
the Fortran code with .Fortran.

How could I use the 64bit version directly in the R code?

I suspect I need to have a quasiRNG.c file where I will use  
preprocessor statement that will select the good version of the  
function to call. Is that correct?


Thanks in advance

Christophe


Le 15 sept. 2009 à 18:25, Anirban Mukherjee a écrit :


Sorry, what I should have said was Halton numbers are quasi-random,
and not pseudo-random. Quasi-random is the technically appropriate
terminology.

Halton sequences are low discrepancy: the subsequence looks/smells
random. Hence, they are often used in quasi monte carlo simulations.
To be precise, there is only 1 Halton sequence for a particular  
prime.

Repeated calls to Halton should return the same numbers. The first
column is the Halton sequence for 2. the second for 3, the third  
for 5

and so on using the first M primes (for M columns). (You can also
scramble the sequence to avoid this.)

I am using them to integrate over a multivariate normal space. If you
take 1000 random draws, then sum f() over the draws is the  
expectation

of f(). If f() is very non-linear (and/or multi-variate) then even
with large N, its often hard to get a good integral. With quasi- 
random
draws, the integration is better for the same N. (One uses the  
inverse

distribution function.) For an example, you can look at Train's paper
(page 4 and 5 have a good explanation) at:

http://elsa.berkeley.edu/wp/train0899.pdf

In the context of simulated maximum likelihood estimation, such
integrals are very common. Of course true randomness has its own
place/importance: its just that quasi-random numbers can be very
useful in certain contexts.

Regards,
Anirban

PS: qnorm(halton()) gets around the problem of the random deviates  
not working.


On Tue, Sep 15, 2009 at 11:37 AM, David Winsemius
 wrote:


On Sep 15, 2009, at 11:10 AM, Anirban Mukherjee wrote:


Thanks everyone for your replies. Particularly David.

The numbers are pseudo-random. Repeated calls should/would give the
same output.


As I said, this package is not one with which I have experience. It
has _not_ however the case that repeated calls to (typical?) random
number functions give the same output when called repeatedly:

> rnorm(10)
 [1] -0.8740195  2.1827411 -0.1473012 -1.4406262  0.1820631
-1.3151244 -0.4813703  0.8177692
 [9]  0.2076117  1.8697418
> rnorm(10)
 [1] -0.7725731  0.8696742 -0.4907099  0.1561859  0.5913528
-0.8441891  0.2285653 -0.1231755
 [9]  0.5190459 -0.7803617
> rnorm(10)
 [1] -0.9585881 -0.0458582  1.1967342  0.6421980 -0.5290280
-1.0735112  0.6346301  0.2685760
 [9]  1.5767800  1.0864515
> rnorm(10)
 [1] -0.60400852 -0.06611533  1.00787048  1.48289305  0.5465
-0.67630052  0.52664127 -0.36449997
 [9]  0.88039397  0.56929333

I cannot imagine a situation where one would _want_ the output to be
the same on repeated calls unless one reset a seed. Unless perhaps I
am not understanding

Re: [Rd] Possible bug in the Rd parser?

2009-10-10 Thread Duncan Murdoch

On 10/10/2009 8:07 AM, Mathieu Ribatet wrote:

Dear list,

I got an automatic email complaining than some of my packages didn't
pass 'R CMD check' for R-2.10.0 alpha anymore. Both of them make use of
the "cases" LaTeX environment.

Inspecting the log outputs I got:

LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! Misplaced alignment tab character &.

I noticed that the Rd parser changed quite recently and that '#', '_'
and '&' must not be escaped according to "Writing R extensions".
However, the problematic .Rd portion seems (to me) OK

\deqn{\theta(h) =
\begin{cases}
u_\beta \left(\mu +  \frac{\nu(h)}{\Gamma(1 - \xi)}
\right),&\xi \neq 0\\
\exp\left(\frac{\nu(h)}{\sigma}\right),&\xi = 0
\end{cases}
  }{u_beta (mu + nu(h) / Gamma(1 - \xi)), if \xi < 1,
exp(nu(h)/sigma), otherwise}

Removing the alignment tab character '&' solves the issue but doesn't
produce the expected LaTeX output. Do I miss something with the new Rd
parser requirements?


I think the new parser is working properly, but there is something wrong 
with your LaTeX.  When I paste that block into a test file and run it 
through the 2.9 parser, the \\ gets converted to \bsl{}, and garbage 
results.  The new parser faithfully reproduces what you wrote, but for 
some reason it's not legal LaTeX.


I suspect the problem is that the text is generated within a \deqn{} 
macro, which is defined in Rd.sty.  Something you're doing is not 
allowed in that context.


It's helpful to run

Rcmd Rd2dvi --no-clean test.Rd

to be able to examine the LaTeX produced by R (which will be saved in a 
temporary directory; the --no-clean tells R not to delete it at the end).


I don't know LaTeX well enough to tell you the best workaround for this, 
but one option is to used the recently added \if or \ifelse and \out 
macros instead of \deqn.  Of course, that will make your Rd file 
unusable in earlier versions, so it's not necessarily the best idea.


Duncan Murdoch

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


Re: [Rd] [R-SIG-Mac] rnorm.halton

2009-10-10 Thread Simon Urbanek

Christophe,

I forgot to answer the second part of your e-mail -- see below.

On Oct 10, 2009, at 12:04 PM, Christophe Dutang wrote:


Hi all,

I need to transform classic 32bit Fortran code to 64bit Fortran  
code, see the discussion [R-SIG-Mac] rnorm.halton. But I'm clearly a  
beginner in Fortran...


Does someone already do this for his package?

From here, http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=bks&fname=/SGI_Developer/Porting_Guide/ch03.html 
 , I identify the following changes (Fortran types) to the Fortran  
code:


 - INTEGER to INTEGER*8
 - REAL*8 to REAL*16

The code I would like to change is available on R forge here : 
http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/randtoolbox/src/LowDiscrepancy.f?rev=4229&root=rmetrics&view=markup

Another question I have is how do I tell the R code to use the 64bit  
version of my code on 64bit machine?


In the current implementation, the file quasiRNG.R calls directly  
the Fortran code with .Fortran.

How could I use the 64bit version directly in the R code?



You don't have a choice -- whether 32 or 64 bits are used is defined  
by R, because you cannot mix 32-bit and 64-bit code. So in 64-bit R  
your package will be compiled into 64-bit. In 32-bit R your package  
will be compiled in 32-bit. You can see which R you are using with


8 * .Machine$sizeof.pointer

(Note: The Mac binaries we provide are multi-arch so they [the Leopard  
build] do in fact include both 32-bit and 64-bit -- which one gets  
started depends on the --arch flag, see R docs for details on multi- 
arch installations).


Cheers,
Simon


I suspect I need to have a quasiRNG.c file where I will use  
preprocessor statement that will select the good version of the  
function to call. Is that correct?




No (see previous e-mail).



Thanks in advance

Christophe


Le 15 sept. 2009 à 18:25, Anirban Mukherjee a écrit :


Sorry, what I should have said was Halton numbers are quasi-random,
and not pseudo-random. Quasi-random is the technically appropriate
terminology.

Halton sequences are low discrepancy: the subsequence looks/smells
random. Hence, they are often used in quasi monte carlo simulations.
To be precise, there is only 1 Halton sequence for a particular  
prime.

Repeated calls to Halton should return the same numbers. The first
column is the Halton sequence for 2. the second for 3, the third  
for 5

and so on using the first M primes (for M columns). (You can also
scramble the sequence to avoid this.)

I am using them to integrate over a multivariate normal space. If you
take 1000 random draws, then sum f() over the draws is the  
expectation

of f(). If f() is very non-linear (and/or multi-variate) then even
with large N, its often hard to get a good integral. With quasi- 
random
draws, the integration is better for the same N. (One uses the  
inverse

distribution function.) For an example, you can look at Train's paper
(page 4 and 5 have a good explanation) at:

http://elsa.berkeley.edu/wp/train0899.pdf

In the context of simulated maximum likelihood estimation, such
integrals are very common. Of course true randomness has its own
place/importance: its just that quasi-random numbers can be very
useful in certain contexts.

Regards,
Anirban

PS: qnorm(halton()) gets around the problem of the random deviates  
not working.


On Tue, Sep 15, 2009 at 11:37 AM, David Winsemius
 wrote:


On Sep 15, 2009, at 11:10 AM, Anirban Mukherjee wrote:


Thanks everyone for your replies. Particularly David.

The numbers are pseudo-random. Repeated calls should/would give the
same output.


As I said, this package is not one with which I have experience. It
has _not_ however the case that repeated calls to (typical?) random
number functions give the same output when called repeatedly:

> rnorm(10)
 [1] -0.8740195  2.1827411 -0.1473012 -1.4406262  0.1820631
-1.3151244 -0.4813703  0.8177692
 [9]  0.2076117  1.8697418
> rnorm(10)
 [1] -0.7725731  0.8696742 -0.4907099  0.1561859  0.5913528
-0.8441891  0.2285653 -0.1231755
 [9]  0.5190459 -0.7803617
> rnorm(10)
 [1] -0.9585881 -0.0458582  1.1967342  0.6421980 -0.5290280
-1.0735112  0.6346301  0.2685760
 [9]  1.5767800  1.0864515
> rnorm(10)
 [1] -0.60400852 -0.06611533  1.00787048  1.48289305  0.5465
-0.67630052  0.52664127 -0.36449997
 [9]  0.88039397  0.56929333

I cannot imagine a situation where one would _want_ the output to be
the same on repeated calls unless one reset a seed. Unless perhaps I
am not understanding the meaning of "random" in the financial  
domain?


--
David


 Currently, Halton works fine when used to just get the
Halton sequence, but the random deviates call is not working in  
64 bit

R. For now, I will generate the numbers in 32 bit R, save them and
then load them back in when using 64 bit R. The package maintainers
can look at it if/when they get a chance and/or access to 64 bit R.

Thanks!

Best,
Anirban

On Tue, Sep 15, 2009 at 9:01 AM, David Winsemius 
wrote:
I get v

Re: [Rd] Possible bug in the Rd parser?

2009-10-10 Thread Duncan Murdoch

On 10/10/2009 8:07 AM, Mathieu Ribatet wrote:

Dear list,

I got an automatic email complaining than some of my packages didn't
pass 'R CMD check' for R-2.10.0 alpha anymore. Both of them make use of
the "cases" LaTeX environment.

Inspecting the log outputs I got:

LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! Misplaced alignment tab character &.

I noticed that the Rd parser changed quite recently and that '#', '_'
and '&' must not be escaped according to "Writing R extensions".
However, the problematic .Rd portion seems (to me) OK

\deqn{\theta(h) =
\begin{cases}
u_\beta \left(\mu +  \frac{\nu(h)}{\Gamma(1 - \xi)}
\right),&\xi \neq 0\\
\exp\left(\frac{\nu(h)}{\sigma}\right),&\xi = 0
\end{cases}
  }{u_beta (mu + nu(h) / Gamma(1 - \xi)), if \xi < 1,
exp(nu(h)/sigma), otherwise}



One more followup:  the problem appears to be in the "cases" 
environment.  If I rewrite that block using "array" instead, things are 
fine:


\deqn{\theta(h) =
\left\{\begin{array}{ll}
u_\beta \left(\mu +  \frac{\nu(h)}{\Gamma(1 - \xi)}
\right),&\xi \neq 0\\
\exp\left(\frac{\nu(h)}{\sigma}\right),&\xi = 0
\end{array}\right.
  }{u_beta (mu + nu(h) / Gamma(1 - \xi)), if \xi < 1,
exp(nu(h)/sigma), otherwise}

This makes me think it's a bug in the LaTeX package that provides 
"cases", or a conflict with our Rd.sty file, but I don't know which.


Duncan Murdoch

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


Re: [Rd] Possible bug in the Rd parser?

2009-10-10 Thread Duncan Murdoch

On 10/10/2009 2:25 PM, Duncan Murdoch wrote:

On 10/10/2009 8:07 AM, Mathieu Ribatet wrote:

Dear list,

I got an automatic email complaining than some of my packages didn't
pass 'R CMD check' for R-2.10.0 alpha anymore. Both of them make use of
the "cases" LaTeX environment.

Inspecting the log outputs I got:

LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! Misplaced alignment tab character &.

I noticed that the Rd parser changed quite recently and that '#', '_'
and '&' must not be escaped according to "Writing R extensions".
However, the problematic .Rd portion seems (to me) OK

\deqn{\theta(h) =
\begin{cases}
u_\beta \left(\mu +  \frac{\nu(h)}{\Gamma(1 - \xi)}
\right),&\xi \neq 0\\
\exp\left(\frac{\nu(h)}{\sigma}\right),&\xi = 0
\end{cases}
  }{u_beta (mu + nu(h) / Gamma(1 - \xi)), if \xi < 1,
exp(nu(h)/sigma), otherwise}



One more followup:  the problem appears to be in the "cases" 
environment.  If I rewrite that block using "array" instead, things are 
fine:


 \deqn{\theta(h) =
 \left\{\begin{array}{ll}
 u_\beta \left(\mu +  \frac{\nu(h)}{\Gamma(1 - \xi)}
 \right),&\xi \neq 0\\
 \exp\left(\frac{\nu(h)}{\sigma}\right),&\xi = 0
 \end{array}\right.
   }{u_beta (mu + nu(h) / Gamma(1 - \xi)), if \xi < 1,
 exp(nu(h)/sigma), otherwise}

This makes me think it's a bug in the LaTeX package that provides 
"cases", or a conflict with our Rd.sty file, but I don't know which.


And the final answer:  the "cases" environment is in the amsmath 
package, which is not used by R.  You need to use regular LaTeX, not 
fancy stuff like that.  (There's a \cases macro in LaTex, which doesn't 
know what to do with alignment tabs:  that's why you got the error you did.)


Duncan Murdoch

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


[Rd] Help with OCaml bindings for R interpreter.

2009-10-10 Thread Guillaume Yziquel

Hello.

I've made out a Debian package out of Maxence Guesdon's OCaml/R bindings:

http://yziquel.homelinux.org/topos/debian-ocamlr.html
http://yziquel.homelinux.org/debian/pool/main/o/ocaml-r/

The upstream software itself is on the following page:

http://home.gna.org/ocaml-r/

This binding is dynamically linked to the /usr/lib/R/lib/libR.so and to
the /usr/lib/libRmath.so libraries. Its purpose is to access R
functionalities from OCaml programs.

However, as it now stands, the binding is not fully functional: When an
OCaml program is compiled with this binding, to generate, say,
myprog.byte, it is necessary to run

R CMD ./myprog.byte

in order for the program to work as expected. I would therefore like to
know how to *completely* embed the R interpreter inside my binding.
Could anyone provide generic information on this topic, or point me to
the right documentation?

All the best,

--
 Guillaume Yziquel
http://yziquel.homelinux.org/

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


Re: [Rd] Help with OCaml bindings for R interpreter.

2009-10-10 Thread Simon Urbanek


On Oct 10, 2009, at 3:53 PM, Guillaume Yziquel wrote:


Hello.

I've made out a Debian package out of Maxence Guesdon's OCaml/R  
bindings:


http://yziquel.homelinux.org/topos/debian-ocamlr.html
http://yziquel.homelinux.org/debian/pool/main/o/ocaml-r/

The upstream software itself is on the following page:

http://home.gna.org/ocaml-r/

This binding is dynamically linked to the /usr/lib/R/lib/libR.so and  
to

the /usr/lib/libRmath.so libraries. Its purpose is to access R
functionalities from OCaml programs.

However, as it now stands, the binding is not fully functional: When  
an

OCaml program is compiled with this binding, to generate, say,
myprog.byte, it is necessary to run

R CMD ./myprog.byte

in order for the program to work as expected. I would therefore like  
to

know how to *completely* embed the R interpreter inside my binding.


It *is* completely embedded. R CMD simply sets up the correct  
environment for the current R. For a given, specific R installation  
you could re-create the environment in the executable (see R CMD sh -c  
set), but by definition it is specific for that installation so you'd  
have to compile that binary at install time.


Cheers,
Simon



Could anyone provide generic information on this topic, or point me to
the right documentation?

All the best,

--
Guillaume Yziquel
http://yziquel.homelinux.org/

__
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] Help with OCaml bindings for R interpreter.

2009-10-10 Thread Guillaume Yziquel

Simon Urbanek a écrit :


On Oct 10, 2009, at 3:53 PM, Guillaume Yziquel wrote:


However, as it now stands, the binding is not fully functional: When an
OCaml program is compiled with this binding, to generate, say,
myprog.byte, it is necessary to run

R CMD ./myprog.byte

in order for the program to work as expected. I would therefore like to
know how to *completely* embed the R interpreter inside my binding.


It *is* completely embedded. R CMD simply sets up the correct 
environment for the current R.


OK. I just stumbled a minute or two ago on:

http://cran.r-project.org/doc/manuals/R-exts.html#Embedding-R-under-Unix_002dalikes

I now get it.

For a given, specific R installation you 
could re-create the environment in the executable (see R CMD sh -c set), 
but by definition it is specific for that installation so you'd have to 
compile that binary at install time.


OK. So it seems that there will be some more work needed in order to 
hide that completely to the OCaml end-user.



Cheers,
Simon


Thanks a lot.

--
 Guillaume Yziquel
http://yziquel.homelinux.org/

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


[Rd] isFALSE

2009-10-10 Thread Romain Francois

Hello,

Just wondering why there is "isTRUE" and not "isFALSE".

Romain

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