daroczig / CEU-R-intro

Data Analysis 1a: Foundation of Data management in R @ CEU
35 stars 62 forks source link

Example ticket #9

Closed daroczig closed 6 years ago

daroczig commented 6 years ago

Feel free to open a new ticket with any question or concern

bzankay commented 6 years ago

Hi Greg, I have an issue with this task is Datacamp (part of assignment):

"The mtd object from the previous exercises is still available in your R sessions. Create a new summary object called mtdgear, showing the frequency table of gears. In other words: count the number of rows per gear in the mtd dataset."

My idea had been related to table function, i.e using this: mtdgear <- table(mtd$gear) .

Although the right numbers occoured in the consol:
3 4 5 15 12 5 the answer resulted an "incorrect submission" message.

When I decided to see answer for 0 points, it was: "mtdgear <- mtd[, .N, by = gear]". This answer however had not resulted the above mentioned correct numbers, but the same line "mtdgear <- mtd[, .N, by = gear]" had just appeared as a solution in the console. Can you help me to figure out if my adoption of table function was right in this case?

daroczig commented 6 years ago

Hey @bzankay, can you please open a new ticket clicking on the green "new issue" in the future to keep the questions separated?

But to answer your question: your table call is correct to generate the frequency table, but in this exercise I expected you to use the data.table approach that we learned on the last lesson. Sorry for the confusion -- I'll update the exercise in a bit.

The solution should be fine, I've just double checked that. If DataCamp doesn't accept it, try refreshing the page. Please open a new ticket if still in doubt, I'm closing this.