에서 집계 한 후 내가 먼저 다른 열 당 데이터 프레임에 하나 개의 컬럼의 평균을 얻기 위해 aggregate
을 사용 :정렬 R
meanDemVoteHouseState <- aggregate(congress$X2012.House.Dem.vote,
by = list(state = congress$state),
FUN = mean)
그때 위해이를 인쇄하고 싶었다. 우선 새로운 데이터 프레임
str(meanDemVoteHouseState)
보았다 분명히, 새로운 변수가 이제 "X"라고
'data.frame': 50 obs. of 2 variables:
$ state: chr "AK" "AL" "AR" "AZ" ...
$ x : num 0.29 0.34 0.29 0.462 0.566 ...
을 얻었다.
내가 그에 정렬 시도 때 :
meanDemVoteHouseState[order(x),]
내가 오류 "을 (를) 찾을 수 없습니다 'X'객체"를 얻었다.
다른 많은 것들을 시도했지만 아무런 효과가 없었습니다.
무엇이 누락 되었습니까? 당신이 두 단계에서 그것을 할 경우, 당신은
meanDemVoteHouseState[order(meanDemVoteHouseState[,"x"]),]
을 원하는
의회 데이터 샘플을 제공 할 수 있습니까? – storaged
'meanDemVoteHouseState [with (meanDemVoteHouseState, order (x))]]'또는'meanDemVoteHouseState [order (meanDemVoteHouseState $ x)]]' – Arun