Modern Statistical Graphs with R
Info
-
Speaker: (Department of Health and Environmental Sciences, Xi'an Jiaotong-Liverpool University)
-
Time: 13:30 -- 15:00, Dec. 8 (Wednesday) 2021
-
On-site: ES211, South Campus of XJTLU
-
Online: , Access Code: 560567
Perquisites
-
Knowledge in R. We assume that you have fundamental knowledge in R (e.g. you have taken part in the XJTLU Library's previous training for R beginners). If not, this training might not suit you well.
-
Installation. The PCs in the computer room are ready with R and RStudio. If you use your own computer, R must be installed, and RStudio is recommended.
-
Instruction for the installation of R and RStudio: ,
-
-
Packages. For saving time, run the following code in R before the training (if you are using the public PCs, please arrive 5 minutes earlier and do it):
install.packages(c('beginr', 'ggplot2','Rcmdr', 'ggplotgui', 'GrapheR', 'plotly', 'GGally', 'remotes', 'MSG', 'fun'))
remotes::install_github(c('pzhaonet/fecitr', 'pzhaonet/mindr'))
-
Data. Download the data file for the following examples.
Why R and why not R
plot(0, 0, col = "hotpink", pch = 169, font = 5, cex = 50)
text(0, 0, "XJTLU Library", cex = 2)
points(c(-0.8, -0.5, 0.5, 0.8), c(0.5, -0.5, -0.5, 0.5), pch = 169, font = 5, col = "red", bg = "red")
demo("ChinaHeart3D", package = "fun")
Show time
-
-
Demo: Violin plot
-
Demo: Interactive map ()
-
Graphical User Interface
-
The package
library(GrapheR)
run.GrapheR()
-
The package
library(Rcmdr)
-
The package
ggplotgui::ggplot_shiny()
The Deducer package
library(Deducer)
JGR()
Programming
-
Basic system
x <- iris$Sepal.Length
y <- iris$Sepal.Width
plot(x, y)
-
The package
library(ggplot2)
ggplot(iris) + geom_point(aes(Sepal.Length, Sepal.Width))
-
The package
-
Other packages
-
The package
-
library(beginr)
plotpch()
plotcolors()
-
The fecitr package
fecitr::plot_summary(iris, base = "hist", if_box = TRUE)
-
The package
library(GGally)
ggpairs(iris, aes(fill = Species, alpha = 0.1))
-
The package
-
The package
library(MSG)
Sys.setlocale("LC_CTYPE", "Chinese")
msg("3.11")
Further readings
-
and
-
-
Homework
-
What are the differences between plotting graphs with R and with Excel? Compare the pros and cons.
-
What do you think about the role graphs play in your study/research?