Log into Bitbucket, create a repository
- Go to https://bitbucket.org and log in.
- Create a new repository with the “Create” button on the top menu.
- Give it a name exactly like “cinf401-assignment-1” or “cinf401-group-project-1”, changing the “1” to the correct number. You must name your repository exactly as described so I can automatically clone and grade your work.
- Ensure the “private repository” checkbox is checked, and that the repository type is “git”.
Add me (joshuaeckroth) as a “reader” of this private repository. To do so, click the gear icon on the left.
Then click “Access Management”.
Then add me (joshuaeckroth) as a reader.
Click the top left bucket icon to get back to the main view.
Expand the “I’m starting from scratch” option and copy the repository URL. It looks like
Log into RStudio
- Connect to delenn with SSH. You should have already forwarded localhost port 8080 to delenn’s localhost port 8080 from the initial setup notes.
- Open your browser to http://localhost:8080.
Create a new git project
Select menu item File > New Project… and choose Version Control.
Next, select git.
Paste your Bitbucket repository URL (from above, it is something like
firstname.lastname@example.org:joshuaeckroth/cinf401-assignment-1.git). Give your project a name exactly like “cinf401-assignment-1” or “cinf401-group-project-1”. If desired, place your project in a certain subdirectory of your home directory on delenn.
Assuming it was successful, you should see several mentions of your project name and directory (see ovals in graphic).
Create a new R Markdown file
You’ll write your prose and final code in Markdown format (or LaTeX if you prefer; adjust these steps accordingly). To do so, select menu item File > New File > R Markdown…
Name this file exactly “cinf401-assignment-1” or “cinf401-group-project-1” (change the “1” as appropriate). Ensure your full name is provided in the “Author” textbox. Select HTML for the output format (this can be changed later; HTML is easiest to preview).
After clicking “Ok”, you should see a new left-pane open with default R Markdown text. You will delete most of this text (starting after the second
---) and begin your work.
Save your new R Markdown file
I suggest you immediately save this R Markdown file. Choose a file name exactly like “cinf401-assignment-1” or “cinf401-group-project-1”.
After clicking “Save”, you should see the filename mentioned in various locations.
Make your initial git commit and push
I also suggest you immediately commit and push your new files. Your git repository is currently still empty. To add, commit, and push the files you created, follow these steps.
- Click the “Git” tab on the top right pane.
- Select the checkboxes next to each of the files in the project. (You won’t always want to add every file in your project. But in this case we do.) Notice the green “A” (“Added”) in the Status column of these files.
- Click “Commit”.
A new window will pop up. (If it doesn’t, check your browser pop-up blocking settings.) Type a commit message in this window and click “Commit”.
A text box will (hopefully) indicate success. Close this commit window.
Now, in the top-right pane, you should see that the added files are missing. This is because the git repository has up to date records of these files, so they are considered “unchanged” and thus won’t appear here.
Click the green up arrow to “push” your local commits to Bitbucket.
You should see a message indicating success.
If desired, you can navigate to Bitbucket and view the files/commits you just pushed. Refresh your Bitbucket repository page, then click one of the two buttons indicated in the graphic below. The top button shows the files in the “HEAD” branch of the repository, and the bottom button shows the history of commits.
Here is what you see if you click the top button.
Here is what you see if you click the bottom button.
Make some changes, commit and push
After working on your files and clicking the save button, you’ll notice that the top-right pane, in the “Git” tab, shows the changed files.
If so inclined, select a file and choose the “Diff” action.
This view shows how the current state of the (saved) file differs from the prior commit.
From this view, you can add the file to be commited, type a commit message, and perform the commit.
You should see that the file was committed.
Now the Git tab shows no changed files, and also indicates that you have one commit that has not been pushed to Bitbucket (“origin”).
Render your R Markdown file
Finally, to preview your report, typed into an R Markdown file, just click the “Knit HTML” button. You can render to PDF or Microsoft Word, instead, by clicking the button’s down-arrow.
Here is the HTML output. Note that the HTML file contains the image data inside the file, so this single HTML file can be sent to others and they will see all your graphics.
Here is the PDF output.
Here is the Microsoft Word output.
Note that “knitting” creates files in your project directory, so you can add them to your git repository. This is not necessary for turning in your assignment/group projects, however, since I will “knit” the source file myself.
Ask for help
RStudio has some nice help facilities. For R Markdown help, click the “?” button (next to the “Knit HTML” button).
Choosing “Markdown Quick Reference” will activate the bottom-right pane and switch to the “Help” tab.
This Help tab is useful for a wide variety of R docs. Click the home button to start from the top, or use the search box to look up particular functions, e.g., the