R(week 4)

library(lubridate)

d1 <- Sys.Date()
as.numeric(d1)
d2 <- "2000-02-29"
d3 <- as.Date(d2)
d4 <- now()
year(d4)
month(d4)
week(d4)

s1 <- sample(LETTERS[1:5], 20, replace = TRUE)
s2 <- factor(s1)
s1
s2
levels(s2)
nlevels(s2)

myLevel <- c("C", "A", "B", "D", "E")
s3 <- factor(s2, levels = myLevel)
s3
d1 <- sample(60:100, 50, replace = TRUE)
d1
d2 <- cut(d1, breaks = 3)
d2
d3 <- cut(d1, breaks = c(59, 69, 89, Inf), labels = c("C", "B", "A"))

getwd()

  

  

posted @ 2021-03-29 16:42  sinEagle  阅读(29)  评论(0编辑  收藏  举报