Watts-College / cpp-527-fall-2022

https://watts-college.github.io/cpp-527-fall-2022/
0 stars 1 forks source link

Lab 1, Question 3 #2

Open MegsBruce opened 2 years ago

MegsBruce commented 2 years ago

I keep getting the following error: "Warning: the condition has length > 1 and only the first element will be used...."

I think I might be missing a step? Lab1

mboudour commented 2 years ago

Hi, with regards to questions about labs, could you please be using my asu email @.***) instead of my github gmail?

Thanks,

--Moses

Moses Boudourides (pronounced Bo͝odo͝orēT͟Həs) Professor of Practice at the School of Public Affairs, Arizona State University Phone: +001-484 534-0290 http://mboudour.github.io/about/

On Tue, Aug 23, 2022 at 9:34 AM Megan Bruce @.***> wrote:

I keep getting the following error: "Warning: the condition has length > 1 and only the first element will be used...."

I think I might be missing a step? [image: Lab1] https://user-images.githubusercontent.com/88808269/186212952-8edfefd4-b6db-4452-b9a6-c6bbf75293d9.jpg

— Reply to this email directly, view it on GitHub https://github.com/Watts-College/cpp-527-fall-2022/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATHZXMMJLQM435UPNIDJEDV2T4R7ANCNFSM57MFMSJA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

MegsBruce commented 2 years ago

@mboudour, I did email you you (using your ASU email). I sent it on the 22nd. Thank you.

mboudour commented 2 years ago

I'm sorry, I found it. These are my first days at ASU and in Phoenix and my time is extremely hectic. I'll try to reply from my asu email right away.

--Moses

Moses Boudourides (pronounced Bo͝odo͝orēT͟Həs) Professor of Practice at the School of Public Affairs, Arizona State University Phone: +001-484 534-0290 http://mboudour.github.io/about/

On Tue, Aug 23, 2022 at 9:45 AM Megan Bruce @.***> wrote:

@mboudour https://github.com/mboudour, I did email you you (using your ASU email). I sent it on the 22nd. Thank you.

— Reply to this email directly, view it on GitHub https://github.com/Watts-College/cpp-527-fall-2022/issues/2#issuecomment-1224330609, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATHZXJNWEOHPLDZ3TZ3AFDV2T5ZZANCNFSM57MFMSJA . You are receiving this because you were mentioned.Message ID: @.***>

kaseympotts commented 2 years ago

@MegsBruce Wild guess, but try calling doors instead of c(1,2,3) in the a.pick step.

Full disclosure, I am just starting this step and about to leave for work but will let you know if I have success after lunch here!

ebossert commented 2 years ago

@kaseympotts @MegsBruce

This is the code I landed on for Step 3 (gathered after reading older discussion boards) and it doesn't produce that error. However, it still doesn't work quite right because sometimes the host chooses the car option instead of the door. No idea why.

open_goat_door <- function( game, a.pick ) { doors <- c(1,2,3) game <- c("goat", "goat", "car") doors <- doors[c(doors != a.pick & game != "car")] opened.door <- sample(doors, 1, replace=F) return(opened.door) # number between 1 and 3 }

MegsBruce commented 2 years ago

@ebossert, @kaseympotts, if you guys aren't already in the Discord chat, I highly recommend checking it out. There's a ton of good information it the "general" channel.

lilliau commented 2 years ago

@ebossert, @kaseympotts, if you guys aren't already in the Discord chat, I highly recommend checking it out. There's a ton of good information it the "general" channel.

Will you send the link to where that is? I would like to be a part of the chat/discussion. Thank You!

MegsBruce commented 2 years ago

Absolutely!

https://discord.gg/nxyyZbVx

kaseympotts commented 2 years ago

@MegsBruce Thanks for the reminder!! I'll be sure to join after work; not sure if it's a Japan-thing but Discord hasn't let me log in all week. Thankfully, its Friday, so I have time to troubleshoot this evening!!

lilliau commented 2 years ago

Absolutely!

https://discord.gg/nxyyZbVx

Thank you! This will be so helpful!

mboudour commented 2 years ago

Hi,

Your function open_goat_door is wrong. You need to write a conditional "if", after the assignment of doors in which you should define goat.doors and opened.door according to whether game[ a.pick ] == "car" or game[ a.pick ] == "goat". At the end of this function, you should be returning opened.door, which is a number between 1 and 3.

Please try to write the function open_goat_door in this way and let me know if you still have questions.

On Tue, Aug 23, 2022 at 6:01 PM ebossert @.***> wrote:

@kaseympotts https://urldefense.com/v3/__https://github.com/kaseympotts__;!!IKRxdwAv5BmarQ!bwIF_FdU32uGYV1SI042Lkq2ieCh3NqmTGePXdTe9AXxGD3srKYsod_BwoAOCsPm2oKf46Wo1T00pNPB9nysYGZZT8mgJww$ @MegsBruce https://urldefense.com/v3/__https://github.com/MegsBruce__;!!IKRxdwAv5BmarQ!bwIF_FdU32uGYV1SI042Lkq2ieCh3NqmTGePXdTe9AXxGD3srKYsod_BwoAOCsPm2oKf46Wo1T00pNPB9nysYGZZLwcWmPI$

This is the code I landed on for Step 3 (gathered after reading older discussion boards) and it doesn't produce that error. However, it still doesn't work quite right because sometimes the host chooses the car option instead of the door. No idea why.

open_goat_door <- function( game, a.pick ) { doors <- c(1,2,3) game <- c("goat", "goat", "car") doors <- doors[c(doors != a.pick & game != "car")] opened.door <- sample(doors, 1, replace=F) return(opened.door) # number between 1 and 3 }

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/Watts-College/cpp-527-fall-2022/issues/2*issuecomment-1225043775__;Iw!!IKRxdwAv5BmarQ!bwIF_FdU32uGYV1SI042Lkq2ieCh3NqmTGePXdTe9AXxGD3srKYsod_BwoAOCsPm2oKf46Wo1T00pNPB9nysYGZZfZ6pgjY$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AATHZXIV6AFH7D2IJEWZI5LV2VX47ANCNFSM57MFMSJA__;!!IKRxdwAv5BmarQ!bwIF_FdU32uGYV1SI042Lkq2ieCh3NqmTGePXdTe9AXxGD3srKYsod_BwoAOCsPm2oKf46Wo1T00pNPB9nysYGZZrLOdfu0$ . You are receiving this because you were mentioned.Message ID: @.***>

-- Moses Boudourides (pronounced Bo͝odo͝orēT͟Həs) Professor of Practice at the School of Public Affairs, Arizona State University Phone: 484 534-0290 http://mboudour.github.io/about/