utils: The R Utils Package

お役立ちツール

> library(utils)

バージョン: 3.3.1


関数名 概略
BATCH Batch Execution of R
COMPILE Compile Files for Use with R
INSTALL Install Add-on Packages
LINK Create Executable Programs
Question Documentation Shortcuts
REMOVE Remove Add-on Packages
RHOME R Home Directory
RShowDoc Show R Manuals and Other Documentation
RSiteSearch Search for Key Words or Phrases in Documentation
Rprof Enable Profiling of R's Execution
Rprofmem Enable Profiling of R's Memory Use
Rscript Scripting Front-End for R
Rtangle R Driver for Stangle
RweaveLatex R/LaTeX Driver for Sweave
SHLIB Build Shared Object/DLL for Dynamic Loading
Sweave Automatic Generation of Reports
SweaveSyntConv Convert Sweave Syntax
URLencode Encode or Decode a (partial) URL
View Invoke a Data Viewer
adist Approximate String Distances
alarm Alert the User
apropos Find Objects by (Partial) Name
aregexec Approximate String Match Positions
as.roman Roman Numerals
aspell Spell Check Interface
aspell-utils Spell Check Utilities
available.packages List Available Packages at CRAN-like Repositories
bibentry Bibliography Entries
browseEnv Browse Objects in Environment
browseURL Load URL into a WWW Browser
browseVignettes List Vignettes in an HTML Browser
bug.report Send a Bug Report
build Utilities for Building and Checking Add-on Packages
capture.output Send Output to a Character String or File
changedFiles Detect which files have changed
chooseBioCmirror Select a Bioconductor Mirror
chooseCRANmirror Select a CRAN Mirror
citEntry Bibliography Entries (Older Interface)
citation Citing R and R Packages in Publications
cite Cite a bibliography entry.
close.socket Close a Socket
combn Generate All Combinations of n Elements, Taken m at a Time
compareVersion Compare Two Package Version Numbers
contrib.url Find Appropriate Paths in CRAN-like Repositories
count.fields Count the Number of Fields per Line
create.post Ancillary Function for Preparing Emails and Postings
data Data Sets
dataentry Spreadsheet Interface for Entering Data
debugger Post-Mortem Debugging
demo Demonstrations of R Functionality
download.file Download File from the Internet
download.packages Download Packages from CRAN-like Repositories
edit Invoke a Text Editor
edit.data.frame Edit Data Frames and Matrices
example Run an Examples Section from the Online Help
file.edit Edit One or More Files
file_test Shell-style Tests on Files
findLineNum Find the Location of a Line of Source Code, or Set a Breakpoint There.
fix Fix an Object
flush.console Flush Output to A Console
formatUL Format Unordered and Ordered Lists
getAnywhere Retrieve an R Object, Including from a Namespace
getFromNamespace Utility functions for Developing Namespaces
getParseData Get detailed parse information from object.
getS3method Get An S3 Method
getSrcFilename Source Reference Utilities
glob2rx Change Wildcard or Globbing Pattern into Regular Expression
globalVariables Declarations Used in Checking a Package
head Return the First or Last Part of an Object
help Documentation
help.request Send a Post to R-help
help.search Search the Help System
help.start Hypertext Documentation
install.packages Install Packages from Repositories or Local Files
installed.packages Find Installed Packages
localeToCharset Select a Suitable Encoding Name from a Locale Name
ls.str List Objects and their Structure
maintainer Show Package Maintainer
make.packages.html Update HTML Package List
make.socket Create a Socket Connection
memory.size Report on Memory Allocation
menu Menu Interaction Function
methods List Methods for S3 Generic Functions or Classes
mirrorAdmin Managing Repository Mirrors
modifyList Recursively Modify Elements of a List
news Build and Query R or Package News Information
nsl Look up the IP Address by Hostname
object.size Report the Space Allocated for an Object
package.skeleton Create a Skeleton for a New Source Package
packageDescription Package Description
packageName Find package associated with an environment.
packageStatus Package Management Tools
page Invoke a Pager on an R Object
person Persons
process.events Trigger event handling
prompt Produce Prototype of an R Documentation File
promptData Generate Outline Documentation for a Data Set
promptPackage Generate a Shell for Documentation of a Package
rcompgen A Completion Generator for R
read.DIF Data Input from Spreadsheet
read.fortran Read Fixed-Format Data in a Fortran-like Style
read.fwf Read Fixed Width Format Files
read.socket Read from or Write to a Socket
read.table Data Input
recover Browsing after an Error
relist Allow Re-Listing an unlist()ed Object
remove.packages Remove Installed Packages
removeSource Remove Stored Source from a Function.
rtags An Etags-like Tagging Utility for R
savehistory Load or Save or Display the Commands History
select.list Select Items from a List
sessionInfo Collect Information About the Current R Session
setRepositories Select Package Repositories
stack Stack or Unstack Vectors from a Data Frame or List
str Compactly Display the Structure of an Arbitrary R Object
summaryRprof Summarise Output of R Sampling Profiler
tar Create a Tar Archive
toLatex Converting R Objects to BibTeX or LaTeX
txtProgressBar Text Progress Bar
type.convert Type Conversion on Character Variables
untar Extract or List Tar Archives
unzip Extract or List Zip Archives
update.packages Compare Installed Packages with CRAN-like Repositories
url.show Display a text URL
utils-deprecated Deprecated Functions in Package 'utils'
utils-package The R Utils Package
vignette View or List Package Vignettes
write.table Data Output
zip Create Zip archives

apropos / find

オブジェクトを見つける

> # apropos(what, where = FALSE, ignore.case = TRUE, mode = "any")
> apropos("^pr")
  [1] "Prague"                       "prcomp"                      
  [3] "precip"                       "preconditions"               
  [5] "predict"                      "predict"                     
  [7] "predict"                      "predict.downscale"           
  [9] "predict.glm"                  "predict.lm"                  
 [11] "predict.rfsrc"                "preDrawDetails"              
 [13] "prepanel.default.bwplot"      "prepanel.default.cloud"      
 [15] "prepanel.default.densityplot" "prepanel.default.histogram"  
 [17] "prepanel.default.levelplot"   "prepanel.default.parallel"   
 [19] "prepanel.default.qq"          "prepanel.default.qqmath"     
 [21] "prepanel.default.splom"       "prepanel.default.xyplot"     
 [23] "prepanel.lmline"              "prepanel.loess"              
 [25] "prepanel.qqmathline"          "prepanel.spline"             
 [27] "prepanel.tmd.default"         "prepanel.tmd.qqmath"         
 [29] "prepareData"                  "prepend"                     
 [31] "preplot"                      "present"                     
 [33] "PresentationOfLord"           "presidential"                
 [35] "presidents"                   "pressure"                    
 [37] "prettify"                     "pretty"                      
 [39] "pretty.default"               "prettyNum"                   
 [41] "princomp"                     "print"                       
 [43] "print"                        "print"                       
 [45] "print"                        "print.AsIs"                  
 [47] "print.by"                     "print.condition"             
 [49] "print.connection"             "print.data.frame"            
 [51] "print.Date"                   "print.default"               
 [53] "print.difftime"               "print.Dlist"                 
 [55] "print.DLLInfo"                "print.DLLInfoList"           
 [57] "print.DLLRegisteredRoutines"  "print.DMS"                   
 [59] "print.factor"                 "print.function"              
 [61] "print.hexmode"                "print.libraryIQR"            
 [63] "print.listof"                 "print.NativeRoutineList"     
 [65] "print.noquote"                "print.numeric_version"       
 [67] "print.octmode"                "print.packageInfo"           
 [69] "print.POSIXct"                "print.POSIXlt"               
 [71] "print.proc_time"              "print.restart"               
 [73] "print.rfsrc"                  "print.rle"                   
 [75] "print.simple.list"            "print.srcfile"               
 [77] "print.srcref"                 "print.summary.table"         
 [79] "print.summaryDefault"         "print.table"                 
 [81] "print.warnings"               "printCoefmat"                
 [83] "printcp"                      "prints_text"                 
 [85] "printSpMatrix"                "printSpMatrix2"              
 [87] "prior_options"                "prmatrix"                    
 [89] "problems"                     "proc.time"                   
 [91] "process.events"               "processingInstruction.SAX"   
 [93] "processXInclude"              "prod"                        
 [95] "profile"                      "profvis"                     
 [97] "profvisOutput"                "progress_estimated"          
 [99] "prohibitGeneric"              "proj"                        
[101] "proj4string"                  "proj4string<-"               
[103] "projectExtent"                "projection"                  
[105] "projection<-"                 "projectRaster"               
[107] "promax"                       "promise_info"                
[109] "prompt"                       "prompt"                      
[111] "promptClass"                  "promptData"                  
[113] "promptImport"                 "promptMethods"               
[115] "promptPackage"                "prop.table"                  
[117] "prop.test"                    "prop.trend.test"             
[119] "proto"                        "prototype"                   
[121] "provideDimnames"              "prune"                       
[123] "prune.rpart"
> # find(what, mode = "any", numeric = FALSE, simple.words = TRUE)
> find(what = "ggplot", mode = "function")
[1] "package:ggplot2"

citation

cite

data

データセットの読み込み

Arguments

  • ...
  • list
  • package
  • lib.loc
  • verbose
  • envir
> data()

download.file

インターネットを通じてファイルをダウンロード

Arguments

  • url... 対象とするURLを文字列で与える
  • destfile... 保存先のファイル名を指定する
  • method
  • quiet... 実行経過や結果についての出力を行うか否か
  • mode...
  • cacheOK
  • extra
> download.file(url, destfile, method, quiet = FALSE, mode = "w",
+               cacheOK = TRUE,
+               extra = getOption("download.file.extra"))

methods

S3メソッドにおける総称関数あるいはクラスのリストを出力

> methods(print) %>% .[1:5]
> methods("$")

read.table / read.csv / read.csv2 / read.delim / read.delim2

Rprof

プロファイリング

Arguments

  • filename
  • append
  • interval
  • memory.profiling
  • gc.profiling
  • line.profiling
  • numfiles
  • bufsize
> Rprof()
> 1 + 1
> Rprof(NULL)

str

オブジェクトの構造を表示する

Arguments

  • object... 対象オブジェクト
  • max.level... 入れ子で表示する最大数
  • vec.len... 表示するベクトルの長さ
  • digits.d...
  • nchar.max
  • give.attr
  • give.length
  • give.head
  • width...
  • nest.lev
  • indent.str
  • comp.str
  • no.list
> str(iris)
'data.frame':    150 obs. of  5 variables:
 $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
 $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
 $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
 $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
 $ Species     : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
> str(ability.cov, vec.len = 5L, nest.lev = 0)
List of 3
 $ cov   : num [1:6, 1:6] 24.64 5.99 33.52 6.02 20.75 29.7 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:6] "general" "picture" "blocks" "maze" "reading" ...
  .. ..$ : chr [1:6] "general" "picture" "blocks" "maze" "reading" ...
 $ center: num [1:6] 0 0 0 0 0 0
 $ n.obs : num 112

zip

zipアーカイブを作成する

> zip(zipfile, files, flags = "-r9X", extras = "",
+     zip = Sys.getenv("R_ZIPCMD", "zip"))