If you need to make a list of long but unknown length you can save time by
adding the items to an environment, with names giving the order, then
converting the environment to a list when you are done filling the
environment. E.g.,
> makeData
function (container, n)
{
for (i in seq_len(n)) con
Dear Jeff, it is a precious help and a fabulous suggestion. I will slowly
go over the R code that you have sent. Thanks a lot !
On Wed, Jul 25, 2018 at 10:43 AM, Jeff Newmiller
wrote:
> The code below reeks of a misconception that lists are efficient to add
> items to, which is a confusion with
The code below reeks of a misconception that lists are efficient to add
items to, which is a confusion with the computer science term "linked
list". In R, a list is NOT a linked list... it is a vector, which means
the memory used by the list is allocated at the time it is created, and
REALLOCA
Dear Thierry and Juan, thank you for your help. Thank you all.
Now, if I would like to add an element to the empty list, how shall I do :
for example, shall i = 2, and j = 1, in a bit of more complex R code :
x <- data.frame(TYPE=c("DEL", "DEL", "DUP", "TRA", "INV", "TRA"),
CHRA=c("chr1", "chr1",
Hi Bogdan,
Does the following do what you expect?
x$intersectA[[i]] <- c(x$intersectA[[i]], x$labA[j])
Note the difference between `[[` and `[`
On Wed, Jul 25, 2018 at 9:26 AM, Bogdan Tanasa wrote:
> Dear Thierry and Juan, thank you for your help. Thank you very much.
>
> Now, if I would like
Dear Thierry and Juan, thank you for your help. Thank you very much.
Now, if I would like to add an element to the empty list, how shall I do :
for example, shall i = 2, and j = 1, in a bit of more complex R code :
x <- data.frame(TYPE=c("DEL", "DEL", "DUP", "TRA", "INV", "TRA"),
CHRA=c("chr1", "
Thank you Juan.
On Wed, Jul 25, 2018 at 12:56 AM, Juan Telleria Ruiz de Aguirre <
jtelleria.rproj...@gmail.com> wrote:
> Check tidyverse's purrr package:
>
> https://github.com/rstudio/cheatsheets/raw/master/purrr.pdf
>
> In the second page of the cheatsheet there is info on how to create list
>
On 07/25/2018 10:23 AM, Ivan Calandra wrote:
Just for my understanding:
Is a data.frame with list columns still a data.frame? Isn't it then a list?
A data.frame is a list of equally sized vectors - that is, each vector
must be of the same length. It is not required that the vector is an
at
At first I was actually thinking about this situation, which cannot work:|
data.frame(x = 1:3, y = list(1:2, 1:3, 1:4))
|But I had never thought about this:|
df$y <-list(1:2, 1:3, 1:4)|
And it actually makes sense. The final requirement here is that all
columns must have the same length!
I'm not
By the way, this also works:
dfl <- data.frame(x = 1:3, y = I(list(1:2, 1:3, 1:4)))
As indicated in "Advanced R" book:
http://adv-r.had.co.nz/Data-structures.html#data-frames
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://
> Just for my understanding:
> Is a data.frame with list columns still a data.frame? Isn't it then a list?
* A data.frame (or tibble) is a list of columns.
* In which each column must be from the same data type, in this case list().
__
R-help@r-project.
Just for my understanding:
Is a data.frame with list columns still a data.frame? Isn't it then a list?
Ivan
--
Dr. Ivan Calandra
TraCEr, laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567
Dear Bogdan,
You are looking for x$intersectA <- vector("list", nrow(x))
Best regards,
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / T
Check tidyverse's purrr package:
https://github.com/rstudio/cheatsheets/raw/master/purrr.pdf
In the second page of the cheatsheet there is info on how to create list
columns within a data.frame :)
[[alternative HTML version deleted]]
__
R-help
Dear all,
assuming that I do have a dataframe like :
x <- data.frame(TYPE=c("DEL", "DEL", "DUP", "TRA", "INV", "TRA"),
CHRA=c("chr1", "chr1", "chr1", "chr1", "chr2", "chr2"),
POSA=c(10, 15, 120, 340, 100, 220),
CHRB=c("chr1", "chr1", "chr1", "chr2", "chr2", "chr1"),
POSB=c(30, 100, 300, 20, 200,
15 matches
Mail list logo