课程: R Code Challenges: Data Science
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Dealing with unexpected data
- [Lecturer] Oh boy, what a mess. Much of the data you're going to experience as a data scientist is a random mix of values and characters, and who knows what got in there. Your job is oftentimes just cleaning things up and giving them the appropriate data types that you can actually draw analysis from. That's what this problem is all about. You're given a random list of types of values and then forced to make decisions based on the type of the value versus the value of the element. So let's step through this code to find out how I chose to solve this problem. The code shows you my definition for deal with this, an R function, and the parameter is mysteryMeat. Now the important things to start off with is you're being handed a list. This isn't a vector or a data frame, it's a list. I chose that because a list allows you to mix types of values. I've created a vector called mysteryMeat. Let's take a look at what that is. The first thing you should notice is, is there are six elements to…