Kristian Schultz 10 місяців тому
батько
коміт
fca4fe8ec4
4 змінених файлів з 110 додано та 16 видалено
  1. 1 0
      .gitignore
  2. 42 16
      lection1/Commands.R
  3. BIN
      lection1/Introduction Data analysis with R.pdf
  4. 67 0
      lection1/Notes.txt

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+.Rhistory

+ 42 - 16
lection1/Commands.R

@@ -7,6 +7,10 @@
 # https://posit.co
 
 
+# --------------------------------------------------------------------------
+# Slide 4, 5: Installing R
+# --------------------------------------------------------------------------
+
 # Some samples
 1 + 2
 4 * 7
@@ -17,6 +21,22 @@
 print("Hello World")
 print("Hello World", quote=FALSE)
 print(81 / 3)
+q()
+
+# --------------------------------------------------------------------------
+# Slide 5: Installing R Studio
+# --------------------------------------------------------------------------
+1 + 2
+4 * 7
+print("Hello World")
+
+
+# --------------------------------------------------------------------------
+# Slide 6: Running R on Posit Cloud
+# --------------------------------------------------------------------------
+1 + 2
+4 * 7
+print("Hello World")
 
 # Some random values:
 rnorm(10)
@@ -107,6 +127,28 @@ plot(w, v)
 plot(w, v, "l")
 help("plot")
 
+# --------------------------------------------------------------------------
+# Slide 8: Packages in R
+# --------------------------------------------------------------------------
+# Install needed package for plotting.
+# Needed only once after installing R
+install.packages("ggplot2")
+
+
+# Activate "ggplot2" package.
+# Needed only once per session or script.
+library(ggplot2)
+
+qplot(data=iris, Sepal.Width, Sepal.Length)
+qplot(data=iris, Sepal.Width, Sepal.Length, colour=Species)
+qplot(data=iris, Sepal.Width, Sepal.Length, colour=Species, facets = .~ Species)
+
+
+qplot(data=diamonds, carat, price, colour=clarity, facets = . ~ clarity)
+
+# --------------------------------------------------------------------------
+# Slide 9: the daily life of a data scientist
+# --------------------------------------------------------------------------
 
 # Datasets
 head(iris)
@@ -122,28 +164,12 @@ boxplot(iris$Sepal.Length ~ iris$Species)
 plot(iris$Sepal.Width, iris$Sepal.Length)
 
 
-# Install needed package for plotting.
-# Needed only once after installing R
-install.packages("ggplot2")
-
-
-# Activate "ggplot2" package.
-# Needed only once per session or script.
-library(ggplot2)
-
-qplot(data=iris, Sepal.Width, Sepal.Length)
-qplot(data=iris, Sepal.Width, Sepal.Length, colour=Species)
-qplot(data=iris, Sepal.Width, Sepal.Length, colour=Species, facets = .~ Species)
-
 
 # Diamonds dataset
-
 myData <- read.csv("diamonds.csv")
 summary(myData)
 plot(myData$carat, myData$price)
 
-qplot(data=diamonds, carat, price, colour=clarity, facets = . ~ clarity)
-
 ggplot(data=myData, aes(x=carat, y=price)) + geom_point()
 ggplot(data=myData, aes(x=carat, y=price, color=clarity)) + geom_point()
 ggplot(data=myData[myData$carat < 2.5,], aes(x=carat, y=price, color=clarity)) + geom_point(alpha=0.1) + geom_smooth()

BIN
lection1/Introduction Data analysis with R.pdf


+ 67 - 0
lection1/Notes.txt

@@ -0,0 +1,67 @@
+# 1: Heading
+
+# 2: Data analysis with R
+- what is R
+- history of R
+- what is data analysis
+  "Data analysis is the process of inspecting, cleansing, transforming, and modeling data with the goal of discovering useful information, informing conclusions, and supporting decision-making."
+
+
+# 3: Installing R
+
+# 4, 5: Installing R
+- Go to https://cran.r-project.org
+  > Download R for Windows
+  > base
+
+- sudo apt update && sudo apt install r-base
+
+- calling R from command-line
+  - quit with q()
+  - some "Hello World" examples, math
+
+# 6: Installing RStudio Desktop
+- go to https://posit.co
+  > Open Source
+  > R Studio IDE
+  > Download R Studio Desktop
+
+- sudo snap install rstudio
+
+- Show around
+
+# 7: Running R on Posit Cloud
+- go to https://posit.co
+  > Products
+  > Cloud
+  > Posit Cloud
+  > Log in or Sign up
+
+- Show around
+
+
+# 8: Packages in R
+- https://cran.r-project.org/web/packages/available_packages_by_date.html
+
+
+
+# 9: The daily life of a data scientist
+- get dataset: package datasets, read.csv
+- Exploratory: summary, hist, scatter, boxplot
+
+# 10: Data visualization in R
+
+# 11, 12: getting the data
+- kaggle.com
+  > datasets
+  > Diamonds
+
+# 13: Exploratory Data Analysis in R
+
+# 14:  Exploratory Data Analysis
+- null hyphothesis: "the initial hyphothesis is wrong"
+
+# 16, 17, 18: Data visualization in R
+- Examples
+
+# 19: Additional reading