njtierney / brolgar

BRowse Over Longitudinal Data Graphically and Analytically in R
http://brolgar.njtierney.com/
Other
109 stars 10 forks source link

`add_key_slope` does not work, but `key_slope` does #45

Closed njtierney closed 5 years ago

njtierney commented 5 years ago

Somehow ln_wages is not passed properly, probably missing something obvious?

library(brolgar)

# fine
key_slope(wages_ts,ln_wages ~ xp)
#> # A tibble: 888 x 3
#>       id .intercept .slope_xp
#>    <int>      <dbl>     <dbl>
#>  1    31       1.41    0.101 
#>  2    36       2.04    0.0588
#>  3    53       2.29   -0.358 
#>  4   122       1.93    0.0374
#>  5   134       2.03    0.0831
#>  6   145       1.59    0.0469
#>  7   155       1.66    0.0867
#>  8   173       1.61    0.100 
#>  9   206       1.73    0.180 
#> 10   207       1.62    0.0884
#> # … with 878 more rows

# errors
add_key_slope(wages_ts,ln_wages ~ xp)
#> Error in eval(predvars, data, env): object 'ln_wages' not found

Created on 2019-07-13 by the reprex package (v0.3.0)

njtierney commented 5 years ago
njtierney commented 5 years ago

@earowang - do you have any thoughts why I might be getting this error?