FAQ: Data Cleaning in R - Diagnose the Data

This community-built FAQ covers the “Diagnose the Data” exercise from the lesson “Data Cleaning in R”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn R

FAQs on the exercise Diagnose the Data

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Can someone please explain what this command means? And how does it apply to both the files at the same time?

clean_data_frame <- 2

hi! the instructions wanted you to examine which of the data sets was clean. if grocery_1 was clean, you would define clean_data_frame <- 1, but if grocery_2 was clean, we would define it as clean_data_frame <- 2.

grocery_2 was formatted correctly and was therefore ‘clean’, and accordingly we wrote
clean_data_frame <- 2

I’m not exactly sure why tho.

So can someone explain the reasoning behind why grocery_2 is considered “clean and tidy.” It seems to me that grocery_1 data frame is the tidy one, as it is concise, not redundant, and contains more data in numeric form for easy analysis.

5 Likes

Same confusion to begin with. However, it looks like grocery_2 is the Tableau format data frame while grocery_1 is the Excel format. I have some experience working with Tableau before. Tableau looks at the data set by column. If you input an Excel format data frame, it cannot make sense of the data. For example, if you put grocery_1 into Tableau and drag Cake_recipe into the sheet, it will add all the quantities for different materials together (2 eggs + 1 milk + 2 flours = 5 total ingredients for cake_recipe!) but that is not what we are interested in. We want to see how many eggs to buy. grocery_2 can do this easily. You put Grocery_item as a filter and select Egg, then it will add all the Numbers in the rows with Egg (2 + 3). This sounds redundant yes, a bit stupid but I guess the problem is many data analytic tools cannot cross check the row and the col. They go col by col. - Personal understanding.

i don’t understand the concept of data cleaning how do they particularly assign value 2 to clean_data_frame without checking if the data is clean or not. can somebody explain please.