DS4PS / cpp-528-fall-2020

Course shell for CPP 528 Foundations of Data Science III - Project Management
http://ds4ps.org/cpp-528-fall-2020/
1 stars 1 forks source link

Issue in LAB 03 on the difference of mhv.00 and mhv.90 #28

Open TVK36692 opened 3 years ago

TVK36692 commented 3 years ago

I am getting no values on mhv.change. The results are after the code.

# adjust 1990 home values for inflation 
mhv.90 <- d$mhmval90 * 1.31  
mhv.00 <- d$mhmval00

mhv.change <- mhv.00 - mhv.90

df <- data.frame( MedianHomeValue1990=mhv.90, 
                  MedianHomeValue2000=mhv.00, 
                  Change.90.to.00=mhv.change )

stargazer( df, 
           type=s.type, 
           digits=0, 
           summary.stat = c("min", "p25","median","mean","p75","max") )

df2 <- data.frame( Change.90.to.00=mhv.change)

stargazer( df2, 
           type=s.type, 
           digits=0, 
           summary.stat = c("min", "p25","median","mean","p75","max") )

=================================================================== Statistic Min Pctl(25) Median Mean Pctl(75) Max

MedianHomeValue1990 0 65,762 98,279 132,951 165,332 655,001 MedianHomeValue2000 0 72,802 106,300 132,807 160,900 1,000,001

=============================================== Statistic Min Pctl(25) Median Mean Pctl(75) Max

I have tried to redo the math over and over and am getting no records. Am I missing something?

cenuno commented 3 years ago

@TVK36692 - to clarify, are you saying that mhv.change is a vector containing all NA values? My suspicion is that it is a numeric vector that should contain both positives and negative values.

In the console, I ran the following lines and am seeing mhv.change, mhv.00, and mhv.90 all contain data:

> summary(mhv.change)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-644276  -19539    2673     -94   21556 1000001 
> summary(mhv.00)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0   81600  119900  144738  173894 1000001 
> summary(mhv.90)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0   75767  111460  144832  182716  644276 

You may want to save and then restart RStudio. It's possible you've re-written any of the objects.