library(tidyverse)
library(DBI)
view(CO2)
#9-1: Write R code to obtain total CO2 uptake by plant.
by_plant<-group_by(CO2,Plant)
uptake_total<-summarize(by_plant,totalUptake=sum(uptake))
view(uptake_total)
#9-2: Sort CO2 data by CO2 uptake in ascending order
arrange(CO2,uptake)
#9-3: Write R code to find the number of records for each "Type"
by_type<-group_by(CO2,Type)
count_type<-unique(summarize(by_type,count(by_type)))
view(count_type)
#9-4: Write R code to calculate total CO2 uptake by each Type and Treatment
Treatment_by_Type<-CO2 %>%
group_by(Treatment, Type) %>%
summarize(totalUptake=sum(uptake))
view(Treatment_by_Type)
#9-5: Write R code to calculate average concentration (conc) for each Type
by_type<-group_by(CO2,Type)
avg_conc<-summarize(by_type,avg_conc=mean(conc))
view(avg_conc)
'지식 창고 > R 언어' 카테고리의 다른 글
OPEN DART R로 크롤링하기 -1) 기본 파라미터 설정 (0) | 2022.04.22 |
---|---|
공공데이터 포털 OPEN API 데이터 R로 불러오기 (0) | 2022.03.24 |
R 언어 설치 및 프로그램 구성 PPT 자료 (1) | 2020.07.19 |
R studio (0) - Package 관련 명령어/ 설치 방법 (0) | 2020.07.11 |
R studio (3)-통계 분석 기초 (1) | 2020.07.11 |
댓글