Thursday 30 August 2018

I want to try to push my development version to Bioconductor...

https://bioconductor.org/developers/how-to/git/push-to-github-bioc/

Tried but failed.
This is the message:

v3431-0a7785bc:drawProteins paulbrennan$ git push upstream devel
Counting objects: 68, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (65/65), done.
Writing objects: 100% (68/68), 14.42 KiB | 2.88 MiB/s, done.
Total 68 (delta 39), reused 0 (delta 0)
remote: FATAL: W refs/heads/devel packages/drawProteins brennanpincardiff DENIED by fallthru
remote: error: hook declined to update refs/heads/devel
To git.bioconductor.org:packages/drawProteins.git
 ! [remote rejected] devel -> devel (hook declined)
error: failed to push some refs to 'git@git.bioconductor.org:packages/drawProteins.git'
v3431-0a7785bc:drawProteins paulbrennan$ 



I wonder why?
Does bumping version number make a difference?

No hook declined.


Very helpful answer back from Lori:

Bioconductor assumes the master branch of a github repository is the devel branch.  There is no devel branch on the git.bioconductor server so you will have to push the changes to upstream master.  This is slightly confusing but stated on the git help pages


http://bioconductor.org/developers/how-to/git/


http://bioconductor.org/developers/how-to/git/push-to-github-bioc/


Merging master into devel branches....

So I found that I had made changes to devel but I was using an old branch of devel that was different from the master.

This was not ideal so I tried to "Update from Master" using Github Desktop.
This created conflicts in DESCRIPTION, NEWS and README.Rmd.

To resolve the conflicts, I opened the files in R-Studio and edited them in the way I thought was necessary using advice from here:
https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/

Then I used git add, i.e. git add DESCRIPTION after the file was updated to resolve the conflict and the conflict markers.

Finally I typed: 
git commit -m "Updating devel from master and resolving conflicts"

to resolve the whole thing. 
This allowed me to update devel all from master and only has the changes in the devel since I started working on it this month (August)

All in all a successful use of Git, I think. 

Friday 24 August 2018

Some links and learning from CaRdiff User Group

Breaking down functions
https://kbroman.org/steps2rr/pages/functions.html

How to Datapasta
https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html

Adding column if it does not exist
https://stackoverflow.com/questions/45857787/adding-column-if-it-does-not-exist
https://stackoverflow.com/a/45858044/3793923

What they forgot to teach you about R
https://blog.rstudio.com/2018/08/07/what-they-forgot-to-teach-you-about-r/
- project-oriented workflows, version control for data science (Git/GitHub!), and how to plan for collaboration, communication, and iteration (incl. RMarkdown)

Code > Insert roxygen skeleton
http://stat545.com/packages05_foofactors-package-02.html


Wednesday 22 August 2018

Steps to turn a function into a package...

1. Downloaded Sefa Github repo.
2. Opened R Studio and made package - called tweetParsR

Here is a screen shot of the file structure:

3. Let's look at the function first.

Remove the library(tidyverse) at top.
Add some documentation using Roxygen tags

Here is some recommended stuff..
### parse_function
#' Turn JSON file of tweets into a CSV file
#'
#' \code{parse_function} uses the dataframe containing the protein features to
#' creates the basic plot element by determining the length of the longest
#' protein.
#'
#' @param x describe the input
#'
#' @return describe the output.
#'
#' @examples
#'
#' @import dlpyr, stringr
#'
#' @export


4. Add some double colon stuff
e.g. dplyr::filter

5. Need to design some tests...

6. DESCRIPTION edited to add some imports...


Sources:
http://tinyheero.github.io/jekyll/update/2015/07/26/making-your-first-R-package.html
https://itsalocke.com/blog/the-making-of-datasaurus/
http://r-pkgs.had.co.nz/
https://ropensci.github.io/dev_guide/building.html#building

http://happygitwithr.com/rstudio-git-github.html
https://github.com/lockedata/pRojects/blob/master/R/createPackageProject.R


Friday 17 August 2018

Some more R resources...

Gapminder links:
http://staff.math.su.se/hoehle/blog/2018/07/02/factfulness.html
and raw content:
https://raw.githubusercontent.com/hoehleatsu/hoehleatsu.github.io/master/_source/2018-07-02-factfulness.Rmd
http://rstudio-pubs-static.s3.amazonaws.com/116038_0ebe7e3db5dd4f29ac10e0c994373f99.html
http://stat545.com/block019_enforce-color-scheme.html#circle-area-population


dplyr
https://dplyr.tidyverse.org/articles/programming.html
https://datacarpentry.org/R-ecology-lesson/03-dplyr.html
http://stat545.com/bit001_dplyr-cheatsheet.html


https://cran.r-project.org/web/packages/tibble/vignettes/tibble.html


http://www.sthda.com/english/wiki/ggplot2-box-plot-quick-start-guide-r-software-and-data-visualization


http://r4ds.had.co.nz/