Levene's Test in R - r

I was using Levene's test to check the equality of variance in R. For this I installed the car package. I used the following command in R for this:
install.packages("car")
After running this command I got the following message:
Installing package into ‘C:/Users/DELL/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘magrittr’, ‘pkgconfig’, ‘R6’, ‘BH’, ‘rematch’, ‘assertthat’, ‘fansi’, ‘utf8’, ‘forcats’, ‘hms’, ‘readr’, ‘cellranger’, ‘zip’, ‘cli’, ‘crayon’, ‘pillar’, ‘rlang’, ‘SparseM’, ‘MatrixModels’, ‘sp’, ‘haven’, ‘curl’, ‘data.table’, ‘readxl’, ‘openxlsx’, ‘tibble’, ‘minqa’, ‘nloptr’, ‘Rcpp’, ‘RcppEigen’, ‘carData’, ‘abind’, ‘pbkrtest’, ‘quantreg’, ‘maptools’, ‘rio’, ‘lme4’
In this list of dependencies, all the packages got installed except Rcpp. After this process, I tried to run the Levene's test and got the following error message
library(car)
leveneTest(Minimum1 ~ Type)
Error in leveneTest(Minimum1 ~ Type) :
could not find function "leveneTest"

Install 'hsm' package by using (install.packages("hms")) before loading 'car' package

Related

Error message when I run install.packages("tidyverse")

Please I need help with this. When I run install package for the tidyverse:
install.packages("tidyverse")
I get this message:
also installing the dependencies ‘colorspace’, ‘sys’, ‘bit’, ‘ps’, ‘sass’, ‘cachem’, ‘memoise’, ‘base64enc’, ‘fastmap’, ‘farver’, ‘labeling’, ‘munsell’, ‘RColorBrewer’, ‘viridisLite’, ‘rappdirs’, ‘rematch’, ‘askpass’, ‘bit64’, ‘prettyunits’, ‘processx’, ‘evaluate’, ‘highr’, ‘yaml’, ‘xfun’, ‘bslib’, ‘htmltools’, ‘jquerylib’, ‘tinytex’, ‘backports’, ‘ellipsis’, ‘generics’, ‘glue’, ‘assertthat’, ‘blob’, ‘DBI’, ‘lifecycle’, ‘R6’, ‘tidyselect’, ‘vctrs’, ‘withr’, ‘data.table’, ‘digest’, ‘gtable’, ‘isoband’, ‘scales’, ‘gargle’, ‘uuid’, ‘cellranger’, ‘curl’, ‘ids’, ‘rematch2’, ‘cpp11’, ‘pkgconfig’, ‘mime’, ‘openssl’, ‘fansi’, ‘utf8’, ‘clipr’, ‘vroom’, ‘tzdb’, ‘progress’, ‘callr’, ‘fs’, ‘knitr’, ‘rmarkdown’, ‘selectr’, ‘stringi’, ‘broom’, ‘cli’, ‘crayon’, ‘dbplyr’, ‘dplyr’, ‘dtplyr’, ‘forcats’, ‘ggplot2’, ‘googledrive’, ‘googlesheets4’, ‘haven’, ‘hms’, ‘httr’, ‘jsonlite’, ‘lubridate’, ‘magrittr’, ‘modelr’, ‘pillar’, ‘purrr’, ‘readr’, ‘readxl’, ‘reprex’, ‘rlang’, ‘rstudioapi’, ‘rvest’, ‘stringr’, ‘tibble’, ‘tidyr’, ‘xml2’
There is a binary version available but the source version is later:
binary source needs_compilation
dplyr 1.0.9 1.0.10 TRUE
I've looked for a duplicate on Stack Overflow and can't find one, so:
This is not an error message. The key line is
There is a binary version available but the source version is later
At this point R pauses and asks whether you want to try installing from source: it is simplest and easiest to say "no" (typing "n" should work). The only drawback is that you will get a slightly older version of the package installed. If you say "yes" (or "y" or "Y"), R will try to install from source, which will (1) not work unless you have development tools installed, (2) take a little bit longer (but it will provide you with the most recent version of the package).

Why is my use of install.packages giving me dependency errors when I try installing tidyverse-packages?

As of 18 Nov 2021, I've downloaded all the tar.gz files that tidyverse imports/depends/suggests. I'm working on a RedHat OS and, unfortunately, I don't have an Internet connection to this machine. I have all those files in a folder. Then I use this command
install.packages(
# i use setwd() to make my tar.gz directory equal to my current working directory
destdir = ".",
pkgs = c(...), # I list all relevant tar.gz here, e.g. c("foo_tar.gz", "bar_tar.gz")
dependencies = c("Depends", "Imports", "Suggests"),
quiet = FALSE,
repos = NULL
)
But I get this error message
ERROR: dependencies ‘broom’, ‘cli’, ‘crayon’, ‘dbplyr’, ‘dplyr’, ‘dtplyr’, ‘forcats’, ‘googledrive’, ‘googlesheets4’, ‘ggplot2’, ‘haven’, ‘hms’, ‘httr’, ‘jsonlite’, ‘lubridate’, ‘magrittr’, ‘modelr’, ‘pillar’, ‘purrr’, ‘readr’, ‘readxl’, ‘reprex’, ‘rlang’, ‘rstudioapi’, ‘rvest’, ‘stringr’, ‘tibble’, ‘tidyr’, ‘xml2’ are not available for package ‘tidyverse’
Every one of those files are in my working directory. I'm using R version 3.6, which is compatible with the downloaded version of tidyverse. Why can't the installer find these files?
Need to run tools::write_PACKAGES before executing install.packages.
Even though the tar.gz files are in the same folder, the PACKAGES file must be populated to properly account for dependencies. Otherwise, the install.packages function doesn't know how the packages are related. Would be nice if that error message was more specific.

Unable to install ggplot2 through console in Rstudio

I have started to learn Rprogramming on my own through Coursera platform. Even after following all the steps taught to us through video class, I cannot install the "ggplot2" package by entering the following code in the console
install.packages("ggplot2")
the output I got after running the above code is as follows
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/DEEPAK K R/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘ps’, ‘processx’, ‘callr’, ‘prettyunits’, ‘backports’, ‘desc’, ‘pkgbuild’, ‘rprojroot’, ‘rstudioapi’, ‘evaluate’, ‘pkgload’, ‘praise’, ‘colorspace’, ‘assertthat’, ‘utf8’, ‘testthat’, ‘farver’, ‘labeling’, ‘lifecycle’, ‘munsell’, ‘R6’, ‘RColorBrewer’, ‘viridisLite’, ‘cli’, ‘crayon’, ‘ellipsis’, ‘fansi’, ‘magrittr’, ‘pillar’, ‘pkgconfig’, ‘vctrs’, ‘digest’, ‘glue’, ‘gtable’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’, ‘withr’
I'm using windows 10.
looking forward to the answers!

R install.packages returns 'ERROR: failed to lock directory'

[Similar question to 14382209 but suggestions there haven't solved this issue]
New installation of R 4.0.0 and tidyverse on a Windows 7 work computer returns this classic failed to create lock directory error
install.packages('tidyverse')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com/users/A04/ocarrib/R/win-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘highr’, ‘markdown’, ‘testthat’, ‘RColorBrewer’, ‘viridisLite’, ‘askpass’, ‘rematch’, ‘prettyunits’, ‘processx’, ‘knitr’, ‘yaml’, ‘htmltools’, ‘evaluate’, ‘base64enc’, ‘tinytex’, ‘xfun’, ‘backports’, ‘generics’, ‘reshape2’, ‘assertthat’, ‘glue’, ‘fansi’, ‘DBI’, ‘lifecycle’, ‘R6’, ‘tidyselect’, ‘ellipsis’, ‘pkgconfig’, ‘Rcpp’, ‘BH’, ‘plogr’, ‘digest’, ‘gtable’, ‘isoband’, ‘scales’, ‘withr’, ‘vctrs’, ‘curl’, ‘mime’, ‘openssl’, ‘utf8’, ‘clipr’, ‘cellranger’, ‘progress’, ‘callr’, ‘fs’, ‘rmarkdown’, ‘whisker’, ‘selectr’, ‘stringi’, ‘broom’, ‘cli’, ‘crayon’, ‘dbplyr’, ‘dplyr’, ‘forcats’, ‘ggplot2’, ‘haven’, ‘hms’, ‘httr’, ‘jsonlite’, ‘lubridate’, ‘magrittr’, ‘modelr’, ‘pillar’, ‘purrr’, ‘readr’, ‘readxl’, ‘reprex’, ‘rlang’, ‘rstudioapi’, ‘rvest’, ‘stringr’, ‘tibble’, ‘tidyr’, ‘xml2’
There are binary versions available but the source versions are later:
binary source needs_compilation
modelr 0.1.6 0.1.7 FALSE
xml2 1.3.1 1.3.2 TRUE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/highr_0.8.zip'
Content type 'application/zip' length 48579 bytes (47 KB)
downloaded 47 KB
# .... Output edited for brevity #
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/tidyverse_1.3.0.zip'
Content type 'application/zip' length 440009 bytes (429 KB)
downloaded 429 KB
package ‘highr’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com\users\A04\ocarrib\R\win-library\4.0’ for modifying
Try removing ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com\users\A04\ocarrib\R\win-library\4.0/00LOCK’
Then trialling rtools
install.packages('rtools')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com/users/A04/ocarrib/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘rtools’ is not available (for R version 4.0.0)
Then trialled:
- Deletion 00lock folder directly from stated location (~A04\ocarrib\R\win-library\4.0/00LOCK)
- restarting R
- No luck, same error
Then trialled with options:
> install.packages("tidyverse", dependencies = TRUE, INSTALL_opts = '--no-lock')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com/users/A04/ocarrib/R/win-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘RColorBrewer’, ‘viridisLite’, ‘askpass’, ‘rematch’, ‘prettyunits’, ‘processx’, ‘lazyeval’, ‘backports’, ‘generics’, ‘reshape2’, ‘assertthat’, ‘fansi’, ‘DBI’, ‘lifecycle’, ‘R6’, ‘tidyselect’, ‘ellipsis’, ‘pkgconfig’, ‘Rcpp’, ‘BH’, ‘plogr’, ‘digest’, ‘gtable’, ‘isoband’, ‘scales’, ‘withr’, ‘vctrs’, ‘curl’, ‘mime’, ‘openssl’, ‘utf8’, ‘clipr’, ‘cellranger’, ‘progress’, ‘callr’, ‘fs’, ‘whisker’, ‘selectr’, ‘stringi’, ‘rex’, ‘yaml’, ‘evaluate’, ‘highr’, ‘markdown’, ‘xfun’, ‘htmltools’, ‘base64enc’, ‘tinytex’, ‘broom’, ‘cli’, ‘crayon’, ‘dbplyr’, ‘dplyr’, ‘forcats’, ‘ggplot2’, ‘haven’, ‘hms’, ‘httr’, ‘jsonlite’, ‘lubridate’, ‘magrittr’, ‘modelr’, ‘pillar’, ‘purrr’, ‘readr’, ‘readxl’, ‘reprex’, ‘rlang’, ‘rstudioapi’, ‘rvest’, ‘stringr’, ‘tibble’, ‘tidyr’, ‘xml2’, ‘covr’, ‘feather’, ‘glue’, ‘knitr’, ‘rmarkdown’, ‘testthat’
There are binary versions available but the source versions are later:
binary source needs_compilation
modelr 0.1.6 0.1.7 FALSE
xml2 1.3.1 1.3.2 TRUE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/RColorBrewer_1.1-2.zip'
Content type 'application/zip' length 55583 bytes (54 KB)
downloaded 54 KB
# Output edited for brevity
package ‘RColorBrewer’ successfully unpacked and MD5 sums checked
package ‘viridisLite’ successfully unpacked and MD5 sums checked
package ‘askpass’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com\users\A04\ocarrib\R\win-library\4.0’ for modifying
Try removing ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com\users\A04\ocarrib\R\win-library\4.0/00LOCK’
Any other thoughts??
Session info:
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.0 tools_4.0.0
Open the R folder (where you first save R after downloading)
Remove 00lock folder by changing its place - cut and paste to another place.
Try to download the library.
In case you're using Ubuntu Linux, you can find the folder 00LOCK-<package> in the location /home/<your-computer-name>/R/x86_64-pc-linux-gnu-library/<your-R-version>. After you removed the folder 00LOCK-<package>, try to install the package again, it should work now!

Having trouble installing basic packages in R

I'm trying to install basic packages in R but having a lot of trouble. I've tried several solutions but am having trouble getting to the bottom of it. I've added dependencies = TRUE, made sure my R was updated, tried to manually install packages, all to no avail.
Error message: also installing the dependencies ‘rlang’, ‘utf8’, ‘pillar’, ‘tibble’, ‘testthat’, ‘covr’
Warning message in install.packages("readr", dependencies = TRUE):
“installation of package ‘rlang’ had non-zero exit status”Warning message in install.packages("readr", dependencies = TRUE):
“installation of package ‘utf8’ had non-zero exit status”Warning message in install.packages("readr", dependencies = TRUE):
“installation of package ‘covr’ had non-zero exit status”Warning message in install.packages("readr", dependencies = TRUE):
“installation of package ‘pillar’ had non-zero exit status”Warning message in install.packages("readr", dependencies = TRUE):
“installation of package ‘testthat’ had non-zero exit status”Warning message in install.packages("readr", dependencies = TRUE):
“installation of package ‘tibble’ had non-zero exit status”Warning message in install.packages("readr", dependencies = TRUE):
“installation of package ‘readr’ had non-zero exit status”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
also installing the dependencies ‘utf8’, ‘pillar’, ‘bit’, ‘glue’, ‘purrr’, ‘rlang’, ‘tibble’, ‘bit64’, ‘covr’, ‘dbplyr’, ‘dtplyr’, ‘ggplot2’, ‘Lahman’, ‘microbenchmark’, ‘nycflights13’, ‘RMySQL’, ‘RPostgreSQL’, ‘RSQLite’, ‘testthat’

Resources