CS计算机代考程序代写 # BS1033 Lecture 1 Analysis Part 1
# BS1033 Lecture 1 Analysis Part 1
# Author: Chris Hansman
# Email: chansman@imperial.ac.uk
# Date : 11/01/21
#Project Automatically Sets the Directory!!
#getwd()
# Installing Packages and Loading Libraries
install.packages(“tidyverse”)
library(tidyverse)
# How I would do the Menti:
ols_basics<-read_csv("ols_basics.csv") #Reading OLS Data
ols_v1 <- lm(Y~X, data=ols_basics) #Estimating OLS Regression
summary(ols_v1) #Examining Output
#tidy data
table1
#non-tidy data (example 1)
table2
#Spreading to make tidy
tidy2 <- table2 %>%
spread(key=type, value=count)
#non-tidy data (example 2)
table4a
#Gathering to make tidy
tidy4a <- table4a %>%
gather(“1999”, “2000”, key = “year”, value = “cases”)
#The pipe operator
x <-sqrt(exp(log(9)))
y <- 9 %>%
log() %>%
exp() %>%
sqrt()