Skip to contents

This function returns a character vector listing all the functions available in the specified R package. It first checks if the package is installed and can be loaded; if not, it raises an error.

Usage

package_functions(package)

Arguments

package

Character. Package name.

Value

A character vector containing the names of all functions in the specified package.

Author

Ahmed El-Gabbas

Examples

str(package_functions(package = "raster"))
#>  chr [1:281] "%in%" "Arith" "Compare" "Geary" "GearyLocal" "KML" "Logic" ...

str(package_functions(package = "sf"))
#>  chr [1:156] "%>%" "FULL_bbox_" "NA_agr_" "NA_bbox_" "NA_crs_" ...

package_functions(package = "ecokit")
#>  [1] "%>%"                        "add_cross_to_grid"         
#>  [3] "add_diagonals_to_grid"      "add_image_to_plot"         
#>  [5] "add_line"                   "add_missing_columns"       
#>  [7] "all_objects_sizes"          "arrange_alphanum"          
#>  [9] "assign_env_vars"            "assign_if_not_exist"       
#> [11] "bash_variables"             "boundary_to_wkt"           
#> [13] "cat_diff"                   "cat_names"                 
#> [15] "cat_sep"                    "cat_time"                  
#> [17] "cc"                         "check_args"                
#> [19] "check_data"                 "check_env_file"            
#> [21] "check_feather"              "check_gbif"                
#> [23] "check_image"                "check_qs"                  
#> [25] "check_quarto"               "check_rdata"               
#> [27] "check_rds"                  "check_rstudio"             
#> [29] "check_stack_in_memory"      "check_system_command"      
#> [31] "check_tiff"                 "check_url"                 
#> [33] "check_zip"                  "chelsa_var_info"           
#> [35] "clear_console"              "clip_raster_by_polygon"    
#> [37] "detect_alias"               "dir_size"                  
#> [39] "file_extension"             "file_size"                 
#> [41] "file_type"                  "function_arguments"        
#> [43] "get_chelsa_links"           "get_mode"                  
#> [45] "git_log"                    "ht"                        
#> [47] "info_chunk"                 "integer_breaks"            
#> [49] "keep_only"                  "lapply_"                   
#> [51] "list_to_rdata"              "load_as"                   
#> [53] "load_multiple"              "load_packages"             
#> [55] "load_packages_future"       "loaded_packages"           
#> [57] "maxent_open"                "maxent_variable_importance"
#> [59] "n_decimals"                 "n_unique"                  
#> [61] "nc_global_attributes"       "normalize_path"            
#> [63] "os"                         "package_functions"         
#> [65] "package_remote_sha"         "pak_from_renv"             
#> [67] "parent_dir"                 "polygon_centroid"          
#> [69] "quiet_device"               "quietly"                   
#> [71] "range_to_new_value"         "raster_to_pres_abs"        
#> [73] "record_arguments"           "reload_package"            
#> [75] "rename_geometry"            "replace_space"             
#> [77] "sapply_"                    "save_as"                   
#> [79] "save_multiple"              "save_session"              
#> [81] "save_session_info"          "scale_0_1"                 
#> [83] "scrape_link"                "script_location"           
#> [85] "set_geometry"               "set_parallel"              
#> [87] "set_raster_crs"             "sf_add_coords"             
#> [89] "source_silent"              "split_df_to_chunks"        
#> [91] "split_raster"               "split_vector"              
#> [93] "stop_ctx"                   "system_command"            
#> [95] "text_to_coordinates"        "tibble_column_size"        
#> [97] "used_packages"             

if (FALSE) { # \dontrun{
  # Error: package not found
  package_functions(package = "non_exist")
} # }