# library
library(data.table)
# generate random data
data <-
data.table(
'Var1' = sample(-100:100, 5),
'Var2' = sample(-100:100, 5),
'Var3' = sample(-100:100, 5)
)
# option 1: directly through the variable names
data[, .(Var2, Var3)]
# option 2: using .SD & .SDcols
data[, .SD, .SDcols = c('Var2', 'Var3')]
Code Example |
---|
R :: name elements in vector r |
R :: r print concatenate |
R :: descending order a list in r |
R :: how to read file in r |
R :: how to multiply two columns in r |
R :: turn matrix into dataframe r |
R :: how to create dictionary in R |
R :: convert a row to a column in r |
R :: find length of a list or vector in r |
R :: export csv file in r |
R :: r environment variables |
R :: convert na to 0 in r |
R :: string concatination R |
R :: remove column from matrix r |
R :: R language get all columns in a dataset |
R :: convert int to character R |
R :: how to format a number in r |
R :: find nas in a vector r |
R :: logistic distribution CDF in r |
R :: generate pair in r |
R :: print string without quotes and escape sequence r |
R :: fcrit in r |
R :: add padding to number r |
R :: r alluvial chart with NA |
Rust :: create file rust |
Rust :: rust reverse an array |
Rust :: rust option |
Rust :: char to upper case rust |
Rust :: How to pass a string literal |
Rust :: armanriazi•rust•generic•monomorphization |