Re: [Rd] Should subsetting named vector return named vector including named unmatched elements?

2024-01-18 Thread Hervé Pagès
Never been a big fan of this behavior either but maybe the intention was to make it easier to distinguish between 2 types of NAs in the result: those that were present in the original vector vs those that are introduced by an unmatched subscript. Like in this example:     x <- setNames(c(101:1

Re: [Rd] Should subsetting named vector return named vector including named unmatched elements?

2024-01-18 Thread Steve Martin via R-devel
Jiří, For your first question, the NA names make sense if you think of indexing with a character vector as the same as menu[match(select, names(menu))]. You're not indexing with "beans"; rather, "beans" becomes NA because it's not in the names of menu. (This is how it's documented in ?`[`: "Cha

[Rd] Should subsetting named vector return named vector including named unmatched elements?

2024-01-18 Thread Jiří Moravec
Subsetting vector (including lists) returns the same number of elements as the subsetting vector, including unmatched elements which are reported as `NA` or `NULL` (in case of lists). Consider: ``` menu = list(   "bacon" = "foo",   "eggs" = "bar",   "beans" = "baz"   ) select = c("bacon", "eg

Re: [Rd] [External] Re: Choices to remove `srcref` (and its buddies) when serializing objects

2024-01-18 Thread Ivan Krylov via R-devel
On Thu, 18 Jan 2024 09:59:31 -0600 (CST) luke-tier...@uiowa.edu wrote: > What does 'blow up' mean? If it is anything other than signal a "bad > binding access" error then it would be good to have more details. My apologies for not being precise enough. I meant the "bad binding access" error in al

Re: [Rd] [External] Re: Choices to remove `srcref` (and its buddies) when serializing objects

2024-01-18 Thread luke-tierney--- via R-devel
On Thu, 18 Jan 2024, Ivan Krylov via R-devel wrote: В Tue, 16 Jan 2024 14:16:19 -0500 Dipterix Wang пишет: Could you recommend any packages/functions that compute hash such that the source references and sexpinfo_struct are ignored? Basically a version of `serialize` that convert R objects to

Re: [Rd] Choices to remove `srcref` (and its buddies) when serializing objects

2024-01-18 Thread Charlie Gao via R-devel
> -- > > Date: Wed, 17 Jan 2024 11:35:02 -0500 > > From: Dipterix Wang > > To: Lionel Henry , Tomas Kalibera > > > > Cc: r-devel@r-project.org > > Subject: Re: [Rd] Choices to remove `srcref` (and its buddies) when > > serializing objects > > Message-ID: <3cf

Re: [Rd] Choices to remove `srcref` (and its buddies) when serializing objects

2024-01-18 Thread Ivan Krylov via R-devel
В Tue, 16 Jan 2024 14:16:19 -0500 Dipterix Wang пишет: > Could you recommend any packages/functions that compute hash such > that the source references and sexpinfo_struct are ignored? Basically > a version of `serialize` that convert R objects to raw without > storing the ancillary source refere