Translate Vector or Matrix of Text Strings
Uses the UNIX tr command to translate any character in
text to the corresponding character in
new. If multichar=T
new have more than one element, or each have one element
but they have different numbers of characters,
uses the UNIX
sed command to translate the series of characters in
old to the series in
new when these characters occur in
new contain a backslash, you sometimes have to quadruple
it to make the UNIX command work. If they contain a forward slash,
preceed it by two backslashes. Invokes the builtin chartr function if
scalar, vector, or matrix of character strings to translate.
vector old characters
corresponding vector of new characters
an object like text but with characters translated
1 2 3 4 5 6
translate(c("ABC","DEF"),"ABCDEFG", "abcdefg") translate("23.12","[.]","\\cdot ") # change . to \cdot translate(c("dog","cat","tiger"),c("dog","cat"),c("DOG","CAT")) # S-Plus gives  "DOG" "CAT" "tiger" - check discrepency translate(c("dog","cat2","snake"),c("dog","cat"),"animal") # S-Plus gives  "animal" "animal2" "snake"
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.
- abs.error.pred: Indexes of Absolute Prediction Error for Linear Models
- addMarginal: Add Marginal Observations
- all.is.numeric: Check if All Elements in Character Vector are Numeric
- approxExtrap: Linear Extrapolation
- areg: Additive Regression with Optimal Transformations on Both...
- aregImpute: Multiple Imputation using Additive Regression, Bootstrapping,...
- binconf: Confidence Intervals for Binomial Probabilities
- biVar: Bivariate Summaries Computed Separately by a Series of...
- bootkm: Bootstrap Kaplan-Meier Estimates
- bpower: Power and Sample Size for Two-Sample Binomial Test
- bpplot: Box-percentile plots
- bystats: Statistics by Categories
- capitalize: capitalize the first letter of a string
- ciapower: Power of Interaction Test for Exponential Survival
- cnvrt.coords: Convert between the 5 different coordinate sytems on a...
- consolidate: Element Merging
- contents: Metadata for a Data Frame
- cpower: Power of Cox/log-rank Two-Sample Test
- Cs: Character strings from unquoted names
- csv.get: Read Comma-Separated Text Data Files
- curveRep: Representative Curves
- cut2: Cut a Numeric Variable into Intervals
- data.frame.create.modify.check: Tips for Creating, Modifying, and Checking Data Frames
- dataRep: Representativeness of Observations in a Data Set
- deff: Design Effect and Intra-cluster Correlation
- describe: Concise Statistical Description of a Vector, Matrix, Data...
- discrete: Discrete Vector tools
- dotchart2: Enhanced Dot Chart
- dotchart3: Enhanced Version of dotchart Function
- dotchartpl: Enhanced Version of dotchart Function for plotly
- Ecdf: Empirical Cumulative Distribution Plot
- epi: Miscellaneous Functions for Epidemiology
- equalBins: Multicolumn Formating
- errbar: Plot Error Bars
- escapeRegex: Escapes any characters that would have special meaning in a...
- event.chart: Flexible Event Chart for Time-to-Event Data
- event.convert: Event Conversion for Time-to-Event Data
- event.history: Produces event.history graph for survival data
- ffCompress: Transform Data Frame Into a Compact 'ff' Object
- find.matches: Find Close Matches
- first.word: First Word in a String or Expression
- format.df: Format a Data Frame or Matrix for LaTeX or HTML
- format.pval: Format P Values
- gbayes: Gaussian Bayesian Posterior and Predictive Distributions
- getHdata: Download and Install Datasets for 'Hmisc', 'rms', and...
- getRs: Interact with github rscripts Project
- getZip: Open a Zip File From a URL.
- ggfreqScatter: Frequency Scatterplot
- ggMisc: Miscellaneous ggplot2 and grid Helper Functions
- GiniMd: Gini's Mean Difference
- hdquantile: Harrell-Davis Distribution-Free Quantile Estimator
- histbackback: Back to Back Histograms
- hist.data.frame: Histograms for Variables in a Data Frame
- Hmisc-internal: Internal Hmisc functions
- hoeffd: Matrix of Hoeffding's D Statistics
- html: Convert an S object to HTML
- impute: Generic Functions and Methods for Imputation
- inc-dec: Increment and Decrement
- knitrSet: knitr Setup and plotly Service Function
- labcurve: Label Curves, Make Keys, and Interactively Draw Points and...
- label: Label Attribute of an Object
- Lag: Lag a Numeric, Character, or Factor Vector
- latex: Convert an S object to LaTeX, and Related Utilities
- latexDotchart: Enhanced Dot Chart for LaTeX Picture Environment with epic
- latexTabular: Convert a Data Frame or Matrix to a LaTeX Tabular
- latexTherm: Create LaTeX Thermometers and Colored Needles
- legendfunctions: Legend Creation Functions
- list.tree: Pretty-print the Structure of a Data Object
- makeNstr: creates a string that is a repeat of a substring
- mApply: Apply a Function to Rows of a Matrix or Vector
- mChoice: Methods for Storing and Analyzing Multiple Choice Variables
- mdb.get: Read Tables in a Microsoft Access Database
- Merge: Merge Multiple Data Frames or Data Tables
- mgp.axis: Draw Axes With Side-Specific mgp Parameters
- minor.tick: Minor Tick Marks
- Misc: Miscellaneous Functions
- mtitle: Margin Titles
- multLines: Plot Multiple Lines
- na.delete: Row-wise Deletion na.action
- na.detail.response: Detailed Response Variable Information
- na.keep: Do-nothing na.action
- nin: Find Matching (or Non-Matching) Elements
- nobsY: Compute Number of Observations for Left Hand Side of Formula
- nstr: Creates a string of arbitry length
- num.intercepts: Extract number of intercepts
- Overview: Overview of Hmisc Library
- panel.bpplot: Box-Percentile Panel Function for Trellis
- partition: Patitions an object into different sets
- pc1: First Principal Component
- plotCorrPrecision: Plot Precision of Estimate of Pearson Correlation Coefficient
- plsmo: Plot smoothed estimates
- popower: Power and Sample Size for Ordinal Response
- print.char.list: prints a list of lists in a visually readable format.
- print.char.matrix: Function to print a matrix with stacked cells
- prnz: Print and Object with its Name
- prselect: Selectively Print Lines of a Text Vector
- pstamp: Date/Time/Directory Stamp the Current Plot
- rcorr: Matrix of Correlations and P-values
- rcorr.cens: Rank Correlation for Censored Data
- rcorrp.cens: Rank Correlation for Paired Predictors with a Possibly...
- rcspline.eval: Restricted Cubic Spline Design Matrix
- rcspline.plot: Plot Restricted Cubic Spline Function
- rcspline.restate: Re-state Restricted Cubic Spline Function
- redun: Redundancy Analysis
- reShape: Reshape Matrices and Serial Data
- rlegend: Special Version of legend for R
- rm.boot: Bootstrap Repeated Measurements Model
- rMultinom: Generate Multinomial Random Variables with Varying...
- samplesize.bin: Sample Size for 2-sample Binomial
- sasxport.get: Enhanced Importing of SAS Transport Files using read.xport
- Save: Faciliate Use of save and load to Remote Directories
- scat1d: One-Dimensional Scatter Diagram, Spike Histogram, or Density
- score.binary: Score a Series of Binary Variables
- sedit: Character String Editing and Miscellaneous Character Handling...
- show.pch: Display Colors, Plotting Symbols, and Symbol Numeric...
- showPsfrag: Display image from psfrag LaTeX strings
- simplifyDims: List Simplification
- smean.sd: Compute Summary Statistics on a Vector
- solvet: solve Function with tol argument
- somers2: Somers' Dxy Rank Correlation
- spower: Simulate Power of 2-Sample Test for Survival under Complex...
- spss.get: Enhanced Importing of SPSS Files
- src: Source a File from the Current Working Directory
- stata.get: Enhanced Importing of STATA Files
- stat_plsmo: Add a lowess smoother without counfidence bands.
- string.bounding.box: Determine Dimensions of Strings
- string.break.line: Break a String into Many Lines at Newlines
- stringDims: String Dimentions
- subplot: Embed a new plot within an existing plot
- summarize: Summarize Scalars or Matrices by Cross-Classification
- summary.formula: Summarize Data for Making Tables and Plots
- summaryM: Summarize Mixed Data Types vs. Groups
- summaryP: Multi-way Summary of Proportions
- summaryRc: Graphical Summarization of Continuous Variables Against a...
- summaryS: Summarize Multiple Response Variables and Make Multipanel...
- symbol.freq: Graphic Representation of a Frequency Table
- sys: Run Unix or Dos Depending on System
- tabulr: Interface to Tabular Function
- tex: function for use in graphs that are used with the psfrag...
- transace: Additive Regression and Transformations using ace or avas
- transcan: Transformations/Imputations using Canonical Variates
- translate: Translate Vector or Matrix of Text Strings
- trunc.POSIXt: return the floor, ceiling, or rounded value of date or time...
- t.test.cluster: t-test for Clustered Data
- units: Units Attribute of a Vector
- unix/sas.get: Convert a SAS Dataset to an S Data Frame
- upData: Update a Data Frame or Cleanup a Data Frame after Importing
- upFirst: Change First Letters to Upper Case
- valueTags: Store Discriptive Information About an Object
- varclus: Variable Clustering
- windows/sas.get: Convert a SAS Dataset to an S Data Frame
- wtd.stats: Weighted Statistical Estimates
- xtfrm.labelled: Auxiliary Function Method for Sorting and Ranking
- xy.group: Mean x vs. function of y in groups of x
- xYplot: xyplot and dotplot with Matrix Variables to Plot Error Bars...
- yearDays: Get Number of Days in Year or Month
- ynbind: Combine Variables in a Matrix