2017-03-28 1 views
0

존재하는 경우 열은 dataframe에서 찾을 수 없다는 오류가 있습니다ggplot은 내가 다음 ggplot 코드를 실행하고

> str(dfcards[dfcards$cluster==1,]) 
'data.frame': 11200 obs. of 55 variables: 
$ cluster   : int 1 1 1 1 1 1 1 1 1 1 ... 
$ Collateral  : num 0 0 0 0 0 0 0 0 0 0 ... 
$ TotalCredit  : num 575.9 982.5 85 5970.4 47.6 ... 
$ TotalCScore  : num 693 677 673 723 699 680 680 678 699 692 ... 
$ CarBalance  : num 0 0 0 0 0 0 0 0 0 0 ... 
$ CardsBalance  : num 575.9 982.5 85 0 47.6 ... 
$ ConsumerBalance : num 0 0 0 5970 0 ... 
$ MortgageBalance : num 0 0 0 0 0 0 0 0 0 0 ... 
$ Gender   : Factor w/ 2 levels "0","1": 2 2 2 1 1 2 1 1 1 1 ... 
$ Age    : num 37 39 36 35 27 35 37 32 33 31 ... 
$ Profession  : chr "Missing" "Bank Employee" "Bank Employee" "Missing" ... 
$ Lifetime   : num 5 8 10 7 7 10 12 6 10 8 ... 
$ Owner    : Factor w/ 2 levels "0","1": 2 2 1 2 1 1 2 1 1 1 ... 
$ Income   : num 1e+06 1e+06 1e+06 1e+05 1e+05 ... 
$ viotiko   : num 8 0 0 8 6 8 8 8 0 7 ... 
$ pd_1year   : num 0.00843 0.00843 0.00843 0.00843 0.00843 ... 
$ pd_1year_group : chr "<1%" "<1%" "<1%" "<1%" ... 
$ viot_0   : num 0 1 1 0 0 0 0 0 1 0 ... 
$ viot_1   : num 0 0 0 0 0 0 0 0 0 0 ... 
$ viot_2   : num 0 0 0 0 0 0 0 0 0 0 ... 
$ viot_3   : num 0 0 0 0 0 0 0 0 0 0 ... 
$ viot_4   : num 0 0 0 0 0 0 0 0 0 0 ... 
$ viot_5   : num 0 0 0 0 0 0 0 0 0 0 ... 
$ viot_6   : num 0 0 0 0 1 0 0 0 0 0 ... 
$ viot_7   : num 0 0 0 0 0 0 0 0 0 1 ... 
$ viot_8   : num 1 0 0 1 0 1 1 1 0 0 ... 
$ Bank_Employee  : Factor w/ 2 levels "0","1": 1 2 2 1 1 1 1 1 1 1 ... 
$ Businessman  : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Doctor   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Engineer   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Farmer   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Housewife   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Independent  : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Lawyer   : Factor w/ 2 levels "0","1": 1 1 1 1 1 2 1 1 1 1 ... 
$ Missing   : Factor w/ 2 levels "0","1": 2 1 1 2 1 1 2 2 1 2 ... 
$ Pensioner   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ PrSec_Employee : Factor w/ 2 levels "0","1": 1 1 1 1 2 1 1 1 1 1 ... 
$ PubSec_Employee : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Self_Employed  : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Student   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Tradesman   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ Unemployed  : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 2 1 ... 
$ OtherProf   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... 
$ qrtCollateral  : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ... 
$ qrtTotalCScore : Factor w/ 10 levels "1","2","3","4",..: 8 3 1 10 9 4 4 3 9 8 ... 
$ qrtCarBalance  : Factor w/ 1 level "1": 1 1 1 1 1 1 1 1 1 1 ... 
$ qrtCardsBalance : Factor w/ 8 levels "1","2","3","4",..: 7 8 5 2 4 7 7 7 4 5 ... 
$ qrtConsumerBalance: Factor w/ 1 level "1": 1 1 1 1 1 1 1 1 1 1 ... 
$ qrtMortgageBalance: Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ... 
$ qrtAge   : Factor w/ 10 levels "1","2","3","4",..: 2 3 2 2 1 2 2 1 1 1 ... 
$ qrtLifetime  : Factor w/ 9 levels "1","2","3","4",..: 2 3 4 3 3 4 5 2 4 3 ... 
$ qrtIncome   : Factor w/ 2 levels "1","2": 2 2 2 2 2 2 2 2 1 1 ... 
$ qrtClusIncome  : Factor w/ 5 levels "1","2","3","4",..: 5 5 5 5 5 5 5 5 2 2 ... 
$ MaxBalance  : num 39508 39508 39508 39508 39508 ... 
$ IncrCardsBal  : num 38932 38526 39423 39508 39461 .. 

: 계수 열이 ggplot 함수에 데이터를 입력한다 dataframe에 (끝에서 3D) 인 'qrtClusIncome'참조 다른 변수, 즉 'as.factor (클러스터)'를 사용합니다. 코드가 문제없이 작동합니다.

어떻게 설명합니까? 내 코드에서 무엇을 변경해야합니까?

귀하의 조언에 감사드립니다.

+0

코드를 사용하기 위해'dfcards' 데이터를 추가 하시겠습니까? – Misaki

답변

0

데이터 프레임의 내용 mu. 오류가 나는 qrtClusIncome를 포함하지 않는 코드 mu로 볼 수 있습니다 그래서 위의 라인이 오류가 무슨에서 선

geom_vline(data=mu, aes(xintercept=grp.mean, color= qrtClusIncome), 
      linetype="dashed", size = 1.5) 

아마 것 같습니다.

관련 문제