Skip to menu

length 오류질문

촙춉 2020.05.26 20:19 Views : 6229

deal <- function(){
  card <- deck[1, ]
  assign("deck", deck[-1, ], envir = globalenv())
  card
  a <- deck$suit
 
  if (a == "joker"){
    "도둑"
  }else if (a == "diamonds"){
    "다이아몬드"
  }else if (a == "hearts"){
    "하트"
  }
   else if (a == "clubs"){
     "클로버"
   }else {
     "스페이드"
   }}

'data.frame':	19 obs. of  3 variables:
 $ face : Factor w/ 14 levels "ace","eight",..: 10 5 11 4 14 14 1 10 9 3 ...
 $ suit : Factor w/ 5 levels "clubs","diamonds",..: 5 1 3 1 3 2 2 2 5 2 ...
 $ value: int  7 11 6 4 2 2 1 7 12 5 ...
>


제가 간단한거 하나만들려구하는데  deal()이라는 함수를 구동시키면

Warning messages:
1: In if (a == "joker") { :
  the condition has length > 1 and only the first element will be used
2: In if (a == "diamonds") { :
  the condition has length > 1 and only the first element will be used
3: In if (a == "hearts") { :
  the condition has length > 1 and only the first element will be used
4: In if (a == "clubs") { :
  the condition has length > 1 and only the first element will be used

이런 에러가떠요.. roll()을 구동했을때 에러가 안나왔으면 좋겠는데..

계속 만들어보다가 함수 겨우 찾아서 만든건데 에러가뜨네요 ㅠㅠ 해결방법이나 다른함수를 써서 코딩할수있는 방법좀 알려주세요

제가 하고싶은건 한번실행할때마다 하나의결과값을 얻는것입니다. 부탁드립니다

No. Subject Author Date
1093 Box plot 그리프 설정에 관해 문의합니다. papahong 2022.06.20
1092 cluster data 의 risk difference 에 대해 여쭙고자 합니다. lagrima 2022.06.19
1091 Pair plot을 할 경우 [1] PipeDragoN 2022.06.13
1090 PSM에서 matching 버튼 위치 문의 통계어려워 2022.06.13
1089 PSM (4그룹) 관련 문의드립니다. emksh77 2022.06.08
1088 정회원후원하였습니다. [1] secret rosemary 2022.06.08
1087 PSM 문의 [2] secret sfumatoi 2022.06.07
1086 multipleROC 패키지에서 multivariable의 cutoff 구하기 file 찬쓰 2022.06.07
1085 survival analysis관련 문의 드립니다 [1] cebukim 2022.06.04
1084 autoReg 설치 관련 오류 [5] 닥터강 2022.05.24
1083 survival tree (RPA) 분석 관련 문의 드립니다. [2] 곰곰11 2022.05.23
1082 통계 질문입니다. [1] file 봄봄봄 2022.05.23
1081 데이터 불러오기 문제 [3] strat 2022.04.25
1080 r프로그래밍 문자는 factor로 읽을 수 없나요? [1] file 채채채추ㅐㅊ채야채 2022.04.21
1079 R 코드와 관련하여 문의 드려도 될까요..? [5] file 꾸이뭉 2022.04.19
1078 R 업데이트 후 mytable 함수 에러가 있습니다. [1] 카이토르 2022.04.18
1077 Survival curve 에서 cumulative incidence % 로 표현 가능할까요 [1] nyknicks 2022.04.16
1076 multiple logistic regression test에서 설명변수 선택에 대해 여쭙습니다. [2] file kms9057 2022.04.16
1075 PSM 문의 드립니다 [1] caesar 2022.04.07
1074 Survival regression에서 Survival probability 그래프에서 회색음영이 무엇인지요? [2] file 케로스 2022.03.24