Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

function
r
working directory
communitycreator

What is the getwd() function in R?

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

The getwd() function is used to return the current working directory in an R process.

Syntax

getwd()

Parameter value

The getwd() function takes no parameter values.

Return value

The getwd() function returns the current working directory.

Note: If the working directory is not available, it returns a character string NULL.

Example

# invoking the getwd() function
getwd()
getwd() function in R

Explanation

In the code above, we use the getwd() function to return the working directory of the R program.

Note: The code file shown above is placed in a folder named usercode, which is at the root of the path. This is why the output is /usercode.

RELATED TAGS

function
r
working directory
communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring