Hi,
I'm trying to do a density plot in Rshiny. I find it confusing with this error
Error: StatBin requires a continuous x variable: the x variable is discrete.Perhaps you want stat="count"?
My data looks like: t_data_gene
ENSG
S45 545
S43 4588
S36 454
S33 4685
...
I used:
ggplot(t_data_gene, aes(x=ENSG)) +
geom_histogram(aes(y=..density..),binwidth=100, colour="black", fill="salmon1")+
geom_density(alpha=.2)
This works fine but I assign ENSG to a variable var
inside output function of Rshiny
ggplot(t_data_gene, aes(x=var)) +
geom_histogram(aes(y=..density..),binwidth=100, colour="black", fill="salmon1")+
geom_density(alpha=.2)
I get the above error. Why is that and how do I resolve this? I tried using stat=count but it gives me a different plot.
ggplot(t_data_gene, aes(x=var)) + geom_bar()
var is a reserved keyword in the stats library, don't use it
Hey Jeremy, thanks for your input. I changed it to var_col, it still gives the same error.
put your rshiny project up on a github site so we can reproduce the problem
I have added the input files and code to my git. I have used aes_string to overcome the above issue, but I'm still not sure how to do a errorbar(issue with ymax and ymin).
https://github.com/vinishavenugopal/Rshiny
Please take a look. I get an error while generating errorbar.