The first step to connecting to WRDS data from within R in the WRDS Cloud is setting up your .Rprofile file in your WRDS home directory. This step only needs to be done once.
The .Rprofile file first loads the RPostgres package, then creates a connection to WRDS with all the necessary parameters and saves that connection as wrds. This allows you to use wrds to connect to the WRDS PostgreSQL database servers seamlessly without having to enter the hostname, username and password each time.
To create your .Rprofile file, you first use an SSH session to connect to the WRDS Cloud, and then create a file named .Rprofile in your WRDS Cloud home directory using a text editor.
To create the .Rprofile file
Where your_username is your WRDS username and your_password is your WRDS password.
As your .Rprofile file contains your WRDS username and password in plain text, it is very important that you restrict permissions on this file using the following command. This command sets the permissions on this file to be read/write for your user account only.
To restrict file permissions:
The following code shows using an SSH session to connect to the WRDS Cloud, creating the .Rprofile file, and restricting file permissions, all together.
To connect to the WRDS cloud and create the .Rprofile file