Skip to content

Finished the lab-w10#5

Open
ChaohongP wants to merge 2 commits intodata-science-methods:mainfrom
ChaohongP:main
Open

Finished the lab-w10#5
ChaohongP wants to merge 2 commits intodata-science-methods:mainfrom
ChaohongP:main

Conversation

@ChaohongP
Copy link
Copy Markdown

No description provided.

Comment thread lab.R Outdated
Copy link
Copy Markdown
Member

@dhicks dhicks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading your code quickly, it looks like you're doing things right, just not with the variables in the right place. See my longer comment w/ example.

Comment thread lab.R
class(ri_df$StartDate)
#' The class of the "StartDate" column is "character".
#' The dates are formatted differently. Some dates refer to a certain day, and some some days are the days passed since a reference date.
ri_df_dates <- ri_df %>%
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're using different names for several variables, and Travis can't find them to check your work

Suggested change
ri_df_dates <- ri_df %>%
dates <- ri_df %>%

Comment thread lab.R
Comment on lines +61 to +63
mutate(int_dates1= dates) %>%
mutate(int_dates1= as.integer(int_dates1)) %>%
mutate(int_dates1 = as.Date(int_dates1, origin='1899-12-30'))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I think I get where you're confused now. I'm asking you to create these variables in the environment, not within the dataframe. The idea is that it's easier to write a function that takes a single vector as input and apply it to a dataframe, rather than working directly with the whole dataframe.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So for example, what I'm looking for here would look like

int_dates1 <- dates %>%
    as.integer() %>%
    as.Date(origin = '1899-12-30')

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it. Thanks!

Copy link
Copy Markdown
Member

@dhicks dhicks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading your code, it looks like you're doing things correctly, just saving them to variables in the wrong place. See my longer comment w/ example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants