(This article was first published on rforcancer, and kindly contributed to R-bloggers)
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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...