Not sure what I am missing... I can reproduce the example and some answers by @CJ Yetman, but not the following simple reprex:
library(tibble)
#> Warning: package 'tibble' was built under R version 4.0.5
library(networkD3)
#> Warning: package 'networkD3' was built under R version 4.0.5
sankeyNetwork(Links = tibble(source = c(1,2), target = c(2,3), value = c(1, 2)), Nodes = tibble(name = c("start", "end", "extra")), Source = "source", Target = "target", Value = "value", NodeID = "name",units = "TWh")
#> Links is a tbl_df. Converting to a plain data frame.
#> Nodes is a tbl_df. Converting to a plain data frame.
Created on 2022-07-18 by the reprex package (v2.0.1)
The problem is that your source and target ids need to be 0-indexed like this:
library(tibble)
#> Warning: package 'tibble' was built under R version 4.1.2
library(networkD3)
Links = data.frame(source = c(1,2), target = c(2,3), value = c(1, 2))
Links$source <- Links$source - 1
Links$target <- Links$target - 1
Nodes = data.frame(name = c("start", "end", "extra"))
sankeyNetwork(Links = Links, Nodes = Nodes, Source = "source", Target = "target", Value = "value", NodeID = "name",units = "TWh")
Created on 2022-07-18 by the reprex package (v2.0.1)