linesofcode: Counts lines of source code in .R files of package source -...

View source: R/linesofcode.R

linesofcodeR Documentation

Counts lines of source code in .R files of package source - NOT TESTED

Description

This is just a way to summarize how many lines of code appear to be in the .R files in the folder that a package is built from.

Usage

linesofcode(
  folder = getwd(),
  packages,
  recursive = TRUE,
  sums = FALSE,
  rfolderonly = FALSE,
  cropfilename = 40,
  croppath = 20,
  showrows = NULL
)

Arguments

folder

Default is current working directory. **This is NOT the base path of the package itself! It is the full path of the folder within which is a folder for each package of interest. For example, folder= '~/Documents/R PACKAGES' works but folder= '~/Documents/R PACKAGES/mypkg' does not see the package called mypkg

packages

Default is all found in folder. Can specify a subset of those by name as character vector.

recursive

Default is TRUE, searches subfolders within specified folder.

sums

Default is FALSE, but if TRUE it returns the count of .R files and lines of code for each package found.

rfolderonly

optional

cropfilename

number of characters displayed in console

croppath

number of characters displayed in console

showrows

number of rows displayed in console

Value

Returns a data.frame of results, with details depending on sums parameter. Also prints summary info if sums=FALSE, and returns detailed info.

Examples


 ## Not run: 
 linesofcode(folder= '..', packages=c('analyze.stuff', 'proxistat') )
 x <- linesofcode(folder= '~/Documents/R PACKAGES')
 x[order(x$code), c('filename', 'package', 'code')]
 
## End(Not run)

ejanalysis/analyze.stuff documentation built on April 2, 2024, 10:10 a.m.