Dataset_info/USArrests

USArrests 데이터셋 예제

modernity4Rcmdr 2022. 6. 25. 15:08

datasets::USArrests()

?USArrests  # USArrests 데이터셋 도움말 보기

# 아래는 example(USArrests) 입니다.

summary(USArrests)

require(graphics)
pairs(USArrests, panel = panel.smooth, main = "USArrests data")

## Difference between 'USArrests' and its correction
USArrests["Maryland", "UrbanPop"] # 67 -- the transcription error
UA.C <- USArrests
UA.C["Maryland", "UrbanPop"] <- 76.6

## also +/- 0.5 to restore the original  <n>.5  percentages
s5u <- c("Colorado", "Florida", "Mississippi", "Wyoming")
s5d <- c("Nebraska", "Pennsylvania")
UA.C[s5u, "UrbanPop"] <- UA.C[s5u, "UrbanPop"] + 0.5
UA.C[s5d, "UrbanPop"] <- UA.C[s5d, "UrbanPop"] - 0.5

Linux 사례 (MX 21)
Linux 사례 (MX 21)
Linux 사례 (MX 21)

# USArrests 원자료를 수정한 UA.C 데이터셋

pairs(UA.C, panel = panel.smooth, main = "USArrests data (corrected)")

Linux 사례 (MX 21)