The context
Let's suppose we have the following two files
File: 1.csv
labels,quantity
foo1,1
foo2,4
foo3,6
File: 2.csv
labels,quantity
foo with spaces 1,1
foo with spaces 2,4
foo with spaces 3,6
and we want to create a parallel coordinates plot for each of those two data sets.
The following code loads the data from 1.csv
into df1
and plot it.
library('echarts4r')
df1 <- read.csv('1.csv')
df1 |>
e_charts() |>
e_parallel(labels, quantity)
The following code loads the data from 2.csv
into df2
and plot it.
library('echarts4r')
df2 <- read.csv('2.csv')
df2 |>
e_charts() |>
e_parallel(labels, quantity)
The problem
As you can see above, df2
doesn't show the lines as occurs when plotting df1
. I suppose this happens because of the spaces found in 2.csv
, so why does this behavior occur when my data contain spaces?
Additional information
I executed both str
and summary
in both data sets to find the reason why this occur, but the information was the same.
summary(df1)
summary(df2)
labels quantity
Length:3 Min. :1.000
Class :character 1st Qu.:2.500
Mode :character Median :4.000
Mean :3.667
3rd Qu.:5.000
Max. :6.000
labels quantity
Length:3 Min. :1.000
Class :character 1st Qu.:2.500
Mode :character Median :4.000
Mean :3.667
3rd Qu.:5.000
Max. :6.000
str(df1)
str(df2)
'data.frame': 3 obs. of 2 variables:
$ labels : chr "foo1" "foo2" "foo3"
$ quantity: int 1 4 6
'data.frame': 3 obs. of 2 variables:
$ labels : chr "foo 1" "foo 2" "foo 3"
$ quantity: int 1 4 6