DS4PS / cpp-526-spr-2020

Course shell for CPP 526 Foundations of Data Science I for Spring 2020.
http://ds4ps.org/cpp-526-spr-2020/
3 stars 0 forks source link

Lab 06 - Defining the new table #26

Open ecking opened 4 years ago

ecking commented 4 years ago

Hello again,

So I merged Salaries and Teams. It looks fine. But if I go to define that new dataset it returns nothing... no error, not even a notice of zero results.. just blank, nothing.

d2 <- merge(Teams, d1, by = c("teamID" ,"yearID"), all=TRUE)

If I remove d2, I get the merged table and it looks fine. The reason why I was doing this was so I could use values from that table together so I could figure out the cost per win. Am I approaching this incorrectly?

lecy commented 4 years ago

What do you get if you type:

d2 <- merge(Teams, d1, by = c("teamID" ,"yearID"), all=TRUE)
head( d2 )
ecking commented 4 years ago

Hmmm. It returns results which is a start but only 6 rows of data...? which is even more baffling to me.

lecy commented 4 years ago

head() prints first six rows, so that is as expected. You are assigning your new data frame to the object d2. All of your data should be accessible there. It is normal that any line that includes assignment will not print the results. You need to request it by typing the object name (or more typically some preview or summary of the object).

ecking commented 4 years ago

SUPER HELPFUL. I understand now.

THANK YOU!

jamisoncrawford commented 4 years ago

Thanks @lecy!