Fetch the repository succeeded.
*! Date : 24aug2014
*! Version : 1.0
*! Author : Thomas Grund, Linkoping University
*! Email : contact@nwcommands.org
capture program drop nwvalue
program nwvalue
local netname ="`0'"
// a specific entries are given
local ego = strpos("`netname'","[")
local alter = strpos("`netname'","]")
local sep = strpos("`netname'",",")
local subset = substr("`netname'",`ego',.)
if (`ego' != 0) {
local e1 = `ego' + 1
local e2 = `sep' - `ego' - 1
local a1 = `sep' + 1
local a2 = `alter' - `sep' - 1
local n1 = `ego' - 1
local egoid = substr("`netname'", `e1', `e2')
local alterid = substr("`netname'", `a1', `a2')
local netname = substr("`netname'", 1, `n1')
}
nwtomatafast `netname'
mata: onenet = `r(mata)'
//nwtomata `netname', mat(onenet)
capture mata: onenet`subset'
if _rc != 0 {
di "{err}{it:nwsubset} {bf:`subset'} invalid"
error 6400
}
mata: st_rclear()
if (`ego'!= 0) {
/*
if "`exp'" != "" {
local exp : subinstr local exp "=" ""
mata: onenet[`egoid',`alterid'] = J(rows(onenet[`egoid',`alterid']), cols(onenet[`egoid',`alterid']), `=`exp'')
}
*/
mata: subnet = onenet[`egoid',`alterid']
mata: st_numscalar("r(rows)", rows(subnet))
mata: st_numscalar("r(cols)", cols(subnet))
if (`r(rows)' == 1 & `r(cols)' == 1) {
mata: st_rclear()
mata: st_numscalar("r(ego)", `egoid')
mata: st_numscalar("r(alter)", `alterid')
mata: subnet[1,1]
mata: st_numscalar("r(value)", subnet[1,1])
}
else {
mata: st_matrix("r(values)", subnet)
mata: subnet
}
}
else {
mata: subnet = onenet
mata: subnet
mata: st_numscalar("r(rows)", rows(subnet))
mata: st_numscalar("r(cols)", cols(subnet))
mata: st_matrix("r(values)", subnet)
}
capture mata: mata drop subnet
end
*! v1.5.0 __ 17 Sep 2015 __ 13:09:53
*! v1.5.1 __ 17 Sep 2015 __ 14:54:23
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。