Skip to content

Commit

Permalink
Merge pull request #2 from antduarte/antduarte-patch-1
Browse files Browse the repository at this point in the history
Antduarte patch 1
  • Loading branch information
antduarte authored Dec 6, 2019
2 parents 148c54d + c9fe377 commit c72efd0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Chp 1/1-2_data_basics/1-2_data_basics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ \subsection{Observations and variables}

\begin{itemize}
\item \var{gender}: What is your gender?
\item \var{intro\_extra}: What is your gender?
\item \var{intro\_extra}: What is your personality?
\item \var{sleep}: How many hours do you sleep at night, on average?
\item \var{bedtime}: What time do you usually go to bed?
\item \var{countries}: How many countries have you visited?
Expand Down
4 changes: 2 additions & 2 deletions Chp 2/2-1_numerical_data/2-1_numerical_data.tex
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ \subsection{Variance and standard deviation}
\begin{frame}
\frametitle{Standard deviation}

The \hl{standard deviation} is the square root of the variance, and has the same units as the data.s
The \hl{standard deviation} is the square root of the variance, and has the same units as the data

\formula{
\[ s = \sqrt{s^2} \]
Expand Down Expand Up @@ -721,4 +721,4 @@ \subsection{Mapping data}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,32 @@ dev.off()


# with mean

myPDF('gpa_dot_plot_mean.pdf', 7, 1.5, mar=c(4,0.5,0.5,0.5), cex.lab = 1.5, cex.axis = 1.25)

openintro::dotPlot(gpa, pch = 19, col = COL[1,4], xlab = "GPA", xlim = c(2.5,4), ylab = "")
M <- mean(d$gpa[d$gpa <= 4], na.rm = TRUE)
polygon(M + c(-2,2,0)*0.01, c(0.25, 0.25, 0.5), border=COL[4], col=COL[4])

dev.off()

#
#myPDF('gpa_dot_plot_mean.pdf', 7, 1.5, mar=c(4,0.5,0.5,0.5), cex.lab = 1.5, cex.axis = 1.25)
#
#openintro::dotPlot(gpa, pch = 19, col = COL[1,4], xlab = "GPA", xlim = c(2.5,4), ylab = "")
#M <- mean(d$gpa[d$gpa <= 4], na.rm = TRUE)
#polygon(M + c(-2,2,0)*0.01, c(0.25, 0.25, 0.5), border=COL[4], col=COL[4])
#
#dev.off()
#
# stacked

X <- c()
Y <- c()
for(i in 1:length(gpa)){
x <- gpa[i]
rec <- sum(gpa == x)
X <- append(X, rep(x, rec))
Y <- append(Y, 1:rec)
}


myPDF('gpa_dot_plot_stacked.pdf', 7, 3, mar=c(4,2,0.5,0.5), cex.lab = 1.5, cex.axis = 1.25)

plot(X,Y, xlim = c(2.5,4), pch = 19, col = COL[1,4], xlab = "GPA", ylab = "", axes = FALSE)
axis(1)
axis(2)

dev.off()
#
#X <- c()
#Y <- c()
#for(i in 1:length(gpa)){
# x <- gpa[i]
# rec <- sum(gpa == x)
# X <- append(X, rep(x, rec))
# Y <- append(Y, 1:rec)
#}
#
#
#myPDF('gpa_dot_plot_stacked.pdf', 7, 3, mar=c(4,2,0.5,0.5), cex.lab = 1.5, cex.axis = 1.25)
#
#plot(X,Y, xlim = c(2.5,4), pch = 19, col = COL[1,4], xlab = "GPA", ylab = "", axes = FALSE)
#axis(1)
#axis(2)
#
#dev.off()
#
2 changes: 1 addition & 1 deletion Chp 2/2-2_categorical_data/2-2_categorical_data.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ \subsection{Contingency tables and bar plots}
\cline{3-4}
& & Died & Survived & Total \\
\cline{2-5}
\multirow{2}{*}{{gender}}& Adult & 1438 & 654 & 2092 \\
\multirow{2}{*}{{Age}}& Adult & 1438 & 654 & 2092 \\
& Child & 52 & 57 & 109\\
\cline{2-5}
& Total & 1490 & 711 & 2201 \\
Expand Down

0 comments on commit c72efd0

Please sign in to comment.