R语言 把字符串转换成单引号文本 – sQuote()函数
R语言中的 sQuote() 函数用于将给定的字符串或字符向量转换为单引号文本。
语法: sQuote(x)
参数:
x: 指定的字符串,字符矢量
例1 :
# R program to illustrate
# sQuote function
# Initializing a string
x <- "GeeksforGeeks"
# Calling the sQuote() function
sQuote(x)
输出:
[1] "‘GeeksforGeeks’"
例2 :
# R program to illustrate
# sQuote function
# Initializing a string
x <- "2020-05-29 19:18:05"
# Calling the sQuote() function
sQuote(x)
输出:
[1] "‘2020-05-29 19:18:05’"