LogoLogo
Computing Skills
Computing Skills
  • Introduction
  • File Directory Structures
  • Text Editors
  • GitHub
  • Unix
  • Julia
    • Installation
    • REPL
    • Basic Syntax
    • Numbers and Math
    • Strings and Characters
    • Regular Expressions
    • Control Flow
    • Collections and Data Structures
    • File Input/Output
    • Packages
    • DataFrames
    • JuliaPlots
    • ScikitLearn.jl
    • JuliaStats
    • Exercises
  • Python
    • Installation
    • REPL
    • Basic Syntax
    • Numbers and Math
    • Strings and Characters
    • Regular Expressions
    • Control Flow
    • Collections and Data Structures
    • File Input/Output
    • Packages
    • Data Frames and Data Manipulation
  • R
    • Installation
    • REPL
    • Basic Syntax
    • Numbers and Math
    • Strings and Characters
    • Regular Expression
    • Control Flow
    • Collections and Data Structures
    • File Input/Output
    • Packages
    • DataFrames
    • Data Analysis and Manipulation
Powered by GitBook
On this page
  • String Functions
  • Resources
Export as PDF
  1. R

Strings and Characters

String Functions

Action
Function

Get string length

nchar(string)

Combine two strings

str_c(string1, string2)

Sort values within a string

sort(string1, string2, string3)

Inputs:

#String length
nchar("codiac")

#Combine strings
str_c("patient ", c("a", "b", "c"))

#Sort values in a string
x <- c("carrot", "apple", "banana")
sort(x)

Outputs:

#String length
6

#Combine strings
"patient a" "patient b" "patient c"

#Sort values in a string
"apple" "banana" "carrot"

Resources

PreviousNumbers and MathNextRegular Expression

Last updated 6 months ago

R for Data Science:

String Functions