Hello, I have a dataframe and I would like to browse the information of its structure only for a subset of columns (since there are hundreds of them). For instance, I tried with grepping some columns as in: ``` df <- data.frame(var_a1 = c(letters[1:3], letters[1:4]), var2 = c(LETTERS[1:7]), var_a2 = c(letters[1:3], letters[1:4]), var4 = (1:7)^2, var_a3 = c("light", "light", "heavy", "heavy", "heavy", "light", "heavy"), stringsAsFactors = FALSE) > grep("*._a*.", names(df)) [1] 1 3 5 ``` This tells me that the pattern v_1 is present in the name of columns 1 3 5. Would it be possible to get a str() of just these columns?
``` > str(df) 'data.frame': 7 obs. of 5 variables: $ var_a1: chr "a" "b" "c" "a" ... $ var2 : chr "A" "B" "C" "D" ... $ var_a2: chr "a" "b" "c" "a" ... $ var4 : num 1 4 9 16 25 36 49 $ var_a3: chr "light" "light" "heavy" "heavy" ... ``` Thank you -- Best regards, Luigi ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.