ls.str                 package:utils                 R Documentation

_L_i_s_t _O_b_j_e_c_t_s _a_n_d _t_h_e_i_r _S_t_r_u_c_t_u_r_e

_D_e_s_c_r_i_p_t_i_o_n:

     'ls.str' and 'lsf.str' are variations of 'ls' applying 'str()' to
     each matched name: see section Value.

_U_s_a_g_e:

     ls.str(pos = -1, name, envir, all.names = FALSE,
            pattern, mode = "any")

     lsf.str(pos = -1, envir, ...)

     ## S3 method for class 'ls_str':
     print(x, max.level = 1, give.attr = FALSE, ...)

_A_r_g_u_m_e_n_t_s:

     pos: integer indicating 'search' path position.

    name: optional name indicating 'search' path position, see 'ls'.

   envir: environment to use, see 'ls'.

all.names: logical indicating if names which begin with a '.' are
          omitted; see 'ls'.

 pattern: a regular expression passed to 'ls'. Only names matching
          'pattern' are considered.

max.level: maximal level of nesting which is applied for displaying
          nested structures, e.g., a list containing sub lists. Default
          0: Display all nesting levels.

give.attr: logical; if 'TRUE' (default), show attributes as sub
          structures.

    mode: character specifying the 'mode' of objects to consider. 
          Passed to 'exists' and 'get'.

       x: an object of class '"ls_str"'.

     ...: further arguments to pass.  and 'lsf.str' passes them to
          'ls.str' which passes them on to 'ls'. The (non-exported)
          print method 'print.ls_str' passes them to 'str'.

_V_a_l_u_e:

     'ls.str' and 'lsf.str' return an object of class '"ls_str"',
     basically the character vector of matching names (functions only
     for 'lsf.str'), similarly to 'ls', with a 'print()' method that
     calls 'str()' on each object.

_A_u_t_h_o_r(_s):

     Martin Maechler

_S_e_e _A_l_s_o:

     'str', 'summary', 'args'.

_E_x_a_m_p_l_e_s:

     require(stats)

     lsf.str()#- how do the functions look like which I am using?
     ls.str(mode = "list") #- what are the structured objects I have defined?

     ## create a few objects
     example(glm, echo = FALSE)
     ll <- as.list(LETTERS)
     print(ls.str(), max.level = 0)# don't show details

     ## which base functions have "file" in their name ?
     lsf.str(pos = length(search()), pattern = "file")

     ## demonstrating that  ls.str() works inside functions
     ## ["browser/debug mode"]:
     tt <- function(x, y=1) { aa <- 7; r <- x + y; ls.str() }
     (nms <- sapply(strsplit(capture.output(tt(2))," *: *"), `[`, 1))
     stopifnot(nms == c("aa", "r","x","y"))

