height <- 72
units <- "inches"
weight <- 230
a <- "ght"
pastem("My record indicates you are $height $(units).")
pastem("Your body mass index is $(round(703*weight/height^2))")
pastem("My record indicates you are $(hei$a) inches tall")
pastem("You are .(height) inches tall.This is below average", pattern = ".")
a <- ".This"
pastem("You are .(height) inches tall.a is below average", pattern = ".")
library(data.table)
N <- 100
DT <- data.table(
id = sample(5, N, TRUE),
v1 = sample(5, N, TRUE),
v2 = sample(1e6, N, TRUE)
)
newvar <- quote(temp)
myvar <- quote(v1)
byvar <- c("id", "v1")
quotem(DT[, list(`$newvar` = mean(`$myvar`)), by = `$byvar`])
evalm(DT[, list(`$newvar` = mean(`$myvar`)), by = `$byvar`])
Run the code above in your browser using DataLab