DS4PS / cpp-526-fall-2020

Course shell for CPP 526 Foundations of Data Science I for Fall 2020
http://ds4ps.org/cpp-526-fall-2020/
MIT License
3 stars 1 forks source link

Step3 Lab06 #26

Open tylerisyoung opened 4 years ago

tylerisyoung commented 4 years ago

After having merged the two datasets with: teams_sals <- left_join(Teams, total_sal)

I am stuck on the next question. I have been using variations of:

teams_sals%>% mutate(Salary_CPW = (teams_sals / W)/100000)

I was hoping to use "Salary_CPW" as a new variable/column with the resulting values from the equation but continue getting the error: Error: Problem with mutate() input Salary_CPW. x non-numeric argument to binary operator Input Salary_CPW is #(teams_sals/W)/100000.

I understand that they're different data types that I'm trying to manipulate, but I am not sure what I should do to fix this. I've recovered all of the material but have still be stuck here for a while now and feel that it's an easy thing to correct, this comment may be a bit late for help in the current lab, but anything helps.

Thanks,

MelDawg commented 4 years ago

From what I can tell, teams_sals is not the salary column in your merged data frame. I bet if you divide w by 'salary', it will work. Good luck!

jamisoncrawford commented 4 years ago

@MelDawg may be onto something! Thanks for stepping in and up.

@tylerisyoung - what is your error message telling you? When you see non-numeric argument in an error message, most times this means that some value (or variable containing multiple values) you are passing to a function is supposed to be of class "numeric". Your error, then, tells you that it's not of class "numeric".

When this is the case, inspect the values individually. What does W look like? What does team_sals look like? Are they both numeric? If not, are they the right variables? If so, what do you need to do to make them numeric?

Let us know if you've got this figured out!