mql4beginner
mql4beginner

Reputation: 2233

how can I add package name that function is associated with to a source code what package

I have a complicated source code that makes use of several packages.Is there a way to get a list of the function and the package it associated with? for example in my code:

uploaded.data.Factors.Included <- reactive({
      inFile <- input$datafile
      if (is.null(inFile)) {return(NULL)}
      SPY <- read.csv(inFile$datapath, header = input$header, sep = input$sep, quote = "")

How can I get somthing like :

uploaded.data.Factors.Included <- shiny::reactive({
          inFile <- input$datafile
          if (is.null(inFile)) {return(NULL)}
          SPY <- base:: read.csv(inFile$datapath, header = input$header, sep = input$sep, quote = "")

Or as a list:

Shiny reactive
Base read.csv

Upvotes: 0

Views: 80

Answers (2)

Roel Hogervorst
Roel Hogervorst

Reputation: 317

It seems that your question is different than I thought.

You have a script (not a package) that calls different functions from several packages. So: library(dplyr) library(tidyr) select(df, var1, var2, var5) # part of dplyr gather(data, key, value) # part of tidyr

And you would like to know to which package the functions belong? But not only that , but a list of all the functions in use in the script, with their package. I don't know a automated way to do that.

An idea (without code):

  1. recognize all the function calls within the script
  2. recognize the library calls (or require, if you must)
  3. download all namespaces from these libraries
  4. match 1 to 3

Upvotes: 0

Roel Hogervorst
Roel Hogervorst

Reputation: 317

I guess you could check the namespace of the package? I mean literally check the file NAMESPACE. It will contain all the exported functions of that package.

Upvotes: 1

Related Questions