[Rd] R_tryEval not properly documented in 'Writing R Extensions' (PR#9524)

2007-02-22 Thread ellis
Full_Name: Byron Ellis
Version: 2.4.1
OS: N/A
Submission from: (NULL) (75.55.126.10)


R_tryEval is implied to be in the public API by 'Embedding R in Other
Applications,' but not documented in 'Writing R Extensions.' This would seem to
be an oversight given the dependence of many applications including but not
limited to the official OS X GUI on this function.

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


Re: [Rd] R_tryEval not properly documented in 'Writing R Extensions' (PR#9524)

2007-02-22 Thread Prof Brian Ripley
On Thu, 22 Feb 2007, [EMAIL PROTECTED] wrote:

 Full_Name: Byron Ellis
 Version: 2.4.1
 OS: N/A
 Submission from: (NULL) (75.55.126.10)


 R_tryEval is implied to be in the public API by 'Embedding R in Other
 Applications,' but not documented in 'Writing R Extensions.' This would seem 
 to
 be an oversight given the dependence of many applications including but not
 limited to the official OS X GUI on this function.

It is not an oversight.  R_tryEval is as far as the R sources are 
concerned just part of the test examples for embedding.

I think you may be referring to

http://developer.r-project.org/embedded.html

That does not list R_tryEval in 'Routines for the Embedded R', so makes no 
such implication (and in any case dates from 2000, before there was a 
documented interface).

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

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


Re: [Rd] R_tryEval not properly documented in 'Writing R Extensions' (PR#9525)

2007-02-22 Thread ripley
On Thu, 22 Feb 2007, [EMAIL PROTECTED] wrote:

 Full_Name: Byron Ellis
 Version: 2.4.1
 OS: N/A
 Submission from: (NULL) (75.55.126.10)


 R_tryEval is implied to be in the public API by 'Embedding R in Other
 Applications,' but not documented in 'Writing R Extensions.' This would seem 
 to
 be an oversight given the dependence of many applications including but not
 limited to the official OS X GUI on this function.

It is not an oversight.  R_tryEval is as far as the R sources are 
concerned just part of the test examples for embedding.

I think you may be referring to

http://developer.r-project.org/embedded.html

That does not list R_tryEval in 'Routines for the Embedded R', so makes no 
such implication (and in any case dates from 2000, before there was a 
documented interface).

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

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


[Rd] rgl update: please test!

2007-02-22 Thread Duncan Murdoch
(This is bcc'd to a list of people who have had problems with rgl lately 
or who are known to be big users; not cc'd, so you don't all get cc'd 
all the responses on the R-devel list).

I've just put together a test build of rgl, and put it on my web site as

http://www.stats.uwo.ca/faculty/murdoch/software/rgl_0.70.564.tar.gz 
(source)

and

http://www.stats.uwo.ca/faculty/murdoch/software/rgl_0.70.564.zip 
(Windows binary).

This includes a number of changes:

   - changes to configure script from Laszlo Kajan and Brian Ripley: 
should now be much more portable
   - removed deprecated OSX font setting calls
   - texture properties are now returned by material3d()
   - allowed normals and texture coordinates to be specified in 
triangles and quads
   - normals may be specified in qmesh objects, but (at present) 
subdivide removes them
   - material3d() now preserves the values of unspecified parameters (as 
documented, but not previously functioning)
   - open3d() now resets all material properties to the defaults.

Could people who have been having problems with rgl (or just making use 
of it) please test this update?  Some of the changes are very recent, 
and may still be buggy:  but I'm going offline from late tomorrow until 
March 4, so I'm not going to have an opportunity to test them myself 
well enough to want to send this to CRAN.

I'm hoping to send this to CRAN soon after I return.

Duncan Murdoch

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


Re: [Rd] R_tryEval not properly documented in 'Writing R Extensions' (PR#9524)

2007-02-22 Thread Byron Ellis
Considering the lack of embedding documentation until relatively
recently, the fact that the function appeared in Rinternals and the
Embedding test cases makes it more part of the API that its appearance
in any documentation since anyone embedding would have to base their
work on those test cases.


In any case, my second claim---that the function is used heavily by
projects under the official R umbrella as well as outside of
it---still stands and should probably serve as sufficient cause to
nominate R_tryEval for the public API.


On 2/22/07, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 On Thu, 22 Feb 2007, [EMAIL PROTECTED] wrote:

  Full_Name: Byron Ellis
  Version: 2.4.1
  OS: N/A
  Submission from: (NULL) (75.55.126.10)
 
 
  R_tryEval is implied to be in the public API by 'Embedding R in Other
  Applications,' but not documented in 'Writing R Extensions.' This would 
  seem to
  be an oversight given the dependence of many applications including but not
  limited to the official OS X GUI on this function.

 It is not an oversight.  R_tryEval is as far as the R sources are
 concerned just part of the test examples for embedding.

 I think you may be referring to

 http://developer.r-project.org/embedded.html

 That does not list R_tryEval in 'Routines for the Embedded R', so makes no
 such implication (and in any case dates from 2000, before there was a
 documented interface).

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



-- 
Byron Ellis ([EMAIL PROTECTED])
Oook -- The Librarian

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


[Rd] Patch for units- in datetime.R

2007-02-22 Thread Jeffrey Horner


Index: src/library/base/R/datetime.R
===
--- src/library/base/R/datetime.R   (revision 40781)
+++ src/library/base/R/datetime.R   (working copy)
@@ -381,7 +381,7 @@
  if (from == value) return(x)
  if (!(value %in% c(secs, mins, hours, days, weeks)))
  stop(invalid units specified)
-sc - cumprod(c(sec=1, mins=60, hours=60, days=24, weeks=7))
+sc - cumprod(c(secs=1, mins=60, hours=60, days=24, weeks=7))
  newx - as.vector(x)*sc[from]/sc[value]
  structure(newx, units=value, class=difftime)
  }

Cheers,

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner

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


[Rd] Bug in httpget function for internet.Rout test (PR#9509)

2007-02-22 Thread plynchnlm
Full_Name: Paul Lynch
Version: 2.4.1
OS: RedHat EL4
Submission from: (NULL) (130.14.254.25)


The httpget function used for the test that produces the internet.Rout file (or
in my case, the internet.Rout.fail file) checks for a Content-Length header
returned from a  webserver in response to the URL: 
http://www.stats.ox.ac.uk/pub/datasets/csb/ch11b.dat.  When I attempt to access
that URL either via the make check in R or via curl --head
http://www.stats.ox.ac.uk/pub/datasets/csb/ch11b.dat; via the command line, the
header I receive is Content-length with a lower case l.  Another user on
r-help reports that he gets it with an upper case L, so the problem appears to
be only visible from certain IP addresses.  It seems likely that the web server
at www.stats.ox.ac.uk is doing some load balancing based on the incoming IP
address, so that some users with get a response from a web server that returns
Content-length while others will get a response from a different web server
that returns Content-Length.  Whatever the cause  is, it seems reasonable that
the test for internet.Rout in httpget should not particular about whether the
upper or lower case L is used.

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


[Rd] text.rpart for the class method doesn't act on label=yprob

2007-02-22 Thread Robert King
Hello All,

Am I misreading the documentation?

The text.rpart documentation says:
label   a column name of x$frame; values of this will label the nodes. For
the class method, label=yval results in the factor levels being
used, yprob results in the probability of the winning factor level being
used, and ‘specific yval level’ results in the probability of that factor
level.

However, yprob doesn't seem to do this:
 pred = rep(letters[1:6],5)
 resp = rep(letters[1:3],10)
 ex.rp - rpart(resp~pred)
 plot(ex.rp)
 text(ex.rp,label=yval)

# works as advertised

 plot(ex.rp)
 text(ex.rp,label=yprob)

Error in text.rpart(ex.rp, label = yprob) :
Label must be a column label of the frame component of the tree

If I try to fake it, by making an element of the frame, like this:
 ex.rp$frame$yprob = (ex.rp$frame$n-ex.rp$frame$dev)/ex.rp$frame$n

The text command does add text to the plot, but adds the class labels
(i.e. yval), not the probabilities

 text(ex.rp,label=yprob)

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


[Rd] How to override functions in namespaces?

2007-02-22 Thread jhallman
In package A I have askForString(), which asks the user for a string.
Also in package A I have defined ssh(), which calls askForString().

Package B has package A as a prerequisite.

In package B I redefine askForString() to take advantage of a nicer user
interface made available by B, namely the Emacs mini-buffer prompt.

Packages B and A are both on the search path, with B ahead of A.  If I
call askForString() at the command prompt, I get the version from B.
But the version used by ssh() depends on whether or not package A has a
namespace. If so, ssh() (defined in A) always uses the A version of
askForString().  How can I get ssh() to use the B version of
askForString()? Or am I going about this all wrong?

Jeff

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


[Rd] dyn.load (PR#9364)

2007-02-22 Thread Christophe . Jean
Hi,

I have exactly the same problem with R 2.4.1 on an Intel MacBook with  
Mac OS X 10.4.8.

Please find below the output of the test.

Christophe
---
  source(/Users/Christophe/Desktop/Rdynunload/run.R)
WARNING: ignoring environment value of R_HOME
gcc-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
include -I/Library/Frameworks/R.framework/Resources/include/i386  - 
msse3  -D__NO_MATH_INLINES  -fPIC  -g -O2 -std=gnu99 -march=nocona -c  
code.c -o code.o
gcc-4.0 -arch i386 -dynamiclib -Wl,-macosx_version_min -Wl,10.3 - 
undefined dynamic_lookup -single_module -multiply_defined suppress -L/ 
usr/local/lib -o foo.so code.o   -L/Library/Frameworks/R.framework/ 
Resources/lib/i386 -lR -dylib_file libRblas.dylib:/Library/Frameworks/ 
R.framework/Resources/lib/i386/libRblas.dylib
[1] Failed
loaded DLL/SO
WARNING: ignoring environment value of R_HOME
gcc-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/ 
include -I/Library/Frameworks/R.framework/Resources/include/i386  - 
msse3  -D__NO_MATH_INLINES  -fPIC  -g -O2 -std=gnu99 -march=nocona -c  
other.c -o other.o
gcc-4.0 -arch i386 -dynamiclib -Wl,-macosx_version_min -Wl,10.3 - 
undefined dynamic_lookup -single_module -multiply_defined suppress -L/ 
usr/local/lib -o foo.so other.o   -L/Library/Frameworks/R.framework/ 
Resources/lib/i386 -lR -dylib_file libRblas.dylib:/Library/Frameworks/ 
R.framework/Resources/lib/i386/libRblas.dylib
first attempt
loaded DLL/SO
first attempt
---

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


[Rd] MCMC Pack Crashes R-GUI session (PR#9516)

2007-02-22 Thread lloydl
Full_Name: Lloyd Lubet
Version: 2.4.1rc
OS: XP
Submission from: (NULL) (65.19.17.17)


Dear Andrew,

I am trying to learn gibbs sampling and Metropolis. 
When I run your gibbs version of multiple linear regression my session crashes.
I have trimmed the dataframe and set my object.size = 1 gigB.
Despite my best efforts it still crashes while advising me to contact the MCMC
Pack developement team.

I am running windows XP with R version 2.4.1.c (the latest).

Here's the offending instruction in R:
 
mcmcReg-MCMCSVDreg( jpMorganChase.Adj.Close ~ exxon.Oil.Volume+usSteel.Volume,
data=yy.lo.res.scaled[ 2000:2274, ], burnin = 100, mcmc = 1000,

thin=1, verbose = 1, seed = NA, tau2.start = 1,

g0 = 0, a0 = 0.01, b0 = 0.01, c0=2, d0=2, w0=1,

beta.samp=TRUE, intercept=TRUE )



Here's the error msg:

Runtime Error!

Program ... \R\R-2.4.1rc\bin\Rgui.exe

This application has requested the Tuntime to terminate it in an unusual way.
Please contact the applications support team for more information



R Console - Rgui.exe - Application Error

The instruction at 0x5ad71531 referenced memory at 0x0014. Memory could
not be read.



Then, it crashes. 



Sincerely,



Lloyd Lubet

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


[Rd] Windows EPS format error (PR#9518)

2007-02-22 Thread mwtoews
This bug can be reproduced using R version 2.4.1 for Windows, where 
WinAnsiEncoding is used.
To reproduce this bug, start a Windows R session, and run:

postscript(first.eps, width=6, height=6, horizontal=FALSE, 
onefile=FALSE, paper=special)
plot(1:5)
dev.off()
q(no)

Now, start a new R session, and run:

pdf(second.pdf)
plot(1:5)
dev.off()
postscript(third.eps, width=6, height=6, horizontal=FALSE, 
onefile=FALSE, paper=special)
plot(1:5)
dev.off()
q(no)

The differences between first.eps and third.eps are shown to be:

$ diff first.eps third.eps
40d39
 /WinAnsiEncoding [
73d71
 ]

The file third.eps is an invalid format, and Vhostview reports:
Error: /undefined in WinAnsiEncoding
Operand stack:
   .notdef   .notdef   .notdef
... etc ...

I've also tested for this peculiar behavior with R 2.4.1 for Debian, 
however it checked clean.
+mt

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


[Rd] Graphical device questions

2007-02-22 Thread Sebastien Durand
Dear all,

I have posted these questions in r-help list but 
since I am getting no reply, I concluded that I 
must asked my question in the wrong list so here 
I am!

Here is my questions:

1- Under a WINDOWS installation of R-2.4.1,  can 
we change the naming of a new ploting device open 
by the command windows()?. Instead of the 
default name e.g.: Device 2 I would like to use 
something like Density plot or whatever!


2- Under a MAC OS X installation of R-2.4.1, 
using quartz devices, is there a way to perform 
bringToTop operation like the one available under 
WINDOWS using bringToTop function.

Thank you very much for your time.

Cheers

Sébastien

-- 
Dans le Ssu Ma Fa on lit: Celui qui place la vie 
au dessus de toute chose sera paralysé par 
l'irrésolution

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


[Rd] Request: make as.POSIXlt generic

2007-02-22 Thread jhallman
In the base package, as.POSIXct() is an S3 generic function, but
as.POSIXlt() is not.  As shown below, the current implementation is
already crying out to be refactored into a generic function with methods
for various classes.  It calls inherits five times. Not only is this
bad style, it also disallows me or anyone else from making as.POSIXlt()
work with other kinds of time-ish objects, such as the 'ti' (Time Index)
class in my fame package.

I would also like to see three other functions made generic: rowSums(),
rowMeans(), and filter().  This would enable Gabor to create methods for
his 'zoo' series, and let me create methods for my 'tis' (Time Indexed
Series).  But these are not as urgent as cleaning up as.POSIXlt().

Jeff Hallman



The current as.POSIXlt() implementation:

as.POSIXlt - function(x, tz = ){
fromchar - function(x) {
xx - x[1]
if(is.na(xx)) {
j - 1
while(is.na(xx)  (j - j+1) = length(x))
xx - x[j]
if(is.na(xx)) f - %Y-%m-%d # all NAs
}
if(is.na(xx) ||
   !is.na(strptime(xx, f - %Y-%m-%d %H:%M:%OS)) ||
   !is.na(strptime(xx, f - %Y/%m/%d %H:%M:%OS)) ||
   !is.na(strptime(xx, f - %Y-%m-%d %H:%M)) ||
   !is.na(strptime(xx, f - %Y/%m/%d %H:%M)) ||
   !is.na(strptime(xx, f - %Y-%m-%d)) ||
   !is.na(strptime(xx, f - %Y/%m/%d)))
{
res - strptime(x, f)
if(nchar(tz)) attr(res, tzone) - tz
return(res)
}
stop(character string is not in a standard unambiguous format)
}

if(inherits(x, POSIXlt)) return(x)
if(inherits(x, Date)) return(.Internal(Date2POSIXlt(x)))
tzone - attr(x, tzone)
if(inherits(x, date) || inherits(x, dates)) x - as.POSIXct(x)
if(is.character(x)) return(fromchar(unclass(x))) # precaution PR7826
if(is.factor(x))return(fromchar(as.character(x)))
if(is.logical(x)  all(is.na(x))) x - as.POSIXct.default(x)
if(!inherits(x, POSIXct))
stop(gettextf(do not know how to convert '%s' to class \POSIXlt\,
  deparse(substitute(x
if(missing(tz)  !is.null(tzone)) tz - tzone[1]
.Internal(as.POSIXlt(x, tz))
}

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


[Rd] supsmu produces segfault when handed all NAs. (PR#9519)

2007-02-22 Thread boe
When handed an argument with all NAs, supsmu() causes a
sigfault causing termination of R.  The following example
reproduces the problem (on a linux gentoo system), but I have verified the 
same behavior on a solaris builds as well as several versions of R.


   x - (1:100)/10;
   y - sin(pi*x) + rnorm(length(x));
   tmp - supsmu(x,y);  # works
   y[c(2,5,10)] - NA;   # a few NAs is OK, warning generated
   tmp-  supsmu(x,y);
   y- NA + y;   # all NAs
   tmp - supsmu(x,y);   # oops

  *** caught segfault ***
  address 0xfff8, cause 'memory not mapped'

  Traceback:
   1: .Fortran(R_supsmu, as.integer(leno), as.double(xo), 
as.double(y[ord]), as.double(wt[o
rd]), as.integer(iper), as.double(span), as.double(bass), smo = 
double(leno), double(n * 7
), double(1))
2: supsmu(x, y)

Possible actions:
1: abort (with core dump)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

--please do not edit the information below--

Version:
  platform = i686-pc-linux-gnu
  arch = i686
  os = linux-gnu
  system = i686, linux-gnu
  status =
  major = 2
  minor = 4.1
  year = 2006
  month = 12
  day = 18
  svn rev = 40228
  language = R
  version.string = R version 2.4.1 (2006-12-18)

Locale:
LC_CTYPE=en_US.utf8;LC_NUMERIC=C;LC_TIME=en_US.utf8;LC_COLLATE=en_US.utf8;LC_MONETARY=en_US.ut
f8;LC_MESSAGES=en_US.utf8;LC_PAPER=en_US.utf8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASURE
MENT=en_US.utf8;LC_IDENTIFICATION=C
Search Path:
  .GlobalEnv, package:stats, package:graphics, package:grDevices, 
package:utils, package:datase
ts, package:methods, Autoloads, package:base

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


[Rd] R crashes in Mac OS

2007-02-22 Thread Giusi Moffa
I am running R under Mac OS X (Tiger, v10.4). Unfortunately it keeps  
crashing while using the editor. One thing that seems to make things  
worse is having more than one script open at the same time. Can  
anyone help?

The last time it happened I got the following messages

error message from R:

*** caught segfault ***
address 0x89d789d8, cause 'memory not mapped'


report:

Date/Time:  2007-02-18 18:59:42.108 +
OS Version: 10.4.8 (Build 8N1051)
Report Version: 4

Command: R
Path:/Applications/R.app/Contents/MacOS/R
Parent:  WindowServer [55]

Version: R 2.4.1 GUI 1.18 (4038)

PID:235
Thread: 0

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_INVALID_ADDRESS (0x0001) at 0x89d789d8

Thread 0 Crashed:

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


[Rd] lower.tail for plnorm (PR#9520)

2007-02-22 Thread candrews
Full_Name: Chris Andrews
Version: 2.4.1
OS: Windows XP
Submission from: (NULL) (128.205.90.25)



# CDF works as expected (=0)
pnorm(-Inf) # 0
plnorm(0)  # 0

# specifying lower.tail=FALSE should give survival function (=1)
pnorm(-Inf, lower.tail=FALSE) # 1
plnorm(0, lower.tail=FALSE) # 0 != 1

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


[Rd] memory problem read.table v array (PR#9526)

2007-02-22 Thread wlangdon
Full_Name: bill langdon
Version: 2.4.1
OS: ubuntu
Submission from: (NULL) (155.245.58.159)


#WBL 22 Feb 2007 ubuntu 
R.version
#platform   i486-pc-linux-gnu
#arch   i486
#os linux-gnu
#system i486, linux-gnu
#status
#major  2
#minor  4.1
#year   2006
#month  12
#day18
#svn rev40228
#language   R
#version.string R version 2.4.1 (2006-12-18)

#if matrix a is created by array vals is created ok

#if matrix a is created by read.table,
#peak resource use (CPU, memory) by array() is excessive

#a = array(0,dim=c(409600,1));#ok
#a = read.table(big.txt,header=FALSE);  #all memory used 
#a = read.table(639x639.txt,header=FALSE);  #all memory used 
#a = read.table(4096.txt,header=FALSE); #all memory used 
#a = read.table(4096nocomment.txt,header=FALSE);#all memory used 
#a = read.table(tiny.txt,header=FALSE); #ten lines ok
#a = read.table(1000.txt,header=FALSE); #all memory used 
a = read.table(639.txt,header=FALSE);   #uses 1.6047029GB
dim(a)
dd = 639;
vals = array(a,dim=c(dd,dd));

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


[Rd] Problem with types on 64-bit

2007-02-22 Thread tom
Hi Everyone,

I have a problem using some working 32-bit R code with 64-bit machine ( I am
using version R-2.4.1 ).  The problem occurs when I am trying to detect a NULL
STRSXP type. ( Perhaps I am doing this detection in the wrong way? )

On 32-bit the following works, and correctly identifies if I am passing NULL
or a valid string object:

if ( v_dta_start != R_NilValue  STRING_ELT( v_dta_start, 0 ) != R_NilValue )
{
dta.start = CHAR( STRING_ELT( v_dta_start, 0 ) );
}

Yet on a 64-bit machine I get the following errors:

(1) when I pass NULL it goes into the if clause and then when it tries to set
dta.start it displays:
CHAR() can only be applied to a 'CHARSXP', not a 'NULL'
(2) if I pass a valid string such as hello, I get the following:
CHAR() can only be applied to a 'CHARSXP', not a 'character'

I have tried converting using AS_CHARACTER but that just brings up the same
messages.  I have also seen S4 and PROMSXP types come up in these error
messages.  

What I don't understand is why this happens - any ideas?

If I can supply any more info let me know, below is the CPU information for
the 64-bit machine. 

Many thanks for your help

Tom

64-BIT CPU INFO
===

processor   : 0
vendor_id   : AuthenticAMD
cpu family  : 15
model   : 5
model name  : AMD Opteron(tm) Processor 144
stepping: 10
cpu MHz : 1794.932
cache size  : 1024 KB
fpu : yes
fpu_exception   : yes
cpuid level : 1
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat
pse36 clflush mmx fxsr sse sse2 syscall nx mmxext lm 3dnowext 3dnow
bogomips: 3597.08
TLB size: 1024 4K pages
clflush size: 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp

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


Re: [Rd] rgl update: please test!

2007-02-22 Thread Rainer Hurling
Hallo Duncan,

your newest version works fine under R-2.5.0 (devel) on FreeBSD 
7.0-CURRENT (i386). I made some tests with different types of diagrams 
and all seems to be ok for me.

Thank you very much. I am look forward to the release of this version.

Have a nice trip,
Rainer



Duncan Murdoch wrote:
 (This is bcc'd to a list of people who have had problems with rgl lately 
 or who are known to be big users; not cc'd, so you don't all get cc'd 
 all the responses on the R-devel list).
 
 I've just put together a test build of rgl, and put it on my web site as
 
 http://www.stats.uwo.ca/faculty/murdoch/software/rgl_0.70.564.tar.gz 
 (source)
 
 and
 
 http://www.stats.uwo.ca/faculty/murdoch/software/rgl_0.70.564.zip 
 (Windows binary).
 
 This includes a number of changes:
 
- changes to configure script from Laszlo Kajan and Brian Ripley: 
 should now be much more portable
- removed deprecated OSX font setting calls
- texture properties are now returned by material3d()
- allowed normals and texture coordinates to be specified in 
 triangles and quads
- normals may be specified in qmesh objects, but (at present) 
 subdivide removes them
- material3d() now preserves the values of unspecified parameters (as 
 documented, but not previously functioning)
- open3d() now resets all material properties to the defaults.
 
 Could people who have been having problems with rgl (or just making use 
 of it) please test this update?  Some of the changes are very recent, 
 and may still be buggy:  but I'm going offline from late tomorrow until 
 March 4, so I'm not going to have an opportunity to test them myself 
 well enough to want to send this to CRAN.
 
 I'm hoping to send this to CRAN soon after I return.
 
 Duncan Murdoch

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


[Rd] Error in ICC1.CI ? (PR#9528)

2007-02-22 Thread Mathieu . DAcremont

Hello,

I'm using the function ICC1.CI of the psychometric package. I wonder if 
there is an error in this function. Because in the paper of McGraw and 
Wong (Psychol Met, 1, 30) or the one of Shrout  Fleiss (Psychol Bult, 
86, 420), the Ftab is not calculate in the same manner of the lower and 
upper bound.

According to these articles Ftab for the lower bound is:

F(df.row, df.error)

and for the upper bound, it is:

F(df.error, df.row).

So the df are reversed. However, in your function ICC1.CI, the Ftab is 
calculated in the same way for the upper and lower bound:

 Ftab - qf(noma/2, df1, df2, lower.tail = F)
 Fl - Fobs/Ftab
 Fu - Fobs * Ftab
 lcl - (Fl - 1)/(Fl + n)
 ucl - (Fu - 1)/(Fu + n)

Is that an error ?

Best regards,

-- 
Mathieu d'Acremont, PhD [EMAIL PROTECTED]
Maître-Assistanttel/fax +4122 379 98 20/44

Pôle de Recherche National en Sciences Affectives
CISA - Université de Genève
Rue des Battoirs 7
CH-1205 Genève
http://affect.unige.ch/

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


Re: [Rd] Problem with types on 64-bit

2007-02-22 Thread Prof Brian Ripley
Neither NULL nor hello are valid values for an element of a STRSXP: only 
CHARSXPs are.  So your test is not the correct one: you need to test 
both isString(v_dta_start) and  TYPEOF(STRING_ELT( v_dta_start, 0 )) == 
CHARSXP to be really safe.

Calling STRSXP on a random SEXP is likely to give different results on 
different machines: there is no fundamental 32- vs 64-but difference here.

On Tue, 20 Feb 2007, [EMAIL PROTECTED] wrote:

 Hi Everyone,

 I have a problem using some working 32-bit R code with 64-bit machine ( I am
 using version R-2.4.1 ).  The problem occurs when I am trying to detect a NULL
 STRSXP type. ( Perhaps I am doing this detection in the wrong way? )

 On 32-bit the following works, and correctly identifies if I am passing NULL
 or a valid string object:

 if ( v_dta_start != R_NilValue  STRING_ELT( v_dta_start, 0 ) != R_NilValue )
 {
dta.start = CHAR( STRING_ELT( v_dta_start, 0 ) );
 }

 Yet on a 64-bit machine I get the following errors:

 (1) when I pass NULL it goes into the if clause and then when it tries to set
 dta.start it displays:
 CHAR() can only be applied to a 'CHARSXP', not a 'NULL'
 (2) if I pass a valid string such as hello, I get the following:
 CHAR() can only be applied to a 'CHARSXP', not a 'character'

 I have tried converting using AS_CHARACTER but that just brings up the same
 messages.  I have also seen S4 and PROMSXP types come up in these error
 messages.

 What I don't understand is why this happens - any ideas?

 If I can supply any more info let me know, below is the CPU information for
 the 64-bit machine.

 Many thanks for your help

 Tom

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

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


Re: [Rd] memory problem read.table v array (PR#9526)

2007-02-22 Thread Prof Brian Ripley
There is nothing to reproduce here: we do not have 639.txt.

But note that read.table returns a data frame, and ?array has

 data: a vector (including a list) giving data to fill the array.

so I do wonder if this is what you intended: you seem to have tried to 
create an array list with 639*639 elements.  It is certainly not the same 
sort of object as array(0,dim=c(409600,1)).

Had 639.txt contained 639 rows of reals, your 'a' would be about
639*639*639*8 bytes, beyond the address space of your machine.

as.matrix(read.table(639.txt, header=FALSE)) might have been what you 
are looking for.


On Thu, 22 Feb 2007, [EMAIL PROTECTED] wrote:

 Full_Name: bill langdon
 Version: 2.4.1
 OS: ubuntu
 Submission from: (NULL) (155.245.58.159)


 #WBL 22 Feb 2007 ubuntu
 R.version
 #platform   i486-pc-linux-gnu
 #arch   i486
 #os linux-gnu
 #system i486, linux-gnu
 #status
 #major  2
 #minor  4.1
 #year   2006
 #month  12
 #day18
 #svn rev40228
 #language   R
 #version.string R version 2.4.1 (2006-12-18)

 #if matrix a is created by array vals is created ok

 #if matrix a is created by read.table,
 #peak resource use (CPU, memory) by array() is excessive

 #a = array(0,dim=c(409600,1));#ok
 #a = read.table(big.txt,header=FALSE);  #all memory used
 #a = read.table(639x639.txt,header=FALSE);  #all memory used
 #a = read.table(4096.txt,header=FALSE); #all memory used
 #a = read.table(4096nocomment.txt,header=FALSE);#all memory used
 #a = read.table(tiny.txt,header=FALSE); #ten lines ok
 #a = read.table(1000.txt,header=FALSE); #all memory used
 a = read.table(639.txt,header=FALSE);   #uses 1.6047029GB
 dim(a)
 dd = 639;
 vals = array(a,dim=c(dd,dd));


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

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


Re: [Rd] Problem with types on 64-bit

2007-02-22 Thread Oleg Sklyar
Besides the comments from Prof. Ripley, I am not sure your if statement 
is fully correct, because suppose v_dta_start is R_NilValue -- why then 
STRING_ELT( R_NilValue, 0 ) should be a valid statement in first place? 
In my code I often use R_NilValue to check for R-NULL, but it always 
works fine on both 32 and 64 bits, moreover on Linux, Mac and Windows as 
well... Oleg

[EMAIL PROTECTED] wrote:
 Hi Everyone,
 
 I have a problem using some working 32-bit R code with 64-bit machine ( I am
 using version R-2.4.1 ).  The problem occurs when I am trying to detect a NULL
 STRSXP type. ( Perhaps I am doing this detection in the wrong way? )
 
 On 32-bit the following works, and correctly identifies if I am passing NULL
 or a valid string object:
 
 if ( v_dta_start != R_NilValue  STRING_ELT( v_dta_start, 0 ) != R_NilValue )
 {
 dta.start = CHAR( STRING_ELT( v_dta_start, 0 ) );
 }
 
 Yet on a 64-bit machine I get the following errors:
 
 (1) when I pass NULL it goes into the if clause and then when it tries to set
 dta.start it displays:
 CHAR() can only be applied to a 'CHARSXP', not a 'NULL'
 (2) if I pass a valid string such as hello, I get the following:
 CHAR() can only be applied to a 'CHARSXP', not a 'character'
 
 I have tried converting using AS_CHARACTER but that just brings up the same
 messages.  I have also seen S4 and PROMSXP types come up in these error
 messages.  
 
 What I don't understand is why this happens - any ideas?
 
 If I can supply any more info let me know, below is the CPU information for
 the 64-bit machine. 
 
 Many thanks for your help
 
 Tom
 
 64-BIT CPU INFO
 ===
 
 processor : 0
 vendor_id : AuthenticAMD
 cpu family: 15
 model : 5
 model name: AMD Opteron(tm) Processor 144
 stepping  : 10
 cpu MHz   : 1794.932
 cache size: 1024 KB
 fpu   : yes
 fpu_exception : yes
 cpuid level   : 1
 wp: yes
 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
 pat
 pse36 clflush mmx fxsr sse sse2 syscall nx mmxext lm 3dnowext 3dnow
 bogomips  : 3597.08
 TLB size  : 1024 4K pages
 clflush size  : 64
 cache_alignment   : 64
 address sizes : 40 bits physical, 48 bits virtual
 power management: ts fid vid ttp
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466

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


Re: [Rd] How to override functions in namespaces?

2007-02-22 Thread Prof Brian Ripley
On Mon, 12 Feb 2007, [EMAIL PROTECTED] wrote:

 In package A I have askForString(), which asks the user for a string.
 Also in package A I have defined ssh(), which calls askForString().

 Package B has package A as a prerequisite.

 In package B I redefine askForString() to take advantage of a nicer user
 interface made available by B, namely the Emacs mini-buffer prompt.

 Packages B and A are both on the search path, with B ahead of A.  If I
 call askForString() at the command prompt, I get the version from B.
 But the version used by ssh() depends on whether or not package A has a
 namespace. If so, ssh() (defined in A) always uses the A version of
 askForString().  How can I get ssh() to use the B version of
 askForString()? Or am I going about this all wrong?

That is one of the main purposes of a namespace, but you can defeat it.

In the scenario you paint, B::askForString() should work (whether or not B 
has a namespace).

If (I am guessing) you want the version that would be gotten at the top 
level (the  prompt) whether or not B is in use, use
get(askForString, pos=1)().

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

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


Re: [Rd] (PR#9523) avoiding a needless function evaluation in optimize()

2007-02-22 Thread Prof Brian Ripley
This is very far from easy, as the C code used does not return the 
function value.

If you would like to rewrite it and the interface and submit a patch it 
will be considered.

It's hard to imagine an application where this would matter, and you have 
not given one to encourage us to give this more than the lowest priority 
on the wishlist.


On Wed, 21 Feb 2007, [EMAIL PROTECTED] wrote:

 Full_Name: Jelle Goeman
 Version: 2.4.0
 OS: windows XP
 Submission from: (NULL) (145.88.209.33)


 Hi,

 I like to use optimize() to optimize functions whose evaluation is costly in
 terms of computation time. The Brent algorithm which is implemented in 
 optimize
 was designed to optimize a function with as few function evaluations as
 possible. Therefore it bothers me that optimize() always evaluates the 
 function
 twice at the optimal value. This can be seen for example by saying:

 square - function(x) {
  print(x)
  x*x
 }
 opt - optimize(square, c(-5,1), tol=0.1)

 Looking at the code of optimize(), I see that the extra function evaluation
 comes when optimize returns

 list(minimum = val, objective = f(val, ...))

 f(val, ...) is calculated, but f(val, ...) has already been calculated at some
 point during the algorithm.

 Would it be possible to let optimize() store its previous function evaluations
 to avoid this unnecessary function evaluation?

 Kind regards,

 Jelle

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


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

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


Re: [Rd] How to override functions in namespaces?

2007-02-22 Thread Duncan Murdoch
On 2/12/2007 1:13 PM, [EMAIL PROTECTED] wrote:
 In package A I have askForString(), which asks the user for a string.
 Also in package A I have defined ssh(), which calls askForString().
 
 Package B has package A as a prerequisite.
 
 In package B I redefine askForString() to take advantage of a nicer user
 interface made available by B, namely the Emacs mini-buffer prompt.
 
 Packages B and A are both on the search path, with B ahead of A.  If I
 call askForString() at the command prompt, I get the version from B.
 But the version used by ssh() depends on whether or not package A has a
 namespace. If so, ssh() (defined in A) always uses the A version of
 askForString().  How can I get ssh() to use the B version of
 askForString()? Or am I going about this all wrong?

There are several ways.  If package A knows that some users will want 
to replace askForString(), then it should allow the user to tell it what 
to use for that function, and fall back to its own definition as a 
default.  It could do this by explicitly looking for askForString in the 
global environment (which will fall back to the search list if not 
found), or it could get the function from an option() setting, etc.

If package A doesn't expect askForString() to be changed, then you 
shouldn't change it:  you might break something else in A.  You should 
write to the author of A (which sounds as though it's yourself), and ask 
for some improvements to the package.

There are dirty methods to modify the contents of a namespace, but you 
shouldn't use those.

Duncan Murdoch

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


Re: [Rd] Writing a package in which files must be sourced in a specific order

2007-02-22 Thread Oleg Sklyar
Put all loadings into functions and call the functions in .onLoad or 
.FirstLib, whatever you have there. I would simply advise not to put any 
  code outside of functions or class methods. In this way the order of 
loading will not matter, it will not depend on system or alphabet and 
you will also be able to save the loaded image of the package for faster 
loading.

Best
Oleg

hadley wickham wrote:
 Dear all,
 
 I have been using the proto package to create objects with mutable
 state for my ggplot package.  This has been very successful so far,
 but I have run into a problem when building/installing the package,
 because the source files need to be loaded in a specific order so that
 dependencies are initialised correctly.
 
 I have named the files so that dependencies are loaded before they are
 needed, so that
 
 lapply(dir(~/documents/ggplot/ggplot/R, full.name=T), source)
 
 runs without error, but when installing the package I get an error
 than indicates that the files aren't being loaded in alphabetical
 order:
 
 Error in proto(Geom, { : object Geom not found
 Error: unable to load R code in package 'ggplot'
 Error: package/namespace load failed for 'ggplot'
 
 Can anyone suggest how I could get around this?
 
 Regards,
 
 Hadley
 
 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466

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


Re: [Rd] Writing a package in which files must be sourced in a specific order

2007-02-22 Thread Prof Brian Ripley
What 'alphabetical order' is depends on the locale.  In en_NZ g  G, in C
G  g.  So it is a rather slippery concept (and gets worse in non-English 
locales: 'aa' sorts after z in Danish).

You don't tell us quite what you are doing, but R CMD INSTALL is 
working in C when concatenating the files in the R directory to ensure 
consistency across R installations.

My guess is that you need to give a collation order in the DESCRIPTION 
file (see 'Writing R Extensions'), if I am interpolating your 
comments correctly.

On Thu, 22 Feb 2007, hadley wickham wrote:

 Dear all,

 I have been using the proto package to create objects with mutable
 state for my ggplot package.  This has been very successful so far,
 but I have run into a problem when building/installing the package,
 because the source files need to be loaded in a specific order so that
 dependencies are initialised correctly.

'loaded'?  Do you mean sourced during INSTALL?

 I have named the files so that dependencies are loaded before they are
 needed, so that

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

 runs without error, but when installing the package I get an error
 than indicates that the files aren't being loaded in alphabetical
 order:

 Error in proto(Geom, { : object Geom not found
 Error: unable to load R code in package 'ggplot'
 Error: package/namespace load failed for 'ggplot'

 Can anyone suggest how I could get around this?

 Regards,

 Hadley

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


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

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


Re: [Rd] Writing a package in which files must be sourced in a specific order

2007-02-22 Thread hadley wickham
 What 'alphabetical order' is depends on the locale.  In en_NZ g  G, in C
 G  g.  So it is a rather slippery concept (and gets worse in non-English
 locales: 'aa' sorts after z in Danish).

I only used characters a-z, so I didn't think that would be a problem.
 However, it turns out I had misnamed one of my files so that it
wasn't sorting correctly, and renaming it fixed the problem.
(Previously I had manully included that file first and I had forgotten
to remove it)

Thanks for the help.

Hadley

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