I have the following data.frame
and i would like to multiply only the numeric
columns by a scalar
value.
library(tidyverse)
library(lubridate)
set.seed(123)
D1 <- data.frame(Date = seq(as.Date("2001-01-01"), to= as.Date("2001-01-10"), by="day"),
A1= runif(10,1,5),
B2 = runif(10,3,6),
C9 = runif(10,2,5))
I tried the following but it eliminate the Date
column
D <- D1 %>%
select(,c(2:4))*1000
Also this one remove the Date
column as well.
D <- D1 %>%
select_if(is.numeric)*1000
Are there any option that would keep the Date
column and does the multiplication ?