Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hey,
I have the following table in my Power BI. I want to create an R Visual out of this.
| Throughput | Label | ThroughputAgegroup |
| 611 | Assess reimbursement | 1-3 Maanden |
| 1191 | Assess reimbursement | 3-6 Maanden |
| 104 | Authorized | 3-6 Maanden |
| 148 | Cancelled | 1-3 Maanden |
| 765 | Cancelled | 3-6 Maanden |
| 4215 | Closed | 0-14 Dagen |
| 57098 | Closed | 1-3 Maanden |
| 14180 | Closed | 15-30 Dagen |
| 26631 | Closed | 3-6 Maanden |
| 14813 | Closed | 6-12 Maanden |
| 52347 | Closed | Groter dan 12 maanden |
| 1565 | Dispatched | 1-3 Maanden |
| 56 | Dispatched | 15-30 Dagen |
| 391 | Dispatched | 3-6 Maanden |
| 107 | Intake | 1-3 Maanden |
| 805 | Ready for closure | 1-3 Maanden |
| 111 | Ready for closure | 3-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 Dagen | 1-3 Maanden | 15-30 Dagen | 3-6 Maanden | 6-12 Maanden | Groter 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
Solved! Go to Solution.
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.
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.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 45 | |
| 35 | |
| 30 | |
| 15 | |
| 15 |
| User | Count |
|---|---|
| 58 | |
| 55 | |
| 38 | |
| 21 | |
| 21 |