rm_invalid: Remove Invalid Excel Sheet Characters

Description Usage Arguments Details Value Examples

View source: R/rm_invalid.R

Description

rm_invalid Removes invalid excel sheet special characters.

Usage

1

Arguments

x

A string or vector of strings.

Details

rm_invalid is useful if you are writing sheets to excel. Excel will not allow certain special characters in sheet names. Invalid characters include colons, square brackets, asterisks, question marks, vertical bars, new lines and tabs.

Value

x with invalid characters removed.

Examples

1
2
3
4
5
6
7
8
rm_invalid(c("excel sheet* example[]: a fake string", "another test::"))

library(xlsx)
string <- "Table* [5]?"
df <- data.frame(foo = 1:3, bar = 1:3)
sName <- rm_invalid(string)
write.xlsx(df, "foo.xlsx", string) #Will throw error
write.xlsx(df, "foo.xlsx", sName)  #No error

faouser1/FAO documentation built on Nov. 4, 2019, 12:35 p.m.