Tuesday, 15 July 2014

ggplot2 - Error while deriving name of Month in R -



ggplot2 - Error while deriving name of Month in R -

the next info shows projects, time frames, , phases. visualize info using r ggplot() code shown below. however, can see below, getting error while inferring months data. utilize name of months x-axis labels. moreover, need print name of projects besides rectangular boxes. please help me in this. give thanks you.

> temp projects starts ends order phase 2013-02-15 2013-03-15 1 research 2013-03-16 2013-04-15 1 prototype b 2013-04-07 2013-04-30 2 research b 2013-05-01 2013-08-30 2 prototype c 2013-05-01 2013-07-30 3 research d 2013-05-01 2013-07-30 4 research > = ggplot(temp, aes(xmin = starts, xmax = ends, ymin = order, ymax = order+0.5)) + geom_rect(aes(fill=phase), color="black") + theme_bw() > b = + geom_text(aes(x= starts + (ends-starts)/2 ,y=order+0.25, label=projects)) > b error in unit(x, default.units) : 'x' , 'units' must have length > 0 in addition: warning messages: 1: in ops.factor(ends, starts) : - not meaningful factors 2: in ops.factor(starts, (ends - starts)/2) : + not meaningful factors 3: removed 6 rows containing missing values (geom_text).

please see version of r.

> version _ platform i686-pc-linux-gnu arch i686 os linux-gnu scheme i686, linux-gnu status major 2 minor 15.2 year 2012 month 10 day 26 svn rev 61015 language r version.string r version 2.15.2 (2012-10-26)

try converting starts , ends date

temp$starts <- as.date(temp$starts) temp$ends <- as.date(temp$ends)

if not work, may want utilize dput(temp) , paste question.

copying + pasting op's data, converting date, using op's code

r ggplot2 monthcalendar

No comments:

Post a Comment