Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |