Cloud Stack Ninja

I have two data frames and I'm asked to calculate the sub-total before discount. I tried to multiply Prices column with Quantities column from the first data frame and then add Delivery Fee from second data frame with R code

Order <- transform(
  Order,
  Sub_Total_Before_Discount=((raw$Prices * raw$Quantities) + Order$Delivery_Fee)
)

and it returns error

Error in raw$Prices * raw$Quantities : non-numeric argument to binary operator

I'm still new to R so please help me if there's any way to calculate this. Thank you so much.

1st data frame

2nd data frame



Read more here: https://stackoverflow.com/questions/64411879/is-there-an-r-function-to-multiply-two-columns-contain-vectors-in-a-data-frame-t

Content Attribution

This content was originally published by newt335 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: