reulerr

Euler plot from .csv data


I am using eulerr to investigate Euler plots in my data but I am having difficulty getting them to work without a lot of manual transcription. For example, I have the following dummy dataset:

A B C A&B A&C A&B&C
10 13 9 5 6 3

If I use this code (with the manual c() entry, it works well:

library(eulerr)

t <- c(A = 10,
       B = 13,
       C = 9,
       "A&B" = 5,
       "A&C" = 6,
       "A&B&C" = 3)
fitt <- euler(t,shape = "ellipse")
plot(fitt,quantities = TRUE)

However, if I use this, it does not:

library(eulerr)

t2 <- read.csv("MyFilePath\\EulerDummyData.csv")
fitt2 <- euler(t2,shape = "ellipse")
plot(fitt2,quantities = TRUE)

If I try the csv as.list() or as.vector() it still does not work - though with different results; no connection in the ellipses at all. Can anyone suggest what I may be doing wrong? It is probably really obvious to those with the skill, but I cannot really get my head around why one works and the other doesn't, I'm afraid. Many thanks in advance.


Solution

  • library(eulerr)
    library(readr)
    
    t2 <- read_csv("EulerDummyData.csv") |> as.list() |> unlist()
    fitt2 <- euler(t2,shape = "ellipse")
    plot(fitt2, quantities = TRUE)