-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_publication.qmd
104 lines (64 loc) · 3.46 KB
/
data_publication.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Publishing Your Dataset {#sec-datapublication}
```{r, include=FALSE}
library(washr)
```
## Creating and Editing the README
To start documenting your dataset for publication, you first need to set up a README file.
### Initialize the README
In your R console, within the project directory, run the following command to create a README file:
```{r}
setup_readme()
```
If you want to include an example article for your package, you can use this command instead:
```{r}
setup_readme(has_example = TRUE)
```
### Editing the README
Locate the `README.Rmd` file in your project directory and open it. Edit each section of the README to provide relevant information about your package. Typical sections include:
- **Package Name and Brief Description**
- **Installation Instructions**
- **Basic Usage**
- **Features**
- **Example**
### Creating a Data Visualization
In the "Example" section of your README, it’s helpful to include at least one plot that showcases your data. For instance, using `ggplot2`, you could create a plot like this (adapt it to fit your specific data):
```{r}
library(ggplot2)
library(yourpackagename)
ggplot(your_data, aes(x = variable1, y = variable2)) +
geom_point() +
theme_minimal() +
labs(title = "Example Plot from YourPackageName")
```
### Building the README
Once you’ve completed editing the README, convert it to a Markdown file by running:
```{r}
devtools::build_readme()
```
This will generate a `README.md` file, which GitHub displays on your repository's main page.
### Updating GitHub
After building the README, go to the "Git" tab in RStudio. Stage the newly created or modified README files, commit them with a message such as "Add and update README," and push the changes to GitHub.
## Setting Up the Package Website
To enhance your package's accessibility, you can create a website for it.
### Initializing the Website
Run the following command in your R console:
```{r}
setup_website()
```
When prompted, choose "No" to prevent overwriting the existing `_pkgdown.yml` file. This preserves the styling for your website.
### Document, Check, and Install the Package
Ensure your package is up-to-date by running the following commands:
```{r}
devtools::document()
devtools::check()
devtools::install()
```
These commands generate the latest documentation, check the package for issues, and install it locally.
### Preparing for GitHub Pages
To host the package website on GitHub Pages, you first need to make sure Git tracks the necessary files. Open the `.gitignore` file in your project directory, find the line that says `docs`, and remove it. Save the file to allow the `docs/` folder to be tracked by Git.
### Updating GitHub with Website Files
Go to the "Git" tab in RStudio. You should now see new files in the `docs/` folder and the updated `.gitignore` file. Stage these changes, commit them with a message like "Add pkgdown website files," and push the updates to GitHub.
### Setting Up GitHub Pages
To activate the website, open your GitHub repository in a web browser. Go to "Settings" > "Pages." Under "Source," select the branch where your `docs/` folder resides (usually "main" or "master") and set the folder to `/docs`. Finally, click "Save."
Your package website will now be live at `https://yourusername.github.io/yourrepositoryname/`.
Remember, if you make significant changes to your package or documentation, you may need to rebuild the website by running `pkgdown::build_site()` and pushing the updated `docs/` folder to GitHub.