본문 바로가기

데이터함수3

R공부- 데이터 가공하기 #필요한 변수만 추출 -행(filter) -열(select) ex) exam%>%select(math): 수학 추출 exam%>%select(-math): 수학만 제외하고 추출 #%>%로 함수 연결 ㄴex)exam %>%filter(class==1)%>%select(english) #파이프 기호 뒤에서 Enter치면 가독성을 지키면서 한 줄의 코드로 동작 ex) exam%>% filter(class==1)%>% select(english) *파이프를 먼저 입력한 다음 엔터를 쳐서 줄을 바꿔줄 것(%>%+Enter) #순서대로 정렬 -arrange : ex) exam%>% arrange(math) : math 오름차순 정렬 exam%>% arrange(desc(math)): math 내림차순 정렬 exam.. 2021. 4. 20.
R공부- 데이터 전처리(조건에 맞는 데이터 가공하기) 데이터 전처리(Preprocessing): 원하는 데이터를 가공하는 작업 데이터추출: filter(dplyr에 들어있는 함수) *Ctrl+Shift+M으로 %>% 기호 입력(%>% 파이프,체인 연산자) ex) exam%>%filter(class==1) 1반만 exam%>%filter(class!=1) 1반 제외 exam%>%filter(math%filter(class==1&math>=50) 1반 중 수학점수 50이상 2) *Shift+\='|' : exam%>%filter(math>=90 | english>=90) 3) 1,3,5반에 해당하면 추출 ㄴexam%>%filter(class==1|class==3|class==5) ㄴexam%>%filter(class %in% c(1,3,5)) : 매치오퍼레이터.. 2021. 4. 19.
R공부- R studio의 기초 (3) 함수 함수(상자) e2=("Hello","World","is","good!") (x) e2 #R스튜디오 실행 후 반드시 패키지 library(ggplot2)를 불러오는 작업을 먼저 해야함 지가 나옴 함수 파라미터(parameter) 지정하기: # qplot(data=mpg , x =cty) qplot(data=mpg, y= hwy, x= drv, geom="point") "" ?함수 > agumentArguments > exemple 코드활용 #Cheat sheet 활용하기 ex) ggplot2 cheat sheet 2021. 4. 16.