Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

How can I compute other network indicators in R?

$
0
0

I have a Network consisting out of patent data and I want to compute several Network indicators. Unfortunately, the Code below works just with the functions ecount and vcount but with nothing else. I want to include also a Count of cutpoints (function cutpoints in statnet) and bridges, as well as Density (function gden), number of clusters and shortest path length.

Can anybody help me in this regard?

# Load libraries

library(dplyr)
library(readr)
library(plyr)
library(igraph)
library(Matrix)
library(tidyr)
library(statnet)




# File for Calculation

RICHTIGE_REGIONALE_PATENTDATEN <- read.csv("RICHTIGE_REGIONALE_PATENTDATEN_bereinigt_mit IPC kurz.csv", sep=",")
RIS <- select (RICHTIGE_REGIONALE_PATENTDATEN,-c(person_id,psn_name,person_address,appln_id,nb_applicants,nb_inventors,docb_family_size,granted,nace2_code,appln_nr_epodoc,person_name))
RIS_90_15 <- RIS[RIS$earliest_filing_year %in% (1990):(1995), ,]

rm(RIS, RICHTIGE_REGIONALE_PATENTDATEN)


# Calculation of knowledge bases in regions in different overall

ror_list <- sort(unique(RIS_90_15$ror_nummer)) #creates list for all ROR numbers existing in the RIS_90_15 data set

net_ind <- data.frame() #creates an empty dataframe to save results

for (ror in ror_list) {
    data <- RIS_90_15[RIS_90_15$ror_nummer == ror,]

    # Adjectency matrix for further steps

    net.edgelist <- data.frame(data$ipc_4digit, data$docb_family_id)
    colnames(net.edgelist) <- c("ipc", "family_id") # creates Table for 2-node Matrix (Actor and Patent ID)

    g <- graph.data.frame(net.edgelist)
    V(g)$type <- V(g)$name %in% net.edgelist[,2]
    igraph::is.bipartite(g)
    g <- bipartite.projection(g)
    g <- g$proj1
    mat <- igraph::as_adjacency_matrix(g)

    net_ind <- rbind(net_ind, 
                     c(ror,
                       ecount(g),
                       vcount(g)
                       ))
    colnames(net_ind) <- c("ROR", "Ecount", "VCount")

} 

Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>