Here's an interesting article:
Collections in R: Review and Proposal
Timothy Barry
The R Journal
doi: 10.32614/RJ-2018-037
https://journal.r-project.org/archive/2018/RJ-2018-037/RJ-2018-037.pdf
On Tue, Nov 2, 2021 at 10:48 PM Yonghua Peng wrote:
>
> I know this is a ne
:47 AM
To: r-help@r-project.org
Subject: Re: [R] Is there a hash data structure for R
On 03-11-2021 00:42, Avi Gross via R-help wrote:
>
> Finally, someone mentioned how creating a data.frame with duplicate
> names for columns is not a problem as it can automagically CHANGE them
>
ate these things.
-Original Message-
From: R-help On Behalf Of Bill Dunlap
Sent: Tuesday, November 2, 2021 1:26 PM
To: Andrew Simmons
Cc: R Help
Subject: Re: [R] Is there a hash data structure for R
Note that an environment carries a hash table with it, while a named list
does not. I think
also packages for many features like sets as well as functions
to manipulate these things.
-Original Message-
From: R-help On Behalf Of Bill Dunlap
Sent: Tuesday, November 2, 2021 1:26 PM
To: Andrew Simmons
Cc: R Help
Subject: Re: [R] Is there a hash data structure for R
Note that an
Note that an environment carries a hash table with it, while a named list
does not. I think that looking up an entry in a list causes a hash table
to be created and thrown away. Here are some timings involving setting and
getting various numbers of entries in environments and lists. The times
ar
If you're thinking about using environments, I would suggest you initialize
them like
x <- new.env(parent = emptyenv())
Since environments have parent environments, it means that requesting a
value from that environment can actually return the value stored in a
parent environment (this isn't an
On Tue, 2 Nov 2021 at 10:48, Yonghua Peng wrote:
>
> I know this is a newbie question. But how do I implement the hash
structure
> which is available in other languages (in python it's dict)?
>
As other posters wrote then environments are the solution.
data.frames, vectors and lists are much slow
Yes. A data.frame is basically a list where all elements are vectors of
the same length. So this issue also exists in a data.frame. However, the
data.frame construction method will detect this and generate unique
names (which also might not be what you want):
> data.frame(a=1:3, a=1:3)
On 02/11/2021 4:13 a.m., Yonghua Peng wrote:
I know this is a newbie question. But how do I implement the hash structure
which is available in other languages (in python it's dict)?
I know there is the list, but list's names can be duplicated here.
As Eric said, the environment comes pretty cl
But for data.frame the colnames can be duplicated. Am I right?
Regards.
On Tue, Nov 2, 2021 at 6:29 PM Jan van der Laan wrote:
>
> True, but in a lot of cases where a python user might use a dict an R
> user will probably use a list; or when we are talking about arrays of
> dicts in python, the
True, but in a lot of cases where a python user might use a dict an R
user will probably use a list; or when we are talking about arrays of
dicts in python, the R solution will probably be a data.frame (with each
dict field in a separate column).
Jan
On 02-11-2021 11:18, Eric Berger wro
One choice is
new.env(hash=TRUE)
in the base package
On Tue, Nov 2, 2021 at 11:48 AM Yonghua Peng wrote:
> I know this is a newbie question. But how do I implement the hash structure
> which is available in other languages (in python it's dict)?
>
> I know there is the list, but list's names c
I know this is a newbie question. But how do I implement the hash structure
which is available in other languages (in python it's dict)?
I know there is the list, but list's names can be duplicated here.
> x <- list(x=1:5,y=month.name,x=3:7)
> x
$x
[1] 1 2 3 4 5
$y
[1] "January" "Februar
13 matches
Mail list logo