I have a family tree which I can draw directly in R. However I'd like to load the source data in Tableau and use the package directly from within Tableau to display the family tree.
This is the data:
parent child
erik megan
erik marina
erik maureen
karin megan
karin marina
karin maureen
erik helena
erik axel
erik kim
erik robin
karin anna
karin alfred
helena jacobus
helena maria
This is the R script that works fine (without Tableau):
library(GGally);
library(sna);
library(ggplot2);
library(network);
family <- read.table("c:/tmp/family_raw.txt", head=T);
ggnet2(family, label = TRUE);
The calculated field in Tableau however does not return the correct amount of data expected by Tableau:
SCRIPT_STR('
library(GGally);
library(sna);
library(ggplot2);
library(network);
data <- data.frame(parent=.arg1, child=.arg2);
nodes <- ggnet2(family)$data;
paste(nodes[,6],nodes[,7])
', ATTR([Parent]), ATTR([Child]))
Any advice?