Learn R Programming

strategicplayers (version 1.1)

strategicplayers-package: tools:::Rd_package_title("strategicplayers")

Description

tools:::Rd_package_description("strategicplayers")

Arguments

Author

tools:::Rd_package_author("strategicplayers")

Maintainer: tools:::Rd_package_maintainer("strategicplayers")

Details

The DESCRIPTION file: tools:::Rd_package_DESCRIPTION("strategicplayers") tools:::Rd_package_indices("strategicplayers") use the sp function to get a list of strategic players indicies

References

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6959850/

Examples

Run this code
 
 
#I am commenting this all out so that the package won't require sna any more :)

#require(sna)

#generate a bernoulli random network on 20 nodes
#network<-rgraph(20, tprob=.2)          

#get the geodesic distances of the network
#geo<-geodist(network)[2]$gdist  

#defining the target group
#targets<-1:10                        

#defining the avoidance group
#avoids<-11:14                         

#defining the theta parameter
#theta<-.8                             

#find sp set of size 4
#spset<-sp(4, geo, targets, avoids, theta, n.loops=100)  
#spset

#calculates distance metric for spset
#distance(geo, targets, avoids, theta, spset)           

#plot the network with the strategic player set highlighted in yellow

#colors<-rep("white", 20)
#colors[targets]<-"green"
#colors[avoids]<-"red"
#colors[spset]<-"yellow"
#par(mar=c(1,1,1,1))
#gplot(network, vertex.col=colors, 
#usearrows=FALSE, edge.col="grey",
#vertex.border="grey", vertex.cex=1.7, pad=0, label=1:dim(network)[1])


Run the code above in your browser using DataLab