0

I am trying to have a quick overview of the dataset variables using this command in R:

str(df, vec.len=1, max.level=1)

But I am getting NA at first:

$ Life.expectancy.at.birth..male..years.  : num  NA NA ...                                             
$ Methane.emissions..kt.of.CO2.equivalent.  : int  NA NA ...                                              
$ Population..total: num  NA NA ...                                                                       
AndrewGB
  • 16,126
  • 5
  • 18
  • 49
  • 1
    You could use `head(df)` or `View(df)` for a quick overview. In a simple way, `summary(df)` gives you some insights, too. – Martin Gal Jul 18 '21 at 21:14
  • 1
    So what exactly do you want to see? Do you just want to drop all NA values and then do a summary? The `str()` just shows you the first few values of the data object you pass in. If you don't like that behavior, you should write your own summary function I suppose. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Jul 18 '21 at 21:20
  • I want to skip the first few values of the data object because the first have NA values but I would like to keep str() . – DS_Beginner Jul 18 '21 at 21:34
  • 2
    You could remove the first few lines of `df`: `str(df[-(1:10),], vec.len=1, max.level=1)` or use `df[!is.na(df$\`Population..total\`),]`. – Martin Gal Jul 18 '21 at 21:44

0 Answers0