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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.