根据超级用户的链接:
AltGr + ^ 会给你一个带有意大利语键盘的Linux系统的~~~~,这就是你在评论中所说的.
(tilde <- rawToChar(as.raw(126)))
# [1] "~"
Run Code Online (Sandbox Code Playgroud)
当您需要文本中的波浪号时,可以使用此变量.
summary(lm(paste0("Sepal.Length", tilde, "Sepal.Width"), data=iris))
# Call:
# lm(formula = paste0("Sepal.Length", tilde, "Sepal.Width"), data = iris)
#
# Residuals:
# Min 1Q Median 3Q Max
# -1.5561 -0.6333 -0.1120 0.5579 2.2226
#
# Coefficients:
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) 6.5262 0.4789 13.63 <2e-16 ***
# Sepal.Width -0.2234 0.1551 -1.44 0.152
# ---
# Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
# Residual standard error: 0.8251 on 148 degrees of freedom
# Multiple R-squared: 0.01382, Adjusted R-squared: 0.007159
# F-statistic: 2.074 on 1 and 148 DF, p-value: 0.1519
Run Code Online (Sandbox Code Playgroud)
或者,您只需键入tilde并复制并粘贴该字符即可.