Horje
merging rows and taking average of duplicate rows rstudio Code Example
merging rows and taking average of duplicate rows rstudio
library(data.table)
dat <- read.table(text='name    value   etc1    etc2
A       9       1       X
A       10      1       X
A       11      1       X
B       2       1       Y
C       40      1       Y
C       50      1       Y',header=TRUE)
keys <- colnames(dat)[!grepl('value',colnames(dat))]
X <- as.data.table(dat)
X[,list(mm= mean(value)),keys]
  name etc1 etc2 mm
1:    A    1    X 10
2:    B    1    Y  2
3:    C    1    Y 45




Whatever

Related
IoC, DI Code Example IoC, DI Code Example
camel style programming Code Example camel style programming Code Example
avoir le pourcentage de catégorie dans la variable R Code Example avoir le pourcentage de catégorie dans la variable R Code Example
how to insert only unique data room android Code Example how to insert only unique data room android Code Example
roblox see if player has gamepass Code Example roblox see if player has gamepass Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7