[Rd] data.frame weirdness
What is going on here? In the lines ending in the inputs and outputs are identical yet one gives a warning and the other does not. a1 <- `rownames<-`(anscombe[1:3, ], NULL) a2 <- anscombe[1:3, ] ix <- 5:8 # input arguments to are identical in both cases identical(stack(a1[ix]), stack(a2[ix])) ## [1] TRUE identical(a1[-ix], a2[-ix]) ## [1] TRUE res1 <- data.frame(stack(a1[ix]), a1[-ix]) res2 <- data.frame(stack(a2[ix]), a2[-ix]) ## Warning message: ## In data.frame(stack(a2[ix]), a2[-ix]) : ## row names were found from a short variable and have been discarded # results are identical identical(res1, res2) ## [1] TRUE -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] data.frame weirdness
They differ in whether the row names are "automatic": > .row_names_info(a1) [1] -3 > .row_names_info(a2) [1] 3 Best, -Deepayan On Tue, 14 Nov 2023 at 08:23, Gabor Grothendieck wrote: > > What is going on here? In the lines ending in the inputs and outputs > are identical yet one gives a warning and the other does not. > > a1 <- `rownames<-`(anscombe[1:3, ], NULL) > a2 <- anscombe[1:3, ] > > ix <- 5:8 > > # input arguments to are identical in both cases > > identical(stack(a1[ix]), stack(a2[ix])) > ## [1] TRUE > identical(a1[-ix], a2[-ix]) > ## [1] TRUE > > > res1 <- data.frame(stack(a1[ix]), a1[-ix]) > res2 <- data.frame(stack(a2[ix]), a2[-ix]) > ## Warning message: > ## In data.frame(stack(a2[ix]), a2[-ix]) : > ## row names were found from a short variable and have been discarded > > # results are identical > identical(res1, res2) > ## [1] TRUE > > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.com > > __ > 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] data.frame weirdness
In that case identical should be FALSE but it is TRUE identical(a1, a2) ## [1] TRUE On Tue, Nov 14, 2023 at 8:58 AM Deepayan Sarkar wrote: > > They differ in whether the row names are "automatic": > > > .row_names_info(a1) > [1] -3 > > .row_names_info(a2) > [1] 3 > > Best, > -Deepayan > > On Tue, 14 Nov 2023 at 08:23, Gabor Grothendieck > wrote: > > > > What is going on here? In the lines ending in the inputs and outputs > > are identical yet one gives a warning and the other does not. > > > > a1 <- `rownames<-`(anscombe[1:3, ], NULL) > > a2 <- anscombe[1:3, ] > > > > ix <- 5:8 > > > > # input arguments to are identical in both cases > > > > identical(stack(a1[ix]), stack(a2[ix])) > > ## [1] TRUE > > identical(a1[-ix], a2[-ix]) > > ## [1] TRUE > > > > > > res1 <- data.frame(stack(a1[ix]), a1[-ix]) > > res2 <- data.frame(stack(a2[ix]), a2[-ix]) > > ## Warning message: > > ## In data.frame(stack(a2[ix]), a2[-ix]) : > > ## row names were found from a short variable and have been discarded > > > > # results are identical > > identical(res1, res2) > > ## [1] TRUE > > > > > > -- > > Statistics & Software Consulting > > GKX Group, GKX Associates Inc. > > tel: 1-877-GKX-GROUP > > email: ggrothendieck at gmail.com > > > > __ > > R-devel@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] data.frame weirdness
Also why should that difference result in different behavior? On Tue, Nov 14, 2023 at 9:38 AM Gabor Grothendieck wrote: > > In that case identical should be FALSE but it is TRUE > > identical(a1, a2) > ## [1] TRUE > > > On Tue, Nov 14, 2023 at 8:58 AM Deepayan Sarkar > wrote: > > > > They differ in whether the row names are "automatic": > > > > > .row_names_info(a1) > > [1] -3 > > > .row_names_info(a2) > > [1] 3 > > > > Best, > > -Deepayan > > > > On Tue, 14 Nov 2023 at 08:23, Gabor Grothendieck > > wrote: > > > > > > What is going on here? In the lines ending in the inputs and outputs > > > are identical yet one gives a warning and the other does not. > > > > > > a1 <- `rownames<-`(anscombe[1:3, ], NULL) > > > a2 <- anscombe[1:3, ] > > > > > > ix <- 5:8 > > > > > > # input arguments to are identical in both cases > > > > > > identical(stack(a1[ix]), stack(a2[ix])) > > > ## [1] TRUE > > > identical(a1[-ix], a2[-ix]) > > > ## [1] TRUE > > > > > > > > > res1 <- data.frame(stack(a1[ix]), a1[-ix]) > > > res2 <- data.frame(stack(a2[ix]), a2[-ix]) > > > ## Warning message: > > > ## In data.frame(stack(a2[ix]), a2[-ix]) : > > > ## row names were found from a short variable and have been discarded > > > > > > # results are identical > > > identical(res1, res2) > > > ## [1] TRUE > > > > > > > > > -- > > > Statistics & Software Consulting > > > GKX Group, GKX Associates Inc. > > > tel: 1-877-GKX-GROUP > > > email: ggrothendieck at gmail.com > > > > > > __ > > > R-devel@r-project.org mailing list > > > https://stat.ethz.ch/mailman/listinfo/r-devel > > > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.com -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] data.frame weirdness
On Tue, 14 Nov 2023 at 09:41, Gabor Grothendieck wrote: > > Also why should that difference result in different behavior? That's justifiable, I think; consider: > d1 = data.frame(a = 1:4) > d2 = d3 = data.frame(b = 1:2) > row.names(d3) = c("a", "b") > data.frame(d1, d2) a b 1 1 1 2 2 2 3 3 1 4 4 2 > data.frame(d1, d2) a b 1 1 1 2 2 2 3 3 1 4 4 2 > data.frame(d1, d3) a b 1 1 1 2 2 2 3 3 1 4 4 2 Warning message: In data.frame(d1, d3) : row names were found from a short variable and have been discarded > data.frame(d2, d3) b b.1 a 1 1 b 2 2 > On Tue, Nov 14, 2023 at 9:38 AM Gabor Grothendieck > wrote: > > > > In that case identical should be FALSE but it is TRUE Yes, or at least both cases should warn (or not warn). Certainly not ideal, but one of the inevitable side effects of having two different ways of storing row names that R tries to pretend should be exchangeable, but are not (and some code not having caught up). Part of the problem, I think, is that it's not clear what the ideal behaviour should be in such cases (to warn or not to warn). Best, -Deepayan > > identical(a1, a2) > > ## [1] TRUE > > > > > > On Tue, Nov 14, 2023 at 8:58 AM Deepayan Sarkar > > wrote: > > > > > > They differ in whether the row names are "automatic": > > > > > > > .row_names_info(a1) > > > [1] -3 > > > > .row_names_info(a2) > > > [1] 3 > > > > > > Best, > > > -Deepayan > > > > > > On Tue, 14 Nov 2023 at 08:23, Gabor Grothendieck > > > wrote: > > > > > > > > What is going on here? In the lines ending in the inputs and > > > > outputs > > > > are identical yet one gives a warning and the other does not. > > > > > > > > a1 <- `rownames<-`(anscombe[1:3, ], NULL) > > > > a2 <- anscombe[1:3, ] > > > > > > > > ix <- 5:8 > > > > > > > > # input arguments to are identical in both cases > > > > > > > > identical(stack(a1[ix]), stack(a2[ix])) > > > > ## [1] TRUE > > > > identical(a1[-ix], a2[-ix]) > > > > ## [1] TRUE > > > > > > > > > > > > res1 <- data.frame(stack(a1[ix]), a1[-ix]) > > > > res2 <- data.frame(stack(a2[ix]), a2[-ix]) > > > > ## Warning message: > > > > ## In data.frame(stack(a2[ix]), a2[-ix]) : > > > > ## row names were found from a short variable and have been discarded > > > > > > > > # results are identical > > > > identical(res1, res2) > > > > ## [1] TRUE > > > > > > > > > > > > -- > > > > Statistics & Software Consulting > > > > GKX Group, GKX Associates Inc. > > > > tel: 1-877-GKX-GROUP > > > > email: ggrothendieck at gmail.com > > > > > > > > __ > > > > R-devel@r-project.org mailing list > > > > https://stat.ethz.ch/mailman/listinfo/r-devel > > > > > > > > -- > > Statistics & Software Consulting > > GKX Group, GKX Associates Inc. > > tel: 1-877-GKX-GROUP > > email: ggrothendieck at gmail.com > > > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] data.frame weirdness
Seems like a leaky abstraction. If both representations are supposed to be outwardly the same to the user then they should act the same and if not then identical should not be TRUE. On Tue, Nov 14, 2023 at 9:56 AM Deepayan Sarkar wrote: > > On Tue, 14 Nov 2023 at 09:41, Gabor Grothendieck > wrote: > > > > Also why should that difference result in different behavior? > > That's justifiable, I think; consider: > > > d1 = data.frame(a = 1:4) > > d2 = d3 = data.frame(b = 1:2) > > row.names(d3) = c("a", "b") > > data.frame(d1, d2) > a b > 1 1 1 > 2 2 2 > 3 3 1 > 4 4 2 > > data.frame(d1, d2) > a b > 1 1 1 > 2 2 2 > 3 3 1 > 4 4 2 > > data.frame(d1, d3) > a b > 1 1 1 > 2 2 2 > 3 3 1 > 4 4 2 > Warning message: > In data.frame(d1, d3) : > row names were found from a short variable and have been discarded > > data.frame(d2, d3) > b b.1 > a 1 1 > b 2 2 > > > > On Tue, Nov 14, 2023 at 9:38 AM Gabor Grothendieck > > wrote: > > > > > > In that case identical should be FALSE but it is TRUE > > Yes, or at least both cases should warn (or not warn). Certainly not > ideal, but one of the inevitable side effects of having two different > ways of storing row names that R tries to pretend should be > exchangeable, but are not (and some code not having caught up). > > Part of the problem, I think, is that it's not clear what the ideal > behaviour should be in such cases (to warn or not to warn). > > Best, > -Deepayan > > > > identical(a1, a2) > > > ## [1] TRUE > > > > > > > > > On Tue, Nov 14, 2023 at 8:58 AM Deepayan Sarkar > > > wrote: > > > > > > > > They differ in whether the row names are "automatic": > > > > > > > > > .row_names_info(a1) > > > > [1] -3 > > > > > .row_names_info(a2) > > > > [1] 3 > > > > > > > > Best, > > > > -Deepayan > > > > > > > > On Tue, 14 Nov 2023 at 08:23, Gabor Grothendieck > > > > wrote: > > > > > > > > > > What is going on here? In the lines ending in the inputs and > > > > > outputs > > > > > are identical yet one gives a warning and the other does not. > > > > > > > > > > a1 <- `rownames<-`(anscombe[1:3, ], NULL) > > > > > a2 <- anscombe[1:3, ] > > > > > > > > > > ix <- 5:8 > > > > > > > > > > # input arguments to are identical in both cases > > > > > > > > > > identical(stack(a1[ix]), stack(a2[ix])) > > > > > ## [1] TRUE > > > > > identical(a1[-ix], a2[-ix]) > > > > > ## [1] TRUE > > > > > > > > > > > > > > > res1 <- data.frame(stack(a1[ix]), a1[-ix]) > > > > > res2 <- data.frame(stack(a2[ix]), a2[-ix]) > > > > > ## Warning message: > > > > > ## In data.frame(stack(a2[ix]), a2[-ix]) : > > > > > ## row names were found from a short variable and have been > > > > > discarded > > > > > > > > > > # results are identical > > > > > identical(res1, res2) > > > > > ## [1] TRUE > > > > > > > > > > > > > > > -- > > > > > Statistics & Software Consulting > > > > > GKX Group, GKX Associates Inc. > > > > > tel: 1-877-GKX-GROUP > > > > > email: ggrothendieck at gmail.com > > > > > > > > > > __ > > > > > R-devel@r-project.org mailing list > > > > > https://stat.ethz.ch/mailman/listinfo/r-devel > > > > > > > > > > > > -- > > > Statistics & Software Consulting > > > GKX Group, GKX Associates Inc. > > > tel: 1-877-GKX-GROUP > > > email: ggrothendieck at gmail.com > > > > > > > > -- > > Statistics & Software Consulting > > GKX Group, GKX Associates Inc. > > tel: 1-877-GKX-GROUP > > email: ggrothendieck at gmail.com -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Segmentation fault early in compilation of revision 85514
On Mon, Nov 13, 2023 at 12:45 PM Avraham Adler wrote: > > On Mon, Nov 13, 2023 at 1:13 AM Dirk Eddelbuettel wrote: > > > > > > Avi, > > > > Might be toolchain-dependent, might be options-dependent--it built fine > > here. > > Easier for you to vary option two so maybe try that? > > > > Dirk > > Thank you, Dirk. > > I think it was more a PEBCAK issue. When I deleted the entire trunk > folder and started the process from scratch, it compiled properly as > per usual. Although this was revision 85520, so perhaps something > changed in the interim. > Are you using a separate build directory, or building in the src/ directory? The R Installation and Administration manual recommends using a separate build directory: You do not necessarily have to build R in the top-level source directory (say, TOP_SRCDIR). To build in BUILDDIR, run: cd BUILDDIR TOP_SRCDIR/configure make and so on, as described further below. This has the advantage of always keeping your source tree clean and is particularly recommended when you work with a version of R from Subversion. > Regardless, the issue resolved itself. > > Thanks, > > Avi > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Segmentation fault early in compilation of revision 85514
On 11/14/23 19:19, Joshua Ulrich wrote: On Mon, Nov 13, 2023 at 12:45 PM Avraham Adler wrote: On Mon, Nov 13, 2023 at 1:13 AM Dirk Eddelbuettel wrote: Avi, Might be toolchain-dependent, might be options-dependent--it built fine here. Easier for you to vary option two so maybe try that? Dirk Thank you, Dirk. I think it was more a PEBCAK issue. When I deleted the entire trunk folder and started the process from scratch, it compiled properly as per usual. Although this was revision 85520, so perhaps something changed in the interim. Are you using a separate build directory, or building in the src/ directory? The R Installation and Administration manual recommends using a separate build directory: You do not necessarily have to build R in the top-level source directory (say, TOP_SRCDIR). To build in BUILDDIR, run: cd BUILDDIR TOP_SRCDIR/configure make and so on, as described further below. This has the advantage of always keeping your source tree clean and is particularly recommended when you work with a version of R from Subversion. Well the compiler shouldn't crash, regardless of whether you do or don't use a separate build directory. It was probably not your fault. If you run into that again, it would be great if you could report it to the compiler developers. It is not so rare to run into compiler bugs and reporting those is an important service to the open-source community, R included. Best Tomas Regardless, the issue resolved itself. Thanks, Avi __ 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