Posts

Showing posts from March, 2022

R-Basic Part VII: STR() Function, Simulation, and R Profiling

Image
  Highlights The  str()  function Simulation - Generating Random Numbers Simulation - Sample Linear Model Simulation - Random Sampling R Profiling The str() function It’s a diagnostic function and it can be used as an alternative to summary() function Outputs a compact display of variables in an array or a dataset Provides one line summary of key information per object or variable Let’s take the arguments required for  str  function: str function (object, ...) UseMethod("str") <bytecode: 0x0000000015fb51e8> <environment: namespace:utils> So, it takes an object, and it may take some other optional arguments (e.g., max.level, digits.d, etc.), as needed. An object can be anything ranging from a function to a large dataset. Let’s pass the  str  function on the  glm  function and see what it gives: str(glm) function (formula, family = gaussian, data, weights, subset, na.action, start = NULL, etastart, mustart, offset, control = list(...), model = TRUE, metho