Where can I get Survey dataset for bnlearn example?

I am following these publications on how to make Causal Generative Modeling:

But I stucked at this point:

survey <- read.table("data/survey.txt", header = TRUE)
head(survey)

Since I cant find anywhere the Survey dataset (which formatted as table) in google, all I found is a network repositories that documented in https://www.bnlearn.com/bnrepository/. This only provide network and probability structure for Survey itself as a bif/dsc/net file type..

Can anyone help me to find where is this particular dataset? Thankyou in advance :slight_smile:

This had to be reverse engineered from the table in the text.

survey <- structure(list(
  A = c(
    "adult", "adult", "adult", "adult", "adult",
    "adult"
  ), R = c("big", "small", "big", "big", "big", "small"),
  E = c("high", "uni", "uni", "high", "high", "high"), O = c(
    "emp",
    "emp", "emp", "emp", "emp", "emp"
  ), S = c(
    "F", "M", "F",
    "M", "M", "F"
  ), T = c(
    "car", "car", "train", "car", "car",
    "train"
  )
), class = c("spec_tbl_df", "tbl_df", "tbl", "data.frame"), row.names = c(NA, -6L), spec = structure(list(cols = list(
  A = structure(list(), class = c("collector_character", "collector")), R = structure(list(), class = c(
    "collector_character",
    "collector"
  )), E = structure(list(), class = c(
    "collector_character",
    "collector"
  )), O = structure(list(), class = c(
    "collector_character",
    "collector"
  )), S = structure(list(), class = c(
    "collector_character",
    "collector"
  )), T = structure(list(), class = c(
    "collector_character",
    "collector"
  ))
), default = structure(list(), class = c(
  "collector_guess",
  "collector"
)), skip = 1L), class = "col_spec"))

survey
#> # A tibble: 6 x 6
#>   A     R     E     O     S     T    
#>   <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 adult big   high  emp   F     car  
#> 2 adult small uni   emp   M     car  
#> 3 adult big   uni   emp   F     train
#> 4 adult big   high  emp   M     car  
#> 5 adult big   high  emp   M     car  
#> 6 adult small high  emp   F     train

Created on 2020-11-16 by the reprex package (v0.3.0.9001)

1 Like

This nice! but I wonder if survey dataset is not only 6 rows, since the snippets just using head() to maybe truncated the data..

If you read the rpubs article, it's just that. The purpose of this toy data set is to produce a small directed acyclic graph, also illustrated.

So its full dataset only 6 rows? okay then, Thankyou @technocrat

1 Like

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.