Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setwd("C:\\Users\\nikit\\Downloads")
- # Вектор
- c(1,2,3,4,5)
- fakedata <- c(1,2,3,4,5) # Назначить переменной
- fakedata[1]
- # Фрейм данных
- morefake <- c("a", "a", "a", "a", "a")
- cbind(fakedata, morefake) # Матрица, значения преобразуются в символы
- fake.df <- data.frame(cbind(fakedata, morefake))
- fake.df$morefake <- as.character(fake.df$morefake)
- colnames(fake.df)
- # Загрузка данных в фрейм данных
- education <- read.csv("2009education.csv", header=TRUE, sep=",", as.is=TRUE)
- education[1,] # Первый ряд
- education[1:10,] # Первые десять рядов
- education$state # Первый столбец
- education[,1] # Первый столбец
- education[1,1] # Первая ячейка
- # Сортировать от наименьшего к наибольшему
- high.order <- order(education$high)
- education.high <- education[high.order,]
- ## основные графики
- plot(fakedata)
- plot(education.high$high)
- plot(education$high, education$bs)
- plot(education[,2:4])
- # Виды графиков
- plot(education.high$high, type="l")
- plot(education.high$high, type="h")
- plot(education.high$high, type="s")
- # Остальные графики
- par(mfrow=c(3,3), mar=c(2,5,2,1), las=1, bty="n")
- plot(education.high$high)
- plot(education$high, education$bs)
- plot(education.high$high, type="l")
- plot(education.high$high, type="h")
- plot(education.high$high, type="s")
- barplot(education$high)
- barplot(education$high, names.arg=education$state, horiz=TRUE, las=1, cex.names=0.5, border=NA)
Advertisement
Add Comment
Please, Sign In to add comment