DF_2 %>% filter(시도명) == "서울") %>%
코드를 이렇게 작성해봤는데 에러가 발생하더라고요
에러: `data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class uneval
Did you accidentally pass `aes()` to the `data` argument?
Run `rlang::last_error()` to see where the error occurred.
어떻게 해결 할 수 있나요!?
Comment 7
-
cardiomoon
2020.05.18 08:01
-
R입문기초
2020.05.18 16:12
> str(DF_3)List of 9$ data : tibble [35,530 x 22] (S3: tbl_df/tbl/data.frame)..$ V1 : int [1:35530] 2 3 6 8 16 17 23 29 33 37 .....$ 암호화YKIHO코드: chr [1:35530] "JDQ4MTg4MSM1MSMkMSMkMCMkODkkMzgxMzUxIzExIyQxIyQzIyQ3OSQ0NjEwMDIjNjEjJDEjJDQjJDgz" "JDQ4MTg4MSM1MSMkMSMkMCMkODkkMzgxMzUxIzExIyQxIyQzIyQ2MiQyNjE4MzIjNjEjJDEjJDQjJDgz" "JDQ4MTg4MSM1MSMkMSMkMCMkODkkMzgxMzUxIzExIyQxIyQzIyQ4OSQzNjEyMjIjODEjJDEjJDIjJDgz" "JDQ4MTg4MSM1MSMkMSMkMCMkODkkMzgxMzUxIzExIyQxIyQzIyQ2MiQ0NjEwMDIjNjEjJDEjJDAjJDgz" .....$ 요양기관명 : chr [1:35530] "강북삼성병원" "건국대학교병원" "경희대학교병원" "고려대학교의과대학부속구로병원" .....$ 종별코드 : int [1:35530] 1 1 1 1 1 1 1 1 1 1 .....$ 종별코드명 : chr [1:35530] "상급종합" "상급종합" "상급종합" "상급종합" .....$ 시도코드 : int [1:35530] 110000 110000 110000 110000 110000 110000 110000 110000 110000 110000 .....$ 시도명 : chr [1:35530] "서울" "서울" "서울" "서울" .....$ 시군구코드 : int [1:35530] 110016 110023 110007 110005 110001 110016 110001 110018 110008 110012 .....$ 시군구명 : chr [1:35530] "종로구" "광진구" "동대문구" "구로구" .....$ 읍면동 : chr [1:35530] NA NA NA NA .....$ 우편번호 : int [1:35530] 3181 5030 2447 8308 6351 3080 6273 5505 6973 2841 .....$ 주소 : chr [1:35530] "서울특별시 종로구 새문안로 29 (평동)" "서울특별시 광진구 능동로 120-1 (화양동)" "서울특별시 동대문구 경희대로 23 (회기동)" "서울특별시 구로구 구로동로 148 고려대부속구로병원 (구로동)" .....$ 전화번호 : chr [1:35530] "02-2001-2001" "1588-1533" "02-958-8114" "02-2626-1114" .....$ 병원URL : chr [1:35530] "http://www.kbsmc.co.kr" "http://www.kuh.ac.kr" "http://www.khuh.or.kr/" "http://guro.kumc.or.kr/main/index.do" .....$ 개설일자 : int [1:35530] 19790324 19821116 19711005 19830831 19940613 19810709 19830404 19890520 20041201 19740325 .....$ 의사총수 : int [1:35530] 380 417 452 531 1334 1526 612 1613 391 528 .....$ 인턴 의사수 : int [1:35530] 25 32 52 36 100 181 41 125 40 41 .....$ 레지던트 의사수: int [1:35530] 133 158 177 180 401 576 256 451 135 171 .....$ X좌표 : num [1:35530] 127 127 127 127 127 .....$ Y좌표 : num [1:35530] 37.6 37.5 37.6 37.5 37.5 .....$ doctor : chr [1:35530] "일반의 의사수" "일반의 의사수" "일반의 의사수" "일반의 의사수" .....$ count : int [1:35530] 5 1 5 1 23 17 2 23 1 5 ...$ layers :List of 1..$ :Classes 'LayerInstance', 'Layer', 'ggproto', 'gg' <ggproto object: Class LayerInstance, Layer, gg>aes_params: listcompute_aesthetics: functioncompute_geom_1: functioncompute_geom_2: functioncompute_position: functioncompute_statistic: functiondata: waiverdraw_geom: functionfinish_statistics: functiongeom: <ggproto object: Class GeomBar, GeomRect, Geom, gg>aesthetics: functiondefault_aes: unevaldraw_group: functiondraw_key: functiondraw_layer: functiondraw_panel: functionextra_params: na.rm orientationhandle_na: functionnon_missing_aes: xmin xmax ymin ymaxoptional_aes:parameters: functionrequired_aes: x ysetup_data: functionsetup_params: functionuse_defaults: functionsuper: <ggproto object: Class GeomRect, Geom, gg>geom_params: listinherit.aes: TRUElayer_data: functionmap_statistic: functionmapping: NULLposition: <ggproto object: Class PositionStack, Position, gg>compute_layer: functioncompute_panel: functionfill: FALSErequired_aes:reverse: FALSEsetup_data: functionsetup_params: functiontype: NULLvjust: 1super: <ggproto object: Class Position, gg>print: functionsetup_layer: functionshow.legend: NAstat: <ggproto object: Class StatIdentity, Stat, gg>aesthetics: functioncompute_group: functioncompute_layer: functioncompute_panel: functiondefault_aes: unevalextra_params: na.rmfinish_layer: functionnon_missing_aes:parameters: functionrequired_aes:retransform: TRUEsetup_data: functionsetup_params: functionsuper: <ggproto object: Class Stat, gg>stat_params: listsuper: <ggproto object: Class Layer, gg>$ scales :Classes 'ScalesList', 'ggproto', 'gg' <ggproto object: Class ScalesList, gg>add: functionclone: functionfind: functionget_scales: functionhas_scale: functioninput: functionn: functionnon_position_scales: functionscales: listsuper: <ggproto object: Class ScalesList, gg>$ mapping :List of 3..$ x : language ~시군구명.. ..- attr(*, ".Environment")=<environment: 0x000001ab6f1629d0>..$ y : language ~ifelse(doctor == "전문의 의사수", count, -count).. ..- attr(*, ".Environment")=<environment: 0x000001ab6f1629d0>..$ fill: language ~doctor.. ..- attr(*, ".Environment")=<environment: 0x000001ab6f1629d0>..- attr(*, "class")= chr "uneval"$ theme : list()$ coordinates:Classes 'CoordCartesian', 'Coord', 'ggproto', 'gg' <ggproto object: Class CoordCartesian, Coord, gg>aspect: functionbacktransform_range: functionclip: ondefault: TRUEdistance: functionexpand: TRUEis_free: functionis_linear: functionlabels: functionlimits: listmodify_scales: functionrange: functionrender_axis_h: functionrender_axis_v: functionrender_bg: functionrender_fg: functionsetup_data: functionsetup_layout: functionsetup_panel_guides: functionsetup_panel_params: functionsetup_params: functiontrain_panel_guides: functiontransform: functionsuper: <ggproto object: Class CoordCartesian, Coord, gg>$ facet :Classes 'FacetNull', 'Facet', 'ggproto', 'gg' <ggproto object: Class FacetNull, Facet, gg>compute_layout: functiondraw_back: functiondraw_front: functiondraw_labels: functiondraw_panels: functionfinish_data: functioninit_scales: functionmap_data: functionparams: listsetup_data: functionsetup_params: functionshrink: TRUEtrain_scales: functionvars: functionsuper: <ggproto object: Class FacetNull, Facet, gg>$ plot_env :<environment: 0x000001ab6f1629d0>$ labels :List of 4..$ title: chr "2020.03 병원 정보 서비스"..$ x : chr "시군구명"..$ y : chr "ifelse(doctor == \"전문의 의사수\", count, -count)"..$ fill : chr "doctor"- attr(*, "class")= chr [1:2] "gg" "ggplot"감사합니다. 위에를 해결하고 색상을 추가하려는데DF_3에러: Discrete value supplied to continuous scale 에러가 발생하네요!DF_3<-DF_2 %>% filter(시도명 == "서울") %>%ggplot(aes(x=시군구명, y=ifelse(doctor=='일반의 의사수', count, -count), fill=doctor)) +geom_bar(stat='identity', width=0.9,alpha=0.8)DF_3DF_3 <- DF_2 %>% filter(시도명 == "서울") %>%ggplot(aes(x=시군구명, y=ifelse(doctor=='일반의 의사수', count, -count), fill=doctor)) +geom_bar(stat='identity', width=0.9,alpha=0.8) +scale_x_continuous(name='시군구명') +scale_y_continuous(name='의사수', labels=c(50, 25, 0, 25, 50), limits=c(-500000,500000)) +scale_fill_manual(name='의사 종류', labels=c('일반의 의사수', '전문의 의사수'), values=c('tan3', 'maroon2')) +labs(title = '2020.03 병원 정보 서비스')str(DF_3)작성한 코드였습니다.어떻게 해당 오류를 해결할 수 있을까요? -
cardiomoon
2020.05.18 16:55
DF_3<-DF_2 %>% filter(시도명 == "서울")str(DF_3)해보셔요 -
R입문기초
2020.05.18 17:09
에러: `data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class unevalDid you accidentally pass `aes()` to the `data` argument?Run `rlang::last_error()` to see where the error occurred.가 발생하네요 -
cardiomoon
2020.05.18 18:01
data를 올려봐주시겠어요?
-
R입문기초
2020.05.18 18:03
여깄습니다!
-
cardiomoon
2020.05.18 19:41
require(tidyverse)df=read.csv("~/Downloads/hosp.csv",fileEncoding = "CP949")df1<-df %>%group_by(시도명)%>%summarize(일반의=sum(일반의.의사수),전문의=sum(전문의.의사수))df1 %>% pivot_longer(cols=일반의:전문의) -> df2ggplot(df2,aes(y=시도명,x=value,fill=name))+geom_col()+theme_bw(base_family="AppleGothic")
No. | Subject | Author | Date |
---|---|---|---|
1053 | 통계와 관련한 기초적인 질문 드립니다.. [2] | 감사합니다 | 2021.12.10 |
1052 | 메타분석 해석 문의 [2] | 루아로 | 2021.12.07 |
1051 | 초보라 질문드립니다 ㅜ [2] | 쵸쿄쵸쿄 | 2021.12.06 |
1050 | ㅠㅠㅠ 초보 질문입니다 [1] | 만고 | 2021.11.26 |
1049 | 라벨붙이기가 안됩니다 [1] | 찬미맘 | 2021.11.22 |
1048 | moonBook ANOVA 질문드립니다. [1] | 타쿠 | 2021.11.20 |
1047 | 3원 분할표? 에서 모델 만드는법 | 플랫슬립 | 2021.11.20 |
1046 | [회귀분석 초급 질문] [1] | 서빱스 | 2021.11.14 |
1045 | [ANOVA 분석 질문] [1] | 서빱스 | 2021.11.14 |
1044 | 대조군1과 치료군2,3,4 의 PSM 에 관해서 질문있습니다. [4] | yessul | 2021.11.11 |
1043 | 서버접속이 안됩니다. Reload [2] | silkywater | 2021.11.11 |
1042 | 메타분석 실행이 안됩니다. [1] | 애플K | 2021.11.08 |
1041 | pair plot 관련하여 질문드립니다. | ulysses11 | 2021.10.29 |
1040 | 메타분석 결과파일 다운로드 하려면 [1] | mono | 2021.10.23 |
1039 | 기본 baseline character table문의드립니다. [1] | ulysses11 | 2021.10.22 |
1038 | 이 error는 뭐가 문제인 걸까요 [1] | CSJU | 2021.10.19 |
1037 | logistic regression에서 p>0.05인 변수의 OR, p 값... | 브이콘65 | 2021.10.14 |
1036 | R 문제가 도저히 안풀려요.. [1] | 자하연미필 | 2021.10.09 |
1035 | 구조방정식에서 종속변수가 0,1로 코딩된 데이터 사용이 가능한가요? [1] | 순수엄마 | 2021.10.08 |
1034 | roc.test를 통해 AUC 비교 [2] | 나현둥 | 2021.10.07 |
DF_2 %>% filter(시도명) == "서울") 여기서 문제가 있네요. 괄호가 안 맞아요
DF_3<-DF_2 %>% filter(시도명 == "서울")
str(DF_3) 하시고 결과를 보여주셔요