DS4PS / cpp-526-sum-2021

Coure shell for CPP 526.
https://ds4ps.org/cpp-526-sum-2021/
MIT License
1 stars 3 forks source link

Lab 4 Question about "dat.one.team <- filter( Teams, name == team.name )" #25

Open AshtonHop9 opened 3 years ago

AshtonHop9 commented 3 years ago

Hey everyone,

In lab 4 I was able to get all of the reactive data to work, but I just wanted some more clarification about the difference between

1.) dat.one.team <- filter( Teams, name == team.name ) and

2.) dat.one.team <- filter(.data = Teams, name == team.name)

Number 2 is already in the lab template above where we would plot our graph from the previous week, and I put number 1 below the graph statements above my information that creates the interactive plot line etc. When I take out number 2 (dat.one.team <- filter( Teams, name == team.name ) it does not effect my interactive graph but it is in the instructions for the lab for adding season stats for a team.

Mainly, I am just curious about the difference....

Thanks!

lecy commented 3 years ago

It’s the difference between explicit and implicit argument use in functions. You can reference arguments by name or position.

function( x=10, y=TRUE )  # explicit call

function( 10, TRUE )  # implicit call

The first argument, the data frame, is named .data in the filter function.

https://dplyr.tidyverse.org/reference/filter.html

jamisoncrawford commented 3 years ago

@AshtonHop9 does this help?

Thanks @lecy!

AshtonHop9 commented 3 years ago

@lecy @jamisoncrawford Thanks for the explanation and link! I think I get it now hah!!