Calculating % of a column with binary values

Hi @sd09! Welcome!

For starters, I think it will be easier to help with a little bit more information (this is pretty common — when you're new to this stuff, it's hard to know how much information is enough!). Since you’re asking a question about homework, you should also make sure you’re familiar with our FAQ: Homework Policy (so far, your question is within bounds :grinning:).

So, my questions for you:

  1. Do you already have your data in R, or is that part of what you’re trying to figure out?

    • If the data is in R, it will help if you can paste in the results of running the str() function on the R object that’s storing your data. For instance, if your data is in an R variable called hw01_data, you’d run:
      str(hw01_data)
      …in the console and copy-paste the results. Be sure to format what you paste as code :sparkles: so it doesn’t get garbled by the forum software!
  2. How would you solve the problem of calculating the percentage of zeroes in the column if you were using a pencil and paper?

  3. Have you been learning about specific R features in class? If so, which things you’ve learned about do you think might apply to this question?

    (It’s OK if you’re not quite sure how, and it’s OK to give a “wrong” answer — I’m asking this because the thing that’s hardest about helping with homework questions is that most assignments can be completed many different ways and it’s difficult to know what to suggest without all the context of the class itself).

1 Like