Format R Code Automatically

Provides a function tidy_source() to format R source code. Spaces and indent will be added to the code automatically, and comments will be preserved under certain conditions, so that R code will be more human-readable and tidy. There is also a Shiny app as a user interface in this package (see tidy_app()).


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("formatR")

1.14 by Yihui Xie, 4 years ago


https://github.com/yihui/formatR


Report a bug at https://github.com/yihui/formatR/issues


Browse source code at https://github.com/cran/formatR


Authors: Yihui Xie [aut, cre] , Ed Lee [ctb] , Eugene Ha [ctb] , Kohske Takahashi [ctb] , Pavel Krivitsky [ctb]


Documentation:   PDF Manual  


GPL license


Suggests rstudioapi, shiny, testit, rmarkdown, knitr


Imported by HKRbook, RFormatter, RaSEn, Rd2roxygen, ScriptMapR, automagic, cohortBuilder, datacleanr, dbGaPCheckup, explor, funspotr, ggThemeAssist, glmtrans, hipecR, jaggR, lambda.r, mapsf.gui, matrans, multiverse, npcs, rscc, shidashi, shinyChakraUI, snahelper.

Suggested by ASMap, BeeBDC, BrazilCrime, Characterization, ClassifyITS, DirichletReg, GINAX, GlarmaVarSel, MBNMAdose, MarkowitzR, MultiGlarmaVarSel, NBtsVarSel, NMdata, ProjectTemplate, RDHonest, SIS, ShiftShareSE, SignacX, SoupX, SticsRFiles, VedicDateTime, asteRisk, ausplotsR, baRulho, circularEV, clustord, conText, condTruncMVN, coveffectsplot, cytometree, derivmkts, dfadjust, discourseGT, elevatr, gen3sis, ggordiplots, googleAnalyticsR, googleAuthR, hdf5r, hdm, iemisctext, kitagawa, knitr, lifecontingencies, loon, lsasim, madness, manifestoR, matrixNormal, mfp2, mosaic, multe, nph, nuts, pez, plinkQC, psd, pubchem.bio, pvar, quanteda, rEDM, raretrans, ref.ICAR, rhierbaps, riskCommunicator, s20x, sadists, scriptexec, shinyMonacoEditor, simitation, simstudy, sketchy, slgf, summarytools, teal.reporter, tidySEM, tikzDevice, upsetjs.


See at CRAN