I would like to ggplot(R) a bar graph of aggregated values based on the computation of multiple numeric columns of a table vs. some categorical column (this is also the "group by") of said table.
Table:
V1 V2 categorical 3 4 c1 5 6 c2 7 3 c2 3 8 c3
I would like to do something like this:
ggplot(Table, aes(categorical)) + stat_summary_bin(aes="V1 * V2"), fun.y = function(r) r$V1 * r$V2)
where the function stuffed into fun.y
accepts a row and then accesses its corresponding V1 and V2 values to return what would be mapped to the y-axis. The desired result would be a plot of 3 bars where c1: 12, c2: 51, and c3: 24.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.