In all of the steps below replace PROJECTNAME with your actual project name (please don’t actually use all caps).
This step should be done by ONE PERSON per group.
Then:
This step should be done by EVERYONE in your group.
You should see the same set of files listed on your “Files” tab that you had in your GitHub repository.
This step should be done by EVERYONE in your group.
In RStudio from the menu bar select “Tools” -> “Shell…”
In the shell enter these two commands (with your actual email and name; duh.)
From the files pane, open up your “.gitignore” file and add the following line:
*.Rproj*
The will prevent you or your groupmates from including RStudio configuration files in the code that you push to GitHub.
This step should be done by EVERYONE in your group.
Let’s test to make sure everything is working so far.
Hopefully that all worked and nothing caught fire.
All of the “Bash” commands shown in these tutorials can be entered using the Shell in RStudio (Tools menu).
Let’s make some example changes to your app files. Assign each person in your group to do one of the following:
actionButton
after the sliderInput
in ui.Rmax
number of bins to 100 for the sliderInput
in ui.R#
somewhere in ui.RWhen you hit “Commit” and then select “ui.R” you’ll each see the change you made highlighted.
Pick one person in your group to go first. Hit the “Push” button in the Commit window or on the “Git” pane.
Pick the second person in your group to go; Hit “Push”.
You’ll see a message like:
To https://github.com/WL-Biol185-ShinyProjects/sample-project.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/WL-Biol185-ShinyProjects/sample-project.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Following the message’s advice, you should click “Pull” to download person #1’s files.
Depending on how you each edited your files one of two things might happen:
Automerge succeeds without any help from you; this works when Git’s merging algorithm can be pretty sure it knows how to merge the files without loosing anything.
You see a message like this:
From https://github.com/WL-Biol185-ShinyProjects/sample-project
bcba6e0..d1b8b44 master -> origin/master
Auto-merging ui.R
CONFLICT (content): Merge conflict in ui.R
Automatic merge failed; fix conflicts and then commit the result.
<<<<<<< HEAD
max = 100,
value = 30), sliderInput("blarg"),
=======
max = 300,
value = 30)
>>>>>>> d1b8b44153b3817104302a5d04458f25e61260bd
Do you believe me now that it will be important for everyone in your group to write well formatted, easy to read, code?
When you’re ready to publish a live version of your app in a publically available location, you can run:
That will fetch the current version of your code from GitHub and update the app linked from our course project’s page:
# Load the packages we'll need
# Define UI for an application that draws a histogram
# Application title
# Sidebar with a slider input for number of bins
# Show a plot of the generated distribution
No need to write any implementation code; just start by sketching out your goals.
Consider this refactoring of our ui.R
script:
library(shiny)
# Define UI for application that draws a histogram
fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 300,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)
Here we’ll split out the code that makes the major UI elements (sidebar and main panel) into their own script files:
sidebar.R
:
library(shiny)
sidebar <- sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 300,
value = 30)
)
main-panel.R
:
ui.R
:
It must run by 5pm on Friday of Finals week (as published on the RNA Shiny server).
It’d be nice to include a link to the projects hosting page on RNA in your README.md: