Skip to content

Week 3 #6

@snystrom

Description

@snystrom

Last week we covered For loops & writing functions. For loops were difficult to cover so we spent an extra class on them. Unfortunately the GMB written exam was that day so >1/2 the class was missing.

Perhaps if/else + functions works better as cohesive lesson.

Was helpful to walk through example on whiteboard where first walk through for i in c(1,2,3). And saving to empty output vector (ideas how to teach this correctly given for-loop memory leak without being overwhelming?) so that i can be used as the index and the value. Then do an example (c("Alice", "Bob", "Claire"), or 5:10) where looping over vector values cannot also be used to index. Walking through this step by step allows students to realize that output["Alice"] <- "Alice" or output[5]<-5 won't work how they think it will.

We did not cover lapply or sapply due to time constraints & because sapply output is hard to predict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DebriefNotes taken immediately after a class session, what worked, what didn't, how the day went.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions