Finding the source code

I'm very new to R and this might sound like a very basic question but any help would be very much appreciated.

Someone in the company wrote a piece of code a few years back which we regularly execute by going to RGUI and typing in p1 = read.csv(file path). I would like to know exactly how this code was written but can't figure it out. I'm not sure where the initial code is or where this code lives.

Any help would be very much appreciated!

Just type "read.csv" and it will show you the details of the function:

#> function (file, header = TRUE, sep = ",", quote = "\"", dec = ".", 
#>     fill = TRUE, comment.char = "", ...) 
#> read.table(file = file, header = header, sep = sep, quote = quote, 
#>     dec = dec, fill = fill, comment.char = comment.char, ...)
#> <bytecode: 0x00000000116c8828>
#> <environment: namespace:utils>

Created on 2020-01-09 by the reprex package (v0.3.0)

read.csv is part of the set of functions included in R when you install it.

The function reads a csv file from the specified path into an object called p1.

If you type in ?read.csv in Rgui then the help will display.

1 Like

If you're working in the Rstudio GUI, you can also select the function (in your case, read.csv) and hit F2 to open up the function definition in a new window. Doing it this way has the advantage of seeing the code sytax highlighted in your usual color scheme.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.