search for: rbindlist

Displaying 20 results from an estimated 20 matches for "rbindlist".

2019 Nov 01
3
Getting error in rbindlist
...") == 0], + function(s) all_simple_paths(x, from = s, + to = V(x)[degree(x, mode = "out") == 0]) %>% + lapply( + function(y) as.data.table(t(names(y))) %>% setnames(paste0("LC", seq_along(.))) + ) %>% + rbindlist(use.names=TRUE,fill = TRUE) + ) %>% rbindlist(use.names=TRUE,fill = TRUE) + ) %>% rbindlist(use.names=TRUE,fill = TRUE, idcol = "Item") *Error message:* Error in rbindlist(., use.names = TRUE, fill = TRUE, idcol = "Item") : attempt to set index 8424/8424 in SET_STRING...
2019 Nov 01
0
Getting error in rbindlist
...on(s) all_simple_paths(x, from = s, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?to = V(x)[degree(x, mode = "out") == > 0]) %>% > ? ? ? lapply( > ? ? ? ? function(y) as.data.table(t(names(y))) %>% > setnames(paste0("LC", seq_along(.))) > ? ? ? ) %>% > ? ? ? rbindlist(use.names=TRUE,fill = TRUE) > ? ) %>% rbindlist(use.names=TRUE,fill = TRUE) > ) %>% rbindlist(use.names=TRUE,fill = TRUE, idcol = "Item") > > > *Regards,* > > *Anshul Saravgi* > > Consulting > > m:?7757030307 > > <https://www.o9solutions.com...
2013 Sep 18
1
rbinlist for data.table and specifying the column class
hello, This rbindlist(list(list(a=NA,b=NA),list(a=20,b=FALSE))) returns a b 1: NA NA 2: TRUE FALSE as per the documentation ?rbindlist is there a way to specify the column class of 'a' to be numeric? In actual usage, i wont be able to re-order the 2nd list entry to be the first. I did try rb...
2018 May 03
1
Converting a list to a data frame
This is very nice to learn about, Denis, but it seems only fair to point out that the result of rbindlist is not a data frame. You can convert it to a data frame easily, but the copy and indexing semantics of data tables are quite different than data tables, which could be a real headache for someone not prepared for those differences. (To learn more, read the data tables vignette.) Tibbles (as prod...
2018 May 02
0
Converting a list to a data frame
...e becomes a new > variable. For example, I would like to turn the list above into a data > frame that looks like this: > > data.frame(type=c("A","A","B","B"),x=c(1:2,5:6),y=c(3:4,7:8)) > > Appreciate any pointers. Hi Kevin, data.table::rbindlist does exactly what you want in a very efficient way: library(data.table) dat <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8)) rbindlist(dat, idcol = "type") Regards, Denes > > Kevin >
2017 Jun 29
2
about reading files in order
...are in the order 1, 10, 100, 101, etc. How to change it so that they are in order? Thanks for your help. temp <- list.files('folder01',pattern="*.txt" name.list <-lapply(paste('folder01',temp,sep='/'),read.table,head=F) library(data.table) files.matrix <-rbindlist(name.list) Also, when use the code below, how to complete it so that the values of the files are stored in a matrix? lists = list.files('folder01') for (i in 1:length(lists)){ file <- read.table(paste('folder01',lists[i],sep='/'),head=F) print(file) } [[alternative...
2013 Apr 03
2
Creating data frame from individual files
...s and column 1 is always identical for all 70 files. Each file has 90,799 rows and is standard across all files. I want to create a matrix 40(rows) x 70 columns. I tried : temp = list.files(pattern="*.txt") named.list <- lapply(temp, read.delim) library(data.table) files.matrix <-rbindlist(named.list) > dim(files.matrix) [1] 6537456 2 What happened here is all 90K rows for 72 files were rbinded. I want to cbind. Could anyone please help me. Thanks Adrian [[alternative HTML version deleted]]
2018 May 02
8
Converting a list to a data frame
I suspect this is pretty easy, but I'm having trouble figuring it out. Basically, I have a list of data frames such as the following example: list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8)) I would like to turn this into data frame where the list elements are essentially rbind'ed together and the element name becomes a new variable. For example, I would like to turn the
2017 Jun 30
1
about reading files in order
...t; > so that they are in order? Thanks for your help. > > > > temp <- list.files('folder01',pattern="*.txt" > > name.list <-lapply(paste('folder01',temp,sep='/'),read.table,head=F) > > library(data.table) > > files.matrix <-rbindlist(name.list) > > > > Also, when use the code below, how to complete it so that the values of > the > > files are stored in a matrix? > > lists = list.files('folder01') > > for (i in 1:length(lists)){ > > file <- read.table(paste('folder01',l...
2017 Jun 29
0
about reading files in order
...101, etc. How to change it > so that they are in order? Thanks for your help. > > temp <- list.files('folder01',pattern="*.txt" > name.list <-lapply(paste('folder01',temp,sep='/'),read.table,head=F) > library(data.table) > files.matrix <-rbindlist(name.list) > > Also, when use the code below, how to complete it so that the values of the > files are stored in a matrix? > lists = list.files('folder01') > for (i in 1:length(lists)){ > file <- read.table(paste('folder01',lists[i],sep='/'),head=F) &g...
2017 Jun 29
1
about reading files in order
...t; > so that they are in order? Thanks for your help. > > > > temp <- list.files('folder01',pattern="*.txt" > > name.list <-lapply(paste('folder01',temp,sep='/'),read.table,head=F) > > library(data.table) > > files.matrix <-rbindlist(name.list) > > > > Also, when use the code below, how to complete it so that the values of > the > > files are stored in a matrix? > > lists = list.files('folder01') > > for (i in 1:length(lists)){ > > file <- read.table(paste('folder01',l...
2024 Sep 28
1
lattice xyplot with cumsum() function inside
This code gives unexpected result. library(data.table) library(lattice) set.seed(123) mydt <- data.table(date = seq.Date(as.IDate("2024-01-01"), by = 1, length.out = 50), xgroup = "A", x = runif(50, 0, 1)) mydt <- rbindlist(list(mydt, data.table(date = mydt$date, xgroup = "B", x = runif(50, 0, 3)))) mydt[, `:=`(xcumsum = cumsum(x)), by = .(xgroup)] mydt[, lapply(.SD, sum), by = .(xgroup), .SDcols = c("x")] # xgroup x # <char> <num> #1: A 26.00455 #2: B 71.55405...
2015 Feb 16
3
consultas formularios web
Estimados Les consulto por lo siguiente, incluso creo que de esto se habló en una oportunidad en esta lista, por ese motivo cualquier sugerencia es bienvenida. Hay algo de información que me hace falta para un trabajo, pero esta no es de una única fuente, y desconozco si brindan los registros, pero lo que es accesible son los sitios web donde estas fuentes publican un formulario HTML simple,
2019 Jul 18
2
predict multinomial model con nnet
Hola todos Cuando realizo las predicciones del modelo multinomial con el paquete nnet, estas cambian cada vez que lo ejecuto ... saben por qué pasa esto ?? Gracias por la ayuda. [[alternative HTML version deleted]]
2014 Mar 15
0
allocation error and high CPU usage from kworker and migration: memory fragmentation?
...referenced by move. library(data.table) library(lubridate) # imports several data.tables, total 730 MiB load(UPC) # provides PL_flag data.table load(STORES) # and parent data.table timevar = 'month' by=c('retailer', 'month') save.dir='/tmp/R_cache' each.parent <- rbindlist(lapply(sort(list.files(MOVEMENT, full.names=T), reduction_function, upc=PL_flag, parent=parent, timevar=timevar, by=by)) reduction_function <- function(filename, upc, parent, timevar, by, save.dir=NA) { load(filenam...
2017 Feb 15
3
problemas con rBIND con distintos número de columnas
...os número de columnas ?Hola, Recordaba que sí que se podía hacer con data.table.... Efectivamente... > library(data.table) > x_dt <- data.table( a= rnorm(10), b = rnorm(10)) > y_dt <- data.table( a= rnorm(10), b = rnorm(10), c = rnorm(10)) > > l <- list(x_dt, y_dt) > rbindlist(l, fill = TRUE) a b c 1: 0.40654327 1.57344885 NA 2: 0.08165417 0.15028804 NA 3: 0.37026494 -1.18386924 NA 4: -0.93010544 2.24961712 NA 5: 0.10843810 0.24032676 NA 6: 0.15378877 -0.78666170 NA 7:...
2024 Sep 21
3
store list objects in data.table
I am trying to store regression objects in a data.table df <- data.frame(x = rnorm(20)) df[, "y"] <- with(df, x + 0.1 * x^2 + 0.2 * rnorm(20)) mydt <- data.table(mypower = c(1, 2), myreg = list(lm(y ~ x, data = df), lm(y ~ x + I(x^2), data = df))) mydt #?? mypower??? myreg #???? <num>?? <list> #1:?????? 1 <lm[12]> #2:?????? 2 <lm[12]> But mydt[1, 2]
2018 Oct 16
2
Comprobar los nombres de columnas entre varios dataframes
Buenas tardes, Quiero aplicar la función rbind y necesito tener los mismos nombres de columnas. Como tengo unas 195 variables en cada dataframe, necesito hacerlo de una forma rápida. Tengo 9 bases de datos y tengo que fusionar todas. ¿Como puedo comprobar que los nombres de las variables son los mismos? Y de lo contrario, ¿como detecto las diferencias? He probado con
2016 May 10
1
recursion problem using do.call(rbind, list(..,<S4>,..))
This was originally a bug report about Matrix, https://r-forge.r-project.org/tracker/?func=detail&atid=294&aid=6325&group_id=61 but the bug is rather a "design" bug in R, or a limitation. This e-mail is a report of the status quo as I see it, and call for comments, sugguests, help/hints for workarounds, or even a suggestion for a programming task helping R core to amend
2017 Feb 14
3
problemas con rBIND con distintos número de columnas
Hola Carlos: Tanto rbind(base) como rbind(data.table) generan el mismo resultado que no busco. Que solución se le podría dar específicamente a la data de 11 columnas, que es la que me da problema. Saludos. [Descripción: FIRMA2] De: Carlos Ortega [mailto:cof en qualityexcellence.es] Enviado el: martes, 14 de febrero de 2017 14:21 Para: Javier Valdes Cantallopts (DGA) CC: r-help-es en