Reputation: 13
When reading data sets with 0 or 1 rows into R both show nrow of 1. I need to use the condition to filter out empty data sets in my program. Any idea why the package reads empty SAS data sets with nrow = 1?
Thanks in advance.
Regards K
Upvotes: 1
Views: 2166
Reputation: 51566
Do you have to use the sas7bdat package? Can you use haven
instead?
> library("haven")
> read_sas("c:/downloads/empty.sas7bdat")
# A tibble: 0 x 5
# ... with 5 variables: Name <chr>, Sex <chr>, Age <dbl>, Height <dbl>, Weight <dbl>
> read_sas("c:/downloads/one.sas7bdat")
# A tibble: 1 x 5
Name Sex Age Height Weight
<chr> <chr> <dbl> <dbl> <dbl>
1 Alfred M 14.0 69.0 112
>
Upvotes: 2