Search code examples
rshinypathshinydashboardgolem

How read external data from different server with golem shiny app?


I am trying to add the txt file that contains let's say 50 proj, with paths outside of the package. I am attempting to use these files to get a shinyapp using golem framework.

My problem is, as much as I read on golem shiny apps, I do not understand where to add these txt files so that I can then use them for my shiny applications. NOTE: I want to work with golem framework and therefore the answer should be aligned to these request.

This is a txt file.

nameproj    technology  pathwork    LinkPublic  Access

Inside I have 50 projects with paths and links that will be used to retrieve the data for the app.

L3_baseline pooled  /projects/gb/gb_screening/analyses_gb/L3_baseline/ kkwf800, kkwf900, etc.. 

Then I create paths to the data like this:

 path_to_data1 = "data/data1.txt"
 path_to_data2 = "data/data2.txt"

Then, I create helper functions. These helper functions will be used in app_server and app_ui modules. Something like the bellow.

make_path<-function(pathwork,type,ex, subfolder=""){
  path<-paste0(pathwork,"/proj", type,"/",ex,"/",subfolder,"/")
  return(path)
}



getfiles = function(screennames, types, pathwork){
 files = data.frame()
  for (ind in 1:length(screennames)){
    hitfile = file.path(make_path(path_worj, types[ind], names[ind], "analysis"),"File.tsv")
    if(file.exists(file)){files=rbind(files, data.frame(filename=file, screen=paste0(names[ind],"-",types[ind])))}
  }
  return(files)
}

Can someone direct me to:

  1. how to actually add the txt files containing paths to external data and projects within golem framework
  2. a clear example where these files are added within the golem

NOTES: My datasets are all within private servers within my company. Thus, all these paths are directing me to these servers. And I have no issues with accessing these datasets.


Solution

  • I have solve the issue by simply adding a source file, with the paths above only and run the app. It seems it is working.