我使用lavaan包进行了CFA
<% if request.query_parameters.empty? %>
<%= link_to category.category_name, shops_path(categories: [category]) %>
<% else %>
<% if !params.has_key?(:categories) %>
<%= link_to category.category_name, shops_path( request.query_parameters.merge!(categories: [category])) %>
<% else %>
<%= link_to category.category_name, shops_path(request.query_parameters[:categories] += [category.permalink]) %>
<% end %>
<% end %>
我设法使用
在单独的数据集中获取五个因子的值require('lavaan');
HS.model <- 'external_regulation_soc =~ JOBMOTIVATIE_extsoc1 +
JOBMOTIVATIE_extsoc2 + JOBMOTIVATIE_extsoc3
external_regulation_mat =~ JOBMOTIVATIE_extmat1 +
JOBMOTIVATIE_extmat2 + JOBMOTIVATIE_extmat3
introjected_regulation =~ JOBMOTIVATIE_introj1 +
JOBMOTIVATIE_introj2 + JOBMOTIVATIE_introj3 +
JOBMOTIVATIE_introj4
identified_regulation =~ JOBMOTIVATIE_ident1 +
JOBMOTIVATIE_ident2 + JOBMOTIVATIE_ident3
intrinsic_motivation =~ JOBMOTIVATIE_intrin1 +
JOBMOTIVATIE_intrin2 + JOBMOTIVATIE_intrin3'
fit <- cfa(HS.model, data = dataset, scores="regression")
summary(fit, fit.measures=TRUE, standardized=TRUE)
但我需要将这5个因素(作为列,作为变量)添加到我的原始数据集中。我怎样才能做到这一点?
我尝试了cbind,但收到了错误:
data_factor <- predict(fit)
感谢您帮助我!