############################################################ ### R BASICS WORKSHOP ### ### PRESENTATION 2.2: PACKAGES AND TASK VIEWS ### ## (A BIT ON OPERATORS) ### ### ### ### Center for Conservation and Sustainable Development ### ### Missouri Botanical Garden ### ### Website: rbasicsworkshop.weebly.com ### ### Last modification: 2021-June-04 ### ############################################################ ### A. A BRIEF LOOK AT OPERATORS ########################### # Operators are similar to functions in R because they also # represent actions. However, the syntax is a bit different: # operators are used BETWEEN values # The most common operators are arithmetic # These two commands are equivalent: sum(19, 5) # Using the function *sum* 19 + 5 # Using the operator *+* # Other common arithmetic operators: 19-5 19*5 19/5 19^5 # A commonly used operator is *:*, which generates regular # sequences: help(":") 1:10 25:4 pi:6 ### B. R PACKAGES ########################################## # PACKAGES are bundles of functions (and optionally # datasets) that can be used as extensions to the defaults # available in R # Most packages are available at: # http://cran.r-project.org/web/packages/ # For a package to be used, first it needs to be installed # using *install.pacakges* install.packages("vegan") # Then, every time it needs to be used, the package needs # to be loaded with *library* library("vegan") help("vegan") # Packages can be updated with *update.packages* update.packages("vegan") ### C. R PACKAGES AND TASK VIEWS ########################### # TASK VIEWS are collections of packages needed for # specific types of analyses (e.g. genetic or spatial # analyses) # Task views can be seen at: # http://cran.r-project.org/web/views/ # All the packages in a task view can be installed with # *install.views*. # *install.views* is in the package *ctv* which needs to be # installed and loaded install.packages("ctv") library("ctv") # install.views("Econometrics") # Installing task views can # take a long time