I am doing a project which is similar to Uber Eat. I want to create new column in a data frame to calculate sub-total of these orders but because the class of each column is "list", R is not allowing me to do that. Do you know any ways to do it.
Thank you
a = c(1,2,3)
b = 1:2
c = (3,1)
P1 = c(12,13,4)
P2 = c(2,4)
P3 = c(12,1)
#My given dataframe will be:
Order | Price | Sub-total
a | P1 | sum(a*P1)
b | P2 | sum(b*P2)
c | P3 | sum(c*P3)
Expect output: Subtotal = [50, 10, 37]
Please see the attached image to understand my dataframe My dataframe
My goal is how to compute aP1, bP2, cP3 and then total sum of aP1....