Shawn Hemelstrand
Shawn Hemelstrand

Reputation: 3238

How do I "read" the syntax of R's help function

Every time I try to look up how to use a function in R using the ? command, what I get is some semi-useful explanations, commands I don't understand, and some limited examples.

What I end up doing most of the time instead of using this function is googling the answers instead, which sometimes helps for nuanced questions, but just trying to understand a single package becomes a chore unless it happens to come up in a basics book I'm reading on R.

I tried looking up how to "read" the help section, but the best I could find was this Dummies page which didn't really help much more:

Dummies Page on Help in R.

The main issue I'm having is that I just dont understand the syntax portion. Here is an example:

semPaths(object, what = "paths", whatLabels, style, layout = "tree", 
  intercepts = TRUE, residuals = TRUE, thresholds = TRUE, intStyle = "multi", 
  rotation = 1, curve, curvature = 1, nCharNodes = 3, nCharEdges = 3, sizeMan = 5,
   sizeLat = 8,  sizeInt = 2, sizeMan2, sizeLat2, sizeInt2, shapeMan, shapeLat, 
  shapeInt = "triangle", ask, mar, title, title.color = "black", title.adj = 0.1, 
  title.line = -1, title.cex = 0.8, include, combineGroups = FALSE, manifests, 
  latents, groups, color, residScale, gui = FALSE, allVars = FALSE, edge.color, 
  reorder = TRUE, structural = FALSE, ThreshAtSide = FALSE, thresholdColor, 
  thresholdSize = 0.5, fixedStyle = 2, freeStyle = 1, 
  as.expression = character(0), optimizeLatRes = FALSE, inheritColor = TRUE, 
  levels, nodeLabels, edgeLabels, pastel = FALSE, rainbowStart = 0, intAtSide, 
  springLevels = FALSE, nDigits = 2, exoVar, exoCov = TRUE, centerLevels = TRUE, 
  panelGroups = FALSE, layoutSplit = FALSE, measurementLayout = "tree", subScale, 
  subScale2, subRes = 4, subLinks, modelOpts = list(mplusStd = "std"), 
  curveAdjacent = '<->', edge.label.cex = 0.6,  cardinal = "none", 
  equalizeManifests = FALSE, covAtResiduals = TRUE, bifactor, optimPoints = 1:8 * (pi/4), 
  ...)

What does any of this mean? All I can tell are that the stuff in "" is a possible use of a function, and thats about it. How do I explore more? For example, if I wanna find out all the potential styles for "layout" in this function, how do I look them up?

Upvotes: 0

Views: 134

Answers (1)

Macosso
Macosso

Reputation: 1439

Hi to understand the information in the help you can follow the following steps,

Thee help is structured with some sections , Usage, Value, Details, References, Examples.

  1. Usage: you have the syntax of the function and their arguments, the mandatory arguments are the ones with no values, ie in semPaths(object,...) object is a mandatory argument.
  2. Arguments: You have the arguments that the function can take and their respective default values.
  3. Examples: perhaps the most important section, where you have some possible usage of the function
  4. References: other sources you may need to read to understand the logic or how the computations are being done.

You may also need to check the package documentation, there you may find more details, you can find this just by googling "package name" .pdf

Upvotes: 1

Related Questions