Skip to content

Commit

Permalink
test no extra packages
Browse files Browse the repository at this point in the history
  • Loading branch information
oduerr committed May 18, 2024
1 parent bec4f02 commit 2f10095
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 22 deletions.
47 changes: 41 additions & 6 deletions R/edudat/R/edudat.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ load_data <- function(name, verbose = FALSE, show_code = FALSE) {

#' Load the Quarto documentation file from repository and cache it locally
#'
#' @param name Name of the Quarto file (e.g., "challenger.qmd")
#' @param name Name of the Quarto file (e.g., "challenger.qmd" or "test.csv.gz")
#' @param verbose Logical indicating whether to print messages
#' @return The path to the cached Quarto file
#' @export
Expand Down Expand Up @@ -152,13 +152,48 @@ list_cache_files <- function() {
}

### misc functions ####
#' Shows the URL of the package on GitHub
#'
#' @export
show_url <- function() {
message("")
show_mini_help <- function() {
# Define the URL and the display text
html_content <- "
<html>
<body>
<h2>edudat package</h2>
<b>Loading the data:</b>
<pre>
<code>
df <- edudat::load_data('challenger.csv')
plot_data(df)
</code>
</pre>
<b>Info:</b>
<pre>
<code>
edudat::list_cache_files()
</code>
</pre>
For more see:
<a href='https://github.com/tensorchiefs/data/'>github.com/tensorchiefs/data/</a>
</body>
</html>"

# Write the HTML content to a temporary file
temp_file <- tempfile(fileext = ".html")
writeLines(html_content, temp_file)

# Open the HTML file in the Viewer pane
rstudioapi::viewer(temp_file)
}

# Example usage of the show_mini_help function
show_mini_help()






Expand Down
12 changes: 11 additions & 1 deletion data/test.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ https://homafiles.info/2016/06/06/the-challenger-disaster-a-tragic-lesson-in-dat

## Plotting in R

```{r plot_data, echo=TRUE, eval=TRUE}
```{r plot_data_old, echo=TRUE, eval=TRUE}
data <- read.csv("https://raw.githubusercontent.com/tensorchiefs/data/main/data/challenger.csv", stringsAsFactors = FALSE)
library(ggplot2)
ggplot(data, aes(x = Temp, y = Failure)) +
geom_point() +
xlab("Temperature (F)") +
ggtitle("Challenger O-Ring Data")
```


```{r plot_data, echo=TRUE, eval=FALSE}
data <- read.csv("https://raw.githubusercontent.com/tensorchiefs/data/main/data/challenger.csv", stringsAsFactors = FALSE)
library(ggplot2)
ggplot(data, aes(x = Temp, y = Failure)) +
Expand Down
22 changes: 7 additions & 15 deletions python/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ on:
jobs:
render:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.MY_GITHUB_PAT }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -22,22 +23,13 @@ jobs:
- name: Install R
uses: r-lib/actions/setup-r@v2

- name: Install R packages
run: |
Rscript -e 'install.packages(c("ggplot2", "knitr", "rmarkdown", "remotes"))'
# Rscript -e 'remotes::install_github("tensorchiefs/data", subdir = "R/edudat", dependencies = TRUE, upgrade = "always", verbose = TRUE)'
#- name: Install R packages
# run: |
# Rscript -e 'install.packages(c("ggplot2"))'
#Rscript -e 'remotes::install_github("tensorchiefs/data", subdir = "R/edudat", auth_token = Sys.getenv("GITHUB_PAT"), dependencies = TRUE, upgrade = "always", verbose = TRUE)'

- name: Install Python packages
run: |
pip install pandas matplotlib
- name: Render all Quarto documents
env:
GITHUB_PAT: ${{ secrets.MY_GITHUB_PAT }}
- name: Render test.qmd document
run: |
#for qmd in data/*.1qmd; do
# quarto render "$qmd" --to html
#done
quarto render data/test.qmd --to html
- name: Deploy to GitHub Pages
Expand Down

0 comments on commit 2f10095

Please sign in to comment.