전체 글
-
-
-
model카테고리 없음 2018. 8. 3. 15:03
ggplot2 패키지에서 제공하는 diamonds 데이터의 cut과 price, cut과 carat, carat과 price 강한 관계가 있다. 이러한 강력한 관계를 제거하기 위하여 다음과 같이 model를 사용할 수 있다. install.packages("tidyverse") install.packages("modelr") library(tidyverse) library(modelr) # 모형 diamonds.model % modelr::add_residuals(diamonds.model) %>% dplyr::mutate(resid = exp(resid)) %>% ggplot2::ggplot(mapping = aes(x = carat, y = resid)) + geom_point() # 상자그림 dia..
-
PatternsR 2018. 8. 3. 14:37
Patterns Q. Could this pattern be due to coincidence(i.e., random chance)?Q. How can you describe the relationship implied by the pattern?Q. How strong is the relationship implied by the pattern?Q. What other variables might affect the relationship?Q. Does the relationship change if you look at individual subgroups of the data? [출처] R for Data Science, Hadley Wickham & Garrett Grolemund, O'REILL..
-
boxplot with tidyverse packageR 2018. 8. 3. 14:32
tidyverse 패키지에서 제공하는 함수를 이용하여 두 개의 양적 자료를 이용하여 집단별 상자그림을 다음과 같이 작성할 수 있다. install.packages("tidyverse") library(tidyverse) # 1. carat를 구간의 폭이 0.1를 갖는 상자그림 diamonds %>% ggplot2::ggplot(mapping = aes(x = carat, y = price)) + geom_boxplot(mapping = aes(group = cut_width(x = carat, width = 0.1))) # 2. carat에 대해 구간의 개수가 20개 되는 상자그림 diamonds %>% ggplot2::ggplot(mapping = aes(x = carat, y = price)) + g..
-
heatmap with tidyverse packageR 2018. 8. 3. 14:05
tidyverse 패키지를 이용하여 두 개의 질적 자료(범주형 자료)에 대한 heatmap를 다음과 같이 작성할 수 있다. install.packages("tidyverse")library(tidyverse)diamonds %>% dplyr::count(cut, color) %>% ggplot2::ggplot(mapping = aes(x = cut, y = color)) + geom_tile(mapping = aes(fill = n)) [출처] R for Data Science, Hadley Wickham & Garrett Grolemund, O'REILLY, p100~101