Re: [Rd] R-Project build system: DESTDIR support

2006-02-27 Thread Hin-Tak Leung
Dirk Eddelbuettel wrote:
> Hi Claudio,
> 
> On 25 February 2006 at 03:11, Claudio Fontana wrote:

> | Currently, your project does not support the DESTDIR variable in
> | generated Makefiles (marked as optional in the GNU coding policies, make and
> | automake manual).

> I'm confused. We've been maintaining R in Debian quite merrily even with the
> exisiting standards. To the best of my knowledge things seem to work without
> DESTDIR. 


You are both right - R currently does not use DESDIR, and also R seems 
to work without it. What happens is that R is *almost* completely 
re-locatable based on one environment variable R_HOME . There is one
wrapper script (/usr/bin/R) which contains the location of R_HOME,
and it is "massaged" with the intended R_HOME location just before
"make install". The "make install" process essentially just copy
all the files into the intended R_HOME, edit the wrapper script
with the location of R_HOME and copy it also.

Change to DESTDIR should be quite simple. I think it is mostly one
line change in R/Makeconf.in,
where
rhome = ${libdir}/R
to
rhome = ${DESTDIR}/${libdir}/R
and maybe one or two other places, concerning that wrapper script.
(some volunteers?)

HTL

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


[Rd] method dispatch and in-place modification? - unclass, RemoveClass, getDataPart, method dispatch

2006-02-27 Thread Hin-Tak Leung
I have a little problem about method dispatch and "unnessary" copying.
Basically what I would like to do is:

`[.myclass` <- function(x, i,j, extraopt=TRUE/FALSE, drop=TRUE) {
   ...do stuff depending on extraopt...
value <- Nextmethod("[", x, i,j, drop=TRUE)
   ... do more stuff depending on extraopt...
}

I have two general problems:
(1) NextMethod() really doesn't like having "extraopt" around.
(2) I can do "unclass" or "class<-" (they seems to do exactly the
same thing with R_set_class()), but it makes a new copy of the object.
The object in my case is very large - (about 80MB, and will be 10x
higher if I can get away with it) and the copying itself accounts
for 97% of the total CPU time consumed - which basically makes it
about 30 times slower than it should be.
In fact R_set_class says:

> /* set the class to value, and return the modified object.  This is
>NOT a primitive assignment operator , because there is no code in R
>that changes type in place. See the definition of "class<-" in 
>the methods package for the use of this code. */


I came upon "RemoveClass()" in R/src/main/object.c which says it is 
__unused__ but seems to do what I would like it to do.

So I tried a S4 method dispatch mechanism, but it is 3 times *slower*
than unclass, and it seems to be due to the switch() statement inside
  getDataPart() (in R/src/library/methods/R/RClassUtils.R)
which typically copies the object three times? (I think 
"attributes(value) <- NULL" also copies)

> getDataPart <- 
> function (object)
> {
> ...
> switch(dataPart, 
   ...
>  array = {
> value <- object
> attributes(value) <- NULL
> attr(value, "dim") <- attr(object, "dim")
> attr(value, "dimnames") <- attr(object, "dimnames")
> object <- value
> }, 
> ...
> object
> }

The basic question is - is there a way of implementing a method which 
has extra arguments compared to generic? The other question concerns
the "there is no code in R that changes type in place" statement -
how can one avoid excessive copying in these two cases? Is it alright to 
invoke the "RemoveClass()" routine to do a unclass_in_place()?
(I did think about doing my own unclass(), but it just seems exactly 
like what RemoveClass() is!).

Hin-Tak Leung

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


[Rd] Egold earn $ while surfing

2006-02-27 Thread Neil Getpaid program

Double your money now
http://www.autumnfund.com/?own=neilgomes




e-gold account is required
Visit E-gold.com

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


Re: [Rd] PR#6614

2006-02-27 Thread Bill Dunlap
On Wed, 23 Feb 2006, Peter Dalgaard wrote:

> "Gabor Grothendieck" <[EMAIL PROTECTED]> writes:
>
> > Try this:
> >
> >  subset(iris, select = - Species)
>
> Or, canonically,
>
> nm <- names(iris)
> iris[, nm != "Species" ]
>
> iris[, -match("Species", nm)]
>
> >
> > On 2/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > I agree with the submitter that this needs some kind of solution.
> > > Although data.frame[,-12] works, how do I drop a named column (the
> > > most common use case)? (I found this bug while searching for an
> > > answer.)

That code with match only works if "Species" is actually
a column of iris.  If not, your result depends on whether
you have a data.frame (an error) or a matrix (a column
of NA's).

I found some mail in a 15 year old sent-mail file that suggested
allowing the tag 'except=' on any of the arguments to "[" to
replace/extend the limited negative integer convention.  The idea was
that
iris[ except=c(10:20), except=c("Petal.Width","Petal.Length")) ]
would return all rows except 10:20 and all columns except
the ones named.
iris[ except=integer(0), ]
would return all rows of iris, while iris[-integer(0), ] returns
no rows of iris.

This abuses the tag= notation, but the "[" function doesn't
really support the i= and j= tags that some people expect.

This would take care of the problem that subset(data.frame,select=-name)
only lets you omit columns.

The mail had a version of [.data.frame (for Splus 2.1?) that
implemented this, although, if it is to be used it should be
implemented in the most primitive [ code so all methods use it.


Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."

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


Re: [Rd] PR#6614

2006-02-27 Thread David Hugh-Jones
One thing I notice is that after using subset() on a data frame
imported from SPSS, my variable.names attribute disappeared. I guess
what I would expect is for a subset() method always to preserve
everything but the omitted column.

Cheers
David

On 27/02/06, Bill Dunlap <[EMAIL PROTECTED]> wrote:
> On Wed, 23 Feb 2006, Peter Dalgaard wrote:
>
> > "Gabor Grothendieck" <[EMAIL PROTECTED]> writes:
> >
> > > Try this:
> > >
> > >  subset(iris, select = - Species)
> >
> > Or, canonically,
> >
> > nm <- names(iris)
> > iris[, nm != "Species" ]
> >
> > iris[, -match("Species", nm)]
> >
> > >
> > > On 2/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > I agree with the submitter that this needs some kind of solution.
> > > > Although data.frame[,-12] works, how do I drop a named column (the
> > > > most common use case)? (I found this bug while searching for an
> > > > answer.)
>
> That code with match only works if "Species" is actually
> a column of iris.  If not, your result depends on whether
> you have a data.frame (an error) or a matrix (a column
> of NA's).
>
> I found some mail in a 15 year old sent-mail file that suggested
> allowing the tag 'except=' on any of the arguments to "[" to
> replace/extend the limited negative integer convention.  The idea was
> that
> iris[ except=c(10:20), except=c("Petal.Width","Petal.Length")) ]
> would return all rows except 10:20 and all columns except
> the ones named.
> iris[ except=integer(0), ]
> would return all rows of iris, while iris[-integer(0), ] returns
> no rows of iris.
>
> This abuses the tag= notation, but the "[" function doesn't
> really support the i= and j= tags that some people expect.
>
> This would take care of the problem that subset(data.frame,select=-name)
> only lets you omit columns.
>
> The mail had a version of [.data.frame (for Splus 2.1?) that
> implemented this, although, if it is to be used it should be
> implemented in the most primitive [ code so all methods use it.
>
> 
> Bill Dunlap
> Insightful Corporation
> bill at insightful dot com
> 360-428-8146
>
>  "All statements in this message represent the opinions of the author and do
>  not necessarily reflect Insightful Corporation policy or position."
>

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


[Rd] readline and/or lme crashes R (PR#8646)

2006-02-27 Thread mmorales
Full_Name: Manuel Morales
Version: 2.2.1
OS: Linux (Fedora Core 4)
Submission from: (NULL) (137.165.200.32)


I've noticed that using readline after an lme analysis results in a crash.

E.g.
library(nlme)
fm1 <- lme(distance ~ age, data = Orthodont)
Crashes after typing the "up arrow", sometimes with the error message:

/usr/local/lib/R/bin/exec/R: symbol lookup error: /usr/lib/libreadline.so.5:
undefined symbol: tputs

Details:
nlme 3.1-68.1
readline-5.0-3

> R.version
 _
platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major2
minor2.1
year 2005
month12
day  20
svn rev  36812
language R

I tried to get a backtrace using gd, but bt gave the output, "no stack"

Manuel

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


Re: [Rd] PR#6614

2006-02-27 Thread Peter Dalgaard
Bill Dunlap <[EMAIL PROTECTED]> writes:

> On Wed, 23 Feb 2006, Peter Dalgaard wrote:
> 
> > "Gabor Grothendieck" <[EMAIL PROTECTED]> writes:
> >
> > > Try this:
> > >
> > >  subset(iris, select = - Species)
> >
> > Or, canonically,
> >
> > nm <- names(iris)
> > iris[, nm != "Species" ]
> >
> > iris[, -match("Species", nm)]
> >
> > >
> > > On 2/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > I agree with the submitter that this needs some kind of solution.
> > > > Although data.frame[,-12] works, how do I drop a named column (the
> > > > most common use case)? (I found this bug while searching for an
> > > > answer.)
> 
> That code with match only works if "Species" is actually
> a column of iris.  If not, your result depends on whether
> you have a data.frame (an error) or a matrix (a column
> of NA's).
> 
> I found some mail in a 15 year old sent-mail file that suggested
> allowing the tag 'except=' on any of the arguments to "[" to
> replace/extend the limited negative integer convention.  The idea was
> that
> iris[ except=c(10:20), except=c("Petal.Width","Petal.Length")) ]
> would return all rows except 10:20 and all columns except
> the ones named.
> iris[ except=integer(0), ]
> would return all rows of iris, while iris[-integer(0), ] returns
> no rows of iris.
> 
> This abuses the tag= notation, but the "[" function doesn't
> really support the i= and j= tags that some people expect.
> 
> This would take care of the problem that subset(data.frame,select=-name)
> only lets you omit columns.
> 
> The mail had a version of [.data.frame (for Splus 2.1?) that
> implemented this, although, if it is to be used it should be
> implemented in the most primitive [ code so all methods use it.

>From the language viewpoint, I think that using the same tag multiple
times and mixing up tagged and positional argument matching would be
quite nasty. I actually suspect that the argument matching rules will
make it impossible in R (except possibly from C and .Primitive). 

However, it could be possible to have an omit() function, as in

iris[ omit(c(10:20)), omit(c("Petal.Width","Petal.Length")) ]  

all this needs to do is to tack an attribute onto the index which the
indexing code can look for. 

-- 
   O__   Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


[Rd] Request for showWarnings parameter for write.table

2006-02-27 Thread Leif Kirschenbaum
Madams & Sirs,
  I use write.table to write CSV files to generate reports for my colleagues to 
open in their spreadsheet application of choice.  I often append data of 
dissimilar structure to the same file, i.e. a few summary lines and then 
additional data of some number of columns.

Normally write.table produces:
> write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,
append=TRUE,sep=",")
Warning message:
appending column names to file in: write.table(etest[, writevars], file = 
fname, row.names = FALSE,  


Therefore I resort to:

> options(warn=-1)
> write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,append=TRUE,sep=",")
> options(warn=0)


However I thought that perhaps a parameter such as included for dir.create 
would be more elegant:
> write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,
append=TRUE,sep=",",showWarnings=FALSE)


where showWarnings would default to TRUE.

Please cc: replies to [EMAIL PROTECTED]

Thank you.


Leif Kirschenbaum
Senior Yield Engineer
Reflectivity, Inc.
(408) 737-8100 x307
[EMAIL PROTECTED]

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


Re: [Rd] Request for showWarnings parameter for write.table

2006-02-27 Thread Gabor Grothendieck
You might also check out suppressWarnings, e.g.

suppressWarnings(write.table(...whatevever...))



On 2/27/06, Leif Kirschenbaum <[EMAIL PROTECTED]> wrote:
> Madams & Sirs,
>  I use write.table to write CSV files to generate reports for my colleagues 
> to open in their spreadsheet application of choice.  I often append data of 
> dissimilar structure to the same file, i.e. a few summary lines and then 
> additional data of some number of columns.
>
> Normally write.table produces:
> > write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,
>append=TRUE,sep=",")
> Warning message:
> appending column names to file in: write.table(etest[, writevars], file = 
> fname, row.names = FALSE,
>
>
> Therefore I resort to:
>
> > options(warn=-1)
> > write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,append=TRUE,sep=",")
> > options(warn=0)
>
>
> However I thought that perhaps a parameter such as included for dir.create 
> would be more elegant:
> > write.table(etest[,writevars],file=fname,row.names=FALSE,col.names=TRUE,
>append=TRUE,sep=",",showWarnings=FALSE)
>
>
> where showWarnings would default to TRUE.
>
> Please cc: replies to [EMAIL PROTECTED]
>
> Thank you.
>
>
> Leif Kirschenbaum
> Senior Yield Engineer
> Reflectivity, Inc.
> (408) 737-8100 x307
> [EMAIL PROTECTED]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

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


[Rd] trouble with R CMD SHLIB on winXP

2006-02-27 Thread j. signorovitch
Hi,

Has anyone come across this difficulty using R-2.2.1 in Windows XP:

when I try to run

R CMD SHLIB mycode.c

I get the response:

"The system cannot execute the specified program."

I've tried installing all windows updates, reinstalling R and putting
"R-2.2.1\bin" at the head of my path.

Googling that error message leads to lots of stuff about *.manifest
files.  The Rgui.exe.manifest etc. files are in my /bin directory.

Funny thing is I have been using SHLIB for ~2 years on this system, up
to several month ago, without difficulty.

Any suggestions would be greatly appreciated!

Thanks,

Jacob

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


[Rd] Typos in writeLines.Rd, readLines.Rd, and data.matrix.Rd

2006-02-27 Thread Stephen D. Weigand
Hello,

The diffs below are based on revision 37445 and show
some typo corrections for writeLines.Rd, readLines.Rd,
and data.matrix.Rd that I'd like to bring to the list's
attention.

Sincerely,

Stephen Weigand
Rochester, Minnesota, USA



--- ./src/library/base/man/writeLines.RdSun Feb 26 13:46:06 2006
+++ /tmp/writeLines.Rd  Sun Feb 26 20:53:44 2006
@@ -14,8 +14,8 @@
  each line of text.}
  }
  \details{
-  If the \code{con} is a character string, the functions call
-  \code{\link{file}} to obtain an file connection which is opened for
+  If the \code{con} is a character string, the function calls
+  \code{\link{file}} to obtain a file connection which is opened for
the duration of the function call.

If the connection is open it is written from its current position.


--- ./src/library/base/man/readLines.Rd Sun Feb 26 13:46:28 2006
+++ /tmp/readLines.Rd   Sun Feb 26 21:08:30 2006
@@ -16,8 +16,8 @@
  \code{n > 0} lines are read? If not, an error will be generated.}
  }
  \details{
-  If the \code{con} is a character string, the functions call
-  \code{\link{file}} to obtain an file connection which is opened for
+  If the \code{con} is a character string, the function calls
+  \code{\link{file}} to obtain a file connection which is opened for
the duration of the function call.

If the connection is open it is read from its current position.


--- ./src/library/base/man/data.matrix.Rd   Sun Feb 26 13:46:15 2006
+++ /tmp/data.matrix.Rd Sun Feb 26 21:14:33 2006
@@ -15,7 +15,7 @@
  factors or numeric vectors.}
  }
  \details{
-  Suppling a data frame with columns which are not numeric, factor or 
logical
+  Supplying a data frame with columns which are not numeric, factor or 
logical
is an error.  A warning is given if any non-factor column has a 
class,
as then information can be lost.
  }

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


Re: [Rd] Typos in writeLines.Rd, readLines.Rd, and data.matrix.Rd

2006-02-27 Thread Prof Brian Ripley
Fixed now, thanks.

BTW, supplying patches inline almost always does not work as lines get 
wrapped, tabs converted   A text attachment should be better.

On Mon, 27 Feb 2006, Stephen D. Weigand wrote:

> Hello,
>
> The diffs below are based on revision 37445 and show
> some typo corrections for writeLines.Rd, readLines.Rd,
> and data.matrix.Rd that I'd like to bring to the list's
> attention.
>
> Sincerely,
>
> Stephen Weigand
> Rochester, Minnesota, USA
>
>
>
> --- ./src/library/base/man/writeLines.RdSun Feb 26 13:46:06 2006
> +++ /tmp/writeLines.Rd  Sun Feb 26 20:53:44 2006
> @@ -14,8 +14,8 @@
>  each line of text.}
>  }
>  \details{
> -  If the \code{con} is a character string, the functions call
> -  \code{\link{file}} to obtain an file connection which is opened for
> +  If the \code{con} is a character string, the function calls
> +  \code{\link{file}} to obtain a file connection which is opened for
>the duration of the function call.
>
>If the connection is open it is written from its current position.
>
>
> --- ./src/library/base/man/readLines.Rd Sun Feb 26 13:46:28 2006
> +++ /tmp/readLines.Rd   Sun Feb 26 21:08:30 2006
> @@ -16,8 +16,8 @@
>  \code{n > 0} lines are read? If not, an error will be generated.}
>  }
>  \details{
> -  If the \code{con} is a character string, the functions call
> -  \code{\link{file}} to obtain an file connection which is opened for
> +  If the \code{con} is a character string, the function calls
> +  \code{\link{file}} to obtain a file connection which is opened for
>the duration of the function call.
>
>If the connection is open it is read from its current position.
>
>
> --- ./src/library/base/man/data.matrix.Rd   Sun Feb 26 13:46:15 2006
> +++ /tmp/data.matrix.Rd Sun Feb 26 21:14:33 2006
> @@ -15,7 +15,7 @@
>  factors or numeric vectors.}
>  }
>  \details{
> -  Suppling a data frame with columns which are not numeric, factor or
> logical
> +  Supplying a data frame with columns which are not numeric, factor or
> logical
>is an error.  A warning is given if any non-factor column has a
> class,
>as then information can be lost.
>  }
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

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

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


Re: [Rd] trouble with R CMD SHLIB on winXP

2006-02-27 Thread Prof Brian Ripley
We don't know from this what the `specified program' is, but it probably 
means that a DLL cannot be found on your path.

It is probable that your PATH is set up incorrectly, so please check with 
the R-admin manual extremely carefully.  In particular, that you really do 
have a complete unpacked tools.zip at the head of your path and that you 
do not also have Cygwin on your path.

On Mon, 27 Feb 2006, j. signorovitch wrote:

> Hi,
>
> Has anyone come across this difficulty using R-2.2.1 in Windows XP:
>
> when I try to run
>
> R CMD SHLIB mycode.c
>
> I get the response:
>
> "The system cannot execute the specified program."
>
> I've tried installing all windows updates, reinstalling R and putting
> "R-2.2.1\bin" at the head of my path.
>
> Googling that error message leads to lots of stuff about *.manifest
> files.  The Rgui.exe.manifest etc. files are in my /bin directory.

Really?  *.manifest files need to be in the same directory as the 
executables they refer to, that's all.  I think you have found hits
related to Visual .NET, which is not in use.

> Funny thing is I have been using SHLIB for ~2 years on this system, up
> to several month ago, without difficulty.


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

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