Category archives: R

R scripting, particularly spatial analysis using R.

R seminar series section 2 # 3

Last update on March 30, 2017.


Download the datavis csv here



# Faith Musili

# R brownbag seminar November 10th, 2016

#Set your working directory

###Install package dplyr
install.packages("dplyr")

###Load dplyr package into R
library(dplyr)

###Read your csv data into R
data<-read.csv("datavis.csv")
class(data)
head(data)
tail(data)
dim(data)
colnames(data)


###Select function
#Select a ...

Continue reading

R seminar series section 2 #2

Last update on March 30, 2017.






#####Setting working directory

setwd("/Users/FMusili/Documents/2.2")

#########Creating objects ##########################

n <- 150
n

58 -> n
n

x <- 1.4
x

X <- 19
X

################Importing Data of different formats############

######### read.csv---for csv
species_csv<-read.csv(file="/Users/FMusili/Documents/2.2/Data/species.csv")
species_csv<-read.csv(file="Data/species.csv")
class(species_csv)
dim(species_csv ...

Continue reading

R seminar series section 2 #1

Last update on March 30, 2017.


R seminar series #10

Last update on April 30, 2015.

String operations in R

Efficiently checking and/or changing strings in complex data sets is often very time consuming, but R has a rich set of functions for managing strings (e.g. sentences or paragraphs). We will focus on the stringr library in this sessions, introducing a few key functions. You will need:

library(stringr ...

Continue reading

R seminar series: Seminar 9

Last update on April 8, 2015.

If you remember, Tor introduced "dplyr" package back in seminar 7. This week, Anthony Ndungu (Research Method Group) continued with "dplyr" and some examples. You can see his presentation below  

Source code for 9th seminar is shown below.


#Antony Ndungu, RMG
#R Seminar
#Using ddply
#......................................................................
setwd("/Users/Antony/Documents/Antony/RMG stuffs/RTraining_ICRAF/Data/")
 
############################################
# library ...

Continue reading

R seminar series: Seminar 8

Last update on March 27, 2015.

We have conducted 8 R Brown-bag seminars till now. This week we decided to revisit some of the examples shown in previous seminars, participants were asked to write code in RStudio and show results (code writing practice session).  

See the presentation of seminar 8 below  


Data used in this seminar is available here and source ...

Continue reading

R seminar series - part 7

Last update on March 19, 2015.

ggplot2 and dplyr

The seventh R brownbag seminar was by Dr. Tor G. Vagen (Senior Scientist, ICRAF) who continued from the previous week and demonstrated more advanced use of ggplot2. The dplyr package, which will be the topic of several future seminars was also introduced.


# Tor-G Vågen
# R brownbag seminar march 19th, 2015
 
# For those ...

Continue reading

R seminar series - part 6

Last update on March 12, 2015.

Sixth seminar of "R brown-bag seminars" was held in ICRAF today.  Leigh Winowiecki (PhD, Soil Scientist, CIAT) presented  "Introduction to ggplot"  topic. Presentation of today's seminar is available here.

Data used in this seminar is available here and source code from seminar 6 is shown below:


#Leigh Winowiecki
#ICRAF Training March 12, 2015
#load ...

Continue reading

R seminar series - part 5

Last update on March 6, 2015.

After a one-week break, our brown-bag seminar series resumed again. In seminar 5, Antony Ndungu presented a number of different R graphing functions. Complete source code for the 5th seminar is available below, while the data used in the exercises can be found here

NB! From next week, we will looking at the wonderful ggplot2 ...

Continue reading

R seminar series - part 3 & 4

Last update on Feb. 22, 2015.

The third and fourth R brown-bag seminars were held on 12th and 19th of February, respectively. Both seminars covered "Introduction to R". 

Complete source code for both seminars is available at this link, while the data used in the exercises can be found here.

In fifth seminar (5th of March), Anthony Ndungu (a.ndungu@cgiar ...

Continue reading