I am using the file.choose() function to choose a file from the dialog box and 
once I get it, I want to be able to split the full name into the folder part 
and the file name part. So for example, when I have closed the file choose 
dialog, the name for the file I get is


Fname1
[1] "D:\\Data\\OneDrive\\ISTA Documents\\QT_App\\QT Analysis Input Data Example 
WorkBook.xlsx"


where the "\\" is used to split the folder and sub-folder and file names. R see 
this "\\" as a single \ backslash character.


Now I try to split it using


str_split(Fname1,"\\")


but this returns an error


Error in stri_split_regex(string, pattern, n = n, simplify = simplify, :
Unrecognized backslash escape sequence in pattern. (U_REGEX_BAD_ESCAPE_SEQUENCE)


I know its got something to do with the \\ because it is treated as a single 
backslash character. But replacing the str_split with


str_split(Fname1,"\")


does not work either. 


Any ideas on how I can handle the \\ and split the full name into its pieces?



Lion Bernard McGarvey

Director, Fort Myers Beach Lions Foundation, Inc.

Retired (Lilly Engineering Fellow).



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to