How I can convert variables using dplyr? Below code gives me:
All select() inputs must resolve to integer column positions.
mutate(superstore, Order.Date = as.Date(select(superstore, Order.Date)))
Data:
download.file('https://github.com/ywchiu/rcookbook/raw/master/chapter7/superstore_sales.csv', 'superstore_sales.csv')
I don't think you need to select the parameter you want to mutate. The code following would do (after you download the file to local directory):
library(read)
library(dplyr)
library(lubridate)
df <- read.csv("./superstore_sales.csv")
df <- mutate(df, Order.Date = as.Date(Order.Date))
Hope this could help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With