Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block 2, Task 1: Create a Program to Assign Students to Groups #5

Open
mbannert opened this issue Sep 22, 2020 · 2 comments
Open

Block 2, Task 1: Create a Program to Assign Students to Groups #5

mbannert opened this issue Sep 22, 2020 · 2 comments
Labels
task student task / exercise

Comments

@mbannert
Copy link
Contributor

mbannert commented Sep 22, 2020

Create a program to assign students to groups. Assign a type of card and a color (clubs, spades, hearts, diamonds) to each student. Make sure to have equally sized groups as much as possible.

Create a reproducible example to show how your code works.

Bonus: Use the GitHub API to get usernames from github.
If you submit your work before the next session, it will help to give you feedback and discuss the code.

Note: This task is a little harder and a bit less of a Mickey Mouse example in the sense that splitting up actually makes sense. Someone on the team could read through the github documentation and figure out how to extract usernames from the API. 1-2 others could think of the problem itself.

Hint:

The following ingredients can be handy to implement the above in R:

  • sample function sample()
  • length function length()
  • names function names()
  • rounding functions like ceiling or floor. ceiling(), floor()
  • lists list()
  • for loops
@mbannert mbannert added the task student task / exercise label Sep 22, 2020
@mbannert mbannert changed the title Task 5: Create a Program to Assign Students to Groups Block 1, Task 5: Create a Program to Assign Students to Groups Sep 29, 2021
@mbannert mbannert changed the title Block 1, Task 5: Create a Program to Assign Students to Groups Block 2, Task 1: Create a Program to Assign Students to Groups Oct 19, 2022
@mbannert
Copy link
Contributor Author

mbannert commented Oct 19, 2022

To skip the GitHub API part for starters, generate a vector of student names, e.g.,

nms <- paste("student", c(LETTERS,letters)[1:20], sep = " ")

@mbannert
Copy link
Contributor Author

For 20 students, the result could look something like this:

{
    "Aces": {
        "Club": "student F",
        "Spade": "student K",
        "Heart": "student O",
        "Diamond": "student Q"
    },
    "Kings": {
        "Club": "student G",
        "Spade": "student N",
        "Heart": "student R",
        "Diamond": "student T"
    },
    "Queens": {
        "Club": "student H",
        "Spade": "student M",
        "Heart": "student B",
        "Diamond": "student D"
    },
    "Jacks": {
        "Club": "student A",
        "Spade": "student E",
        "Heart": "student I",
        "Diamond": "student P"
    },
    "Tens": {
        "Club": "student J",
        "Spade": "student L",
        "Heart": "student C",
        "Diamond": "student S"
    }
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task student task / exercise
Projects
None yet
Development

No branches or pull requests

1 participant