#' --- #' title: "Getting help in R" #' date: "2021-11-24" #' author: "Jose" #' output: #' html_document: #' code_folding: show #' toc: yes #' toc_float: #' smooth_scroll: true #' df_print: paged #' highlight: zenburn #' --- #' remove objects #' objects() rm(list = ls()) #' Libraries #' ## Common ways of getting help when working with R #' #' Within R use the "?" question symbol before any command and run #' ?dput #' Use "help", "help.search" or "apropos" when need search for some terms #' #' Ask about control-flow constructs in R help("if") #' Information about extract or replace function help("[[") #' Help on "Quotes" help(Quotes) help.search("download file") #' Find the formal arguments in a function formalArgs(help) formalArgs(table) #' "find" can be used to know which package contains a function find("table") find("count")#' this will return nothing, because the package should be loaded library(dplyr) #' "apropos" give the name of objects containing the characters passed to the function count_testing <- c(1,2) apropos("count") #' ## Examples and demostration of functions #' example(glm) library(lubridate) example(ymd) example(Compare) library(dplyr) example(case_when) demo(graphics) #' Use "help.start" to view all R documentation help.start() #' ## Searching in packages #' #' Obtain help in packages library(help = data.table) #' Finding objects within a package library(data.table) objects(grep("data.table", search())) #' List vignettes in a package vignette(package = "data.table") browseVignettes("data.table") vignette("datatable-faq") #' Edit dataframe using R data editor #' carros <- cars fix(carros) carros #' Unload a package from the environment #' #' detach("package:data.table", unload = TRUE) #' End