07 Scatterplot Barplot Piechart
07 Scatterplot Barplot Piechart
To remember:
Basic operators ToDo:
Variable assignment Boxplots
Basic data types
Scatterplots
Vectors
Matrices Bar-plots
Row and column names Pie-chart
Indexing a matrix
Lists
Data frames
Time series
Arrays
Read and writ data
Plots
Exporting plots
#Set the working directory- getwd()/ setwd("Y:/")
getwd()
setwd("C:/Users/nobel/Desktop/research methodology
MSC")
getwd()
####Study_1
study_1 <- read_excel("Tree_height.xlsx", sheet =
"study_1")
str(study_1)
head(study_1)
ToDo 3
# exporting plots as graphic files
#Customize your plot (as you like: color, box type) and save it as a pdf file with width
= 7 and height = 5
pdf(file = "plot2.pdf", width = 7, height = 5) # specify size of the graphics region (in
inches)
plot(temp ~ time, data=beaver1)
dev.off()
# copy an existing plot from Rstudio to a pdf-file
plot(temp ~ time, data=beaver1, col="green")
dev.print(device=pdf, file="plot3.pdf", width=5, height=7, paper="a4")
http://earlh.com/blog/2011/09/18/labeled-boxplot-in-r/
Pie-chart
https://www.tutorialspoint.com/r/r_pie_charts.htm
Scatterplots
ToDo:
Read the Tree.csv file in R
Plot the Elevation and the Diameter of the Tree data set,
change the points symbol to star and the color blue
………………………………..
Plot the Height and the Diameter of the Tree data set,
change the points symbol and the color to what you want
and give a title
………………………….
Make a multi-panel plots (use function par() and mfrow)
……………………………….
ToDo1
Read the Tree.csv file in R and make a boxplot
with the tree height and tree species, give the
axes the proper names:………………………
Change the color in blue:
……………………..
Can you make the boxplot horizontal?
…………………..
To Do
# Create data for the Tree pie-chart
# Assign the percentage of every species to a vector:
…………………………
#Assign the species name to a vector with a name that
you want:
……………………………….
http://www.clayford.net/statistics/a-note-on-boxplots-in-r/
http://www.tutorialspoint.com/statistics/
https://www.tutorialspoint.com/r/r_bar_charts.htm