Here is my toy dataframe.How can I get the combination of a minimum number of variables that uniquely identify the observations in the dataframe i.e which variables together can make the primary key?
Joining the data tables:via returns the expected result. However, I would expect the line:to returnbecause the keyword on:
I have data as follows and I want to create new variable that takes into account the preceding information in the prior period. For example,
I need to aggregate overlapping segments into a single segment ranging all connected segments. Note that a simple foverlaps cannot detect connections between non overlapping but connected segments, see the example for clarification. If it would rain on my segments in my plot I am looking for the stretches of...
Suppose this is my datasetI need calculate frequency for two groupsand for variable var1, calculate count of 1 value and 2 value. For each group. So the desired output
I have 2 data.tables:The result I expect is the following: joining label from dt2 to dt1 by the fact that value1 in dt1 is between valueMin and valueMax in dt2 and dt2$name matches to value1). Here is a solution I have (gives correct result):
I have a very large data.table in which (a large number of) items are defined by strings including text and numbers.
I have the below data set:I want to create a new column df3 with first value equal to 100 and then lag(df3, 1) * (1 + df2). So the final output will be:
I have a dataset with repeating sequences of TRUE that I would like to label based on some conditions - by id, and by the sequence's incremental value. A FALSE breaks the sequence of TRUEs and the first FALSE that breaks any given sequence of TRUE should be included in...
I still have a difficult time thinking about how one works with R data.table columns which are lists.