Re: [R] quartz() on MAC OSX

2007-05-21 Thread Paul Roebuck
On Tue, 22 May 2007, hadley wickham wrote:

> On 5/22/07, Rolf Turner <[EMAIL PROTECTED]> wrote:
>
> > On 22/5/07 6:48 AM, "hadley wickham" <[EMAIL PROTECTED]> wrote:
> >
> > > Two possible solutions:
> > >
> > >  * DISPLAY=0.0.0.0:0 R - and then X11() should work without having to use
> > > xterm
> > >
> > >  * install.packages("CarbonEL"); library(CarbonEL); quartz()
> >
> > It is clear that life is determined to frustrate me.  I had a look at CRAN
> > just now and could find no sign of a package called "CarbonEL".  The list
> > jumps from "car" to "cat" --- no "Carbon" of any flavour.  What gives?
> >
> > Also I tried setting the DISPLAY (probably incorrectly, since I don't
> > understand what's going on).  I used
> >
> > > Sys.setenv(DISPLAY="0.0.0.0:0 R")
> > > X11()
> >
> > And got the error message
> >
> > Error in X11() : X11 module cannot be loaded
>
> Sorry, just type
> DISPLAY=0.0.0.0:0 R
> at the command prompt

Edit ~/.Rprofile (create if necessary) as below:

$ cat << NOMORE >> ~/.Rprofile
Sys.putenv("DISPLAY"=":0.0")
NOMORE
$

You should start the X11 server first before expecting
the functionality to work, as below:

[[ Terminal.app ]]
$ open /Applications/Utilities/X11.app
$ R
> X11()

Discussion of Mac-specific issues belongs in r-sig-mac,
not r-help.

--
SIGSIG -- signature too long (core dumped)

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


[R] Makeconf on Windows - where?

2007-03-30 Thread Paul Roebuck
Read in the Windows release notes for 2.4.0 that:

  There is a new file etc/Makeconf that provides an
  approximation to the Unix version and may help with
  src/Makefile's.

Yet when I look at the CRAN binary I have for 2.4.1patched,
there are five files in the $R_HOME/etc directory, but no
Makeconf. Is the file only available with custom installs?

--
SIGSIG -- signature too long (core dumped)

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


[R] Canonical method for S engine selection?

2006-12-06 Thread Paul Roebuck
Assuming script 'common.q' contains code that needed
different processing depending on interpreter
(either S-PLUS or R), what should the condition be?

if () {
# Do S-PLUS code
} else {
# Do R code
}

Looking for something akin to the C preprocessor directive
USING_R, but for S.

--
SIGSIG -- signature too long (core dumped)

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


[R] default help system (was Re: Basic package structure question)

2006-06-23 Thread Paul Roebuck
<<>>

On Fri, 23 Jun 2006, Duncan Murdoch wrote:

> >> On Fri, 23 Jun 2006, Joerg van den Hoff wrote:
> >>
> >>> our Windows machines lack proper development environments (mainly
> >>> missing perl is the problem for pure R-code packages, I believe?) and we
> >>> bypass this (for pure R-code packages only, of course) by
> >>>
> >>> 1.) install the package on the unix machine into the desired R library
> >>> 2.) zip the _installed_ package (not the source tree!) found in the R
> >>>   library directory
> >>> 3.) transfer this archive to the Windows machine
> >>> 4.) unzip directly into the desired library destination
> >>>
> >>> this procedure up to now always worked including properly installed
> >>> manpages (text + html (and I hope this remains the case in the future...)
>
> One obvious limitation of this install method is that it won't produce
> native Windows help files (.chm).  Plans are to make CHM the default
> help system as of the 2.4.0 release, so your packages will not work
> properly unless you give special instructions on how to change the help
> system defaults.

Is the decision to change default help files to CHM set
in stone? What's the payback for this change?

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] make check errors for R-2.3.1

2006-06-09 Thread Paul Roebuck
On Thu, 8 Jun 2006, Luo Weijun wrote:

> I tried to build R-2.3.1 from source under Mac OS X
> 10.4.6. (I am doing so because only this way I can get
> the 64-bit version of R)
>
> The configure and make steps look fine. But I got
> errors when I did make check-all, here is the message:
>
> running code in 'base-Ex.R' ...make[4]: ***
> [base-Ex.Rout] Error 1
> make[3]: *** [test-Examples-Base] Error 2
> make[2]: *** [test-Examples] Error 2
> make[1]: *** [test-all-basics] Error 1
> make: *** [check-all] Error 2
>
> I am not sure what does this mean.
> One potentially related issue is that, I downloaded
> and installed a gfortran compiler: GNU Fortran 95
> (GCC) 4.2.0 20060512 (experimental), because we don¡¯t
> have one originally. But I didn¡¯t use the latest
> cctools, and our version is: Apple Computer, Inc.
> version cctools-590.23.2.obj~17. Not sure whether this
> matters. Our gcc compiler is:
> powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple
> Computer, Inc. build 5250).

See "Tools" section of 
for GCC. R-GUI installer contains needed Fortran compiler.
See also  for additional
Mac OS X build/compilation issues.

This should properly be discussed on R SIG Mac rather
than R Help.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] X11 device

2006-05-31 Thread Paul Roebuck
On Wed, 31 May 2006, Marius Hofert wrote:

> I am working with R on a Mac Powerbook G4. As described a couple of
> days ago, I would like to create an animation consisting of - say -
> 1000 plots (lattice: xyplot, wireframe etc.). Everything works
> perfectly fine (thanks to all of you for the suggestions and ideas),
> but before I am able to plot (.png's in a for-loop), I have to start
> a X11 device. I was wondering if it is possible to start the X11
> device from the R console (as it is tedious to click the X11-button
> in the GUI). Searching through the web, I found the command "X11()",
> but that _only_ works, if the X11-button in the GUI was pressed
> before... otherwise, I get an error message that it wasn't possible
> to start the X11 device and I get an additional warning saying that
> the connection to the X11 display couldn't be opened.
>
> Does it work to start such an device from the console? If so, what's
> the command to use?

# Start X11 server on Mac OS X
if (Sys.info()[1] == "Darwin") {
x11.app <- file.path("",
 "Applications",
 "Utilities",
 "X11.app")
system(paste("open", x11.app))
}

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Automate concatenation?

2006-05-30 Thread Paul Roebuck
On Tue, 30 May 2006, Robert Lundqvist wrote:

> I have this typical problem of joining a number of vectors with similar
> names - a1, a2,..., a10 - which should be concatenated into one. Using
> c(a1,a2,a3,a4,a5,a6,a,a8,a9,a10) naturally works, but I would like to do
> it with less manual input. My attempts to use paste() gives a vector of
> the vector names, see below. The question is how to do the the
> concatenation? Any suggestions?
>
> paste("a",1:10,sep="")

a1 <- c(5, 4)
a2 <- 2
a3 <- 6:9
cmd <- sprintf("c(%s)",
   paste("a", 1:3, sep = "", collapse = ", "))
eval(parse(text = cmd))


--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] sprintf question

2006-05-03 Thread Paul Roebuck
How would one go about getting sprintf to use the
values of a vector without having to specify each
argument individually?

> v <- c(1, 2, -1.197114, 0.1596687)
> iv <- c(3, 1, 2, 4)
> sprintf("%9.2f\t%d\t%d\t%8.3f", v[3], v[1], v[2], v[4])
[1] "-1.20\t1\t2\t   0.160"

Essentially, desired effect would be something like:
> sprintf("%9.2f\t%d\t%d\t%8.3f", v[iv]) # wish it worked

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Memory usage and limit

2006-04-26 Thread Paul Roebuck
On Wed, 26 Apr 2006, Min Shao wrote:

> I recently made a 64-bit build of R-2.2.1 under Solaris 9 using gcc v.3.4.2.
> The server has 12GB memory, 6 Sparc CPUs and plenty of swap space. I was the
> only user at the time of the following experiment.
>
> I wanted to benchmark R's capability to read large data files and used a
> data set consisting of 2MM records with 65 variables in each row. All but 2
> of the variables are of the character type and the other two are numeric.
> The whole data set is about 600 MB when stored as plain ASCII file.
>
> The following code was used in the benchmarking runs:
>
>  c = list(var1=0, var2=0, var3="", var4="", .var65="")
>  A <- scan("test.dat", skip = 1, sep = ",", what = c, nmax=X,
> quiet=FALSE)
>  summary(A)
> where  = 100 or 200
>
> I made two runs with nmax=100 and nmax=200 respectively. The first
> run completed successfully, in about hour of CPU time. However, the actual
> memory usage exceeded 2.2GB, about 7 times of the acutal file size on disk.
> The second run aborted when the memory usage reached 4GB. The error messgae
> is  "vector memory exhausted (limit reached?)".
>
> Three questions:
> 1) Why were so much memory and CPU consumed to read 300MB of data? Since
> almost all of the variables are character, I expected almost of 1-1 mapping
> between file size on disk and that in memory
> 2) Since this is a 64-bit build, I expected it could handle more than the
> 600MB of data I used. What does the error message mean? I don't beleive the
> vector length exceeded the theoretic limit of about 1 billion.
> 3) The original file was compressed and I had to uncompress it before the
> experiement. Is there a way to read compressed files directly in R

A <- scan(gzfile("test.dat.gz", "r"),
  skip = 1,
  sep  = ",",
  what = c,
  nmax = X,
  quiet= FALSE)

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Breakdown a number

2006-04-20 Thread Paul Roebuck
On Thu, 20 Apr 2006, Gabor Grothendieck wrote:

> On 4/19/06, Paul Roebuck <[EMAIL PROTECTED]> wrote:
> > On Wed, 19 Apr 2006, Gabor Grothendieck wrote:
> >
> > > On 4/19/06, Paul Roebuck <[EMAIL PROTECTED]> wrote:
> > >
> > > > Isn't there a builtin method for doing this and, if so,
> > > > what is it called?
> > > >
> > > >breakdown <- function(whole) {
> > > >breaks <- c(250, 800)
> > > >pieces <- integer(length(breaks) + 1)
> > > >if (whole > breaks[2]) {
> > > >pieces[3] <- whole - breaks[2]
> > > >whole <- breaks[2]
> > > >}
> > > >if (whole > breaks[1]) {
> > > >pieces[2] <- whole - breaks[1]
> > > >whole <- breaks[1]
> > > >}
> > > >pieces[1] <- whole
> > > >
> > > >return(pieces)
> > > >}
> > > >
> > > > breakdown(1200) # 250 550 400
> > >
> > > Maybe you could discuss in words what you want but perhaps
> > > you are looking for diff:
> >
> > That was rather my problem searching for my answer as I
> > was unsure what this was called. I was searching for
> > 'bins' or 'breaks' (like in hist method but not for
> > plotting) and leading nowhere fast. Alas, I thought
> > sample code would go further than my description.
> >
> >
> > > > bp <- c(0, 250, 800, 1200)
> > > > diff(bp)
> > > [1] 250 550 400
> >
> > Don't think diff method is going to work either, at
> > least in cases where the 'whole' is less than greatest
> > 'break'.
> >
> > > breakdown2 <- function(x, breaks = c(250, 800)) {
> >  diff(c(0, breaks, x))
> >  }
> > > breakdown(10) # 10 0 0
> > > breakdown2(10)# 250 550 -790
> > >
> > > breakdown(400)# 250 150 0
> > > breakdown2(400)   # 250 550 -400
> >
>
> Just sort it:
>
> bd <- function(x, breaks = c(250, 800)) diff(sort(c(0, breaks, x)))

Doesn't work either. Tests below didn't fare well.

> If you don't want the 0 values in the case that x is one of the
> breaks then use diff(sort(unique(c(0, breaks, x

I did want the zeros in the result.

###
check.results <- function(input) {
stopifnot(input >= 0)
output <- bd(input)
expected <- breakdown(input)
if (!identical(output, expected)) {
cat("expected:", expected, "\n")
cat("output:  ", output,   "\n")
return(FALSE)
} else {
return(TRUE)
}
}

check.results(1200) # TRUE
check.results(800)  # TRUE
check.results(799)  # FALSE
check.results(500)  # FALSE
check.results(250)  # FALSE
check.results(200)  # FALSE
check.results(1)# FALSE
check.results(0)# FALSE

Goal was to split value according to breaks such that each
piece of it could later be multiplied with a corresponding
rate. It's not unlike the type of processing that would go
into figuring out how much a hypothetical out-of-state phone
call would cost (for example, .10 for first five minutes,
0.07 for next ten minutes, and 0.05 for rest of the call)

calc.cost.per.call <- function(minutes) {
duration <- bd(minutes, breaks = c(5, 10))
rates <- c(0.10, 0.07, 0.05)
sum(duration * rates)
}

calc.cost.per.call(24)  # would be 1.65


Thanks for your help.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Breakdown a number

2006-04-19 Thread Paul Roebuck
On Wed, 19 Apr 2006, Gabor Grothendieck wrote:

> On 4/19/06, Paul Roebuck <[EMAIL PROTECTED]> wrote:
>
> > Isn't there a builtin method for doing this and, if so,
> > what is it called?
> >
> >breakdown <- function(whole) {
> >breaks <- c(250, 800)
> >pieces <- integer(length(breaks) + 1)
> >if (whole > breaks[2]) {
> >pieces[3] <- whole - breaks[2]
> >whole <- breaks[2]
> >}
> >if (whole > breaks[1]) {
> >pieces[2] <- whole - breaks[1]
> >whole <- breaks[1]
> >}
> >pieces[1] <- whole
> >
> >return(pieces)
> >}
> >
> > breakdown(1200) # 250 550 400
>
> Maybe you could discuss in words what you want but perhaps
> you are looking for diff:

That was rather my problem searching for my answer as I
was unsure what this was called. I was searching for
'bins' or 'breaks' (like in hist method but not for
plotting) and leading nowhere fast. Alas, I thought
sample code would go further than my description.


> > bp <- c(0, 250, 800, 1200)
> > diff(bp)
> [1] 250 550 400

Don't think diff method is going to work either, at
least in cases where the 'whole' is less than greatest
'break'.

> breakdown2 <- function(x, breaks = c(250, 800)) {
  diff(c(0, breaks, x))
  }
> breakdown(10) # 10 0 0
> breakdown2(10)# 250 550 -790
>
> breakdown(400)# 250 150 0
> breakdown2(400)   # 250 550 -400


--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Breakdown a number

2006-04-19 Thread Paul Roebuck
Isn't there a builtin method for doing this and, if so,
what is it called?

breakdown <- function(whole) {
breaks <- c(250, 800)
pieces <- integer(length(breaks) + 1)
if (whole > breaks[2]) {
pieces[3] <- whole - breaks[2]
whole <- breaks[2]
}
if (whole > breaks[1]) {
pieces[2] <- whole - breaks[1]
whole <- breaks[1]
}
pieces[1] <- whole

return(pieces)
}

breakdown(1200) # 250 550 400

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] extremely simple "for loop" question

2006-04-12 Thread Paul Roebuck
On Wed, 12 Apr 2006, Brian Quinif wrote:

> I want to do a for loop in which m takes on the values
> 1, 5, 10, 15, 20.  What is the syntax for doing that?
>
> I had been doing a loop for m in 1:20, but I only want
> those values above.

?seq

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] S4 method dispatch matrixOrArray

2006-04-12 Thread Paul Roebuck
On Wed, 12 Apr 2006, Gabor Grothendieck wrote:

> On 4/12/06, Paul Roebuck <[EMAIL PROTECTED]> wrote:
>
> > I have some code where the primary dispatching is on
> > other parameters so I'd like not to have to create a
> > set of functions for "matrix" and another duplicate
> > set for "array". But the class union technique isn't
> > working as implemented below and I don't have my Green
> > book with me. How do I fix my infinite recursion problem?
> >
> >
> > ##
> > library(methods)
> >
> > setGeneric("foo",
> >   function(A, ...) {
> >   cat("generic", match.call()[[1]], "\n")
> >   standardGeneric("foo")
> >   })
> >
> > setMethod("foo",
> >  signature(A = "vector"),
> >  function(A, ...) {
> >  callGeneric(matrix(A, nrow = 1), ...)
> >  })
> >
> > setClassUnion("matrixOrArray", c("matrix", "array"))
> >
> > setMethod("foo",
> >  signature(A = "matrixOrArray"),
> >  function(A, ...) {
> >  cat("A =", A, "\n")
> >  })
> >
> > ## Test
> > foo(1:4)
> > foo(matrix(1:4, 1, 4))
> > foo(array(1:4, c(1, 4, 1)))
>
> I think its good enough to just define an array method, i.e. you
> don't need the matrix method or the matrixOrArray class, and the
> vector method can call foo(matrix(A,1), ...) so:
>
> setGeneric("foo",
>   function(A, ...) {
>   cat("generic", match.call()[[1]], "\n")
>   standardGeneric("foo")
>   })
>
> setMethod("foo",
>  signature(A = "array"),
>  function(A, ...) {
>  cat("A =", A, "\n")
>  })
>
> setMethod("foo",
>  signature(A = "vector"),
>  function(A, ...) {
>  foo(matrix(A, nrow = 1), ...)
>  })

Something didn't seem right here. That was pretty close
to what I had started with, before trying to go the
classUnion route. Matter of fact, the vector method can
retain use of callGeneric.

The solution has to do with the order in which calls to
setMethod are made. Adding foo-vector after foo-array
works fine; the other way around causes infinite recursion.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] S4 method dispatch matrixOrArray

2006-04-12 Thread Paul Roebuck
I have some code where the primary dispatching is on
other parameters so I'd like not to have to create a
set of functions for "matrix" and another duplicate
set for "array". But the class union technique isn't
working as implemented below and I don't have my Green
book with me. How do I fix my infinite recursion problem?


##
library(methods)

setGeneric("foo",
   function(A, ...) {
   cat("generic", match.call()[[1]], "\n")
   standardGeneric("foo")
   })

setMethod("foo",
  signature(A = "vector"),
  function(A, ...) {
  callGeneric(matrix(A, nrow = 1), ...)
  })

setClassUnion("matrixOrArray", c("matrix", "array"))

setMethod("foo",
  signature(A = "matrixOrArray"),
  function(A, ...) {
  cat("A =", A, "\n")
  })

## Test
foo(1:4)
foo(matrix(1:4, 1, 4))
foo(array(1:4, c(1, 4, 1)))

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Indexing With List Of Vectors (Replacement)

2006-04-06 Thread Paul Roebuck
I have the following:

> a <- matrix(1:10, nrow = 2, byrow = TRUE)
> b <- array(as.integer(0), c(7, 5))
> idx <- list()
> length(idx) <- 2
> dim(idx) <- c(1, 2)
> idx[[1]] <- as.integer(1:2)
> idx[[2]] <- as.integer(1:5)

I can do the following, which works if 'b' is a matrix.

> b[idx[[1]], idx[[2]]] <- a
> b
 [,1] [,2] [,3] [,4] [,5]
[1,]13579
[2,]2468   10
[3,]88888
[4,]88888
[5,]88888
[6,]88888
[7,]88888

Looking for a way to do this generically such that 'idx'
with 'n' length can be used to index n-dimensional arrays.

b[<<>>] <- a

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] do.call method within namespace

2006-04-02 Thread Paul Roebuck
How does one go about invoking a method within a namespaced
package if that package has not been loaded via library
method?

Given "mypackage" and method "foo" within:
mypackage::foo(1, 2, 3)

Executing the same method's function call:
do.call("foo", list(1, 2, 3))

didn't work. Nor did the following:
do.call("mypackage::foo", list(1, 2, 3))

There some other means to do this without loading the
package via library method?

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Disable LazyLoading mechanism completely

2006-04-02 Thread Paul Roebuck
On Sat, 1 Apr 2006, Duncan Murdoch wrote:

> On 3/31/2006 6:03 PM, Paul Roebuck wrote:
> > On Fri, 31 Mar 2006, Duncan Murdoch wrote:
> >
> >> On 3/31/2006 5:15 PM, Paul Roebuck wrote:
> >>> Is there a global option somewhere that can completely
> >>> disable the LazyLoad option? I want all my packages
> >>> in source format for searching purposes, crippled by
> >>> the conversion to database format.
> >> Why not just keep the source?  Maybe I misunderstood where
> >> you're thinking of searching, but I think even without
> >> LazyLoad, you'll lose comments in the functions.
> >
> > My thought is something along the lines of
> >
> > options(lazy.load = FALSE)
> >
> > which would override the setting in the DESCRIPTION file
> > as though every package had set it as:
> >
> > LazyLoad: no
> >
> > I want the ability to patch/search the code by default.
> > LazyLoad removes this capability. I know there will be a
> > minor speed hit and accept that in exchange for the above
> > capability.
>
> Lazy loading just replaces each object with a promise to
> load it, right? So if you need to do a search/patch,
> couldn't you force those promises during the search?

As far as searching, think outside the bun - grep, mdfind.
Patching-wise, used to be able to just correct .R
and try again, which no longer exists as a compilation of
the R source files from the package in text format. Much
faster development-wise than constantly reinstalling the
package.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Disable LazyLoading mechanism completely

2006-04-01 Thread Paul Roebuck
On Sat, 1 Apr 2006, Prof Brian Ripley wrote:

> On Fri, 31 Mar 2006, Dirk Eddelbuettel wrote:
>
> > On 31 March 2006 at 16:15, Paul Roebuck wrote:
> > | Is there a global option somewhere that can completely
> > | disable the LazyLoad option? I want all my packages
> > | in source format for searching purposes, crippled by
> > | the conversion to database format.
> >
> > AFAICT setting LazyLoad=No in DESCRIPTION might do the trick.
> >
> > For reasons I fail to understand I have to set it to that value for Debian
> > builds of the Rcmdr package, and the resulting package does indeed have R
> > code as plain sources. I'd agree with you that being able to read, and hence
> > search, the code is a good thing but I also trust the R masters on the
> > advantages of lazy loading.  There may be an option to diable it globally 
> > ...
>
> Quite a large number of packages (including almost all using S4 methods)
> *do not work* without lazyloading or saved images.  So this option would
> just break other people's work.

Can you elaborate a bit on this statement? S4 predates
LazyLoad and used to work just fine before that mechanism
was introduced. Indeed, several of my own packages have S4
methods and work with neither LazyLoading nor saved images.
Should that be read as "since package authors made one-way
changes to support LazyLoad"? Is there some way to tell
whether a package can do without it?

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Disable LazyLoading mechanism completely

2006-03-31 Thread Paul Roebuck
On Fri, 31 Mar 2006, Duncan Murdoch wrote:

> On 3/31/2006 5:15 PM, Paul Roebuck wrote:
> > Is there a global option somewhere that can completely
> > disable the LazyLoad option? I want all my packages
> > in source format for searching purposes, crippled by
> > the conversion to database format.
>
> Why not just keep the source?  Maybe I misunderstood where
> you're thinking of searching, but I think even without
> LazyLoad, you'll lose comments in the functions.

My thought is something along the lines of

options(lazy.load = FALSE)

which would override the setting in the DESCRIPTION file
as though every package had set it as:

LazyLoad: no

I want the ability to patch/search the code by default.
LazyLoad removes this capability. I know there will be a
minor speed hit and accept that in exchange for the above
capability.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Disable LazyLoading mechanism completely

2006-03-31 Thread Paul Roebuck
Is there a global option somewhere that can completely
disable the LazyLoad option? I want all my packages
in source format for searching purposes, crippled by
the conversion to database format.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Reset R's temporary directory automatically

2006-03-31 Thread Paul Roebuck
I have run into this several times now. I leave a copy of
R running for days at a time. At some point in time, the
temporary directory R uses no longer exists. Once that
happens, installs (and other basic operations) stop
functioning. Currently I recreate the directory manually
by failing some basic operation and recreating the directory
specified in the error message.

How can I get R to reset its current temporary directory
setting without my intervention?


> version
 _
platform powerpc-apple-darwin7.9.0
arch powerpc
os   darwin7.9.0
system   powerpc, darwin7.9.0
status   Patched
major2
minor2.1
year 2006
month02
day  23
svn rev  37423
language R

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Branching, depending upon operating system

2006-03-31 Thread Paul Roebuck
On Fri, 31 Mar 2006, Frank Rossdeutscher wrote:

> From my current code, I need to call either a batch
> file or shell script, depending on what operating system
> R is running. But before that I need to find out, whether
> the machine is running Windows or Linux. I found the
> "getBuiltinOs()" command in the utils package, but I cant
> get it to work. It really shouldn`t be difficult, but how
> can I do an if-branch using that (or a different) command?

system(if (.Platform$OS.type == "windows") {
   "myscript.cmd"
   } else {
   "myscript.sh"
   })

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Recall for parent

2006-03-29 Thread Paul Roebuck
What's the best way to simulate Recall for parent function?
Consider this one-time recursive code:

alwaysEven <- function(x) {
handleOdd <- function(x) {
alwaysEven(x-1)# use Recall-like here
}

return(if (x %% 2) handleOdd(x) else x)
}
any2even <- alwaysEven
rm(alwaysEven)
any2even(3)

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to clear screen in R-console?

2006-02-17 Thread Paul Roebuck
On Thu, 16 Feb 2006, Henrik Bengtsson wrote:

> On 2/16/06, Michael <[EMAIL PROTECTED]> wrote:
>
> > On 2/16/06, Christian Schulz <[EMAIL PROTECTED]> wrote:
> > >
> > > >How to clear the screen in R-console?
> > >
> > > ctrl - e & l
> >
> > Any funcation that is callable from my program, instead of
> > pressing keys?
>
> depends on what type of terminal you are running.  For example, if you
> run R in a VT100 terminal, you can try
>
> cat("The following VT100 escape sequence will clear the screen on a
> VT100 terminal\n")
> cat("\033[2J")  # [2J  == Clear Screen
> cat("If the screen was cleared you should only see this sentence.\n")
>
> i.e.
>
> vt100ClearScreen <- function(...) cat("\033[2J")
>

On my terminal, this required the addition of cursor homing
to replicate the effects of using the OS to clear the screen.

system_cls <- function() system("clear")
vt100_cls  <- function() cat("\033[2J\033[H")

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problem with scoping a variable value

2006-02-16 Thread Paul Roebuck
On Thu, 16 Feb 2006, Tolga Uzuner wrote:

> I have a function which has a variable called show as an input:
>
> richardson.grad <- function(func, x, d=0.01, eps=1e-4, r=6, show=F){
> # do some things
>if(show) {
>
> cat("\n","first order approximations", "\n")
> print(a.mtr, 12)
>
>
> }
> #do more things and return
> }
>
> The show variable is being used as a flag to show intermediate results.
>
> Interestingly enough, I have downloaded a package recently which defines
> the show variable as a function:
>
>  > show
> standardGeneric for "show" defined from package "methods"
>
> function (object)
> standardGeneric("show")
> 
> Methods may be defined for arguments: object
>
>  >
>
> Now, all of a sudden, the function I had defined earlier is scoping up
> to this new value, and is thus not working:
>
>  > richardson.grad(function(x) x^2,2)
> Error in if (show) { : argument is not interpretable as logical
>  >
>
> I could always redefine show in richardson.grad to be something else but
> something seems wrong: why is richardson.grad not looking up show's
> value in the  function ? How would I fix this ?

You didn't spell out the logical value 'FALSE' which may
be causing your problem. Consider this alternative also...

richardson.grad <- function(func,
x,
d = 0.01,
eps = 1e-4,
r = 6,
verbose = getOption("verbose")) {
## do some things
if (verbose) {
 cat("\n", "first order approximations:", "\n")
 print(a.mtr, 12)
}
## do more things and return
}

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] [REQ] Equivalent INSTALL cmdline option

2006-01-24 Thread Paul Roebuck
Would R-Core entertain adding the more proper (-L) option
as an equivalent to the existing (-l) option for INSTALL
script so it would match other utilities (like cc) for
specifying directories?

$ R CMD INSTALL -L  

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] R Commenting Style

2006-01-19 Thread Paul Roebuck
I seem to remember reading somewhere about some style
guide regarding R the number of comment characters (#)
prior to the comment meaning something.

Anyone know to what I'm referring? Where?

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] suppress tick labels

2005-12-01 Thread Paul Roebuck
On Thu, 1 Dec 2005, Sebastian Leuzinger wrote:

> is R able to suppress tick labels (not tick marks)? i
> know there is a way around this with axes=F and then
> draw new axes, but it would be easier to suppress them
> in the first place.

Something wrong with setting them to null string?

> plot(rnorm(20), xlab="", ylab="")

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Fwd: Matrix rotation

2005-11-28 Thread Paul Roebuck
On Thu, 24 Nov 2005, Benjamin Lloyd-Hughes wrote:

> Ok I warned you that I'd been drinking! What I really meant was
> something to go from:
>
>   [,1] [,2]
> [1,]12
> [2,]43
>
> to
>
>   [,1] [,2]
> [1,]41
> [2,]32
>
> to
>
>   [,1] [,2]
> [1,]34
> [2,]21
>
> to
>
>   [,1] [,2]
> [1,]23
> [2,]14
>


Another possible solution...

> library(matlab)
> x <- matrix(c(1,2,4,3), nrow=2, byrow=TRUE)
> x
 [,1] [,2]
[1,]12
[2,]43
> matlab::rot90(x, 3)
 [,1] [,2]
[1,]41
[2,]32
> matlab::rot90(x, 2)
 [,1] [,2]
[1,]34
[2,]21
> matlab::rot90(x, 1)
 [,1] [,2]
[1,]23
[2,]14

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to run R in batch mode

2005-11-18 Thread Paul Roebuck
On Fri, 18 Nov 2005, Beatriz wrote:

> Paul Roebuck wrote:
>
> >On Fri, 18 Nov 2005, Beatriz wrote:
> >
> >>I want to run R in batch mode but it doen't work (Error: syntax error)
> >>
> >>[SNIP]
> >>
> >>I don't know what is wrong. Could you help me, please?
> >
> >Isn't it possible that it is working just fine and you really
> >do have a syntax error in your R source file (better named
> >as 'test.R') instead?
>
> I've only wirtten
> library(limma)
> in my "test.txt" file and I've tried with test.R and test.r too

Try the following:

$ cat > hello.R
cat("hello, world", "\n")

$ R CMD BATCH hello.R hello.Rout
$ cat hello.Rout

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to run R in batch mode

2005-11-18 Thread Paul Roebuck
On Fri, 18 Nov 2005, Beatriz wrote:

> I want to run R in batch mode but it doen't work (Error: syntax error)
>
> I've found this in R help:
> R CMD BATCH [options] infile [outfile]
>
> I have tried differents commands:
> (I have been working in the same directory I have "test.txt" file and
> "test2.txt" would be the output file)
>
>  > R CMD BATCH test.txt
>
> [SNIP additional tries]
>
> I don't know what is wrong. Could you help me, please?

Isn't it possible that it is working just fine and you really
do have a syntax error in your R source file (better named
as 'test.R') instead?

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] sibling list element reference during list definition

2005-11-11 Thread Paul Roebuck
Can the value of a list element be referenced from a
sibling list element during list creation without the use
of a temporary variable?

The following doesn't work but it's the general idea.

> list(value = 2, plusplus = $value+1)

such that the following would be the output from str()

List of 2
 $ value   : num 2
 $ plusplus: num 3

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Tcl/tk [for Mac OS X]

2005-11-02 Thread Paul Roebuck
On Tue, 1 Nov 2005, Sokol Haxhinasto wrote:

> I recently installed the R (the most recent) and Bioconductor on my
> computer.
> I installed the packages in "affy", the affyGui and the limmaGui on my
> computer and they all appear in the Load Package window.
> After trying to load the affyGui or the limmaGui packages I receive the
> following message entitled: "Tcl/Tk Extension(s) Not Found"-
>
> limmaGUI requires the Tcl/Tk extensions, BWidget and Tktable.
> You must have Tcl/Tk installed on your computer, not just the minimal
> Tcl/Tk installation which comes with R (for Windows).  If you do have
> Tcl/Tk installed, including the extensions (e.g. using the ActiveTcl
> distribution in Windows), make sure that R can find the path to the Tcl
> library, e.g. C:\Tcl\lib (on Windows) or /usr/lib (on Linux/Unix) or
> /sw/lib on Mac OSX.
>
> Any suggestions.
> Also I am trying to get the R.app installed and run on my mac, and am not
> successful.



--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problems with dyn.load()

2005-11-01 Thread Paul Roebuck
On Tue, 1 Nov 2005, Marcelo Damasceno wrote:

> Is there some function that returns the directory where
> the libraries of the instaled package are? Because in
> Mandrake, R installs in /usr/lib/R/library/pack/libs, and in
> Debian it installs in /usr/local/lib/R/library/pack/libs.

?system.file

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R.app window size

2005-10-10 Thread Paul Roebuck
On Mon, 10 Oct 2005, Jason Horn wrote:

> This is a question for any of you who use R.app (OS X).  Is there any
> way to resize the quartz plot window from within R?  I know that you
> can resize the window by dragging the corner of the window, and fro
> the preferences panel.  But is there a way to specify the window size
> from the console?  I want to specify the size of the plot window from
> inside an R function.

You had a problem with the width & height arguments?
Probably best to use device independent method for scripting.

grdev <- function(...) {
get(getOption("device"))(...)
}

grdev(width = 7.8, height = 5.8)
#quartz(width = 7.8, height = 5.8)


--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] sscanf equivalent

2005-10-09 Thread Paul Roebuck
On Fri, 7 Oct 2005, Prof Brian Ripley wrote:

> On Fri, 7 Oct 2005, Paul Roebuck wrote:
>
> > I have a data file from which I need to read portions of
> > data but data location/quantity can change from file to file.
> > I wrote some code and have a working solution but it seems
> > wasteful to have to do it this way. Here's the contrived
> > incomplete code.
> >
> >datalines <- readLines(datafile.pathname)
> ># marker will appear on line preceding and following
> ># actual data
> >offset.data <- grep("marker", datalines)
> >datalines <- NULL
> >
> ># grab first column of each assoc dataline
> >data <- scan(datafile.pathname,
> > what = numeric(0),
> > skip = offset.data[1],
> > nlines = offset.data[2]-offset.data[1]-1,
> > flush = TRUE,
> > multi.line = FALSE,
> > quiet = TRUE)
> ># output is vector of values
> >
> > Originally wrote code to parse data from 'datalines'
> > using sub and strsplit methods but it was woefully slower
> > and more complex than using scan method. What is desired
> > is a means of invoking method like scan but with existing
> > data instead of filename.
>
> Why not use a text connection?

I tried that but result was far slower than the method above.

R> file.info(datafile.pathname)$size
[1] 944850
R> system.time(datalines<-readLines(datafile.pathname), TRUE)[3]
[1] 0.59
R> length(datalines)
[1] 67931
R> system.time(tconn<-textConnection(datalines), TRUE)[3]
[1] 52.97

Once a textConnection object was created, the scan method
invocation using it took less than half the time of the
corresponding filename-based invocation. Problem is that
this was only taking a second to perform the scan using
the filename-based invocation. And since grep method doesn't
accept textConnection as argument, I still require the
otherwise unused 'datalines' variable and its associated
memory. Even if grep supported such, the timing increased
even more not having the variable.

R> system.time(tconn<-textConnection(readLines(datafile.pathname)), TRUE)[3]
[1] 66.61


Any other thoughts?


# R version 2.1.1, 2005-06-20, powerpc-apple-darwin7.9.0

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] sscanf equivalent

2005-10-07 Thread Paul Roebuck
I have a data file from which I need to read portions of
data but data location/quantity can change from file to file.
I wrote some code and have a working solution but it seems
wasteful to have to do it this way. Here's the contrived
incomplete code.

datalines <- readLines(datafile.pathname)
# marker will appear on line preceding and following
# actual data
offset.data <- grep("marker", datalines)
datalines <- NULL

# grab first column of each assoc dataline
data <- scan(datafile.pathname,
 what = numeric(0),
 skip = offset.data[1],
 nlines = offset.data[2]-offset.data[1]-1,
 flush = TRUE,
 multi.line = FALSE,
 quiet = TRUE)
# output is vector of values

Originally wrote code to parse data from 'datalines'
using sub and strsplit methods but it was woefully slower
and more complex than using scan method. What is desired
is a means of invoking method like scan but with existing
data instead of filename.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Library error when using R CMD check

2005-10-03 Thread Paul Roebuck
On Mon, 3 Oct 2005, Ken Termiso wrote:

> I've got a library I'm trying to build, and am having an error on R CMD
> check...
>
> The source is fine, and the script runs OK, but during the script test
> execution it downloads a library from an online repository, which goes fine
> and it says that installation was successful...
>
> However, after it installs the library OK, it then cannot find it (despite
> it being installed properly in the R installation even before I ran R CMD
> check)...it is looking in the working directory's .Rcheck folder, and halts
> because it cannot find it there...
>
> I'm not sure at all what I'm sup'd to do...?? Is there a way for me to tell
> R CMD check to only look for installed libraries in another place?

This help any?

$ R_LIBS=
$ env R_LIBS=$R_LIBS R CMD check 

Note that the first line would normally corespond to the
entry of the same name in your <~/.Renviron> file. In the case
of Mac OS X, it should normally be:

R_LIBS=~/Library/R/library

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Y-Axis Label Overwritten By TickMark Values

2005-10-01 Thread Paul Roebuck
On Sat, 1 Oct 2005, Marc Schwartz wrote:

> On Sat, 2005-10-01 at 06:07 -0500, Paul Roebuck wrote:
>
> > Can someone tell me how to fix the left margin of plot region
> > such that the tick values don't overwrite the x-axis label?
> > I haven't been able to set the correct par option to fix this...
>
> This is the Y axis label, not the X axis.

Oops. I'd been up all night...

> Set par("mar") prior to creating the plot to increase the left
> hand margin space and then use mtext() rather than title() to
> move the Y axis label further left by using the 'line' argument.
>
> [SNIP code]
>
> See ?par and ?mtext for more information.

What a black art. Pray tell where you learned this that I
may study there as well. In at least one of my prior attempts,
I had used par("mar") but hadn't realized that title(ylab)
would have to be changed; it just didn't seem (to me anyway)
like wanting to display slightly larger numbers as tickmark
values would have required using other low-level plot commands.

After about a hour of trying different options, I found myself
really wanting to use the "R Plot Wizard(TM)" that lets you
interactively set the LAF of the plot, then generates the
appropriate R code to make it so.

> BTW, I would not use 'tcl = 0.3' which, as a positive value,
> places the tick marks themselves within the plot region.
> That's contrary to typical guidance, since the tick marks
> get lost in this plot and more importantly, can overwrite
> data points in certain plot types.

Was emulating Matlab's plot output and that's how it places
tickmarks (for better or worse). I actually needed to place
tickmarks on all sides but hadn't found that option yet.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] X-Axis Label Overwritten By TickMark Values

2005-10-01 Thread Paul Roebuck
Can someone tell me how to fix the left margin of plot region
such that the tick values don't overwrite the x-axis label?
I haven't been able to set the correct par option to fix this...

TIA


grdev <- function(...) {
get(getOption("device"))(...)
}

plotFixMe <- function(spectrum, ...) {
saved.par <- par(las = 1, tcl = 0.3)
on.exit(par(saved.par))

plot(spectrum,
 type = "l",
 col  = "blue",
 xlab = "",
 ylab = "",
 ...)
title(main = "x-axis label overwritten by tick values",
  xlab = "Index",
  ylab = "Intensity")
}

grdev()
plotFixMe(rnorm(50)*2, ylim = c(0, 5))

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Use of contains in S4 classes

2005-08-18 Thread Paul Roebuck
On Thu, 18 Aug 2005, Ross Boylan wrote:

> setClass("B", representation=representation("B", extra="numeric))
> setClass("B", representation=representation(extra="numeric"),
>   contains="B")
> Are these the same?  If not, how do they differ?
>
> What about
> setClass("B", representation=representation("B", extra="numeric"),
>   contains="B")
> ?
>
> As far as I can tell, the Green Book doesn't talk about a contains
> argument to setClass.

"S4 - Composition and Inheritance" by Witold Eryk Wolski
(a.k.a. Extending.pdf) might be what you're looking for.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Compilation failures: mgcv, spatstat, Matrix, cluster

2005-08-13 Thread Paul Roebuck
On Sat, 13 Aug 2005, Michael Kubovy wrote:

> With Version 2.1.1  (2005-06-20) on Power Mac G5 running Mac OS X
> 10.4.2 (8C46):
>
> Some compilations work (e.g., MatchIt, RGraphics, Zelig), and some
> don't, e.g., mgcv, spatstat,  and the following (Matrix, cluster):
>
> trying URL 'http://www.ibiblio.org/pub/languages/R/CRAN/src/contrib/
> Matrix_0.98-3.tar.gz'
> Content type 'application/x-tar' length 626712 bytes
> opened URL
> ==
> downloaded 612Kb
>
> * Installing *source* package 'Matrix' ...
> ** libs
>
> The downloaded packages are in
>  /private/tmp/RtmpPddsAE/downloaded_packages
> gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/
> include  -I/usr/local/include  -I./Metis -fno-common  -g -O2 -c
> HBMM.c -o HBMM.o
> In file included from HBMM.c:2:
> iohb.h:6:19: malloc.h: No such file or directory
> make: *** [HBMM.o] Error 1
> ERROR: compilation failed for package 'Matrix'

Didn't check package for actually functioning correctly,
but the following changes will allow compilation on OS X
10.3. In ANSI C, the standard memory allocation routines
are declared in ;  is obsolete for that
purpose and isn't guaranteed to exist.


Matrix/src/mmio.c:
Add #include 
Remove #include 

Matrix/src/iohb.h:
Remove #include 

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] signal handling

2005-08-12 Thread Paul Roebuck
On Fri, 12 Aug 2005, Paul Gilbert wrote:

> Omar Lakkis wrote:
>
> > Is ther a signal handling model in R? similar to Perl's
> > %SIG hash. I want to do fast clean up in my R code before
> > exit when a kill signal is issued.
>
> I'm not sure about perl's signals, but Unix signals can be
> passed with
>  q("yes/no", status=whatever)
> See ?q.  This is pretty useful for passing signal to make,
> for example.

That's a return code though, not a signal.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Dating Objects

2005-08-12 Thread Paul Roebuck
On Fri, 12 Aug 2005, Jason Skelton wrote:

> I'm trying to carryout the equivalent of ls -l in R
> to give some date/time label to each of my objects
>
> If the case is that there is no equivalent, is it
> possible to list all objects in an environment that
> share a common component so that the common component
> is also displayed?
>
> I'm attempting to do the following
>
> object$time <- Sys.time()
>
> for every object i've created which although tedious
> appears to work
>
> However I've no idea how if it is possible to list all
> the objects by $time or extract the object name & $time
> from all objects simultaneously so I can compare them.

Not really following why you want to do this so it's
hard to suggest something. Were you attempting to track
mtime or ctime?

Perhaps instead you could describe the larger problem
you're trying to solve so there's more context to work
with.

> Or am I just wasting my time?

Most of us probably are...

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] signal handling

2005-08-11 Thread Paul Roebuck
On Thu, 11 Aug 2005, Omar Lakkis wrote:

> Is ther[sic] a signal handling model in R? similar to
> Perl's %SIG hash. I want to do fast clean up in my R
> code before exit when a kill signal is issued.

You may find on.exit() somewhat useful for cleanup
but signals are not propogated to your code by the
R environment.

?Signals (on Unix-based platforms) mentions that SIGUSR2
will bypass the above; no idea about Windows.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] question on creating a new logical variable

2005-08-11 Thread Paul Roebuck
On Thu, 11 Aug 2005, Renuka Sane wrote:

> I have two variables.
> A <- rep(c(1:9), 2)
> B <- rep(c(2:10),2)
>
> I want to know the the value for
> A==1 and B==1
>
> [SNIP]
>
> To solve the problem I therefore create a new variable
> C <- c(A, B)
> and then do table(C==1) which gives me
> FALSE TRUE
> 34 2
>
> Is there a way to do this without making the new variable C?

You mean something besides not explicitly creating it?

table(c(A, B) == 1)

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to use the function from another package

2005-08-09 Thread Paul Roebuck
On Tue, 9 Aug 2005, Peter Yang wrote:

> I am trying to write a package(A) for myself and need to use a
> function from another package(B) which is in R already(need to install
> it before use). Could anyone tell me how to implement that? Also I
> hope that my package gives an ERROR message(something like "STOP,
> please install package B first") if the package B is not installed
> yet.  It is my first time to write a package. Thanks very much for
> your help.

In your package's DESCRIPTION file, you should have an entry
that lists your package dependencies. Simply add the other
package there as well.

For example, to support the current version of R and a
package named foo, the entry would look like this:

Depends: R (>= 2.1.1), foo

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] SJava linux installation problems

2005-08-05 Thread Paul Roebuck
On Fri, 5 Aug 2005, Dhiren DSouza wrote:

> I am extremely new to linux so bare with the questions.  I am
> trying to install the SJava package for R on linux (debian).
>
> I issue the R CMD INSTALL SJava_0.68-0.tar.gz and get the
> following error
>
> Cannot find Java.
> Please set your path to include the directory in which the
> java executable resides, or set the environment variable
> JAVA_HOME before this configure script is run.
>
> I have j2sdk1.4.2_08 installed and I am assuming that the I
> need to set the environment variable JAVA_HOME to its path,
> so I did the following
>
> export JAVA_HOME=/usr/local/j2sdk1.4.2/j2sdk1.4.2_08/bin/

Remove '/bin/' from the environment variable path as
JAVA_HOME should point to the directory containing the
'bin' subdirectory. Best practice is NOT to include the
trailing slash of directory name in the value for an
environment variable.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Turning off return warning messages.

2005-07-19 Thread Paul Roebuck
On Wed, 20 Jul 2005, Steve Su wrote:

> Is there a way I can turn off the following warning message
> for using multi-argument returns?
>
> multi-argument returns are deprecated in: return(p1, p2, p3, p4)

doubleEm <- function(p1, p2, p3, p4) {
return(list(p1 = p1*p1,
p2 = p2*p2,
p3 = p3*p3,
p4 = p4*p4))
}

res <- doubleEm(1, 2, 3, 4)
cat("p3 =", res$p3, "\n")

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Installing packages, again

2005-04-25 Thread Paul Roebuck
On Mon, 25 Apr 2005, Tyler Smith wrote:

> I've just uninstalled R2.01 and installed the new R2.10 on my WindowsXP
> machine. I then attempted to install the vegan package from source
> files, as I learned to do last week, with the help of some of you. I
> have updated my path variable to the new R directory (R/rw2010/bin
> instead of R/rw2001pat/bin), and I've still got the HTMLHelpWorkshop
> files installed, as well as Perl and the MinGW compiler. I didn't change
> anything in those files, and everything is stored in directories without
> spaces in the name. I had trouble with the install, so I deleted the
> rtools folder and reinstalled it.
>
> Still, the package won't install. Following R CMD INSTALL vegan I get
> the error: "no rule to make target 'C:/R/rw2001pat/include/R.h', needed
> by 'goffactor.o'. Stop." So it looks like I've still got something
> pointing to the old rw2001pat directory, instead of the new rw2010
> directory. Can anyone tell me what I've overlooked? I have also gone
> into Mkrules and updated all the paths that I could.

Create a file in the 'vegan' package directory named
'.Rbuildignore' and add the text 'Makedeps' on a line by
itself. See if that fixes your problem. You're picking up
the dependencies from previous version's last compilation.
You could also delete this file since it'll be recreated
anyway. IMO, the file 'Makedeps' should be added to the list
of files R ignores by default.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] write a library under 2.0.1 version

2005-03-01 Thread Paul Roebuck
On Tue, 1 Mar 2005, Prof Brian Ripley wrote:

> On Tue, 1 Mar 2005 [EMAIL PROTECTED] wrote:
>
> > I had written a library under R 1.9.0 and now I would like to import that
> > library under R 2.0.1
> > Apparently it does not work; I can install the package, but when I try to
> > read it the error is the following:
> >
> > Error in library(compvar) : 'compvar' is not a valid package -- installed
> > < 2.0.0
> >
> > [SNIP]
>
> You install the package with R CMD INSTALL, just as was documented for
> 1.9.1.  See the `Writing R Extensions' and `R Installation and
> Administration' manuals.

Out of curiousity, just how often has the package installation
compatibility between versions been an issue? Would it perhaps
be beneficial to version personal directories by major version?
I.e. instead of having just "~/R/library", would it be better
to have "~/R/1.x/library" and "~/R/2.x/library" and have the
.Rprofile select appropriately depending on version of R being
executed? If so, maybe this question would cease to be an issue.

I'd be interested to know how Prof. Ripley's R_LIBS variable
is defined, if he wouldn't mind sharing. Also curious if most
people keep BioConductor packages installed separately in a
third location.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] dumping the summary of lm to a text file

2005-02-17 Thread Paul Roebuck
On Thu, 17 Feb 2005, Adrian Dragulescu wrote:

> I have a linear regression
>
>  ctl<- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
>  trt<- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
>  group  <- gl(2,10,20, labels=c("Ctl","Trt"))
>  weight <- c(ctl, trt)
>  reg<- lm(weight ~ group)
>
>  sreg   <- summary(reg)
>
> and I would like to dump exactly what I see on the console with
> print(sreg) to a text file.  I've tried using cat but it did not work.
> I've read the list questions but I did not see a solution.

outfile <- file("regsumm.out", "w")
capture.output(summary(reg), file=outfile)
close(outfile)

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Strange parsing behavior of an else condition

2005-02-07 Thread Paul Roebuck
On Tue, 8 Feb 2005, Christian Lederer wrote:

> can anybody explain the reason, why the first piece of code
> below gives a parsing error, while the other two variations
> work?
>
> # Gives a parsing error
> x <- 1
> if (x < 0)
>   {
> y <- 1
>   }
> else # Error occurs at this line
>   {
> y <- -1
>   }
>
>
> # This works
> x <- 1
> {
>   if (x < 0)
> {
>   y <- 1
> }
>   else
> {
>   y <- -1
> }
> }
>
> # This works too
> x <- 1
> if (x < 0)
>   {
> y <- 1
>   } else
>   {
> y <- -1
>   }
>

help("if")

In the first case, the if expression is complete prior to
the else, hence the error. The second case completes since
the outer enclosing brace has not been processed. The third
case completes since the else is on the same line as brace
closing if expression and else expression not yet processed.

There may also be issues whether you're running interactively
or not. Recommend not using Whitesmith style brace formatting
with R or S-plus. IMO, the following formatting style works
best:

sety <- function(x) {
if (x < 0) {
y <- 1
} else {
y <- -1
}
}

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Rmatlab

2005-02-07 Thread Paul Roebuck
On Mon, 7 Feb 2005, David Enot wrote:

> I came across recently to the Rmatlab package
> (http://www.omegahat.org/RMatlab/) that allows R and Matlab
> to "talk" to each other. I made several attempts to install
> it on my Mac but without any success as some headers seem
> to miss. I am just wondering if anyone has already tried
> and successfully used RMatlab. According to the website,
> this should run on unix machines and I was surprised that
> it couldn't be true for Mac as the OS X, Linux and Unix
> MATLAB architectures are pretty much similar.

Pretend we can't see your screen and include the error messages
in your post. Can we assume you are running 10.3.7 and have
XCode 1.5 loaded as well?

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Uninstalling R from Mac OS X

2005-02-03 Thread Paul Roebuck
On Thu, 3 Feb 2005, Christofer Ecklund wrote:

> Could you tell me how to uninstall R from Mac OS X (10.3)?  I am not
> too familiar with terminal or the command line so a GUI removal would
> be better, however I would like to remove every trace of the program
> from my system.  Usually with a package installer there is some sort of
> uninstaller included, but I could not find it.  I have read the
> documentation but could not identify a GUI uninstaller.

No, most OS X packages do not provide an uninstaller.
You can find out what got installed via installer by
viewing the bill of materials files as such:

$ lsbom /Library/Receipts/R-GUI.pkg/Contents/Archive.bom
$ lsbom /Library/Receipts/R\ framework.pkg/Contents/Archive.bom

Toss the following in the trash from the Finder:
/Applications/R.app
/Library/Frameworks/R.framework
~/Library/R/  (if it exists)

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Re: [Rd] Typo in 'R Language Definition'

2005-01-31 Thread Paul Roebuck
On Mon, 31 Jan 2005, Prof Brian Ripley wrote:

> On Sun, 30 Jan 2005, Paul Roebuck wrote:
>
> > Section 3.5.3 The call stack (pg 23 of R-lang.pdf)
> > ...the computation the the currently active environment...
> >   ^^^
>
> Which version of R is this?  I think it has been corrected a
> while ago in R-patched and R-devel.  Do see the posting guide...

version 2.0.1 (2004-11-15) DRAFT
If it has been corrected, the changes never made it to the
web site.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] type of list elements in .Call

2005-01-30 Thread Paul Roebuck
On Mon, 31 Jan 2005, Faheem Mitha wrote:

> [SNIP]
> as I would expect. I thought that if the vectors in the list could be
> regarded as integer vectors, they would be, but apparently not. Is there
> any way I can tell R to regard them as integer vectors?

.Call("printlst", list(as.integer(c(1,2)),
   as.integer(c(3,4)))

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Startup Files (RProfile) and R-Aqua

2005-01-30 Thread Paul Roebuck
On Sun, 30 Jan 2005, Thomas Hopper wrote:

> I'm having some difficulty understanding the documentation relative to
> the startup files with R-Aqua 2.0.1 for Mac OS X.
>
> Specifically, I'm wondering: where does R search for the startup files
> (my home directory at Users::?); how should they be named
> (.RProfile will be treated by Mac OS X as a system file and be hidden,
> so I'm wondering if it should just be RProfile)? I can't find this
> platform-specific information in any of the documentation.

Should be "$HOME/.Rprofile" for user-level default setting and
will be hidden by Finder. It's not something you're going to be
changing daily anyway and can be modified using TextWrangler's
'Open Hidden..." menu option by non-Terminal users.

This is not platform-specific and is described in Appendix B of
'Introduction to R' (pg 85 of R-intro.pdf).

> As a related issue, where would I store my home-grown functions?
> Would .RProfile be a good place to keep them?

I keep .First and .Last and a couple functions that pose as
typing shortcuts in ".Rprofile". Anything else I source an
external file..

Create a subdirectory under "~/Library/R" and store functions
there if nowhere else makes sense.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Rinternals.h and iostream don't play nice together'

2005-01-30 Thread Paul Roebuck
On Sun, 30 Jan 2005, Faheem Mitha wrote:

> Consider the following file.
>
> ***
> foo.cc
> ***
> #include 

and if you use the following instead of "Rinternals.h"?
extern "C" {
#include 
}

> #include 
> #include 
> ***
>
> R CMD SHLIB foo.cc
>
> gives scads of errors. I've use C++ extensively with R before (using C
> linkage) but not with Rinternals.h. I'm puzzled. The errors make no sense
> to me. Am I doing something wrong? Is it impossible to use iostream here
> for some reason?
> [SNIP lots of error messages]

'Course I'm assuming you read that part in the 'R-exts.pdf'
about using C++ iostreams with R being best avoided? If you
really need to do so anyway, I'll give you a link to my iostream
manipulator source that interfaces with the R console. It handles
the scenario described in section 4.6 of above document but
requires the GNU C++ compiler (g++) in order to work though.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Error: cannot allocate vector of size... but with a twist

2005-01-27 Thread Paul Roebuck
On Fri, 28 Jan 2005, James Muller wrote:

> I have a memory problem, one which I've seen pop up in the list a few
> times, but which seems to be a little different. It is the Error: cannot
> allocate vector of size x problem. I'm running R2.0 on RH9.
>
> [SNIP]
>
> R chews up memory up until the 3.5Gb area, then halts. Here's the last
> bit of output:
>

32-bit addressing goes to ~4Gb.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] an R script editor for Mac

2005-01-24 Thread Paul Roebuck
Jacques VESLOT wrote:

> Could someone please make me know if there is a nice script editor available
> under Mac, similar to Crimson, that offers R syntax highlighting (and pairs
> of parentheses underlining) ?

Did you look into BareBone's TextWrangler, 'BBEdit Lite' replacement?
It's now available as free (as in beer) download for 10.3.5+.


I created a quick version of the Codeless Language Module for R
but it's lacking at the moment.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] signif() generic

2005-01-19 Thread Paul Roebuck
On Wed, 19 Jan 2005 [EMAIL PROTECTED] wrote:

> I'm trying to write a class for Gaussian error propagation of measured
> values and their (estimated) errors,
>
> > setClass("sec", representation(val="numeric", err="numeric"))
>
> I've already successfully implemented basic arithmetics using mostly the
> "Arith" group generics. But I'm running into trouble when trying to get
> signif() to work for my purposes, i.e. with a default argument
> (digits=2): When trying
>
> > seMethod("signif", signature(x="sec", digits="numeric")),
>   function(x, digits=2){
>   # ...do something...
>   }
> )
>
> and
>
> > signif(sec1)
>
> I get
>
> > Error in signif(x, digits) : Non-numeric argument to mathematical
> function
>
> Putting a second argument (like digits=2) into the call makes it work,
> but I want some default behavior specified for missing digits argument
> so it works in an analogous fashion as signif for numeric values.
> I also tried inserting
>
> > setGeneric("signif", function(x, digits=6) standardGeneric("signif"))
>
> before the setMethod block, but that wouldn't help either.


setGeneric("signif", function(x, digits=6) standardGeneric("signif"))
setMethod("signif", signature(x="sec", digits="numeric"),
function(x, digits) {
# ...do something...
print(x)
print(digits)
}
)

setMethod("signif", signature(x="sec", digits="missing"),
function(x, digits) {
callGeneric(x, digits)
}
)

The missing data method will cause the default value (6) to
be passed to the numeric data method.

> signif(new("sec"))
An object of class "sec"
   ...
[1] 6
>

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] help wanted using R in a classroom

2005-01-19 Thread Paul Roebuck
On Tue, 18 Jan 2005, bogdan romocea wrote:

> It appears you wouldn't get much improvement at all even if the 2nd CPU
> were used at 100%. Five R sessions can easily overwhelm one CPU. I
> think you need (a lot) more CPUs than 2 to solve your problem.
>
> Possible solutions:
> 1. Install R on each eMac. Since you have 40 of them, you might want to
> put together a script to do this.
> 2. Get some boxes that can run Windows. On Windows, you can run R from
> a CD/zip drive/USB drive. (So you could burn 40 CDs and have everyone
> run their R session on their box.) As far as I know the same is not
> true for GNU/Linux and Mac OS.
>

Mac OS X is certainly capable of running programs on CD/Zip/USB drive.

> -Original Message-
> From: Sam Parvaneh
> Sent: Monday, January 17, 2005 6:11 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] help wanted using R in a classroom
>
> I'm using R 2.0.1 for Mac OS X in a classroom with 40 eMacs running
> Mac OS X version 10.3.6.
> These Macs are network based, meaning that the students log in to an
> XServe G4 where their user accounts and home directories are stored.
>
> The problem that I'm having each time a group of students (usually 7
> to 10) use R is that the whole system get incredibly slow.
> The response time for opening an application while the students are
> running R is around 5 minutes.
> If a student wants to log into the system while others are running R,
> it can take up to 10 minutes for the student to get logged in.
> Everything gets very slow that it's almost impossible to work.
> When I look at the server Graphs, the CPU usage of the first CPU is
> always 100% when these students are using R. The second CPU is left
> at 15%.
>
> When these students quit R, then everything's back to normal again.
> The usage of both CPUs go back down to between 5-10%.
> Is there anyone out there using R in a university like this?
> Does anyone have an idea what this might depend one or maybe a
> solution?

You didn't mention where R is currently installed. What is
the path to the R framework and is that located on the XServe?
If only the student's personal R library directory is involved,
that shouldn't cause these problems.

Did you try creating a disk image (dot-dmg) containing the
R application and have it mount locally on each eMac?

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] install.packages() for local source file

2005-01-01 Thread Paul Roebuck
On Sat, 1 Jan 2005, Roger D. Peng wrote:

> Paul Roebuck wrote:
> > Wish to install a local source package on Un*x platform from
> > within R. Same thing as I can accomplish from cmdline as
> >
> > $ export R_LIBS=~/R/library
> > $ cd /path/to/pkg
> > $ R CMD INSTALL -l $R_LIBS 
> >
> >
> > So, how do you go about this anyway?
> > And isn't this a bug in 'install.packages'?
> >
> > ---
> > $ R
> >
> > R : Copyright 2004, The R Foundation for Statistical Computing
> > Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3
> >
> >
> >>file.pkg <- "mypkg_0.1.tar.gz"
> >>path.pkg <- file.path(path.expand("~"), "cvknn", file.pkg)
> >>file.exists(path.pkg)
> >
> > [1] TRUE
> >
> >>uri.pkg <- paste("file://", path.pkg, sep = "")
> >>install.packages(contriburl = uri.pkg, lib = Sys.getenv("R_LIBS"))
> >
> > Error in file.info(x) : Object "tmpd" not found
> >
> >>traceback()
> >
> > 4: file.info(x)
> > 3: dirTest(destdir)
> > 2: download.packages(pkgs, destdir = tmpd, available = available,
> >contriburl = contriburl, method = method)
> > 1: install.packages(contriburl = uri.pkg, lib = Sys.getenv("R_LIBS"))
> >
> >>version
> >
> >  _
> > platform sparc-sun-solaris2.9
> > arch sparc
> > os   solaris2.9
> > system   sparc, solaris2.9
> > status
> > major1
> > minor9.0
> > year 2004
> > month04
> > day  12
> > language R
> >
>
> By the way, do you get this error in a recent version of R
> (say >= 1.9.1). I believe install.packages() has changed
> since 1.9.0.  For example, see the thread starting here
>
> https://stat.ethz.ch/pipermail/r-help/2004-July/053001.html
>

Roger,

Thanks for that link which helped me diagnose the problem.
I observed the same error you observed (.../053047.html). Still
think it's kind of hinky to pass an uninitialized variable (tmpd)
to another method and count on it doing something though.

I wondered if something had changed as well, but noticed no change
glancing at the source for install.packages on 2.0.1 (OS X).
But underneath, the behavior was different since I got a
different error message which noted the lack of a PACKAGES
file. That was enough to get the rest to work...

Hopefully this will help my case for updating to the current
version on our shared Un*x workstations since I can now point
to a definitive bug that impacted my work due to using an
older version of this software.


R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0

> parentdir <- file.path(path.expand("~"), "Projects", "cvknn")
> uri.parentdir <- paste("file://", parentdir, sep = "")
> savewd <- getwd()
> setwd(parentdir)
> rmsymlink <- FALSE
> if (file.exists("PACKAGES") == FALSE) {
> file.symlink(file.path("mypkg", "DESCRIPTION"), "PACKAGES")
> rmsymlink <- TRUE
> }
> install.packages("mypkg",
+  contriburl = uri.parentdir,
+  lib = Sys.getenv("R_LIBS"))
> if (rmsymlink) file.remove("PACKAGES")
> setwd(savewd)

Perhaps the documentation for the 'contriburl' should
specify that it is expecting 'URL of the directory of
the contrib section of CRAN'.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] install.packages() for local source file

2005-01-01 Thread Paul Roebuck
On Sat, 1 Jan 2005, Liaw, Andy wrote:

> > From: Paul Roebuck
> >
> > > Please read ?install.packages.  It's most definitely not a bug for a
> > > function that works as documented.  If you want, you might take the
> > > source for install.packages and strip it down to do what you want,
> > > say something called installLocalPackages.
> >
> > Well, I called myself having read it but it still wasn't obvious
> > to me; hence I posted the question here. Exactly which part should
> > I have read more carefully? I will grant that I left out one thing
> > when I did my cut'n'paste but it doesn't change the result.
> > My attempt to install my local package should have read:
> >
> > > install.packages("mypkg",
> >contriburl = uri.pkg,
> >lib = Sys.getenv("R_LIBS"))
> >
> > Looking at the source, 'tmpd' is only set if the protocol
> > is not "file:". Since I use that protocol, it would seem
> > to me that passing 'NULL' instead of 'tempfile("Rinstdir")'
> > would constitute a bug.
>
> The version of ?install.packages (in R-2.0.1) I've read never said
> it could install local source packages, so why would it be
> considered a bug not being able to do something that is never
> claimed?  You seem to expect the function to do something that
> it is never designed to do.

The name of the routine made the claim, not I.
One could be forgiven for assuming it could since the
'contriburl' argument implies it could use a CD. I've
used it in the past for local installs by simulating
the CRAN directory structure and overriding the 'CRAN'
argument but that's kind of a hassle for something quick.
Perhaps it should be renamed 'install.packages.from.CRAN'
since the current name implies something different to me.

The programmer in me would still call the current situation
a bug - the if statement around the 'localcran' variable
is missing the else case to handle this scenario. Assuming
so, I really don't see why this [w|c]ouldn't handle local source
installs. And if it can't (and never could be made to do so),
then the code should have a 'stop("local install unimplemented")'
there so no one else ever has to ask again.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] install.packages() for local source file

2005-01-01 Thread Paul Roebuck
On Sat, 1 Jan 2005, Liaw, Andy wrote:

> > From: Paul Roebuck
> >
> > Wish to install a local source package on Un*x platform from
> > within R. Same thing as I can accomplish from cmdline as
> >
> > $ export R_LIBS=~/R/library
> > $ cd /path/to/pkg
> > $ R CMD INSTALL -l $R_LIBS 
> >
> >
> > So, how do you go about this anyway?
> > And isn't this a bug in 'install.packages'?
> >
> > ---
> > $ R
> >
> > R : Copyright 2004, The R Foundation for Statistical Computing
> > Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3
> >
> > > file.pkg <- "mypkg_0.1.tar.gz"
> > > path.pkg <- file.path(path.expand("~"), "cvknn", file.pkg)
> > > file.exists(path.pkg)
> > [1] TRUE
> > > uri.pkg <- paste("file://", path.pkg, sep = "")
> > > install.packages(contriburl = uri.pkg, lib = Sys.getenv("R_LIBS"))
> > Error in file.info(x) : Object "tmpd" not found
> > > traceback()
> > 4: file.info(x)
> > 3: dirTest(destdir)
> > 2: download.packages(pkgs, destdir = tmpd, available = available,
> >contriburl = contriburl, method = method)
> > 1: install.packages(contriburl = uri.pkg, lib = Sys.getenv("R_LIBS"))
> > > version
> >  _
> > platform sparc-sun-solaris2.9
> > arch sparc
> > os   solaris2.9
> > system   sparc, solaris2.9
> > status
> > major1
> > minor9.0
> > year 2004
> > month04
> > day  12
> > language R
>
> Please read ?install.packages.  It's most definitely not a bug for a
> function that works as documented.  If you want, you might take the
> source for install.packages and strip it down to do what you want,
> say something called installLocalPackages.

Well, I called myself having read it but it still wasn't obvious
to me; hence I posted the question here. Exactly which part should
I have read more carefully? I will grant that I left out one thing
when I did my cut'n'paste but it doesn't change the result.
My attempt to install my local package should have read:

> install.packages("mypkg",
   contriburl = uri.pkg,
   lib = Sys.getenv("R_LIBS"))

Looking at the source, 'tmpd' is only set if the protocol
is not "file:". Since I use that protocol, it would seem
to me that passing 'NULL' instead of 'tempfile("Rinstdir")'
would constitute a bug.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] install.packages() for local source file

2004-12-31 Thread Paul Roebuck
Wish to install a local source package on Un*x platform from
within R. Same thing as I can accomplish from cmdline as

$ export R_LIBS=~/R/library
$ cd /path/to/pkg
$ R CMD INSTALL -l $R_LIBS 


So, how do you go about this anyway?
And isn't this a bug in 'install.packages'?

---
$ R

R : Copyright 2004, The R Foundation for Statistical Computing
Version 1.9.0  (2004-04-12), ISBN 3-900051-00-3

> file.pkg <- "mypkg_0.1.tar.gz"
> path.pkg <- file.path(path.expand("~"), "cvknn", file.pkg)
> file.exists(path.pkg)
[1] TRUE
> uri.pkg <- paste("file://", path.pkg, sep = "")
> install.packages(contriburl = uri.pkg, lib = Sys.getenv("R_LIBS"))
Error in file.info(x) : Object "tmpd" not found
> traceback()
4: file.info(x)
3: dirTest(destdir)
2: download.packages(pkgs, destdir = tmpd, available = available,
   contriburl = contriburl, method = method)
1: install.packages(contriburl = uri.pkg, lib = Sys.getenv("R_LIBS"))
> version
 _
platform sparc-sun-solaris2.9
arch sparc
os   solaris2.9
system   sparc, solaris2.9
status
major1
minor9.0
year 2004
month04
day  12
language R


--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Text Mining with R

2004-12-03 Thread Paul Roebuck
On Fri, 3 Dec 2004, Jose Quesada wrote:

> On Fri, 3 Dec 2004 19:15:57 +, Tobias Verbeke wrote:
>
> > You may have a look at:
> >
> > http://wwwpeople.unil.ch/jean-pierre.mueller/
>
> I just created a zip file from the tar, and used the "install from
> zip" option of the Rwin console.
>
> ttda is shown in the list of installed packages. However, when I try
> "load packages", or the equivaent "library(ttda)", I get:
>
> Error in library(ttda) : 'ttda' is not a valid package -- installed < 2.0.0?
> > local({pkg <- select.list(sort(.packages(all.available = TRUE)))
> + if(nchar(pkg)) library(pkg, character.only=TRUE)})
> Error in library(pkg, character.only = TRUE) :
> 'ttda' is not a valid package -- installed < 2.0.0?
>
> Do you know why?

Converting from one archive format to another doesn't
change the fact that it's still a source archive. The Windows
"install from zip" is expecting a precompiled, binary archive.
Unless you used the R development tools, it ain't gonna fly.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] setGeneric(rm)

2004-12-03 Thread Paul Roebuck
On Fri, 3 Dec 2004, Marcos Carrero wrote:

> We are developing a package using S4 classes. The S4 classes are
> wrappers to C++ classes. So S4 classes contain an integer that is the
> memory address of one C++ object. If an user calls the rm() function,
> the C++ object must be deleted. But our generic rm() function apparently
> doesn't work. Here is the code:
>
> # The class
> setClass("component", representation(pointer="integer", "VIRTUAL"))
>
> # The generic method
> setGeneric("rm", function(..., list = object, pos = -1,
>   envir = as.environment(pos),
>   inherits = FALSE)  standardGeneric("rm"))
>
> setMethod("rm", "component", function(list=object, pos, envir, inherits) {
>   warning("object deleted")
>   .Call("Rm");i
> })
>
> We implemented generic methods for print(), show() and summary() succesfully.

The method signatures don't match. Does the warning message
actually display?

BTW, isn't it dangerous to assume a pointer and integer
occupy the same amount of storage?

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Redirect standard input and output of R

2004-11-18 Thread Paul Roebuck
On Wed, 17 Nov 2004, Victor Robles wrote:

> I'm trying to write a C program that write to the standard input of R
> and read the standard output. I can perfectly read the R output, but
> I'm not able of writing anything to R.
> [SNIP C code]

Several years ago, I wrote some software that used S-plus as its
back-end and Java for the front-end. I found what worked best was
to add a pseudoterminal inbetween; you can use the code from
"UNIX Programming Environment" to create one. The solution was
later reused when a similar project used R for its back-end.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R package installation

2004-11-17 Thread Paul Roebuck
On Wed, 17 Nov 2004, Timothy D. Johnson wrote:

> I was given an excerpt with your problem about installing package on
> a MAC, such as Hmisc.
>
> I had the same problems and found a work around.
>
> I have not had any trouble loading in source packages since, include
> Hmisc and Design, acepack and vgam.
>
> First, I downloaded and installed the g77 compiler.
>
> I use a progam named FINK to find, download and intall g77 (so first I
> installed FINK then from within FINK I downloaded/installed the
> g77 compiler.)
> [SNIP details]

Still seems like simply installing this from this link would be simpler;
FINK is unnecessary. Of course, this is already covered in the OS X FAQ
 although some
explanation could be added that a Fortran77 compiler might also be needed
for linking other packages.



--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] can i copy the graphics to openoffice?

2004-11-11 Thread Paul Roebuck
On Fri, 12 Nov 2004, ronggui wrote:

> under windows,i can plot a graphics in windows() device and then copy it to
> ms-office.but it under linux,can i do similar things?
> i want to use plot() to draw a graphic in X11() so i can have a look to make
> sure if that's what i want,if so,i then want to copy it to openoffice. can i?
> i know ,i can use plot graphic into jpeg() ,but if i do so,i can not see the
> graphic directly.that's not what i want.
> any suggestion?

Why not just plot it twice?
Once to x11() and another to png()/jpeg()/postscript()
or whatever format you desire. If you don't like the
results, don't use the resulting files...

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Need car() and cdr() for '...'

2004-11-09 Thread Paul Roebuck
Needed to redefine function "sum" for my MATLAB package.
There's something similar in Chambers's Green Book (pg 351)
so I modified it as such:

library(methods)
setGeneric("sum", function(x, ..., na.rm = FALSE) {
if (nDotArgs(...) > 0)
sum(c(sum(x, na.rm = na.rm),
  sum(..., na.rm = na.rm)))
else
standardGeneric("sum")
})
setMethod("sum", "vector", function(x, na.rm) {
return(base::sum(x, na.rm));
})
setMethod("sum", "matrix", function(x, na.rm) {
return(apply(x, 2, sum, na.rm));
})
setMethod("sum", "array", function(x, na.rm) {
stop('Argument "x" must either be a vector or matrix')
})
setMethod("sum", "missing", function() {
stop('Argument "x" missing')
})

Problem is that R's definition for summary functions
doesn't specify the "x" argument so the generic
won't work. So does someone have LISP-derived car/adr
functions I can use to split the '...' list such that
the generic function could use this instead:

sum(c(sum(car(...), na.rm = na.rm),
  sum(cdr(...), na.rm = na.rm)))

Of course, better ideas are welcome too.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Rd \docType options

2004-11-08 Thread Paul Roebuck
Where would I find a list of valid options for \docType{}?
I found the following types using grep:
- class
- data
- genericFunction
- methods
Are there others?

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Compilation error on mgcv_1.1-7 on OS X (10.3)

2004-11-01 Thread Paul Roebuck
On Mon, 1 Nov 2004, Jon Egil Strand wrote:

> I run into a compilation error when updating to mgcv_1.1-7 in R 2.0.0 on
> OS X 10.3. Note that other pacakges have compiled nicely.
>
> Some details are given below, but in short it looks like it's seeking for
>
>   /usr/local/lib/powerpc-apple-darwin6.8/3.4.2/
>
> which I don't have. But I do have
>
>   /usr/lib/gcc/darwin/3.3
>
> i.e a lower version of GCC in a different directory. More details at end.
>
> I am sorry if this is very easy to configure, but as long as I am unable
> to do it I will be very grateful for any help.
>
> ---
>   Compilation details
> ---
>
> gcc -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/include  
> -I/usr/local/include   -fno-common  -g -O2 -c qp.c -o qp.o
> gcc -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/include  
> -I/usr/local/include   -fno-common  -g -O2 -c tprs.c -o tprs.o
> gcc -bundle -flat_namespace -undefined suppress -L/usr/local/lib -o
>   mgcv.so gcv.o magic.o mat.o matrix.o mgcv.o qp.o tprs.o  -framework
>   vecLib -L/usr/local/lib -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2
>   -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2/../../.. -lfrtbegin
>   -lg2c -lSystem -lcc_dynamic -framework R
>
> ld: warning -L: directory name (/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2) 
> does not exist
> ld: warning -L: directory name 
> (/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2/../../..) does not exist
> ld: can't locate file for: -lfrtbegin
>
> make: *** [mgcv.so] Error 1
> ERROR: compilation failed for package 'mgcv'
>

My guess would be that this package requires G77 in order
to link correctly as that library is for Fortran.

Install this and try it again.



--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Mac OS X binary package naming convention

2004-10-29 Thread Paul Roebuck
Did the convention change during the R 2.0.0 Cocoa update?
When I issue the build command:

$ R CMD build --binary mypkg

I expected to get 'mypkg_0.9-0.tgz' but instead got
'mypkg_0.9-0_R_powerpc-apple-darwin6.8.tar.gz'. Or should
I rename it manually?


platformpowerpc-apple-darwin6.8
archpowerpc
os  darwin6.8
system  powerpc, darwin6.8
status
major   2
minor   0.0
year2004
month   10
day 04
languageR

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Warning: number of items to replace is not a multiple ofreplacement length

2004-09-29 Thread Paul Roebuck
On Wed, 29 Sep 2004, Mag. Ferri Leberl wrote:

> What does this warning mean precisely?

Usually means there isn't enough room to store your results.

> Is there any reason to care about it?

You probably should.

> Can I Avoid it by another way of programming?

Yes you can. Had you provided an example that caused the
problem, you could have received more help!

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] S4 method selection based on second argument

2004-09-28 Thread Paul Roebuck
I'm translating some Matlab code and need some help figuring
out how to change this call into an S4 generic method.

In matlab, there's a function called 'repmat' with three
calling sequences (all I have to deal with anyway):
1) B = repmat(A, m, n)
2) B = repmat(A, [m n])
3) B = repmat(A, n)
In all cases, A is the fill value, m is number of rows,
and n is number of columns.

As separate functions, the translations would roughly be:

repmat1 <- function(A, m, n) {
kronecker(matrix(1, n, m), A)
}

repmat2 <- function(A, rc) {
repmat1(A, rc[1], rc[2])
}

repmat3 <- function(A, n) {
repmat1(A, n, n)
}

Suggestions?


--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Using R to send to SOAP server?

2004-09-17 Thread Paul Roebuck
On Fri, 17 Sep 2004, Don MacQueen wrote:

> I have an R process continuously monitoring a data stream. When the
> data meet certain criteria, I need to send a message to a SOAP server.
>
> Currently I'm doing this by making a system() call to execute a perl
> script, passing the message as an argument to the perl script.
>
> I'm wondering if it can be done directly by R, and if so, whether
> there might be any performance benefit.
>
> I've looked at RSOAP, and as far as I can tell, it's designed to work
> only in the other direction, that is, a SOAP server passes client
> commands to R, and returns the R results to the client. If I'm wrong
> about that, I'd appreciate being told so.

SSOAP allows R to invoke SOAP methods provided by a SOAP server.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Confused about specifying plot colors as RGB values

2004-09-17 Thread Paul Roebuck
Based on reading 'rgb' documentation, I would have thought
the following would have produced identical results. Can
someone explain how to make this happen? I need to be able
to specify an array of rgb values for the 'col' parameter.


colnames.col <- c("black", "red", "blue", "green")
colnames.rgb <- apply(as.matrix(colnames.col), 1, col2rgb)
dimnames(colnames.rgb)[[2]] <- colnames.col

baseline <- 1:32
offset2 <- 2*baseline
offset3 <- 3*baseline
offset4 <- 4*baseline
offsets <- cbind(offset2, offset3, offset4)

# Produces expected result
X11()
matplot(baseline, col = colnames.col[1], type = "l")
matlines(offsets, col = colnames.col[-1])

# Displays a ??yellow?? line
X11()
matplot(baseline, col = as.matrix(colnames.rgb[,1]), type = "l")
matlines(offsets, col = colnames.rgb[,-1])


--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Splitting vector into individual elements

2004-09-15 Thread Paul Roebuck
On Wed, 15 Sep 2004, Peter Dalgaard wrote:

> Paul Roebuck <[EMAIL PROTECTED]> writes:
>
> > Is there a means to split a vector into its individual
> > elements without going the brute-force route for arguments
> > to a predefined function call?
> >
> > offred.rgb <- c(1, 0, 0) * 0.60;
> >
> > ## Brute force style
> > offred.col <- rgb(offred.rgb[1],
> >   offred.rgb[2],
> >   offred.rgb[3],
> >   names = "offred")
> > ## Desired style
> > offred.col <- rgb(silver.bullet(offred.rgb),
> >   names = "offred")
>
> The closest is probably this:
>
> offred.col <- do.call("rgb", c(as.list(offred.rgb),
>list(names="offred")))
>

Everyone offered 'do.call' as the solution. While that
works, is it to say that there is no means of expanding
the expression as an argument to the original function?

> (ever read/seen The Handmaid's Tale, btw?)
>

Not yet. Though renaming my sample variable 'off.red.col'
would avoid future confusion with oppressed handmaids.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Splitting vector into individual elements

2004-09-15 Thread Paul Roebuck
Is there a means to split a vector into its individual
elements without going the brute-force route for arguments
to a predefined function call?

offred.rgb <- c(1, 0, 0) * 0.60;

## Brute force style
offred.col <- rgb(offred.rgb[1],
  offred.rgb[2],
  offred.rgb[3],
  names = "offred")
## Desired style
offred.col <- rgb(silver.bullet(offred.rgb),
  names = "offred")

Neither of my attempts gets it right.

silver.bullet.try1 <- function(x) {
expr <- cat(x, sep = ",")
return(parse(text = expr))
}

silver.bullet.try2 <- function(x) {
expr <- expression(cat(x, sep = ","))
return(eval(expr))
}

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Dyn.load of sharing object with GSL library

2004-09-09 Thread Paul Roebuck
On Thu, 9 Sep 2004, Vicky Landsman wrote:

> Following the recommendation of Prof. Ripley, I have created the Makevars
> file with the line:
> PKG_LIBS="-L/usr/lib/libm -lm -L/usr/local/lib/libgsl -lgsl -L/usr/local/lib
> /libgslcblas -lgslcblas"
> in the working directory.

That should probably look like this instead:

  PKG_LIBS="-L/usr/local/lib -lgsl -lgslcblas -lm"

The math library (-lm) should not be necessary here but I left it in
case it's needed by your [unspecified] OS for some reason.

> Now I have the code file Example3.c which computes the Bessel function value
> (the example is taken from the GSL reference book).
> I am running:
> R CMD SHLIB Example3.c
> and all looks good.

Shared library linkage often allows symbols to remain undefined
until runtime by design. As such, there would be no error message.

> The dyn.load("Example3.so") fails with the following error message:
>
> Error in dyn.load(x, as.logical(local), as.logical(now)) :
> unable to load shared library
> "/fs/users1/guest/msvika/PhD/R_04/Example3.so":
>   ld.so.1: /usr/local/sbin/R-1.9/R-1.9.1/bin/R.bin: fatal: relocation error:
> file /fs/users1/guest/msvika/PhD/R_04/Example3.so: symbol gsl_sf_bessel_J0:
> referenced symbol not found

You may need the following environment variable set prior to
running R. It would be best added to your .profile.

  $ export LD_LIBRARY_PATH=$HOME/lib:/usr/local/lib:/usr/dt/lib:/usr/lib

And why in the world is your R installation located in a
directory for system binaries? Perhaps it would be better
located as '/usr/local/R-1.9.1' or '/opt/R-1.9.1' instead.


--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] 64 bit benefit for dual G5 powermac

2004-09-03 Thread Paul Roebuck
On Fri, 3 Sep 2004, Sek Won Kong,M.D wrote:

> Can dual G5 Powermac have benefit of 64 bit in terms of memory and maximum
> matrix size? I have read several positive postings on 64 bit machine.
> If yes, what will be configure looked like other than { ./configure
> --with-blas='-framework vecLib' --with-lapack --with-aqua } ?

I believe most of the 64-bit support you are wanting is to
be delivered in the forthcoming OS X 10.4 (Tiger) release.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] [Q] Apply Function Over Multiple Array Margins

2004-08-25 Thread Paul Roebuck
Is there a canonical means to apply a function
over multiple arrays simultaneously? For example,
if I wanted to plot each line with a different color?
Or is a for loop conversion my best option?


x <- seq(0, 8, by = 2)
y <- matrix(1:15, nrow = 5, byrow = TRUE)
my.colors <- heat.colors(3)

drawLines <- function(row) {
lines(x, row)# want corresponding 'my.colors' here
}

plotData <- function(x, y) {
plot(x, type='n', axes = FALSE,
 xlim = c(min(x), max(x)),
 ylim = c(0, max(y)));
box();
axis(1, min(x):max(x))
axis(2, seq(0, max(y), by = 5))
axis(3, labels = FALSE)
axis(4, labels = FALSE)
apply(y, 1, drawLines)
}

plotData(x, t(y))

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Functions in a package not visible to a user

2004-07-16 Thread Paul Roebuck
On Thu, 15 Jul 2004, Andy Liaw wrote:

> Rui Dantas wrote:
>
> > I have a package with several R functions. Some are internal auxiliary
> > functions, and should not be available to the user (nor do they, for
> > example, need "user" documentation). How can I hide them?
>
> That's one of the purposes of the namespace.  See Prof. Tierney's article in
> the R Newsletter, or the slides of his keynote lecture at the useR! 2004
> conference.  It's also explained in the `Writing R Extensions' manual.
> Basically you only export functions that the users should see.  The manual
> also explains how to not document functions that aren't intended to be
> called by users.

Am I the only one who finds the namespace still too limited?
It still lacks the middle ground of being able to have only
package level access without declaring functions public.

I also found the suggested documentation standard for private
functions too limiting. I modified the R-ext 1.1.4 recommendation
for my package to use multiple '-internal.Rd' instead of
a single '-internal.Rd'; this allowed me to document the
disparate functions with logical grouping rather than using the
suggested "bag" approach.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



[R] Re: .Platform addition

2004-07-12 Thread Paul Roebuck
On Mon, 12 Jul 2004, Duncan Murdoch wrote:

> On Mon, 12 Jul 2004 11:01:49 -0500 (CDT), Paul Roebuck
> <[EMAIL PROTECTED]> wrote :
>
> >I glanced this and thought this might be handy to keep for
> >possible use. To make it less Windows-specific, I was going
> >to replace Gabor's fsep default value with '.Platform$file.sep'
> >when I noticed that .Platform doesn't have a '$path.sep'
> >field. Just missing or available elsewhere?
>
> By the way, as far as I know .Platform$file.sep is "/" on all
> platforms now.  In Windows R converts these to "\" when necessary.

While that may be great for R itself, it would be of little
help attempting to parse the Windows PATH environment variable.
The actual raw value of '\\' is actually more appropriate in this
case, no?

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


.Platform addition (was Re: [R] where does R search when source()?)

2004-07-12 Thread Paul Roebuck
On Sun, 11 Jul 2004, Gabor Grothendieck wrote:

> search.path <-
> function(fn,
>  paths = strsplit(Sys.getenv("PATH"), split = ";")[[1]],
>  fsep = "\\") {
> for(d in paths) {
> f <- file.path(d, fn, fsep = fsep)
> if (file.exists(f))
> return(f)
> }
> return(NULL)
> }
>
> source(search.path("myscript.R"))

I glanced this and thought this might be handy to keep for
possible use. To make it less Windows-specific, I was going
to replace Gabor's fsep default value with '.Platform$file.sep'
when I noticed that .Platform doesn't have a '$path.sep'
field. Just missing or available elsewhere?

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Statistics::R

2004-07-08 Thread Paul Roebuck
On Thu, 8 Jul 2004, michael watson (IAH-C) wrote:

> I am looking (possibly in vain!) for the Author of the Statistics::R
> perl package - I believe he announced the package on this mailing list
> some months ago.  The name is Graciliano Monteiro Passos, and his e-mail
> address, [EMAIL PROTECTED], is giving permanent errors.
>
> Can anyone help?  Does anyone use this perl package with R?  I am having
> a few problems with it.

I used it for one of my projects and also tried unsuccessfully
to contact the author. I forgot to follow-up on that failure so
if you find him, let me know too.

Can't help without a description of the problem you are having
though...

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] NAMESPACE and tests for unexported functions

2004-07-07 Thread Paul Roebuck
How do you get around the problem of having tests for
functions that are not exported in NAMESPACE? It seems
rather self-defeating to have to export everything so
that 'R CMD CHECK pkg' won't crash when it encounters
a test case for an internal function. I don't want
someone using the package to call the function, but the
package itself should be able to see its own contents.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Win32 & C code

2004-07-07 Thread Paul Roebuck
On Wed, 7 Jul 2004, Simon Cullen wrote:

> I'm trying to get C code working with R. This is my first time writing C
> on Windows and I'm making a mess of it. Help!
> ...
> I seem to be unable to make Windows pay attention to additions to the PATH
> variable so I stuck the code (test.c) into the $R_HOME\bin directory. I
> copied into the same directory mingw32-make.exe and renamed it make.exe
> (as the perl script SHLIB seems to want a make.exe).
> ...


I wrote a batch file to get mine working. Change directory
paths to match your setup.

WINBUILD.CMD
-
@cls
@SETLOCAL
@set PROJ=rwt
@set RBINDIR=C:\R\rw1091\bin
@set TOOLSBINDIR=C:\Rtools\bin
@set MINGWBINDIR=C:\MinGW\bin
@set PERLBINDIR=C:\Perl\bin
@set TEXBINDIR=C:\PROGRA~1\TeXLive\bin\win32
@set HCCBINDIR=C:\PROGRA~1\HTMLHE~1
    Next line split for readability 
@set PATH=%TOOLSBINDIR%;%RBINDIR%;%MINGWBINDIR%;%PERLBINDIR%;
  %TEXBINDIR%;%HCCBINDIR%;%WINDIR%\system32;%WINDIR%
@echo PATH=%PATH%
Rcmd build --binary %PROJ%
Rcmd check %PROJ%
@ENDLOCAL


--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Enumeration in R

2004-07-07 Thread Paul Roebuck
On Tue, 7 Jul 2004, Peter Dalgaard wrote:

> Paul Roebuck <[EMAIL PROTECTED]> writes:
>
> > I want the equivalent of this 'C' declaration.
> > enum StoplightColor {
> > green = 3,
> > yellow = 5,
> > red = 7
> > };
>
> I think you *dis*abled it by specifying an initializer which doesn't
> check the validity:

Thanks. It all seems obvious once it's pointed out to you.
I have a couple related questions:

1) When I was reading Chambers book (pg 288), my initial
impression was that there was a way I could have done this
class without specifying the representation in 'setClass'
- I just couldn't figure out how to assign values that
way. Could this class have been defined 'slotless'? If so,
how?

2) How do you define a class and instantiate some, yet
prevent more from being created after that. Possibly better
stated, from the package's API view, I would like these to
be instance variables of opaque types. So I would like to
create my 'global' constants in an initialization routine
then prevent use of 'new' to create any more. I tried the
following with no success. Possible?

setMethod("new",
  "stoplightColor",
  function(Class, ...) stop("can't make any more"))

3) This seems kind of painful for trivial stuff. My idea
was to move some of the validation error checking out of my
project by converting certain function arguments into classes
that could be validated upon creation, improving the clarity
of project routines. What is the canonical style used in R
package authoring?




- stoplightColor.R 
setClass("stoplightColor",
 representation(value = "integer"),
 prototype = integer(1))
stoplightColor <- function(value) {
new("stoplightColor", value)
}
valid.stoplightColor <- function(object) {
valid <- switch(as([EMAIL PROTECTED], "character"),
"3" = TRUE,
"5" = TRUE,
"7" = TRUE,
FALSE)
if (valid == FALSE)
return('Invalid value - must be [3|5|7]');
return(TRUE);
}
setValidity("stoplightColor", valid.stoplightColor)
initialize.stoplightColor <- function(.Object, value) {
if (missing(value) || is.na(value))
stop('Argument "value" is missing or NA')
[EMAIL PROTECTED] <- as.integer(value)
validObject(.Object)
.Object
}
setMethod("initialize",
  signature(.Object = "stoplightColor"),
  initialize.stoplightColor)
stoplightColor.as.integer <- function(from) {
return([EMAIL PROTECTED])
}
setAs("stoplightColor", "integer", stoplightColor.as.integer)

green <- stoplightColor(3)
yellow <- stoplightColor(5)
red <- stoplightColor(7)

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Enumeration in R

2004-07-06 Thread Paul Roebuck
I want the equivalent of this 'C' declaration.
enum StoplightColor {
green = 3,
yellow = 5,
red = 7
};

This mostly works except the validity checking doesn't
seem to occur automatically. What didn't I do to enable
it?

setClass("stoplightColor",
 representation(value = "integer"),
 prototype = integer(1))
stoplightColor <- function(value) {
if (missing(value))
stop('no value!')
new("stoplightColor", value)
}
valid.stoplightColor <- function(object) {
valid <- switch(as([EMAIL PROTECTED], "character"),
"3" = TRUE,
"5" = TRUE,
"7" = TRUE,
FALSE)
if (valid == FALSE)
return("Value not in list of valid values [3|5|7]");
return(TRUE);
}
setValidity("stoplightColor", valid.stoplightColor)
initialize.stoplightColor <- function(.Object, value) {
[EMAIL PROTECTED] <- as.integer(value)
.Object
}
setMethod("initialize",
  signature(.Object = "stoplightColor"),
  initialize.stoplightColor)
green <- stoplightColor(3)
yellow <- stoplightColor(5)
red <- stoplightColor(7)

# error: no value argument
noarg <- stoplightColor()

# error: invalid number argument
bad <- stoplightColor(6)  # WHY NO WARNING HERE?
validObject(bad)


--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] contrib.url binary paths inconsistent

2004-07-05 Thread Paul Roebuck
Binary distribution [Windows]
-
> contrib.url(getOption("CRAN"))
[1] "http://cran.r-project.org/bin/windows/contrib/1.9";

Binary distribution [Mac OS X]
-
> contrib.url(getOption("CRAN"), type = "mac.binary")
[1] "http://cran.r-project.org/bin/macosx/1.9";



Possible update for Mac OS X version:

contrib.url <-
function(CRAN, type = c("source", "mac.binary")) {
type <- match.arg(type)
ver <- paste(R.version$major,
 substring(R.version$minor, 1, 1),
 sep = ".")
switch(type,
   source = file.path(CRAN, "src", "contrib"),
   mac.binary = file.path(CRAN, "bin", "macosx", "contrib", ver))
}

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R BATCH problem

2004-07-01 Thread Paul Roebuck
On Thu, 1 Jul 2004, Andreas Pauling wrote:

> Entering
>
> rows<-as.matrix(c(4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276,280,284,288,292,296,300,304,308,312,316,320,324,328,332,336,340,344,348,352,356,360,364,368,372,376,380,384,388,392,396,400,404,408,412,416,420,424,428,432,436,440,444,448,452,456,460,464,468,472,476,480,484,488,492,496,500,504,508,512,516,520,524,528,532,536,540,544,548,552,556,560,564,568,572,576,580,584,588,592,596,600,604,608,612,616,620,624,628,632,636,640,644,648,652,656,660,664,668,672,676,680,684,688,692,696,868,872,876,880,884,888,892,896,900,904,908,912,916,920,924,928,932,936,940,944,948,952,956,960,964,968,972,976,980,984,988,992,996,1000,1004,1008,1012,1016,1020,1024,1028,1032,1036,1040,1044,1048,1052,1056,1060,1064,1068,1072,1076,1080,1084,1088,1092,1096,1100,1104,1108,1112,1116,1120,1124,1128,11!
32,
>  
> 1136,1140,1144,1148,1152,1156,1160,1164,1168,1172,1176,1180,1184,1188,1192,1196,1200,1204,1208,1212,1216,1220))
>
> at the prompt works fine. Also source() works well. However, when
> calling a script that contains just this single command with R
> BATCH 

Re: [R] MacOS X binaries won't install

2004-06-30 Thread Paul Roebuck
On Tue, 29 Jun 2004, Ruben Solis wrote:

> I've tried installing the MacOS X binaries for R available at:
>
> http://www.bioconductor.org/CRAN/
>
> I'm running MacOS X version 10.2.8.
>
> I get a message indicating the installation is successful, but when I
> double-click on the R icon that shows up in my Applications folder, the
> application seems to try to open but closes immediately.
>
> I looked for  /Library/Frameworks/R.framework (by typing ls
> /Library/Frameworks) and it does not appear.  A global search for
> R.framework yields no results, so it seems that the installation is not
> working. (I was going to try command line execution.)

Check your log file for related error messages.
Can also inspect the package contents to ensure scripts
have execute permission as that would also cause the behavior
you describe.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R via ssh login on OS X?

2004-06-28 Thread Paul Roebuck
On Mon, 28 Jun 2004, James Howison wrote:

> I have an ssh only login to a G5 on which I am hoping to run some
> analyses.  The situation is complicated by the fact that the computer's
> owner is away for the summer (and thus also only has shell login).
>
> R is installed and there is a symlink to /usr/local/bin/R but when I
> try to launch it I get:
>
> [EMAIL PROTECTED] R
> kCGErrorRangeCheck : Window Server communications from outside of
> session allowed for root and console user only
> INIT_Processeses(), could not establish the default connection to the
> WindowServer.Abort trap
>
> I though, ah ha, I need to tell it not to use the GUI but to no avail:
>
> [EMAIL PROTECTED] R --gui=none
> kCGErrorRangeCheck : Window Server communications from outside of
> session allowed for root and console user only
> INIT_Processeses(), could not establish the default connection to the
> WindowServer.Abort trap
>
> I'm embarrassed to say that I'm writing to the list without having the
> latest version installed---because I can't install it at the moment.  I
> am using R 1.8.1.  I have tried to compile the latest from source but
> there is no F77 compiler. I thought I'd ask around before going down
> the "put local dependencies in the home folder" to compile this route
> (any hints on doing that would be great though) ...
>
> Can other people get R command-line to work with logged in remotely via
> ssh?  Any hints?
> Is this something that is fixed in more recent versions?
>
> I think I can see one other route:  getting the computer's owner to
> install fink and their version remotely ... but I'm open to all "don't
> bother the professor when he's on holiday" options ...

I suffered similarly attempting to run R via CGI; I never found
a workaround for remote access (also running 1.8.1 with Panther).
Seemed to have something to do with running an application requiring
access to graphics but not being the user currently "owning" the dock.
I did not determine if the limitation was due to R implementation or
operating system software.

F77 not necessary; use 'f2c' instead. But don't bother with Fink since
it's not necessary to build it. No 'sudo' access either? Is the user
still logged in (screenlocked) or are you just lacking administrative
access?

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] [SOLVED] GET_DIM() crash on Windows only

2004-06-24 Thread Paul Roebuck
Paul Roebuck wrote:

>I have the following contrived code in package format.
>On Solaris and Mac OS X, code runs just fine. On Windows,
>it crashes the R environment with the "Send Bug Report"
>dialog. I tried R 1.8.1 (Win2K) and R 1.9 (WinXP) binaries
>with the same result. PCs otherwise appear properly
>configured for creating R packages. Anything blatantly
>wrong? Suggestions?

The culprit of my troubles turned out to be the GCC compiler
option '-ansi' in "src/Makevars". Why this causes a problem
is not known at this time. My Makevars for the example program
was as below:

PKG_CFLAGS=-Wall -ansi -pedantic -DDEBUG_RWT -I./
PKG_LIBS=-lm

Creating a Windows-specific config file "src/Makevars.win"
without that option solves the problem.

PKG_CFLAGS=-Wall -pedantic -DDEBUG_RWT -I./
PKG_LIBS=-lm

Many thanks to Uwe Ligges for figuring out the cause.

--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] assigning from multiple return values

2004-06-23 Thread Paul Roebuck
On Wed, 23 Jun 2004, Jack Tanner wrote:

> I know that if I have a function that returns multiple values, I should
> do return(list(foo, bar)). But what do I do on the recieving end?
>
> fn <- function(x) {
>return(list(foo, bar))
> }
>
> I know that at this point I could say
>
> values.list <- fn(x)
>
> and then access
>
> values.list[1]
> values.list[2]
>
> But that's hideous. I'd rather be able to say something like
>
> list(local_foo, local_bar) <- fn(x)
>
> and have the right thing happen. I realize that it's my responsibility
> to not screw up and say instead
>
> list(local_bar, local_foo)
>
> Any suggestions?
>

How about naming the list elements for clarity then?

fn <- function(x) {
foo <- x;
bar <- 1/x;
return(list(foo = foo,
bar = bar));
}

x <- 10;
values.list <- fn(x);
print(values.list$foo);
print(values.list$bar);


--
SIGSIG -- signature too long (core dumped)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


  1   2   >