search for: setdt

Displaying 10 results from an estimated 10 matches for "setdt".

2018 May 01
4
Merging dataframes
...Sorry - this may be trivial, but I am struggling here for this. For two dataframes (A and B), I wish to identify (based on a primary key-column present in both A & B) - 1. Which records (rows) of A did not match with B, and 2. Which records of B did not match with A ? I came across a setdt function while browsing, but when I tried it, it says - Could not find function "setdt". Overall, if there is any way of doing it (preferably in some simplified way), please advise. Many thanks in advance. regards, Tito [[alternative HTML version deleted]]
2018 May 01
0
Merging dataframes
...> > For two dataframes (A and B), I wish to identify (based on a primary > key-column present in both A & B) - > > 1. Which records (rows) of A did not match with B, and > > > > 2. Which records of B did not match with A ? > > > > I came across a setdt function while browsing, but when I tried it, it says > - Could not find function "setdt". > > > > Overall, if there is any way of doing it (preferably in some simplified > way), please advise. > > > Many thanks in advance. > > > regards, > &...
2018 May 02
2
Merging dataframes
...d B), I wish to identify (based on a primary >> key-column present in both A & B) - >> >> 1. Which records (rows) of A did not match with B, and >> >> >> >> 2. Which records of B did not match with A ? >> >> >> >> I came across a setdt function while browsing, but when I tried it, it >> says >> - Could not find function "setdt". >> >> >> >> Overall, if there is any way of doing it (preferably in some simplified >> way), please advise. >> >> >> Many thanks in ad...
2018 Jun 25
2
Transformar muchas variables factor en variables binarias de acuerdo a niveles
...stackoverflow.com/questions/33990760/converting-factors-to-binary-in-r df <-data.frame(a = c(1,2,3), b = c(1,1,2), c = c("Rose","Pink","Red"), d = c(2,3,4)) cbind(df[1:2], sapply(levels(df$c), function(x) as.integer(x == df$c)), df[4]) o así library(data.table) setDT(df)[, c(levels(df$c), "c") := c(lapply(levels(c), function(x) as.integer(x == c)), .(NULL))] Pero no me resuelve el tener que hacerlo algunos cientos de veces, que es lo que querría evitar. Sé que es evidente cómo se tiene que hacer, pero soy ciego a esa evidencia :-( Muchas gracia...
2018 May 02
0
Merging dataframes
...>>> key-column present in both A & B) - >>> >>> 1. Which records (rows) of A did not match with B, and >>> >>> >>> >>> 2. Which records of B did not match with A ? >>> >>> >>> >>> I came across a setdt function while browsing, but when I tried it, it >>> says >>> - Could not find function "setdt". >>> >>> >>> >>> Overall, if there is any way of doing it (preferably in some simplified >>> way), please advise. >>> &gt...
2018 Jun 25
2
Transformar muchas variables factor en variables binarias de acuerdo a niveles
...rame(a = c(1,2,3), b = c(1,1,2), c = > > c("Rose","Pink","Red"), d = c(2,3,4)) > > > > cbind(df[1:2], sapply(levels(df$c), function(x) as.integer(x == df$c)), > > df[4]) > > > > o así > > > > library(data.table) > > setDT(df)[, c(levels(df$c), "c") := > > c(lapply(levels(c), function(x) as.integer(x == c)), .(NULL))] > > > > > > Pero no me resuelve el tener que hacerlo algunos cientos de veces, que es > > lo que querría evitar. Sé que es evidente cómo se tiene que hacer, p...
2018 May 02
0
Merging dataframes
...am struggling here for this. >> For two dataframes (A and B), I wish to identify (based on a primary >> key-column present in both A & B) - >> 1. Which records (rows) of A did not match with B, and >> 2. Which records of B did not match with A ? >> I came across a setdt function while browsing, but when I tried it, it says >> - Could not find function "setdt". >> Overall, if there is any way of doing it (preferably in some simplified >> way), please advise. >> Many thanks in advance. >> regards, >> Tito >> [...
2018 Jun 25
2
Transformar muchas variables factor en variables binarias de acuerdo a niveles
...; > c("Rose","Pink","Red"), d = c(2,3,4)) > > > > > > cbind(df[1:2], sapply(levels(df$c), function(x) as.integer(x == df$c)), > > > df[4]) > > > > > > o as? > > > > > > library(data.table) > > > setDT(df)[, c(levels(df$c), "c") := > > > c(lapply(levels(c), function(x) as.integer(x == c)), .(NULL))] > > > > > > > > > Pero no me resuelve el tener que hacerlo algunos cientos de veces, que > es > > > lo que querr?a evitar. S? que es evide...
2024 Sep 22
2
store list objects in data.table
...ses. My data is organized in a data.table.? My goal is to perform analyses according to some groups.? The results of analysis are objects.? If these objects could be stored as elements of a data.table, this would help downstream summarizing of results. Let me try another example. carsdt <- setDT(copy(mtcars)) carsdt[, unique(cyl) |> length()] #[1] 3 carsreg <- carsdt[, .(fit = lm(mpg ~ disp + hp + wt)), by = .(cyl)] #I would like a data.table with three rows, one each for "lm" object corresponding to cyl value carsreg[, .N] #[1] 36 #Here each component of "lm&quo...
2024 Sep 22
1
store list objects in data.table
Well, you may have good reasons to do things this way -- and you certainly do not have to explain them here. But you might wish to consider using R's poly() function and a basic nested list structure to do something quite similar that seems much simpler to me, anyway: x <- rnorm(20) df <- data.frame(x = x, y = x + .1*x^2 + rnorm(20, sd = .2)) result <- with(df,