-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05-summary.Rmd
More file actions
68 lines (43 loc) · 1.63 KB
/
05-summary.Rmd
File metadata and controls
68 lines (43 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Publication style figures and saving
'ggpubr' package is wondeful to create publication quality figures
```{r, fig.cap='Scatter plot with facets pub quality', out.width='80%', fig.asp=.75, fig.align='center'}
diamonds2<-diamonds
levels(diamonds2$color)
diamonds2$color<- factor(diamonds2$color, levels =c("D" ,"E" ,"F" ,"G", "H", "I", "J"),
labels=c("Red","Blue","Orange","Pink","Indigo","Jade","Orange"))
ggplot(diamonds2)+
geom_point(aes(x=carat,y=price))+
geom_smooth(aes(x=carat,y=price),method='lm')+
facet_wrap(~color)+
ggpubr::theme_pubr(base_size=22)+
ylab("Carat")+ xlab("Price")
```
##Correlation plot
```{r}
diamonds2<-diamonds %>% select(depth,table, price,carat)
# calulate the correlations
c <- cor(diamonds2, use="complete.obs")
```
```{r, fig.cap='Correlation plot', out.width='80%', fig.asp=.75, fig.align='center'}
library(ggcorrplot)
ggcorrplot(c,lab=T, color=c("green","black","orange"))
```
## Time series
Data collected in successive time points- dates, years, hours
Let's look at some time series data
Customize dates
Weekday name: %a and %A for abbreviated and full weekday name, respectively
Month name: %b and %B for abbreviated and full month name, respectively
%d: day of the month as decimal number
%U: week of the year as decimal number (00–53)
%Y: Year
```{r}
#tidyr::population
head(economics_long)
```
```{r, fig.cap='time series plot', out.width='80%', fig.asp=.75, fig.align='center'}
ggplot(economics_long)+
geom_line(aes(date, value, color=variable))+
scale_x_date(breaks='10 years',date_labels = "%b-%y")+
xlab("Date")
```