1

'/' could be used as file path separator in R. like:

path <- 'c:/users/john'
setwd(path)

However, the following also works:

path <- 'c:////users///john'
setwd(path)

It seems that the number of slash does not affect the above statement. I cannot find any rules about this. Does anyone have any clue on this? Thanks!

1 Answer 1

1

This is not R specific but depends on the operating system. At least for UNIX based platforms there is an official definition for this behaviour. In the Single UNIX Specification/3.267 Pathname you can read the following:

... Multiple successive slash characters are considered to be the same as one slash, except for the case of exactly two leading slash characters. ...

Sign up to request clarification or add additional context in comments.

1 Comment

@BowenSong if you are satisfied with the answer please accept it so the question is marked as answered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.