Re: [Rd] sort changes datatype of operand
Please do note that this too is a reading error. The documentation for rowsum() says group: a vector giving the grouping, with one element per row of 'x'. R has used 'group' as if it were as.vector(group), as it was entitled to do. If you do not want that, give a _vector_ with the property you do want, e.g. as.character(group). You could also call rowsum() with reorder=FALSE and reorder later to your taste. On Thu, 17 Aug 2006, Brahm, David wrote: > On 8/3/2006 10:34 AM, <[EMAIL PROTECTED]> noted that, > starting with R-2.3.0, sort() fails to preserve date classes: > > > dates <- seq(Sys.Date(), len=5, by="1 day") > > dates[order(dates)] > > [1] "2006-08-03" "2006-08-04" "2006-08-05" "2006-08-06" "2006-08-07" > > sort(dates) > > [1] 13363 13364 13365 13366 13367 > > and Duncan Murdoch <[EMAIL PROTECTED]> replied: > > > The problem is that some classes assume a particular ordering for > > values; sort can mess them up. If you know that's not the case, you > > can protect the class yourself: > > cl <- class(dates) > > sorteddates <- sort(dates) > > class(sorteddates) <- cl > > I have to agree with Stephen (and Alex Dannenberg in another post) > that this change is unfortunate for date classes. How do you > reproduce this old behavior (without assuming alphanumeric ordering): > > > x <- matrix(1:12, 4,3) > > group <- Sys.Date() + c(0,1,0,1) > > rowsum(x, group) >[,1] [,2] [,3] > 2006-08-174 12 20 > 2006-08-186 14 22 > > Under R-2.3.1, the result is now: > [,1] [,2] [,3] > 133774 12 20 > 133786 14 22 > > Blech! > > -- David Brahm ([EMAIL PROTECTED]) -- 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] sort changes datatype of operand
On 8/18/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > Please do note that this too is a reading error. The documentation for > rowsum() says > >group: a vector giving the grouping, with one element per row of > 'x'. > > R has used 'group' as if it were as.vector(group), as it was entitled to > do. If you do not want that, give a _vector_ with the property you do > want, e.g. as.character(group). > > You could also call rowsum() with reorder=FALSE and reorder later to your > taste. > > On Thu, 17 Aug 2006, Brahm, David wrote: > > > On 8/3/2006 10:34 AM, <[EMAIL PROTECTED]> noted that, > > starting with R-2.3.0, sort() fails to preserve date classes: > > > > > dates <- seq(Sys.Date(), len=5, by="1 day") > > > dates[order(dates)] > > > [1] "2006-08-03" "2006-08-04" "2006-08-05" "2006-08-06" "2006-08-07" > > > sort(dates) > > > [1] 13363 13364 13365 13366 13367 > > > > and Duncan Murdoch <[EMAIL PROTECTED]> replied: > > > > > The problem is that some classes assume a particular ordering for > > > values; sort can mess them up. If you know that's not the case, you > > > can protect the class yourself: > > > cl <- class(dates) > > > sorteddates <- sort(dates) > > > class(sorteddates) <- cl Just curious, what is it about the Date class that make it assume a "particular ordering" that sort() can mess up? Why is it wrong to have the following? sort.default <- base::sort sort <- function(...) UseMethod("sort") sort.Date <- function(x, ...) { y <- NextMethod("sort", x, ...); class(y) <- class(x); y } /Henrik > > > > I have to agree with Stephen (and Alex Dannenberg in another post) > > that this change is unfortunate for date classes. How do you > > reproduce this old behavior (without assuming alphanumeric ordering): > > > > > x <- matrix(1:12, 4,3) > > > group <- Sys.Date() + c(0,1,0,1) > > > rowsum(x, group) > >[,1] [,2] [,3] > > 2006-08-174 12 20 > > 2006-08-186 14 22 > > > > Under R-2.3.1, the result is now: > > [,1] [,2] [,3] > > 133774 12 20 > > 133786 14 22 > > > > Blech! > > > > -- David Brahm ([EMAIL PROTECTED]) > > -- > 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 > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] sort changes datatype of operand
On Fri, 18 Aug 2006, Henrik Bengtsson wrote: Commenting on a much earlier posting than mine! > On 8/18/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: [...] > > On Thu, 17 Aug 2006, Brahm, David wrote: > > > > > On 8/3/2006 10:34 AM, <[EMAIL PROTECTED]> noted that, > > > starting with R-2.3.0, sort() fails to preserve date classes: > > > > > > > dates <- seq(Sys.Date(), len=5, by="1 day") > > > > dates[order(dates)] > > > > [1] "2006-08-03" "2006-08-04" "2006-08-05" "2006-08-06" "2006-08-07" > > > > sort(dates) > > > > [1] 13363 13364 13365 13366 13367 > > > > > > and Duncan Murdoch <[EMAIL PROTECTED]> replied: > > > > > > > The problem is that some classes assume a particular ordering for > > > > values; sort can mess them up. If you know that's not the case, you > > > > can protect the class yourself: > > > > cl <- class(dates) > > > > sorteddates <- sort(dates) > > > > class(sorteddates) <- cl > > Just curious, what is it about the Date class that make it assume a > "particular ordering" that sort() can mess up? sort() is not written with knowledge of all classes including those not yet dreamt of. Duncan said 'some classes'. > Why is it wrong to have the following? > > sort.default <- base::sort > sort <- function(...) UseMethod("sort") > sort.Date <- function(x, ...) { y <- NextMethod("sort", x, ...); > class(y) <- class(x); y } For a start, that drops the "tzone" attribute, and the methods do not match the generic. And it dispatches lists to sort.list(). More importantly, it might be used on a class inheriting from "Date" which sort did mess up (e.g. one which stored labels in Japanese in an attribute). It is likely that there will be a solution to this in 2.4.0, fortunately written by people with a deeper understanding of the issues (and who have actually read the documentation). -- 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] Small typo in list.Rd
Gregor Gorjanc wrote: > Hello! > > There is a tiny typo in list.Rd. > > Index: R/src/library/base/man/list.Rd > === > --- ../man/list.Rd (revision 38909) > +++ ../man/list.Rd (working copy) > @@ -59,7 +59,7 @@ >inconsistent with functions such as \code{\link{as.character}}, and is >for efficiency since lists can be expensive to copy.) > > - \code{is.list} returns \code{TRUE} iff its argument > + \code{is.list} returns \code{TRUE} if its argument > Those are not typo's - (there are two "iff"'s in that paragraph). "iff" is a short-hand for "if and only if", in some culture. HTL __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Small typo in list.Rd
Hin-Tak Leung wrote: > Gregor Gorjanc wrote: >> Hello! >> >> There is a tiny typo in list.Rd. >> >> Index: R/src/library/base/man/list.Rd >> === >> --- ../man/list.Rd (revision 38909) >> +++ ../man/list.Rd (working copy) >> @@ -59,7 +59,7 @@ >>inconsistent with functions such as \code{\link{as.character}}, and is >>for efficiency since lists can be expensive to copy.) >> >> - \code{is.list} returns \code{TRUE} iff its argument >> + \code{is.list} returns \code{TRUE} if its argument >> > > Those are not typo's - (there are two "iff"'s in that paragraph). > "iff" is a short-hand for "if and only if", in some culture. OK, I did not know that and I appologize for making noise on the list for this. However, I wonder how many people know this? It is fine to have some short-hands (as IMHO, RTFM, etc. in e-mails), but these can be an obstacle for exact understanding of the documentation, specially for non-english users. -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- "One must learn by doing the thing; for though you think you know it, you have no certainty until you try." Sophocles ~ 450 B.C. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Small typo in list.Rd
Hi, iff is shorthand typically used in mathematical proofs. You have probably found the one group (users of R) that have the highest probability of knowing the meaning of "iff". That said, I agree that it should not be used in official documentation. It should be replaced with "if and only if" if it was not just a typo to begin with. Kevin On Aug 18, 2006, at 8:48 AM, Gregor Gorjanc wrote: > Hin-Tak Leung wrote: >> Gregor Gorjanc wrote: >>> Hello! >>> >>> There is a tiny typo in list.Rd. >>> >>> Index: R/src/library/base/man/list.Rd >>> === >>> --- ../man/list.Rd (revision 38909) >>> +++ ../man/list.Rd (working copy) >>> @@ -59,7 +59,7 @@ >>>inconsistent with functions such as \code{\link >>> {as.character}}, and is >>>for efficiency since lists can be expensive to copy.) >>> >>> - \code{is.list} returns \code{TRUE} iff its argument >>> + \code{is.list} returns \code{TRUE} if its argument >>> >> >> Those are not typo's - (there are two "iff"'s in that paragraph). >> "iff" is a short-hand for "if and only if", in some culture. > > OK, I did not know that and I appologize for making noise on the list > for this. However, I wonder how many people know this? It is fine to > have some short-hands (as IMHO, RTFM, etc. in e-mails), but these > can be > an obstacle for exact understanding of the documentation, specially > for > non-english users. > > -- > Lep pozdrav / With regards, > Gregor Gorjanc > > -- > University of Ljubljana PhD student > Biotechnical Faculty > Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan > Groblje 3 mail: gregor.gorjanc bfro.uni-lj.si > > SI-1230 Domzale tel: +386 (0)1 72 17 861 > Slovenia, Europefax: +386 (0)1 72 17 888 > > -- > "One must learn by doing the thing; for though you think you know it, > you have no certainty until you try." Sophocles ~ 450 B.C. > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] not a typo in list.Rd
> "Gregor" == Gregor Gorjanc <[EMAIL PROTECTED]> > on Fri, 18 Aug 2006 14:48:40 +0200 writes: Gregor> Hin-Tak Leung wrote: >> Gregor Gorjanc wrote: >>> Hello! >>> >>> There is a tiny typo in list.Rd. >>> >>> Index: R/src/library/base/man/list.Rd >>> === >>> --- ../man/list.Rd (revision 38909) >>> +++ ../man/list.Rd (working copy) >>> @@ -59,7 +59,7 @@ >>> inconsistent with functions such as \code{\link{as.character}}, and is >>> for efficiency since lists can be expensive to copy.) >>> >>> - \code{is.list} returns \code{TRUE} iff its argument >>> + \code{is.list} returns \code{TRUE} if its argument >>> >> >> Those are not typo's - (there are two "iff"'s in that paragraph). >> "iff" is a short-hand for "if and only if", in some culture. Gregor> OK, I did not know that and I appologize for making noise on the list Gregor> for this. However, I wonder how many people know this? I think I'd like to keep fostering a culture where this is known. It's such a beatiful useful short concise language element. If you don't know, nowadays there's Wikipedia where you can find it. Gregor> It is fine to have some short-hands (as IMHO, RTFM, Gregor> etc. in e-mails), but these can be an obstacle for Gregor> exact understanding of the documentation, specially Gregor> for non-english users. I knew what 'iff' means many years before I knew any of the above (and any other) e-mail acronyms, But that just shows how old I am Martin __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] How to use R and add-on packages as library in C/C++
Hi, I have a question for building a standalone exe file via C/C++ with R and add-on packages in Windows (Compiler is VC). It may looks like ... #include #include int main() { double *x, *y, z; // ... (Variables initial) z = ar( x, ...); // In this example, I want use the ar (time series) function (in stats package) // as a library funciton. // ... (Other statement) return 0; } In the "Writing R Extensions" manual, just demo with numerical functions, not statistical functions. I don't know is it possible to use statistical functions (Time series at least) or other functions in the add-on package, and how to make it. Thanks for your patient to reading this. ^^ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] not a typo in list.Rd
On 8/18/06, Martin Maechler <[EMAIL PROTECTED]> wrote: > > "Gregor" == Gregor Gorjanc <[EMAIL PROTECTED]> > > on Fri, 18 Aug 2006 14:48:40 +0200 writes: > >Gregor> Hin-Tak Leung wrote: >>> Gregor Gorjanc wrote: >>>> Hello! >>>> >>>> There is a tiny typo in list.Rd. >>>> >>>> Index: R/src/library/base/man/list.Rd >>>> === >>>> --- ../man/list.Rd (revision 38909) >>>> +++ ../man/list.Rd (working copy) >>>> @@ -59,7 +59,7 @@ >>>> inconsistent with functions such as \code{\link{as.character}}, and is >>>> for efficiency since lists can be expensive to copy.) >>>> >>>> - \code{is.list} returns \code{TRUE} iff its argument >>>> + \code{is.list} returns \code{TRUE} if its argument >>>> >>> >>> Those are not typo's - (there are two "iff"'s in that paragraph). >>> "iff" is a short-hand for "if and only if", in some culture. > >Gregor> OK, I did not know that and I appologize for making noise on the > list >Gregor> for this. However, I wonder how many people know this? > > I think I'd like to keep fostering a culture where this is > known. It's such a beatiful useful short concise language element. > If you don't know, nowadays there's Wikipedia where you can > find it. > >Gregor> It is fine to have some short-hands (as IMHO, RTFM, >Gregor> etc. in e-mails), but these can be an obstacle for >Gregor> exact understanding of the documentation, specially >Gregor> for non-english users. > > I knew what 'iff' means many years before I knew any of the > above (and any other) e-mail acronyms, But that just shows > how old I am > > Martin I think the documentation should be as clear as possible including to non-English speakers and to non-mathematicians and that means writing things out in full where there could be confusion. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] not a typo in list.Rd
Le 18.08.2006 15:56, Gabor Grothendieck a écrit : > On 8/18/06, Martin Maechler <[EMAIL PROTECTED]> wrote: > >>> "Gregor" == Gregor Gorjanc <[EMAIL PROTECTED]> >>> on Fri, 18 Aug 2006 14:48:40 +0200 writes: >>> >>Gregor> Hin-Tak Leung wrote: >>>> Gregor Gorjanc wrote: >>>>> Hello! >>>>> >>>>> There is a tiny typo in list.Rd. >>>>> >>>>> Index: R/src/library/base/man/list.Rd >>>>> === >>>>> --- ../man/list.Rd (revision 38909) >>>>> +++ ../man/list.Rd (working copy) >>>>> @@ -59,7 +59,7 @@ >>>>> inconsistent with functions such as \code{\link{as.character}}, and is >>>>> for efficiency since lists can be expensive to copy.) >>>>> >>>>> - \code{is.list} returns \code{TRUE} iff its argument >>>>> + \code{is.list} returns \code{TRUE} if its argument >>>>> >>>> >>>> Those are not typo's - (there are two "iff"'s in that paragraph). >>>> "iff" is a short-hand for "if and only if", in some culture. >> >>Gregor> OK, I did not know that and I appologize for making noise on the >> list >>Gregor> for this. However, I wonder how many people know this? >> >> I think I'd like to keep fostering a culture where this is >> known. It's such a beatiful useful short concise language element. >> If you don't know, nowadays there's Wikipedia where you can >> find it. >> >>Gregor> It is fine to have some short-hands (as IMHO, RTFM, >>Gregor> etc. in e-mails), but these can be an obstacle for >>Gregor> exact understanding of the documentation, specially >>Gregor> for non-english users. >> >> I knew what 'iff' means many years before I knew any of the >> above (and any other) e-mail acronyms, But that just shows >> how old I am >> >> Martin >> > > I think the documentation should be as clear as possible including > to non-English speakers and to non-mathematicians and that means > writing things out in full where there could be confusion. Hi, What about an \iff command ? -- +---+ | Romain FRANCOIS | | R Graph Gallery : http://addictedtor.free.fr/graphiques | `---+ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] not a typo in list.Rd
Martin Maechler <[EMAIL PROTECTED]> writes: > I think I'd like to keep fostering a culture where this is known. > It's such a beatiful useful short concise language element. If you > don't know, nowadays there's Wikipedia where you can find it. or a dictionary. http://dictionary.reference.com/browse/iff http://webster.com/dictionary/iff I'd figure if we can use it in Scrabble(tm), we can use it in technical documentation. - Allen S. Rout __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] S4 'object is not subsettable' in prototype
> "Martin" == Martin Morgan <[EMAIL PROTECTED]> > on Thu, 17 Aug 2006 15:35:53 -0700 writes: Martin> Extracting prototype structure apparently relies on list properties of Martin> the earlier S4 implementation. Martin> Martin >> setClass("A", representation(x="numeric")) Martin> [1] "A" >> str(getClass("A")) Martin> Formal class 'classRepresentation' [package "methods"] with 11 slots Martin> ..@ slots :List of 1 Martin> .. ..$ x: atomic [1:1] numeric Martin> .. .. ..- attr(*, "package")= chr "methods" Martin> ..@ contains : list() Martin> ..@ virtual : logi FALSE Martin> ..@ prototype :Error in object[1:ile] : object is not subsettable Thank you, Martin, As you probably know, in R-devel, S4 objects have been changed "under the hood" to finally have become ``first rate'' R entities; and more changes are expected before release. I agree you've found an "infelicity" in the current setup, since > setClass("A", representation(x="numeric")) [1] "A" > getClass("A")@prototype attr(,"x") numeric(0) > length(getClass("A")@prototype) [1] 1 > getClass("A")@prototype[1] Error in getClass("A")@prototype[1] : object is not subsettable > It's not clear yet to me *what* should be changed. For my taste, if length(object) returns 1, I'd typically want that object[1] should be valid; but I think we already have some (peculiar) exceptions to that rule. If you look at such prototypes for more complicated classes, you get even more the impression that some bit (maybe literally?) is missing somewhere. Martin __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] How to use R and add-on packages as library in C/C++
This is indeed in the manual you mention. To use R functions and not just standalone libRmath, you need to embed R. On Fri, 18 Aug 2006, Pai-Hsien Hung wrote: > Hi, > I have a question for building a standalone exe file via C/C++ with R > and add-on packages in Windows (Compiler is VC). It may looks like > ... > > #include > #include > > int main() { > double *x, *y, z; > > // ... (Variables initial) > > z = ar( x, ...); > // In this example, I want use the ar (time series) function (in stats > package) > // as a library funciton. > > // ... (Other statement) > > return 0; > } > > In the "Writing R Extensions" manual, just demo with numerical > functions, not statistical functions. I don't know is it possible to > use statistical functions (Time series at least) or other functions in > the add-on package, and how to make it. Thanks for your patient to > reading this. ^^ > > -- 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] Pb with contrib.url() (PR#9131)
On Aug 8, 2006, at 2:52 AM, Prof Brian Ripley wrote: > On Mon, 7 Aug 2006, Simon Urbanek wrote: > >> Herve, >> >> On Aug 7, 2006, at 11:34 AM, [EMAIL PROTECTED] wrote: >> >>> Recently I needed to download a few R packages for Unix, Windows >>> and Mac OS X. The idea was to put them all together on a USB key in >>> order to be able to install them on systems without network >>> connection. >>> >>> It worked fine for the "src" and "win.binary" packages but I had >>> the following problems with the "mac.binary" packages: >>> download.packages("XML", destdir=".", type="mac.binary") >>> Warning: unable to access index for repository >>> http://cran.fhcrc.org/bin/macosx/x86_64/contrib/2.3 >> >> ^^ we don't build binaries for x86_64 architecture, so you cannot use >> that (Apple didn't release Leopard yet, so there is no 64-bit Intel >> binaries around anyway). The only architectures supported by our >> binaries are powerpc, i686 and universal. > > Note that ?download.packages says (from Linux) > > type: character, indicating the type of package to download and > install. Possible values are '"source"' (the default except > under the CRAN Mac OS X build), '"mac.binary"' and > '"win.binary"' (which can be downloaded but not installed). > > so we do appear to say we can download MacOS binaries on non-MacOS > platforms. There in lies the problem as contrib.url > (type="mac.binary") > uses the architecture of the current platform. I think you need types > "mac.binary.powerpc" etc to now allow this. > Yes, I see, thanks. Given that we supply universal binaries (=should work on all supported archs), we could define mac.binary as macosx/ universal and mac.binary.xxx as macosx/xxx. The default would still be mac.binary. I'm not sure if we really need separate architecture binaries. The only benefit I see is that other repositories which don't have the resources to build binaries for all platforms could provide separate binaries. On CRAN the other directories are just symlinks to universal anyway. Any comments on that? Does anyone use the separate binaries feature? Cheers, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Pb with contrib.url() (PR#9131)
Simon Urbanek <[EMAIL PROTECTED]> writes: > Yes, I see, thanks. Given that we supply universal binaries (=should > work on all supported archs), we could define mac.binary as macosx/ > universal and mac.binary.xxx as macosx/xxx. The default would still > be mac.binary. I like this idea. > I'm not sure if we really need separate architecture binaries. The > only benefit I see is that other repositories which don't have the > resources to build binaries for all platforms could provide separate > binaries. On CRAN the other directories are just symlinks to > universal anyway. Any comments on that? Does anyone use the separate > binaries feature? Allowing folks to host an OS X architecture specific binary seems worthwhile, but I don't think CRAN-style repositories should have to have those dirs if they are only hosting universal binaries. Best, + seth __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] S4 'object is not subsettable' in prototype
Martin Maechler <[EMAIL PROTECTED]> writes: > I agree you've found an "infelicity" in the current setup, > since > > > setClass("A", representation(x="numeric")) > [1] "A" > > getClass("A")@prototype > > attr(,"x") > numeric(0) > > length(getClass("A")@prototype) > [1] 1 > > getClass("A")@prototype[1] > Error in getClass("A")@prototype[1] : object is not subsettable > > > > It's not clear yet to me *what* should be changed. > For my taste, if length(object) returns 1, > I'd typically want that object[1] should be valid; > but I think we already have some (peculiar) exceptions to that > rule. I disagree with the notion that length and "[" should be tightly coupled. An object having length doesn't have to mean that subsetting makes any sense. For example, an environment has length, but what should env1[1] return? And with S4 classes, there are many such examples where "[i]" won't make sense. + seth __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] S4 'object is not subsettable' in prototype
> "Seth" == Seth Falcon <[EMAIL PROTECTED]> > on Fri, 18 Aug 2006 09:54:54 -0700 writes: Seth> Martin Maechler <[EMAIL PROTECTED]> writes: >> I agree you've found an "infelicity" in the current setup, >> since >> >> > setClass("A", representation(x="numeric")) >> [1] "A" >> > getClass("A")@prototype >> >> attr(,"x") >> numeric(0) >> > length(getClass("A")@prototype) >> [1] 1 >> > getClass("A")@prototype[1] >> Error in getClass("A")@prototype[1] : object is not subsettable >> > >> >> It's not clear yet to me *what* should be changed. >> For my taste, if length(object) returns 1, >> I'd typically want that object[1] should be valid; >> but I think we already have some (peculiar) exceptions to that >> rule. Seth> I disagree with the notion that length and "[" should be tightly Seth> coupled. An object having length doesn't have to mean that subsetting Seth> makes any sense. For example, an environment has length, but what Seth> should env1[1] return? And with S4 classes, there are many such Seth> examples where "[i]" won't make sense. You are right. I was rather thinking of "basic" objects rather than highly structured objects such as S4 classes. Note that for me, an environment belongs into the category of "peculiar" exceptions ;-) Martin Seth> + seth __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] 32- / 64-bit R query
Hello, Is there a way to query whether R has been compiled using 32- or 64-bits? A certain memory-intensive simulation will need to be optimized differently depending on the memory constraints of the architecture such that it will run quickly in 64-bits, and will run within ~3GB under 32-bits. And as I'd like to distribute the simulation across a mixed-architecture cluster using the snow package, I'd like each R process to be optimized accordingly. Thanks, Robert Robert McGehee Quantitative Analyst Geode Capital Management, LLC 53 State Street, 5th Floor | Boston, MA | 02109 Tel: 617/392-8396Fax:617/476-6389 mailto:[EMAIL PROTECTED] > This e-mail, and any attachments hereto, are intended for ...{{dropped}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] 32- / 64-bit R query
.Machine$sizeof.pointer is 4 or 8. On Fri, 18 Aug 2006, McGehee, Robert wrote: > Hello, > Is there a way to query whether R has been compiled using 32- or > 64-bits? A certain memory-intensive simulation will need to be optimized > differently depending on the memory constraints of the architecture such > that it will run quickly in 64-bits, and will run within ~3GB under > 32-bits. And as I'd like to distribute the simulation across a > mixed-architecture cluster using the snow package, I'd like each R > process to be optimized accordingly. > > Thanks, > Robert > > Robert McGehee > Quantitative Analyst > Geode Capital Management, LLC > 53 State Street, 5th Floor | Boston, MA | 02109 > Tel: 617/392-8396Fax:617/476-6389 > mailto:[EMAIL PROTECTED] > > > > > This e-mail, and any attachments hereto, are intended for ...{{dropped}} > > __ > 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] 32- / 64-bit R query
One way is to look at .Machine$sizeof.pointer -- 4 on 32-bit and 8 on 64-bit. luke On Fri, 18 Aug 2006, McGehee, Robert wrote: > Hello, > Is there a way to query whether R has been compiled using 32- or > 64-bits? A certain memory-intensive simulation will need to be optimized > differently depending on the memory constraints of the architecture such > that it will run quickly in 64-bits, and will run within ~3GB under > 32-bits. And as I'd like to distribute the simulation across a > mixed-architecture cluster using the snow package, I'd like each R > process to be optimized accordingly. > > Thanks, > Robert > > Robert McGehee > Quantitative Analyst > Geode Capital Management, LLC > 53 State Street, 5th Floor | Boston, MA | 02109 > Tel: 617/392-8396Fax:617/476-6389 > mailto:[EMAIL PROTECTED] > > > >> This e-mail, and any attachments hereto, are intended for ...{{dropped}} > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Luke Tierney Chair, Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel