phdjsep
September 20, 2018, 7:39pm
1
Hello,
I'm following these directions for creating a Project Template in RStudio Server and everything seems to be working except the directories and files are being created one folder up from the project. I can't see the reason why. Any help would be sincerely appreciated!
starter <- function(path, ...) {
# ensure path exists
dir.create(path, recursive = TRUE, showWarnings = FALSE)
# Create directories
dir.create(“data”)
dir.create(“data/raw”)
dir.create(“data/interim”)
dir.create(“data/processed”)
dir.create(“data/external”)
dir.create(“docs”)
dir.create(“models”)
dir.create(“reports”)
dir.create(“graphs”)
dir.create(“utilities”)
dir.create(“src”)
dir.create(“src/data”)
dir.create(“src/analysis”)
# Create files
file.create(“README.md”)
fileConn <- file(“README.md”)
writeLines(c(“#Project Title”,“##Description”, “##Confluence Link”), fileConn)
close(fileConn)
}
phdjsep
September 20, 2018, 10:31pm
2
Solved!
starter <- function(path, ...) {
# ensure path exists
dir.create(path, recursive = TRUE, showWarnings = FALSE)
# Create directories
dir.create(file.path(path, "data"))
dir.create(file.path(path, "data/raw"))
dir.create(file.path(path, "data/interim"))
dir.create(file.path(path, "data/processed"))
dir.create(file.path(path, "data/external"))
dir.create(file.path(path, "docs"))
dir.create(file.path(path, "models"))
dir.create(file.path(path, "reports"))
dir.create(file.path(path, "graphs"))
dir.create(file.path(path, "utilities"))
dir.create(file.path(path, "src"))
dir.create(file.path(path, "src/data"))
dir.create(file.path(path, "src/analysis"))
# Create files
file.create(file.path(path, "README.md"))
}
jcblum
September 21, 2018, 3:41am
3
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:
If your question has been answered, don't forget to mark the solution!
How do I mark a solution?
Find the reply you want to mark as the solution and look for the row of small gray icons at the bottom of that reply. Click the one that looks like a box with a checkmark in it:
[image]
Hovering over the mark solution button shows the label, "Select if this reply solves the problem". If you don't see the mark solution button, try clicking the three dots button ( ••• ) to expand the full set of options.
When a solution is chosen, the icon turns green and the hover label changes to: "Unselect if this reply no longer solves the problem". Success!
[solution_reply_author]
…
1 Like