代码拉取完成,页面将自动刷新
同步操作将从 连享会/nwcommands 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
capture program drop nw2set
program nw2set
syntax [varlist (default=none)][, generate(string) rownames(varname) xvars name(string) clear nwclear edgelist name(string) vars(string) labs(string) mat(string) ]
set more off
if "`clear'" != "" {
nwdrop _all, netonly
}
if "`nwclear'" != "" {
nwclear
}
if "`generate'" == "" {
local generate = "_modeid"
}
if "`edgelist'" != "" {
qui foreach var in `varlist' {
tostring(`var'), replace
}
nw2fromedge `varlist', generate(`generate') `xvars' name(`name')
exit
}
capture mata: mata drop M
if "`mat'" != "" {
mata: M = J((rows(`mat') + cols(`mat')), (rows(`mat') + cols(`mat')), 0)
mata: M[((cols(`mat') + 1) :: rows(M)), (1:: cols(`mat'))] = `mat'
mata: M = M + M'
}
// matrix given in varlist
else {
tempname mat
qui putmata `mat' = (`varlist')
mata: M = J((rows(`mat') + cols(`mat')), (rows(`mat') + cols(`mat')), 0)
mata: M[((cols(`mat') + 1) :: rows(M)), (1:: cols(`mat'))] = `mat'
mata: M = M + M'
mata: mata drop `mat'
local rows ""
forvalues i=1/`=_N' {
if "`rownames'" != "" {
local new = "`=`rownames'[`i']'"
local new = strtoname("`new'")
local rows "`rows' `new'"
}
else {
local rows "`rows' n`i'"
}
}
local l "`varlist' `rows'"
}
if "`labs'" != "" {
local l "`labs'"
}
local mode1 : word count `varlist'
qui nwset, mat(M) labs(`l') vars(`l') name(`name') undirected `xvars'
qui nwload, labelonly
capture drop `rownames'
capture drop `generate'
capture drop `varlist'
generate `generate' = 2 - (_n <= `mode1')
mata: mata drop M
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。