Can't use max.level function

I want to see some details about the first line of the dataframe. This is my code:

name <- "Carmen"; n1 <- 10; n2 <- 100; m <- 0.5
M <- data.frame(n1, n2, m)
ls.str(pattern="M", max.level=-1)

But it results in error, I don't know if this function has already updated to a new one:
Error in ls.str(pattern = "M", max.level = -1) : unused argument (max.level = -1)

I started learning R and I'm reading this pdf (the code is found on page 10):

The argument max.level is now part of the print method for the objects returned by ls.str(). Here is an example.

ls.str(pattern = "^D")
DF : Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	6 obs. of  3 variables:
 $ x : num  0 1 2 3 4 5
 $ y1: num  0.01 0.04 0.02 0.08 0.04 0.06
 $ y2: num  845 845 844 845 846 844

print(ls.str(pattern = "^D"), max.level = 0)
DF : Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	6 obs. of  3 variables:

print(ls.str(pattern = "^D"), max.level = 1)
DF : Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	6 obs. of  3 variables:
 $ x : num  0 1 2 3 4 5
 $ y1: num  0.01 0.04 0.02 0.08 0.04 0.06
 $ y2: num  845 845 844 845 846 844

You can see a brief help file on ls.str() by running

?ls.str
2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.