Description Usage Arguments Details Value Functions Examples
To use both of this functions, it is required to have git installed. Because of git2r library limitations, those functions won't work if either user.name or user.email are empty in git config file. Uses .rds format to save objects. Hugo_get_object is intended to use only with hugo_share_object - it is not general function to download object from github, and don't try to use it as one.
1 2 3 | hugo_share_object(object)
hugo_get_object(user, repo_name, object_name)
|
object |
R object which you wish to share. |
user |
Github user name, to construct proper url to repository. |
repo_name |
Name of github repository, also used to construct url. |
object_name |
Name of the object you want to download. |
While using hugo_share_object user is prompted and asked to insert additional parameters - github user name, password for given user, and repository name, to wich you want to add your object. Because whole repository is downloaded, it is possible to create new directories. When prompted for repository name please insert it similarly to: 'example_repo_for_hugo/subfold1/subfolder2'. Your input is parsed, so that part before first '/' is treated as repository name, and rest is considered exact path you wish to use. Please, don‘t insert ’/' as the last character!. This are proper calls:
example_repo_for_hugo
example_repo_for_hugo/subfolder1
example_repo_for_hugo/subfolder1/subfolder2
While these are not:
repository_name/
repository_name/directory1/
repository_name/directory2/
If hugo remebers previus answer, user will be prompted and asked if he wishes to use current credentials or insert new ones.
Please check Functions section.
hugo_share_object
: Shares given object via github, prompts user for input.
Returns: in case of success prompts user with message, and returns string, which is direct call to hugo_get_object. In case of failure, prompts user with appropriate message and returns NULL.
hugo_get_object
: Downloads given object from github.
Returns: in case of success prompts user with message, and returns object.
It us up to user how to handle it - wheter to assign it to variable,
or use as parameter. In case of failure, prompts user with appropriate
message and returns NULL.
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
hugo_share_object(iris)
hugo_get_object(matrix(runif(200), ncol = 10))
object_1 <- hugo_get_object('tidyverse','readr','revdep/checks.rds')
object_2 <- hugo_get_object('hadley','r-python','github.rds')
object_3 <- hugo_get_object('user','repository','file.rds')
object_4 <- hugo_get_object('user','repository','subfolder1/file.rds')
object_5 <- hugo_get_object('user','repository','subfolder1/subfolder2/file.rds')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.