R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(readxl)
forest_example_data<-read_excel("C:/Users/16ZD90P-GX50K/Desktop/forest_example_data.xls")
colnames(forest_example_data)<-c("name","city","gubun","area",
                                 "number","stay","city_new",
                                 "code","codename")
str(forest_example_data)
## tibble [204 × 9] (S3: tbl_df/tbl/data.frame)
##  $ name    : chr [1:204] "광치자연휴양림" "삼척활기자연휴양림" "거창 항노화 힐링랜드" "문수산자연휴양림" ...
##  $ city    : chr [1:204] "강원도" "강원도" "경상남도" "경상북도" ...
##  $ gubun   : chr [1:204] "공유림" "사유림" "공유림" "국유림" ...
##  $ area    : num [1:204] 51 75625 500000 30000 9800000 ...
##  $ number  : num [1:204] 160 175 2000 500 102 131 250 2000 105 226 ...
##  $ stay    : chr [1:204] "Y" "Y" "Y" "Y" ...
##  $ city_new: chr [1:204] "강원도" "강원도" "경상남도" "경상북도" ...
##  $ code    : chr [1:204] "4320000" "4240000" "5470000" "5240000" ...
##  $ codename: chr [1:204] "강원도 양구군" "강원도 삼척시" "경상남도 거창군" "경상북도 봉화군" ...
head(forest_example_data)
## # A tibble: 6 × 9
##   name                 city    gubun   area number stay  city_new code  codename
##   <chr>                <chr>   <chr>  <dbl>  <dbl> <chr> <chr>    <chr> <chr>   
## 1 광치자연휴양림       강원도  공유… 5.1 e1    160 Y     강원도   4320… 강원도 …
## 2 삼척활기자연휴양림   강원도  사유… 7.56e4    175 Y     강원도   4240… 강원도 …
## 3 거창 항노화 힐링랜드 경상남… 공유… 5   e5   2000 Y     경상남도 5470… 경상남… 
## 4 문수산자연휴양림     경상북… 국유… 3   e4    500 Y     경상북도 5240… 경상북… 
## 5 강씨봉자연휴양림     경기도  공유… 9.8 e6    102 Y     경기도   6410… 경기도  
## 6 데미샘자연휴양림     전라북… 공유… 2   e5    131 Y     전라북도 6450… 전라북도
nrow(forest_example_data)
## [1] 204
library(descr)
freq(forest_example_data$city, plot=T, main='city')

## forest_example_data$city 
##                Frequency  Percent
## 강원도                24  11.7647
## 경기도                20   9.8039
## 경상남도              42  20.5882
## 경상북도              21  10.2941
## 대구광역시             3   1.4706
## 대전광역시             2   0.9804
## 울산광역시             2   0.9804
## 인천광역시             2   0.9804
## 전라남도              17   8.3333
## 전라북도              15   7.3529
## 제주특별자치도         5   2.4510
## 충청남도              16   7.8431
## 충청북도              35  17.1569
## Total                204 100.0000
table(forest_example_data$city)
## 
##         강원도         경기도       경상남도       경상북도     대구광역시 
##             24             20             42             21              3 
##     대전광역시     울산광역시     인천광역시       전라남도       전라북도 
##              2              2              2             17             15 
## 제주특별자치도       충청남도       충청북도 
##              5             16             35
fe=forest_example_data
barplot(table(forest_example_data$city))

barplot(table(forest_example_data$city),col="lightcyan",cex.names=0.7,las=2)

library(descr)
freq(forest_example_data$gubun, plot=T, main='gubun')

## forest_example_data$gubun 
##        Frequency Percent
## 공유림       153   75.00
## 국유림        30   14.71
## 사유림        21   10.29
## Total        204  100.00
barplot(table(forest_example_data$gubun),col="lightcyan")

library(ggplot2)
## Warning: 패키지 'ggplot2'는 R 버전 4.3.1에서 작성되었습니다

ggplot(forest_example_data,aes(x=city,y=area))+
  geom_point()

ggplot(forest_example_data,aes(x=city,y=number))+
  geom_point()
## Warning: Removed 5 rows containing missing values (`geom_point()`).

barplot(table(forest_example_data$stay),col="lightcyan")

table(forest_example_data$city)
## 
##         강원도         경기도       경상남도       경상북도     대구광역시 
##             24             20             42             21              3 
##     대전광역시     울산광역시     인천광역시       전라남도       전라북도 
##              2              2              2             17             15 
## 제주특별자치도       충청남도       충청북도 
##              5             16             35
min(table(forest_example_data$city))
## [1] 2
max(table(forest_example_data$city))
## [1] 42

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.