how to know which function is associated with which package in rstats
Typically speaking we don't specify the package before a function because it's not needed and it's less writing. That does not mean that it's not possible however. You can use the notation package_name::function_name()
to load functions from packages without even the need to library()
them. This is mostly used when loaded packages have overlapping function names.
To get a list of all functions used in a certain code the package NCmisc
has a very handy function:
NCmisc::list.functions.in.file("app.R")
$.GlobalEnv
[1] "dt.data"
$`c("package:lubridate", "package:data.table")`
[1] "isoweek" "month" "year"
$`character(0)`
[1] "." "dt.Cycle" "dt.filter" "dt.KPI" "dt.monthly" "dt.MQQ" "dt.overunder" "dt.shops" "dt.sorterrfid" "dt.WO" "dt.YTD"
$`package:base`
[1] "as.Date" "c" "library" "list" "max" "order" "paste" "paste0" "readRDS" "round" "sum" "Sys.Date"
$`package:billboarder`
[1] "bb_legend" "bb_linechart" "bb_x_axis" "bb_y_axis" "bb_y_grid" "bbaes" "billboarder" "billboarderOutput" "renderBillboarder"
$`package:data.table`
[1] "melt.data.table" "setcolorder"
$`package:shiny`
[1] "br" "checkboxGroupInput" "conditionalPanel" "dataTableOutput" "div" "downloadButton" "downloadHandler" "numericInput" "radioButtons"
[10] "reactive" "renderDataTable" "selectInput" "shinyApp" "tabPanel" "tabsetPanel"
$`package:shinydashboard`
[1] "dashboardBody" "dashboardHeader" "dashboardPage" "dashboardSidebar"
$`package:utils`
[1] "write.csv"
When using this function just make sure that you have the packages loaded. It can only check the function names in packages that are in your loaded library.