0
$\begingroup$

I hope this question is not too vague. I have been using Matlab for a long time, but my company now wants to migrate all codes in R and I am the guy who has to do the job.

Whenever I had to use new functions or toolbox in Matlab I was aware that the help is "ignorant-proof" and actually anyone who could read was able to understand it as it is very well explained from A to Z.

Now translating the Matlab code to R is becoming frustrating because I can't understand the logic behind the R documentation.

It seems to me like the functions property and methods of packages are explained randomly inside the documentation.

Is anyone willing to give me some tips (if they even exist) on how to read R documentation?

$\endgroup$
1
2
$\begingroup$

You probably know this already, but you can type help(), with the name of any function in the brackets to bring up the CRAN documentation on that function.

Each R package will have a pdf on CRAN that lists all of the functions in that library in the same style.

Each function help page follows the same format. They start with a brief DESCRIPTION of what the package does.

Then there is USAGE. This shows the various arguments you need to specify when using the function - some will be compulsory, some will be optional.

ARGUMENTS - very briefly describes each of the arguments that you need to specify.

DETAILS - this is quite a variable field - the author of the function often gives more details about the function.

VALUE - this tells you what the outputs of the function will be.

AUTHORS, REFERENCES - self explanatory

SEE ALSO - points you in the direction of related functions

EXAMPLES - gives you some code snippets to show you the function being used in practise. These are very useful if you're learning R.

Some packages will also have "vignettes", which give more detailed descriptions of how the functions within a package should be used.

$\endgroup$
2
  • 1
    $\begingroup$ Thank you for the answer but that is exactly what I am referring to. That documentation is just bad $\endgroup$ – gioxc88 Jan 21 '18 at 17:16
  • $\begingroup$ Haha - you get used to it! I agree that it's not intuitive for beginners, but you will soon find that you can get all the information you need from it. Try doing the examples - if they've been done properly they should give you a clear idea of what the function is doing and how to use it. Look for vignettes if available. Maybe try posting an example if there are specific functions you're having trouble understanding? $\endgroup$ – rw2 Jan 21 '18 at 17:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.