R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS 15.0
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Los_Angeles
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] htmlwidgets_1.6.4 compiler_4.4.1 fastmap_1.2.0 cli_3.6.3
[5] tools_4.4.1 htmltools_0.5.8.1 yaml_2.3.10 rmarkdown_2.28
[9] knitr_1.48 jsonlite_1.8.9 xfun_0.47 digest_0.6.37
[13] rlang_1.1.4 evaluate_1.0.0
4 Getting Started
4.1 Function calls
Working in R, like any programming language, involves calling functions. For this to work as expected, you need to pass the right type of object(s) to the appropriate function.
4.2 Errors & Warnings
Given your specific goal, when you execute an R expression, there are a few possible outcomes:
4.2.1 No warning or error
- The code executes & produces correct output without issuing a warning (best case scenario).
- The code executes BUT produces incorrect output without issuing a warning: Fix code to produce correct output (worst case scenario).
4.2.2 Warning
- The code executes & produces correct output but issues a warning: Fix code to avoid warning.
- The code executes & produces incorrect output & issues a warning: Fix code to produce correct output & avoid warning.
4.2.3 Error
- The code stops execution & produces an error: Fix code to avoid error.
4.3 Getting help
If you have an issue that you can’t resolve by reading the documentation or searching online, before asking for help, make sure you collect all the relevant information. This includes:
- The code you are running.
- The error message you are getting.
- The output you are expecting.
- The output you are getting.
- The version of R you are using.
- The version of any packages you are using.
- The operating system you are using.
- Any other relevant information.
- A minimal reproducible example (MRE) or minimal working example (MWE).
A very useful R command to collect information on your R session is sessionInfo()
:
It is recommended to include the output of sessionInfo()
when asking for help - it is often expected.
Stack Overflow provides guidelines on how to create an MRE.
Stack Overflow is a massively popular Q&A site for programmers, part of the wider Stack Exchange network. Many R-related web searches will bring up posts in Stack Overflow. You can view all questions tagged with “r”.