Asking for help in R


There are several ways you can ask for help in R, here I show some of them:
1- Use ? operator followed by the function name you wanna get help from. For example:
?mean
?var
You can either put the function name inside quotation marks or not just like the examples above. If you feel like using quotation marks, then you can write the help search query just like:
?'mean'
?'var'
The result obtained using the latter expression is the same as the former one. Some 'special' functions need to be explicity enclosed in quotation marks such as '[', '[[', '+' (all arithmetic operators), 'in', '%o%', '%*%', among others.

If you type ?[[ insted of typing ?'[[' you'll get an error message, in order to avoid it write ?'[['. One rule of thumb could be: always ask for help using quotation marks.

2- Another useful function for searching what a specific function does is 'help.search'. How does it work? well, if you thought of using ?'help.search' to answer that question, then you're right. Once you read what 'help.search' does youu can understand the examples below.

help.search("linear models")  # In case you forgot how to fit linear models
help.search("print")  # All help pages with topics or title matching 'print'
3- Forgot a function name? If so, then 'apropos' function is your friend!.
apropos("GLM")  # more than a dozen
##  [1] "anova.glm"            "anova.glmlist"        ".__C__anova.glm"     
##  [4] ".__C__anova.glm.null" ".__C__glm"            ".__C__glm.null"      
##  [7] "glm"                  "glm.control"          "glm.fit"             
## [10] "glm.fit.null"         "model.frame.glm"      "predict.glm"         
## [13] "print.glm"            "residuals.glm"        "rstandard.glm"       
## [16] "rstudent.glm"         "summary.glm"         
apropos("lm")  # a lot of results
##  [1] "anova.glm"            "anova.glmlist"        "anovalist.lm"        
##  [4] "anova.lm"             "anova.lmlist"         "anova.mlm"           
##  [7] ".__C__anova.glm"      ".__C__anova.glm.null" ".__C__glm"           
## [10] ".__C__glm.null"       ".__C__lm"             ".__C__mlm"           
## [13] "colMeans"             "contr.helmert"        ".__C__optionalMethod"
## [16] "getAllMethods"        "glm"                  "glm.control"         
## [19] "glm.fit"              "glm.fit.null"         "hatvalues.lm"        
## [22] "KalmanForecast"       "KalmanLike"           "KalmanRun"           
## [25] "KalmanSmooth"         "kappa.lm"             "lm"                  
## [28] "lm.fit"               "lm.fit.null"          "lm.influence"        
## [31] "lm.wfit"              "lm.wfit.null"         "model.frame.glm"     
## [34] "model.frame.lm"       "model.matrix.lm"      "nlm"                 
## [37] "nlminb"               "plot.lm"              "plot.mlm"            
## [40] "predict.glm"          "predict.lm"           "predict.mlm"         
## [43] "print.glm"            "print.lm"             "residuals.glm"       
## [46] "residuals.lm"         "rstandard.glm"        "rstandard.lm"        
## [49] "rstudent.glm"         "rstudent.lm"          "summary.glm"         
## [52] "summary.lm"           "summary.mlm"         
apropos("arima")
## [1] "arima"       "arima0"      "arima0.diag" "arima.sim"   "makeARIMA"  
## [6] "varimax"    
4- What about searching on the web?
4-1- http://rseek.org/ is a good place to start.
4-2- Mailing lists are good options http://www.r-project.org/mail.html
4-3- My very favorite is Stackoverflow (tagged R questions) http://stackoverflow.com/questions/tagged/r
I highly recommend using Stackoverflow, but also I recommend reading carefully how to ask for help in there, see http://stackoverflow.com/faq
-->

No hay comentarios:

Publicar un comentario