The data are from Kaggle.
The original file companion_plants.csv
contains the line
378 yarrow,helps,””””,herbs
I searched on Google. The answer was that yarrow helps rosemary, basil, lavender, thyme, oregano. I entered the corresponding lines and saved the data to companionPlants.csv
> setwd("C:/Users/vlado/DL/data/kaggle/companionPlants") > source("https://raw.githubusercontent.com/bavla/Rnet/master/R/Pajek.R") > CP <- read.csv("companionPlants.csv") > dim(CP) > head(CP) > S <- factor(CP$Source.Node) > D <- factor(CP$Destination.Node) > L <- union(levels(D),levels(S)) > S <- factor(CP$Source.Node,levels=L) > D <- factor(CP$Destination.Node,levels=L) > R <- factor(CP$Link) > uvFac2net(S,D,r=R,Net="companionPlants.net") > N <- rep("?",length(L)) > for(i in 1:length(S)) N[S[i]] <- CP$Source.Type[i] > T <- factor(N) > TL <- levels(T) > paste(paste(1:length(TL),TL,sep=": "),collapse=", ") [1] "1: ?, 2: flowers, 3: fruits, 4: herbs, 5: vegetables" > vector2clu(T,Clu="companionPlants.clu")
Compare with: