Result of nrow function - error

Hi @Willa2020 and welcome! Thanks for posting the code, but it is even easier for folks to help you if you posts a reproducible example (reprex) that contains your data and code. Please have a look at this guide, to see how to create one.

As to your code above, one problem I see is that you are using the pipe (%>%) when it sounds like you want to be using the assignment operator (<- or ->). If you post a reprex including your data, I'm sure we'll be able to help out!