data.frame <- readstata13::read.dta13("path_to_datafile.dta")
require(tibble)
xx <- 1:3
yy <- letters[1:3]
zz <- factor(c('duck', 'duck','goose'))
my.tibble <- tibble(xx, yy, zz)
my.tibble
as.data.frame(my.tibble)
write.table(my.tibble, file='tibbledata.csv', sep=',')
my.dataframe <- read.csv(file='tibbledata.csv')
my.dataframe
str(my.tibble)
str(my.dataframe)
I know too little about data frames to understand why tibbles are not dealt with as data frames by lavaan, simply ignoring the labelling. But Yves is looking into it.
# Model_acc_model_a <- 'hp =~ a*rooms + b*edu + c*sol + d*netscc => e*age + f*gend + g*disab + h*orph
cc ~~ hp'
cc_fit_a <- lavaan::cfa(cc_model_a, data = cc, ordered = c("rooms", "edu", "sol", "nets", "gend", "disab", "orph"), conditional.x = FALSE, std.lv = FALSE)
ordered = c("rooms", "edu", "sol", "nets", "gend", "disab", "orph")
> cc_fit_a <- lavaan::cfa(cc_model_a, data = cc, ordered = c("rooms", "edu", "sol", "nets", "gend", "disab", "orph"), conditional.x = FALSE, std.lv = FALSE)Error in lav_data_full(data = data, group = group, cluster = cluster, : lavaan ERROR: missing observed variables in dataset: cc
> str(cc)Classes ‘spec_tbl_df’, ‘tbl_df’, ‘tbl’ and 'data.frame': 6059 obs. of 8 variables: $ age : num 2 6 8 10 6 14 5 4 8 5 ... $ gend : num 4 2 2 2 1 2 4 5 2 3 ... $ disab: num 0 1 0 1 0 0 0 0 0 0 ... $ orph : num 0 1 1 1 0 0 1 0 0 0 ... $ sol : num 3 3 3 NA 2 3 3 3 3 3 ... $ edu : num 2 1 0 0 1 NA 0 0 1 0 ... $ rooms: num 3 1 4 3 2 3 2 3 3 2 ... $ nets : num 1 0 0 0 1 0 0 0 0 0 ...
--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/a5341fef-ed1b-4dba-9c44-e312b86f5109%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/_8Nx9oRjGwc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/CAHxMgedE2nrgc%3DGL1Fp_J9%3D8V85o5zt4H9K5zt4jsTUMKrY%2Bcg%40mail.gmail.com.