79298772

Date: 2024-12-21 02:26:00
Score: 1.5
Natty:
Report link

Use transmute to accomplish this. while also creating a new column with row names if needed.

data <- tibble( col1 = rep(4, 5),
                col2 = rep(2, 5))
rownames(data ) <- as.character(c("red", "blue", "green", "black", "brown"))

data %>% transmute(new_col = col1/col2, row_names = row.names(.))

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user28876813