Hi friend ı have a question,
we have 6 (A,B,C,D,E,X) people and 8 (New York,Los Angeles,Chicago,Miami,Washington,San Diego,San Francisco,Boston) city. we havea df like below.AND THEY TRAVEL BETWEEN CITIES.
df <- data.frame(
PERSON = c("A","B","C","D","E","B","A","B","C","D","A","D","A","B","C","D","E","B","A","B"),
WEIGHT = c(1,2,3,5,7,2,4,5,1,3,2,5,7,8,4,5,2,4,1,3),
PIECE = c(4,5,2,1,1,99,1,5,4,20,5,86,15,50,20,1,100,1,310,825),
TOTAL_WEIGHT = c(4,10,6,5,7,198,4,25,4,60,10,430,105,400,80,5,200,4,310,2475),
FROM = c("New York","Los Angeles","Chicago","Miami","Washington","San Diego","San Francisco","Boston","New York","Los Angeles","Chicago","Miami","Washington","San Diego","San Francisco","Boston","New York","Los Angeles","Chicago","Miami"),
TO = c("Miami","New York","Los Angeles","Chicago","Miami","Washington","San Diego","San Francisco","Boston","New York","Los Angeles","Chicago","Miami","Washington","San Diego","San Francisco","Boston","New York","Los Angeles","Chicago")
)
I try to find sum of the total weights like below table.
Note: "X" person forget all the plan and doesn't travel. but ı report that in table.
How can ı do that?