search for: pct1

Displaying 1 result from an estimated 1 matches for "pct1".

Did you mean: pc1
2017 Aug 13
1
ggplot's aes_ doesn't work as expected for x=factor()
...riable names on the fly. Using aes_ doesn't work as I expected when x = factor(x). Is this a bug or am I not understanding something? # toy dataset df <- data.frame(LogicalVar = c(FALSE, TRUE, FALSE, TRUE, FALSE, TRUE), Var1 = c(0.01, 0.01, 1, 1, 30, 30), pct1 = c(12, 88, 60, 40, 93, 7), Var2 = c(2, 2, 4, 4, 8, 8), pct2 = c(43, 57, 10, 90, 50, 50) ) varnames <- names(df) # using aes()--this works ggplot(df, aes(x=factor(Var1), y=pct1, fill=LogicalVar)) + geom_bar(stat="identity") # works #...