ggplot2 - R: geom_histogram(stat="identity), argument "env" is missing -


i want make color-coded histogram , ran problem.

i use ggplot on r 3.1.1

the initial attempt seen below, worked fine long indicators numerical. when changing indicators strings make easier understand graph, order in bars scrambled.

ggplot(df_2,aes(hard_failures,fill=indicator)) + geom_histogram()  

the next step add stat="identity"

ggplot(df_2,aes(hard_failures,fill=indicator)) + geom_histogram(stat="identity") 

now following error message, not know how fix.

error in exists(name, envir = env, mode = mode) : argument "env" missing, no default

does know how fix error message?

alternatively,does know how change written next colors on side, can keep indicators numerical , edit graph afterwards?

sorry way put data in. don't know how supposed put data in.

hard_failures   indicator      36    2      3     1      46    2     36    2      54    2      3     1     6     1     47    2  hard_failures   indicator      36    "time-rule"        3     "voltage-rule"     46    "time-rule"     36    "time-rule"        54    "time-rule"        3     "voltage-rule"     6     voltage-rule     47    time-rule 

edit: output of dput(head(yourdata, 10)) when data numeric.

structure(list(hard_failures = c(36, 3, 46, 36, 54, 3, 6, 47,  55, 2), indicator = structure(c(2l, 1l, 2l, 2l, 2l, 1l, 1l, 2l,  2l, 1l), .label = c("1", "2"), class = "factor")), .names =  c("hard_failures",  "indicator"), row.names = c(na, 10l), class = "data.frame")` 

the output of dput(head(yourdata, 10)) when data in strings.

structure(list(hard_failures = structure(c(21l, 14l, 32l, 21l,  41l, 14l, 43l, 33l, 42l, 8l), .label = c("0", "1", "10", "11",  "12", "14", "19", "2", "20", "21", "23", "28", "29", "3", "30",  "31", "32", "33", "34", "35", "36", "37", "38", "39", "4", "40",  "41", "42", "43", "44", "45", "46", "47", "48", "49", "5", "50",  "51", "52", "53", "54", "55", "6", "7", "8", "9"), class = "factor"),   indicator = structure(c(1l, 2l, 1l, 1l, 1l, 2l, 2l, 1l, 1l,   2l), .label = c("time-rule", "voltage-rule"), class = "factor")), .names >= c("hard_failures",  "indicator"), row.names = c(na, 10l), class = "data.frame")` 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -