Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
Hi,
I can't figure out what I'm doing wrong... No matter what I try, I can't get a custom visual to keep my data as strings, it always does some weird index conversion...
This is my (simply) script.R:
source('./r_files/flatten_HTML.r')
############### Library Declarations ###############
libraryRequireInstall("ggplot2");
libraryRequireInstall("plotly")
####################################################
################### Actual code ####################
fig <- plot_ly(
type = 'table',
cells = list(
values = rbind(Values$id, Values$string)
))
####################################################
############# Create and save widget ###############
p = ggplotly(fig);
internalSaveWidget(p, 'out.html');
####################################################
If I give it a table:
id,string
1,Test1
2,test
3,Test1
4,test
5,not test
I get a visual table:
1,3
2,2
3,3
4,2
5,1
This is driving me nuts and it's probably a really simple answer!
PS I used the defaults generated by:
pbiviz new no_strings -t rhtml
Solved! Go to Solution.
Hey @jschne ,
I assume you are facing the implicit string to factor conversion, this R: rbind string to factor column - Stack Overflow provides two approaches to tackle this challenge.
Hopefully, this provides what you are looking for.
Regards,
Tom
Hey @jschne ,
I assume you are facing the implicit string to factor conversion, this R: rbind string to factor column - Stack Overflow provides two approaches to tackle this challenge.
Hopefully, this provides what you are looking for.
Regards,
Tom
You saved my Friday!
For some reason the code worked in RStudio, but it needed that stringsasFactors to work in the custom viz.
Thanks again!
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 28 | |
| 28 | |
| 20 | |
| 19 | |
| 19 |
| User | Count |
|---|---|
| 35 | |
| 26 | |
| 19 | |
| 18 | |
| 17 |