[This article was first published on rforcancer, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
I have just remembered a package called ‘prettyR’ that pretty much does what it says. It makes R code more readable.. so an example from my forthcoming genomeplot package (see forthcoming blog entry):
## this function integrates 3 steps to creating a genome plot ## 1 query bioMart to get a GFF like data-frame from ensembl ## 2 add new elements to the gff to make it plot with ggplot2 ## 3 plot it with ggplot2 ## the reason to split it like this is so that basic users may use this simple function ## and advanced users can try custom queries or altered plotting themes with the sep functions gnmplot= function(filters='hgnc', values='MAF', species='human') { require(biomaRt); require(ggplot2) gff= getGFF(filters=filters, values=values, species=species) gff_new=alterGFF() gnmplot=gffplot(gffnew) return(gnmplot) }
which I think you will agree.. is quite nice. So in future I’ll be using this for all R-code on the website.
To leave a comment for the author, please follow the link and comment on their blog: rforcancer.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.