#导入数据框#
mydataframe<-read.table("C:/Users/admin/Desktop/clean.txt",header=TRUE,colClasses=c("character","numeric"))
#重命名#
names(mydataframe)[1:2]<-c("Time","Record")
#数据清洗#
duplicated(mydataframe$Time)
mydata<-unique(mydataframe)
duplicated(mydata$Time)
#绘制散点图#
install.packages("ggplot2")
library(ggplot2)
update.packages("ggplot2")
ggplot(data=mydata,aes(x=Time,y=Record))+
geom_point()+
labs(title="Picture of point",x="Time",y="Record")
#绘制折线图#
install.packages("ggplot2")
library(ggplot2)
update.packages("ggplot2")
ggplot(data=mydata,aes(x=Time,y=Record,group=1))+
geom_line(color="black")+
geom_point()+
labs(title="Picture of line",x="Time",y="Record")
#绘制箱线图#
mydata[1:95,3]<-"2017/06/03"
mydata[95:190,3]<-"2017/06/04"
mydata[191:286,3]<-"2017/06/05"
mydata[287:381,3]<-"2017/06/06"
names(mydata)[3]<-c("date")
install.packages("ggplot2")
library(ggplot2)
update.packages("ggplot2")
ggplot(data=mydata,aes(x=date,y=Record))+
geom_boxplot(fill="cornflowerblue",color="black",notch="TURE")+
labs(title="Picture of box",x="Time",y="Record")
#绘制分图散点#
mydata$Time<-as.factor(mydata$Time)
update.packages("ggplot2")
ggplot(data=mydata,aes(x=Time,y=Record,color=date,shape=date))+
geom_point()+
facet_grid(.~date)
mydataframe<-read.table("C:/Users/admin/Desktop/clean.txt",header=TRUE,colClasses=c("character","numeric"))
#重命名#
names(mydataframe)[1:2]<-c("Time","Record")
#数据清洗#
duplicated(mydataframe$Time)
mydata<-unique(mydataframe)
duplicated(mydata$Time)
#绘制散点图#
install.packages("ggplot2")
library(ggplot2)
update.packages("ggplot2")
ggplot(data=mydata,aes(x=Time,y=Record))+
geom_point()+
labs(title="Picture of point",x="Time",y="Record")
#绘制折线图#
install.packages("ggplot2")
library(ggplot2)
update.packages("ggplot2")
ggplot(data=mydata,aes(x=Time,y=Record,group=1))+
geom_line(color="black")+
geom_point()+
labs(title="Picture of line",x="Time",y="Record")
#绘制箱线图#
mydata[1:95,3]<-"2017/06/03"
mydata[95:190,3]<-"2017/06/04"
mydata[191:286,3]<-"2017/06/05"
mydata[287:381,3]<-"2017/06/06"
names(mydata)[3]<-c("date")
install.packages("ggplot2")
library(ggplot2)
update.packages("ggplot2")
ggplot(data=mydata,aes(x=date,y=Record))+
geom_boxplot(fill="cornflowerblue",color="black",notch="TURE")+
labs(title="Picture of box",x="Time",y="Record")
#绘制分图散点#
mydata$Time<-as.factor(mydata$Time)
update.packages("ggplot2")
ggplot(data=mydata,aes(x=Time,y=Record,color=date,shape=date))+
geom_point()+
facet_grid(.~date)