youngwoos / Doit_R

<Do it! 쉽게 배우는 R 데이터 분석> 저장소
212 stars 438 forks source link

인터랙티브 구분도가 안돼요 #43

Closed k1915 closed 3 years ago

k1915 commented 4 years ago

미국 주별 강력범죄율 단계 구분도 만들기

install.packages("ggiraphExtra") library("ggiraphExtra")

library(tibble)

행이름을 별도의 칼럼으로 변환

crime <- rownames_to_column(USArrests, var="state") crime$state <- tolower(crime$state) #소문자로 변환 str(crime)

미국 주별 위,경도 정보 데이터셋은 state포함

install.packages("maps") install.packages("mapproj")

library(ggplot2) states_map <- map_data("state")#데이터셋 추출 str(states_map) ggChoropleth(data=crime, #지도에 그릴 데이터 aes(fill=Murder, #색깔 기준 칼럼 map_id=state), #지역 기준 칼럼 map=states_map) #지도 데이터

ggChoropleth(data=crime, aes(fill=Murder, map_id=state), map=states_map, interactive = T)

이 코드 사용중 마지막 ggChoropleth(data=crime, aes(fill=Murder, map_id=state), map=states_map, interactive = T) 이부분에서 마우스를 올려도 아무 반응이 없어요

youngwoos commented 4 years ago

R과 R스튜디오를 최신 버전으로 설치하신 다음 다시 시도해보시겠어요? R스튜디오 1.2에서 Viewer 창 문제가 있었는데 업데이트 되면서 해결됐습니다. 그래도 같은 문제가 발생하면 아래 데이터 분석 커뮤니티에 질문을 올려주세요.

데이터 분석 커뮤니티 https://www.facebook.com/groups/datacommunity/

k1915 commented 4 years ago

다 최신 버전깔았는데 안되네요...

youngwoos commented 4 years ago

올려주신 코드로 테스트 해봤는데 이상 없이 동작합니다. Plots 탭이 아니라 Viwer 탭에서 확인하신게 맞나요? sessionInfo() 실행해서 출력 결과 올려주시겠어요?