I am trying to use ggplot to plot 2 data sets of mine. This is my code below.
data <- read.table("test.txt",sep="\t",header = F)
y <- data.frame(v1=data$V7,v2=data$V8)
head(y)
v1 v2
1 -0.305037 0.00223546
2 -0.207126 0.26586100
3 0.290341 0.49381600
4 -0.345713 0.21023300
5 -1.249040 0.54090400
6 -0.340126 0.60984800
y2<-head(y,100)
d2<-melt(y2)
ggplot(d2,aes(y2=value, fill=variable)) + geom_density(alpha=0.25)
I was taking help from this post for my data set Overlay density plots I am getting this warning and the graph is not being generated:
Warning message:
Computation failed in stat_density()
:
attempt to apply non-function
How can I make this work?
Thanks