Sorry I had to edit the metadata file due to privacy concerns. I edited the files in the git, now if you can see the barplot function, it works completely fine if I don't add the errorbar. The issue is the getting the mean of var1 to be used in the ymin and ymax of errorbar. I appreciate your help. Thanks!
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()
1 answer
You are trying to merge on a column that does not exist in your metadata file.
The full metadata has no ExternalSampleId as well, in fact I don't see any column that can be merged with your expression data columns. You will need to format your Quote column or format the columns of your expression data to match them up.
Log in to answer this question.
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.