Tag Archives: R

R shell session to plot a Graph

The following is a R shell session to plot a graph.

$R

R version 3.0.3 (2014-03-06) -- "Warm Puppy"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> timereal <- c(19,21,24,20,24) 
> timeuser <- c(16,16,20,12,12) 
> timesys <- c(0,4,0,4,8)
> timedata <- c(timereal,timeuser,timesys)
> png(filename="barplot-array-size-100-python.png")
> barplot(timedata,col=rainbow(5))
Fontconfig warning: "/etc/fonts/conf.d/65-droid-sans-fonts.conf", line 103: Having multiple values in  isn't supported and may not work as expected
Fontconfig warning: "/etc/fonts/conf.d/65-droid-sans-fonts.conf", line 138: Having multiple values in  isn't supported and may not work as expected
> dev.off()
null device 
          1 
> 

R boxplot – Produce box-and-whisker plot(s) of the given (grouped) values

R shell session

> boxplot
function (x, ...)
UseMethod("boxplot")


> boxplot(1,2)
> boxplot(1,2)
> boxplot(1,2,3)
> threads <- factor(c(0,1,2,3,4,5,6,7,8,9))
> levels(threads)
 [1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
> maximum <- c(10,11,12,13,14,15,16,17,18,19,20)
> boxplot(threads,maximum)
> minimum <- c(10,11,12,13,14,15,16,17,18,19,20)
> boxplot(threads,maximum,minimum)
> actual <- c(13,14,15,16,17)
> boxplot(threads,maximum,minimum,actual)
> png(file="Rboxplot.png")
> boxplot(threads,maximum,minimum,actual)
> dev.off()
null device
          1
>

FIXME : create a R boxplot image from the above session.

R upstream project page

http://www.r-project.org/

R barplot for ls command details

commandline session


root>R

R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> lscalls <- c(2,707,16,11,25,26,24,38,4,5,2,1,2,9,1,1,2,1,1,1,1)
>  png(file="Rbarplot-ls.png")
> barplot(lscalls)
> dev.off
function (which = dev.cur()) 
{
    if (which == 1) 
        stop("cannot shut down device 1 (the null device)")
    .External(C_devoff, as.integer(which))
    dev.cur()
}


> dev.off()
null device 
          1 
> 

Rbarplot-ls