본문 바로가기
반응형

R71

(R) Kernal density curve /geom_density()/geom_line(stat="density") > ggplot(data=trees,aes(x=Volume))+geom_density() > ggplot(data=trees,aes(x=Volume))+geom_density() > ggplot(data=trees,aes(x=Volume))+geom_line(stat="density") As you can see below, setting geom_density(adjust=1) means nothing. There is no difference between ggplot(data=trees,aes(x=Volume))+geom_desity() and ggplot(data=trees,aes(x=Volume))+geom_density(adjust=1) because basic set for adjust in.. 2020. 9. 3.
(R) Ways to change the name of element in a variable / revalue()/ ifelse() >library(MASS)> View(birthwt) > ?birthwt > table(birthwt$race) 1 2 3 96 26 67 > table(birthwt$smoke) 0 1 115 74 The variable 'smoke' express 'smoking status during pregnancy' containing elements 0,1.Actually we cannot really know which elements express 'No smoke' or 'smoke' because they are just numbers. For readers of the graph, I will assign 'NO smoke' to 0 and 'smok.. 2020. 9. 1.
(R) geom_histogram/facet_wrap(vars())/facet_grid(vars())/adjust the position of tick mark -scale_y_continuous(breaks=c()) > ggplot(data=airquality,aes(x=Temp))+geom_histogram() > ggplot(data=airquality,aes(x=Temp))+geom_histogram(binwidth=4,fill="white",colour="black") > ggplot(data=airquality,aes(x=Temp))+geom_histogram(binwidth=4,fill="white",colour="black")+facet_grid(vars(Month)) > ggplot(data=airquality,aes(x=Temp))+geom_histogram(binwidth=4,fill="white",colour="black")+facet_wrap(vars(Month)) - scale_y_contin.. 2020. 9. 1.
(R) add label to dot plots / annotate("text")/geom_text(aes(label=)) This is the file that includes the information on worldwide fertility rate and Life expectancy.I brought this information from https://www.unfpa.org/sites/default/files/pub-pdf/UNFPA_PUB_2020_EN_State_of_World_Population.pdf >install.packages("read_excel")>library(read_excel)> fertility_life View(fertility_life) Add label one by one to the dot plot > ggplot(data=fertility_life,aes(x=Lifeexpectan.. 2020. 9. 1.
반응형