Differences between revisions 1 and 2
Revision 1 as of 2017-11-09 16:29:22
Size: 2033
Editor: maegger
Comment:
Revision 2 as of 2017-11-09 16:37:58
Size: 2545
Editor: maegger
Comment:
Deletions are marked like this. Additions are marked like this.
Line 37: Line 37:
{{attachment:RStudio.png}}
Line 51: Line 52:
 * Start {{{R}}} (''either by command line or by using RStudio'')
 * Now define the height and weight of Jane, Joe, Jim and June.
 {{{
height = c(164, 188, 132, 154)
weight = c(69, 102, 38, 52)
}}}
 * Interested in some statistics, e.g. who is the tallest?
 {{{
summary(height)

   Min. 1st Qu. Median Mean 3rd Qu. Max.
  132.0 148.5 159.0 159.5 170.0 188.0
}}}
 * How about a simple '''plot''' of height and weight?
 {{{
plot(weight, height)
}}}

About R

R is an integrated suite of software facilities for data manipulation, calculation and graphical display.

Using R

In our environment you have the possibility to either directly start R from the command line or by using rstudio

By Command Line

  • Open a Terminal
  • type R to start R

    R version 3.4.2 (2017-09-28) -- "Short Summer"
    Copyright (C) 2017 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.
    
    [Previously saved workspace restored]
    
    >
  • You can now use any command you like. To exit R just type q()

with RStudio

RStudio is an integrated development environment (IDE) for R.

  • Start RStudio by typing rstudio in a shell

RStudio.png

Packages

R can be extended by more than 11'000 Packages. The standard (or base) packages are considered part of the R source code. They contain the basic functions that allow R to work, and the datasets and standard statistical and graphical functions that are described in the R manual.

Using a Base Packages

Let us assume you want to do some simple statistics about the height and weight of a family of four. The familly consists of the parents Jane and Joe and their kids Jim and June.

Member

Height

Weight

Jane

164

69

Joe

188

102

Jim

132

38

June

154

52

  • Start R (either by command line or by using RStudio)

  • Now define the height and weight of Jane, Joe, Jim and June.
    height = c(164, 188, 132, 154)
    weight = c(69, 102, 38, 52)
  • Interested in some statistics, e.g. who is the tallest?
    summary(height)
    
       Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      132.0   148.5   159.0   159.5   170.0   188.0 
  • How about a simple plot of height and weight?

    plot(weight, height)

Using an additional Package (rJava)

Programming/R (last edited 2020-09-03 13:52:40 by davidsch)