Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
571 changes: 571 additions & 0 deletions Assignment-2-2020.html

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Assignment2_Xingyi Xie.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@



67 changes: 67 additions & 0 deletions Xingyi2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
title: "Assignment 2_Xingyi Xie"
name: "Xingyi Xie"
date: "October 5, 2020"



"1."
scores<-rnorm(100,75)
x<-c("sport","music","nature","literature")
classification<-sample(x,100,replace = T)
data<-data.frame(scores,classification)
head(data)

"2."
hist(data$scores)
hist(data$scores,breaks = 10)
hist(data$scores,breaks = 20)
hist(data$scores,breaks = c(70,72,74,76,78,80))
hist(data$scores,breaks = 20,xlim = c(72,78))

"3."
rating<-cut(data$scores,3,c(1,2,3))

"4."
install.packages("RColorBrewer")
library(RColorBrewer)
color<-brewer.pal(4,"BuGn")
hist(as.numeric(rating),breaks = 5,col = color)

"5."
boxplot(scores~classification,col=color)

"6."
logins<-sample(1:25,100,replace = T)

"7."
data<-data [, -(4:9)]
head(data)
install.packages("ggplot2")
library(ggplot2)
install.packages("datasets")
library(datasets)
data<-cbind(data,logins)
ggplot(data,aes(scores,logins,colour=classification))+geom_point()+ggtitle("plot")

"8."
plot(AirPassengers)

"9."
library(datasets)
plot(AirPassengers)



"Part3."
DF1<-read.csv("Home/Desktop/assignment2_XingyiXie/swirl-data.csv", header = TRUE))
DF2<-data.frame(DF1$hash, DF1$lesson_name, DF1$attempt)
Data<-group_by(DF2,lesson_name)
DF3<-summarise(Data,sum_hash=sum(attempts))
t(DF3)
DF4<-data.frame(DF1$hash, DF1$lesson_name, DF1$correct)
DF4$correct<-ifelse(DF4$correct=“T”,0,1)
DF6<-as.Date(DF1$datetime, “%y/%m/%d”)




65 changes: 65 additions & 0 deletions XingyiXie2.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
title: "Assignment 2_Xingyi Xie"
name: "Xingyi Xie"
date: "October 5, 2020"



"1."
scores<-rnorm(100,75)
x<-c("sport","music","nature","literature")
classification<-sample(x,100,replace = T)
data<-data.frame(scores,classification)
head(data)

"2."
hist(data$scores)
hist(data$scores,breaks = 10)
hist(data$scores,breaks = 20)
hist(data$scores,breaks = c(70,72,74,76,78,80))
hist(data$scores,breaks = 20,xlim = c(72,78))

"3."
rating<-cut(data$scores,3,c(1,2,3))

"4."
install.packages("RColorBrewer")
library(RColorBrewer)
color<-brewer.pal(4,"BuGn")
hist(as.numeric(rating),breaks = 5,col = color)

"5."
boxplot(scores~classification,col=color)

"6."
logins<-sample(1:25,100,replace = T)

"7."
data<-data [, -(4:9)]
head(data)
install.packages("ggplot2")
library(ggplot2)
data<-cbind(data,logins)
ggplot(data,aes(scores,logins,colour=classification))+geom_point()+ggtitle("plot")

"8."
install.packages("datasets")
library(datasets)
plot(AirPassengers)

"9."
plot(AirPassengers)



"Part3."
DF1<-read.csv("Home/Desktop/assignment2_XingyiXie/swirl-data.csv", header = TRUE))
DF2<-data.frame(DF1$hash, DF1$lesson_name, DF1$attempt)
Data<-group_by(DF2,lesson_name)
DF3<-summarise(Data,sum_hash=sum(attempts))
t(DF3)
DF4<-data.frame(DF1$hash, DF1$lesson_name, DF1$correct)
DF4$correct<-ifelse(DF4$correct=“T”,0,1)
DF6<-as.Date(DF1$datetime, “%y/%m/%d”)