Skip to menu

length 오류질문

촙춉 2020.05.26 20:19 Views : 6200

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
1233 선형회귀분석 시 보정변수 사용 관련 질문드립니다. [2] secret 전한울 2023.09.18
1232 그래프 관련 문의드립니다. secret nanak 2023.09.14
1231 영수증 메일로 받을수 있을까요? [1] secret 딸기공주 2023.09.13
1230 mycsv 관련 문의드립니다. [1] 도삼 2023.09.12
1229 matched group 을 대상으로 stratified cox secret saga 2023.09.06
1228 IPTW 시 SMD 계산 관련 여쭙습니다. 장한나 2023.09.04
1227 회귀분석 관련 문의드립니다. [2] secret 전한울 2023.09.04
1226 PSM matching 실행시 disconnected 됩니다... [1] 맹구모션 2023.08.25
1225 메타분석_출간오류분석 관련 질문드립니다. [2] 블루레몬 2023.08.21
1224 plot 문의 드립니다. 1122 2023.08.20
1223 semMediation 설치문의 [2] 마술샘 2023.08.11
1222 로지스틱 회귀분석 문의드립니다. [2] secret JKJ 2023.08.09
1221 지출 문의 드립니다. [1] 블루레몬 2023.08.08
1220 autoReg 실행 중 에러 [1] pkjsdf123 2023.08.08
1219 영수증 처리 [1] secret britnepak 2023.07.28
1218 multipleROC 커브 글을 따라가다 궁금한 것이 생겨서 질문드립니다. [2] file rgppwls 2023.07.20
1217 disconnected from server 오류 [2] secret JKJ 2023.07.13
1216 mytable에서 변수 순서와 ztable적용시 변수가 숫자로 변형 [1] 둥니맨 2023.07.12
1215 box plot 시 X 축 label이 다 나오지 않아 질문드립니다. [2] file 난둥 2023.07.03
1214 안녕하십니까 교수님 PSM 결과에 대해 궁금한 것이 있어 여쭤봅니다 [2] secret 김도훈 2023.06.29