I have a dataframe 'd' like this:
breaks counts.x counts.y
1 -20 1 1
2 -15 0 1
3 -10 0 5
4 -5 4 18
5 0 13 27
6 5 18 25
7 10 9 12
8 15 2 1
9 20 1 7
10 25 NA 0
11 30 NA 1
When I try to melt using 'breaks' as id variable it is giving me the following error:
d=melt(d,id=breaks)
Error in varnames[id.vars] :
only 0's may be mixed with negative subscripts
How can I resolve this? I have to draw a ggplot using breaks on x axis and counts on y axis.
melt(d, id = "breaks")
(quotebreaks
) ormelt(d, id = 1)
. $\endgroup$dput(your_data_frame)
$\endgroup$