Skip to content

Presentation of data in Graphical format

18 messages · Sunita22, milton ruser, Sunita Patil +5 more

#
Hello

My data contains following columns:

1st column: Posts (GM, Secretary, AM, Office Boy)               
2nd Column: Dept (Finance, HR, ...)
3rd column: Tasks (Open the door, Fix an appointment, Fill the register,
etc.....) depending on the post
4th column: Average Time required to do the task

So the sample data would look like
Posts            Dept        Task                       Average time
Office Boy      HR           Open the door          00:00:09
Secretary       Finance    Fix an appointment    00.00.30
....                .....          .....                        .....

I am trying to represent this data in Graphical format, I tried graphs like
Mosaic plot, etc. But it does not represent the data correctly. My aim is to
check the "amount of time and its variability for groups of tasks"

Thank you in advance
Regards
Sunita
2 days later
#
Hi

r-help-bounces at r-project.org napsal dne 18.11.2009 16:01:27:
data
I agree with Tal. But it partly depends on your data. If you have many 
levels and only few time values in each boxplot would not look well. Maybe 
you could check also ?xtabs or ?table and/or R graph gallery 
http://addictedtor.free.fr/graphiques/ if you find suitable graph.

Regards
Petr
wrote:
wrote:
wrote:
time
graphs
aim
http://www.R-project.org/posting-guide.html
#
Given that you have neither provided your data, nor explained what you
are trying to uncover from it, what sort of advice do you expect to
get?

Hadley
#
That is not enough information for anyone to suggest a useful plot.
For a start:

 * How many observations do you have?
 * How many difference posts/departments/tasks?
 * Are the variables nested or crossed?
 * Have you successfully parsed the time representation into something
R can work with?  Is the representation inconsistent as in your
example?
 * What is the purpose of the study?  What do you want to find out?

Maybe you should meet with a local statistical consultant to discuss
these issues in person. WARNING: you might have to pay - good advice
is not always/seldom/ever free.

Hadley
On Wed, Nov 18, 2009 at 9:53 AM, Sunita Patil <sunitap22 at gmail.com> wrote:

  
    
#
Hi,

(Sorry, I didn't cc the r-help list)
On Nov 18, 2009, at 10:22 AM, Sunita Patil wrote:

            
I'm not sure what you mean, exactly.

Many of those graphs there aren't just "normal" R functions. They are  
put together using several commands in order to build the final  
picture you see there.

For instance, say you like this graph:

http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=145

At the bottom left of the page, you'll find a Source Code section  
under "Requirements".

Click the "view" link there:
http://addictedtor.free.fr/graphiques/graphcode.php?graph=145

And that's the code you need to make the graph (it's quite complex,  
but there are simpler ones.

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
  |  Memorial Sloan-Kettering Cancer Center
  |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
#
Hi (again),
On Nov 18, 2009, at 10:53 AM, Sunita Patil wrote:

            
Fine, we see what your data looks like, but what are you trying to  
plot?! What do you want to show people about this data?

-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
#
Well, from what you say it seems to me that you could also use Pareto 
charts together with some aggregation of data. But it depends on what you 
want to show to your audience. Below is some code which I slightly adapted 
form original author.

Regards
Petr

#----------------------------------------------------------------------------------------------------------------------
# pareto. Produces a Pareto plot of effects. 
# 
# Parameters: 
# effects - vector or matrix of effects to plot. 
# names - vector of names to label the effects. 
# xlab - String to display as the x axis label. 
# ylab - String to display as the y axis label. 
# perlab - Label for the cumulative percentage label. 
# heading - Vector of names for plot heading. 
# 
pareto <- function(effects, names=NULL, xlab=NULL, ylab="Magnitude of 
Effect", indicate.percent=TRUE, perlab="Cumulative Percentage", 
heading=NULL, trunc.perc=.95, long.names=FALSE,...) 
{ 
        # set up graphics parameters, note: set las=2 for perpendicular 
axis. 
        oldpar <- par( mar=c(6, 4, 2, 4) + 0.1 , las=3) 
        on.exit(par(oldpar)) 
 
        if( ! is.matrix(effects)) effects<-as.matrix( effects ) 
 
        for( i in 1:ncol(effects) ) 
        { 
 
                if( i==2 ) oldpar$ask<-par(ask=TRUE)$ask 
                # draw bar plot 
                eff.ord <- rev(order(abs(effects[,i]))) 
                ef <- abs(effects[eff.ord,i]) 
                names<-as.character(names)[eff.ord]
                # plot barplot 

                        # get cumulative sum of effects 
                        sumeff <- cumsum(ef) 
                        m<-max(ef) 
                        sm<-sum(ef) 
                        sumeff <- sumeff/sm

                vyber<-sumeff>trunc.perc
                suma.ef<-sum(ef[vyber])
                sumeff<-c(sumeff[!vyber],1)*m
                ef<-c(ef[!vyber],suma.ef)
                names<-c(as.character(names[!vyber]),"Dalsi")
                ylimit<-max(ef) + max(ef)*0.19 
                ylimit<-c(0,ylimit) 
                par( mar=c(6, 4, 2, 4) + 0.1 , las=3) 
 
        if (long.names) {
        x<- barplot(ef, names.arg=names, ylim=ylimit, xlab=xlab, 
ylab=ylab, main=heading[i], plot=F, ...)
        x<- barplot(ef, ylim=ylimit, xlab=xlab, ylab=ylab, 
main=heading[i], ...)
        text(x,ylimit[2]/10, names, srt=90, adj=0, cex=.7)} else {

                x<-barplot(ef, names.arg=names, ylim=ylimit, xlab=xlab, 
ylab=ylab, main=heading[i], ...) 
                }


                if( indicate.percent == TRUE ){ 



                        # draws curve. 
                        lines(x, sumeff, lty="solid", lwd=2, col="purple") 

                        # draw 80% line 
                        lines( c(0,max(x)), rep(0.8*m,2) ) 
                        # draw axis labling percentage. 
                        at <- c(0:5)* m/5 
                        axis(4, at=at, 
labels=c("0","20","40","60","80","100"), pos=max(x)+.6) 
                        # add axis lables 
                        par(las=0) 
                        mtext(perlab, 4, line=2) 
                } 
 
        } # end for each col 
} 


#Don Wingate 


r-help-bounces at r-project.org napsal dne 18.11.2009 16:17:32:
"Secretary"
list
wrote:
Maybe
<sunitap22 at gmail.com>
<milton.ruser at gmail.com
tried
correctly. My
tasks"
code.
code.
http://www.R-project.org/posting-guide.html
#
On 11/19/2009 03:13 AM, Sunita Patil wrote:
Hi Sunita,
You seem to have two aims, one to display the tasks, and the other to 
summarize the times. I have been looking at the plot.dendrite function 
and it might perform the first task with a bit of rewriting (which it 
needs anyway). The second task might be handled by the hierobarp 
function. I'll try to work out whether these will do the job in the next 
day or two.

Jim