I am a beginner in R , I am trying to find the multiply (product price) column by (purchase price) in a new column name ( total ) , but I get an error when run the following :
new_test_import <- read_csv("test_import.csv")
head(new_test_import)
str(new_test_import)
colnames(new_test_import)
total_price <- select (new_test_import , "product" , "product_price" , "purchase_price")
mutate(total_price, total = product_price * purchase_price)
cols( product_price = col_character(), purchase_price = col_character()
Error in `mutate()`:
`**ℹ In argument: `total = product_price * purchase_price`.
Caused by error in `product_price * purchase_price`:
! non-numeric argument to binary operator***
Backtrace:
`1. dplyr::mutate(total_price, total = product_price * purchase_price)
2. dplyr:::mutate.data.frame(total_price, total = product_price * purchase_price)
3. dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
5. dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
6. mask$eval_all_mutate(quo)
7. dplyr (local) eval()