[datatable-help] subset data table in i with multiple criteria for multiple variables

2015-12-09 Thread carlsutton
Is there a way to subset a data table using "i" with multiple criteria using multiple variables(columns)? I have some test code shown below on what I have tried. And yes, I have read the documentation, taking the data camp class (Multiple viewing, I'm a slow learner) and have not seen anything

Re: [datatable-help] subset data table in i with multiple criteria for multiple variables

2015-12-09 Thread carlsutton
necessary in `i`. You can also chain data.tables: dt[a<35][b>35][, lapply(.SD, median, na.rm = T), by = d] --Mel. On 12/9/2015 1:02 PM, carlsutton wrote: > Is there a way to subset a data table using "i" with multiple criteria using > multiple variables(columns)?  I hav

[datatable-help] creating levels for a variable

2015-12-26 Thread carlsutton
Please forgive me for asking such a basic question. I have been fumbling around trying to learn R for a couple years via Data Camp, Coursera, and Lynda.com but keep amazing myself at how inadequate I am. I have searched this site and stack overflow and have not found an answer, probably because

[datatable-help] finding dt columns by partial name

2016-03-10 Thread carlsutton
Hi I did search but did not see an answer. I have a dt with 580 + columns. many of the columns will have variations of a name to specifically identify them, ie, call23,Call111, doCall.now, etc. Since I cannot recall the exact column names I have been resorting todf <- data.frame(dt) and

Re: [datatable-help] := and ':=" throwing errors

2016-04-01 Thread carlsutton
Thank you, I did not even think of wrapping in ( ) for the ':=" scenario. Feeling a bit silly about that. Just fooling around I did discover that dt[, "new.var" := fun(var), by = something] does work. For some reason I had been wrapping that (go figure), i.e. dt[, .("new.var" := fun(var)), by

[datatable-help] calculating proportions on 192 column data table grouped by one column

2016-07-27 Thread carlsutton
I can do the calculation on a couple columns, but how do I automate this for 192 column data table? # calculating proportion for column variables library(data.table) a <- rep(1:5, 2) b <- sample(20:50, size = 10, replace = TRUE) c <- sample(80:130, size = 10, replace = TRUE) dt1 <-

[datatable-help] filing a column with a number from another column by group

2016-12-01 Thread carlsutton
As a result of some computations using data.table wherein the computations require using "i" to select certain rows, the results of the computations only reside in those certain rows. Further computations require that the computation results be in each row by group. A much simplified example

[datatable-help] command := works with toy data but causes error with real data

2016-12-21 Thread carlsutton
Hi Thanks to the help from this list I was able to get the toy data to work and subsequently got cast to work. With anticipation of wonderful things to happen with real data, I copied the command from toy data to melt real data and R complained. What I would like to know: 1. What is wrong