checkNamespace: Check Namespace and Rd files

View source: R/system_and_package.R

Check Namespace and Rd filesR Documentation

Check Namespace and Rd files

Description

Check Namespace/Rd and examples files.

Usage

checkNamespace(path.namespace,path.rfolder)
checkAliases(path.man,path.rfolder)
checkTF(path.man)
checkExamples(path.man,package,each = 1,print.errors = stderr(),
	print.names = FALSE)
checkUsage(path.man,path.rfolder)

Arguments

path.namespace

An full path to the "NAMESPACE" file.

package

A character vector with the name of the package.

path.rfolder

An full path to the directory that contains the "R" files.

path.man

An full path to the directory that contains the "Rd" files.

each

An integer value for running each example.

print.errors

Print the errors to a file. By default it's "stderr()".

print.names

A boolean value (TRUE/FALSE) for printing the names of the files before running the examples.

Details

checkNamespace: reads from the NAMESPACE folder all the export R functions, reads from folder R all the R functions and check if all the functions are export.

checkAliases: reads from the man directory all the Rd files, then reads from each file the aliases and check if:

  • All the R files has man file or an alias.

  • All aliases belongs to functions.

  • If there are dublicated aliases.

checkExamples: reads from the man directory all the Rd files, then read from each file the examples and then run each of them. If you want to print the errors in any file then set "print.errors=file_name" or in the standard error "print.errors=stderr()" and then you will see all the errors for every file. Set to argument "package" the name of your package. The argument "print.names" it is very helpful because if any of you function crashes R during running you will never know which one was. So setting it "TRUE", it will print the name of each file before running it's example.It might crash, but you will know which file. Remember that there is always an error timeout so it might didn't crash the current file but one from the previous.

checkTF: reads from the man directory all the Rd files, then read from each file the examples and checks if any examples has the values "T" and "F" instead "TRUE" and "FALSE". The "T","F" is wrong.

checkUsage: reads from the man directory all the Rd files and for each man check if the usage section has the right signature for the functions from the R directory.

checkTF, checkUsage, checkAliases: you can choose which files not to read for both R and Rd. You must add in the first line of the file in comment the "attribute" "[dont read]". Then each function will know which file to read or not. For Rd you add "%[dont read]" and for R "#[dont read]". Finally, these functions will return in the result a list of which files had this attribute.

Value

checkNamespace: a vector with the names of missing R files. (Don't use it for now)

checkAliases: a list with 4 fields.

  • Missing Man files: A vector with the names of the missing Rd files or nothing.

  • Missing R files: A vector with the names of the missing R files or nothing.

  • Duplicate alias: A vector with the names of the dublicate aliases or nothing.

  • dont read: A list with 2 fields

    • R: A character vector whith the names of the files that had attribute "#[dont read]" or nothing.

    • Rd: A character vector whith the names of the files that had attribute "%[dont read]" or nothing.

checkExamples: a list with 3 fields

  • Errors: A character vector with the names of the Rd files that produced an error.

  • Big Examples: A character vector with the names of the Rd files that has big examples per line.

  • dont read: A list with 2 fields

    • R: A character vector whith the names of the files that had attribute "#[dont read]" or nothing.

    • Rd: A character vector whith the names of the files that had attribute "%[dont read]" or nothing.

checkTF: a list with 3 fields

  • TRUE: A character vector with the names of the Rd files that has "T" or nothing.

  • FALSE: A character vector with the names of the Rd files that has "F" or nothing.

  • dont read: A list with 2 fields

    • R: A character vector whith the names of the files that had attribute "#[dont read]" or nothing.

    • Rd: A character vector whith the names of the files that had attribute "%[dont read]" or nothing.

checkUsage: a list with 3 fields

  • missing functions: A character vector with the name of the file that is missing and the Rd file that is found or nothing.

  • missmatch functions: A character vector with the name of the file that has missmatch function and the Rd file that is found or nothing.

  • dont read: A list with 2 fields

    • R: A character vector whith the names of the files that had attribute "#[dont read]" or nothing.

    • Rd: A character vector whith the names of the files that had attribute "%[dont read]" or nothing.

  • hidden functions: A character vector with the name of the functions thath have been declared as hidden.

  • usage lines wider than 90 characters: A list with the Rd's that have usages that are wider than 90 characters.

Author(s)

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

See Also

read.directory, AddToNamespace, sourceR, sourceRd, read.examples

Examples


	#for example: path.namespace="C:\some_file\NAMESPACE"
	#for example: path.rfolder="C:\some_file\R\"
	#for example: path.man="C:\some_file\man\"
	#system.time( a<-checkNamespace(path.namespace,path.rfolder) )
	#system.time( b<-checkAliases(path.man,path.rfolder) )
	#system.time( b<-checkExamples(path.man) )
	#system.time( b<-checkExamples(path.man,2) )
	#system.time( b<-checkTF(path.man) )
	#system.time( b<-checkTF(path.man,path.rfolder) )


Rfast documentation built on Nov. 9, 2023, 5:06 p.m.