On sample size for low proportions

Intro When dealing with labor force statistics, a key variable for the design of an unemployment household survey is the the status of individuals in the labor force. For governments, it is of interest to provide a set of indicators intended to measure and track the occupation of the citizens of the country (or region). For example, you can obtain estimates of the current unemployment rate (measured monthly or quarterly); also, the net change between two periods and the gross flows between categories of employment among periods are also of interest.

Scatter plots in survey sampling

When it comes to analyzing survey data, you have to take into account the stochastic structure of the sample that was selected to obtain the data. Plots and graphics should not be an exception. The main aim of such studies is to try to infer about how the behavior of the outcomes of interest in the finite population. For example, you may want to know how many people are in poverty.

dplyr and the design effect in survey samples

For those guys like me who are not such R geeks, this trick could be of interest. The package dplyr can be very useful when it comes to data manipulation and you can extract valuable information from a data frame. For example, when using if you want to count how many humans have a particular hair color, you can run the following piece of code: library(dplyr) starwars %>% filter(species == "Human") %>% group_by(hair_color) %>% summarise(n = n()) hair_color n auburn 1 auburn, grey 1 auburn, white 1 black 8 blond 3 brown 14 brown, grey 1 grey 1 none 3 white 2 As a result the former query gives you a data frame and you can use it to make another query.

Automatic output format in Rmarkdown

I am writing a Rmarkdown document with plenty of tables, and I want them in a decent format, e.g. kable. However I don’t want to format them one by one. For example, I have created the following data frame in dplyr. library(dplyr) data("iris") iris %>% group_by(Species) %>% summarise(n = n()) %>% arrange(desc(n)) ## # A tibble: 3 x 2 ## Species n ## <fctr> <int> ## 1 setosa 50 ## 2 versicolor 50 ## 3 virginica 50 One solution to the output format of this data frame would be to name it as an object in R, and then give it a format by using the kable function.
UpDog logo Host your own website for free with UpDog.