Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
NielsDecoene
Helper I
Helper I

R issue how do i plot this.

Hey,

I have the following table in my Power BI. I want to create an R Visual out of this.

ThroughputLabelThroughputAgegroup
611Assess reimbursement1-3 Maanden
1191Assess reimbursement3-6 Maanden
104Authorized3-6 Maanden
148Cancelled1-3 Maanden
765Cancelled3-6 Maanden
4215Closed0-14 Dagen
57098Closed1-3 Maanden
14180Closed15-30 Dagen
26631Closed3-6 Maanden
14813Closed6-12 Maanden
52347ClosedGroter dan 12 maanden
1565Dispatched1-3 Maanden
56Dispatched15-30 Dagen
391Dispatched3-6 Maanden
107Intake1-3 Maanden
805Ready for closure1-3 Maanden
111Ready for closure3-6 Maanden

 

So i proceded to install all the correct R installations and packages, i produced some R shaping to the table :

> str(dataset)
'data.frame': 17 obs. of 3 variables:
$ Throughput : int 611 1191 104 148 765 4215 57098 14180 26631 14813 ...
$ Label : Factor w/ 7 levels "Assess reimbursement",..: 1 1 2 3 3 4 4 4 4 4 ...
$ ThroughputAgegroup: Factor w/ 6 levels "0-14 Dagen","1-3 Maanden",..: 2 4 4 2 4 1 2 3 4 5 ...
> test <- cast(dataset, Label ~ ThroughputAgegroup, mean, value = 'Throughput')
> test
To get the following table:

Label
0-14 Dagen1-3 Maanden15-30 Dagen3-6 Maanden6-12 MaandenGroter dan 12 maanden 
        
1
Assess reimbursement
NaN
611
NaN
1191
NaN
NaN
2
Authorized
NaN
NaN
NaN
104
NaN
NaN
3
Cancelled
NaN
148
NaN
765
NaN
NaN
4
Closed
4215
57098
14180
26631
14813
52347
5
Dispatched
NaN
1565
56
391
NaN
NaN
6
Intake
NaN
107
NaN
NaN
NaN
NaN
7
Ready for closure
NaN
805
NaN
111
NaN
NaN

 

Now I want to visualize this, when i try plotting this using:

corrplot(test, method = "circle", tl.cex=0.6, tl.srt = 45, tl.col = "black", type= "upper", order="hclust")

to get a nice visualisation i'm prompted with the following error: 
Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr, :
length of 'dimnames' [2] not equal to array extent
In addition: Warning message:
In Ops.factor(left, right) : ‘<’ not meaningful for factors

 

Is there any way to visualize this? So that for each match in the matrix a Cirlce with a shape is created? NaN values can be blank.

 

Tyvm in advance

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Is ggplot going to be better for what you need - e.g.

 

library(ggplot2) #Required for ggplot

ggplot(dataset, aes(x=`ThroughputAgegroup`, y=`Label`)) +
  geom_point(size=10, alpha=0.1) +
  geom_text(aes(label=`Throughput`), size=3) 

You'll still need to work with the formatting - e.g. in my quick test, I couldn't get the X axis on top.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Is ggplot going to be better for what you need - e.g.

 

library(ggplot2) #Required for ggplot

ggplot(dataset, aes(x=`ThroughputAgegroup`, y=`Label`)) +
  geom_point(size=10, alpha=0.1) +
  geom_text(aes(label=`Throughput`), size=3) 

You'll still need to work with the formatting - e.g. in my quick test, I couldn't get the X axis on top.

Thanks alot Steve, i'll start right away to see what the pieces of code do so I can apply my formatting. 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors