[Oaxaca package] Can´t acces to data("chicago") to replicate example.

Hi all. I'm fairly new R and looking to use the oaxaca-blinder decomposition. After i installed the oaxaca package as seen in Hlavac With the package installed when i try to use de data("chicago") i recieved the message:

data("chicago")
Warning message:
In data("chicago") : data set ‘chicago’ not found

Using library("oaxaca") shows this:

library("oaxaca")
Error: package or namespace load failed for ‘oaxaca’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘ggplot2’
In addition: Warning message:
package ‘oaxaca’ was built under R version 3.5.3

I use install.packages("ggplot2") and still Chicago data is not found. I don't know how to proceed. My intention is just to be able to replicate that example.

Thanks.

Try cutting and pasting the following

library(oaxaca)
#> 
#> Please cite as:
#>  Hlavac, Marek (2018). oaxaca: Blinder-Oaxaca Decomposition in R.
#>  R package version 0.1.4. https://CRAN.R-project.org/package=oaxaca
data(chicago)
head(chicago)
#>   age female foreign.born LTHS high.school some.college college advanced.degree
#> 1  52      0            1    0           1            0       0               0
#> 2  46      1            1    0           1            0       0               0
#> 3  31      1            1    0           1            0       0               0
#> 4  35      0            1    0           1            0       0               0
#> 5  19      0            0    0           1            0       0               0
#> 6  50      1            1    1           0            0       0               0
#>   ln.real.wage
#> 1     2.140066
#> 2           NA
#> 3     2.499795
#> 4     2.708050
#> 5     2.079442
#> 6           NA

Hi, thank you for you reply. I paste this and still the data is not available. (oaxaca and ggplot2 packages ara installed)

library(oaxaca)
Error: package or namespace load failed for ‘oaxaca’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘ggplot2’
In addition: Warning message:
package ‘oaxaca’ was built under R version 3.5.3
#>
#> Please cite as:
#> Hlavac, Marek (2018). oaxaca: Blinder-Oaxaca Decomposition in R.
#> R package version 0.1.4. CRAN - Package oaxaca
data(chicago)
Warning message:
In data(chicago) : data set ‘chicago’ not found
head(chicago)
Error in head(chicago) : object 'chicago' not found

What happens with?

library(ggplot2)

Hi. library(ggplot2) shows this with package installed.

Error in library("ggplot2") : there is no package called ‘ggplot2’

If it's installed, you should be able to confirm with this snippet

library(ggplot2)
ggplot(mpg, aes(displ, hwy, colour = class)) + 
  geom_point()

If not,

install.packages("ggplot2")

Interesting. I've been using :

install.packages("ggplot2")

Showing this:

Installing package into ‘C:/Users/usuario/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘lifecycle’, ‘rlang’, ‘scales’

There are binary versions available but the source versions are later:
binary source needs_compilation
lifecycle 0.2.0 1.0.1 FALSE
rlang 0.4.5 0.4.12 TRUE
scales 1.1.0 1.1.1 FALSE
ggplot2 3.3.0 3.3.5 FALSE

Binaries will be installed
trying URL https//cran.rstudio.com/bin/windows/contrib/3.5/rlang_0.4.5.zip
Content type 'application/zip' length 1115838 bytes (1.1 MB)
downloaded 1.1 MB

package ‘rlang’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\usuario\AppData\Local\Temp\Rtmp8G2VL1\downloaded_packages
installing the source packages ‘lifecycle’, ‘scales’, ‘ggplot2’

trying URL //cran.rstudio.com/src/contrib/lifecycle_1.0.1.tar.gz
Content type 'application/x-gzip' length 99716 bytes (97 KB)
downloaded 97 KB

trying URL //cran.rstudio.com/src/contrib/scales_1.1.1.tar.gz
Content type 'application/x-gzip' length 515201 bytes (503 KB)
downloaded 503 KB

trying URL ://cran.rstudio.com/src/contrib/ggplot2_3.3.5.tar.gz
Content type 'application/x-gzip' length 3063309 bytes (2.9 MB)
downloaded 2.9 MB

  • installing source package 'lifecycle' ...
    ** package 'lifecycle' successfully unpacked and MD5 sums checked
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    namespace 'rlang' 0.4.5 is being loaded, but >= 0.4.10 is required
    ERROR: lazy loading failed for package 'lifecycle'
  • removing 'C:/Users/usuario/Documents/R/win-library/3.5/lifecycle'
    In R CMD INSTALL
    Warning in install.packages :
    installation of package ‘lifecycle’ had non-zero exit status
    ERROR: dependency 'lifecycle' is not available for package 'scales'
  • removing 'C:/Users/usuario/Documents/R/win-library/3.5/scales'
    In R CMD INSTALL
    Warning in install.packages :
    installation of package ‘scales’ had non-zero exit status
    ERROR: dependency 'scales' is not available for package 'ggplot2'
  • removing 'C:/Users/usuario/Documents/R/win-library/3.5/ggplot2'
    In R CMD INSTALL
    Warning in install.packages :
    installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\usuario\AppData\Local\Temp\Rtmp8G2VL1\downloaded_packages’

But the snippet is not working , the result is :

Error in library(ggplot2) : there is no package called ‘ggplot2’

So, looks like its not installing anything?
Thanks.

That's right. Installation failed:

is the obscure message that indicates this. Again, I can't help with why this occurs under Windows.

You are getting old package versions because you are installing binaries on a very old R version. For getting the latest package versions either install from source or even better, update R so you can get access to the latest precompiled binaries.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.