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

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

Reply
Anonymous
Not applicable

r script returns text values and not attachments in dataset

Hi,

 

I have just started working with Rscript. I am trying to filter columns based on pattern matching using regex in R-Script.

 

# 'dataset' holds the input data for this script
dataset$StrDate<- as.character(dataset$Subject)

x<-as.character(dataset$StrDate)

pattern <- "^[[:alpha:]]{4}\\s\\d{2}\\.\\d{2}\\.\\d{2}"
isMatch <- function(x) {grepl(pattern, as.character(x), ignore.case=TRUE)}
dataset$Flag=isMatch(x)

output<-dataset

 

 

My input table contains columns such as Subject, Attachments,Body,Sender etc. The attachment column has tables containing pdf attachments. However, the output from the above code is a Name, Value table. After I expand the values column I get all the columns in text format. I need the pdf attachments in Attachments column. Can someone please help with this issue.

 

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous,

 

What is your data source then? Could you please share it to me together with your excepted result? So that I can test it my side.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Thanks for your response!

 

I am extracting my inbox email data here from Microsoft exchange online. I cant send across the dataset due to company policy but I am attaching snapshot of all the columns.Capture.PNGCapture1.PNG

 

Since I want all the emails in the inbox from Cash team I am trying to filter out all the RE: and Fw: here using Rscript. After I filter the emails R-script returns me the following table.

 

Capture2.PNG

 

On expanding the values column I see that my input table column values have been converted to string format. Since in the next steps I want to extract the pdf attachment in table under Attachments column, i am not able to do so anymore.

 

I hope the problem and solution expected is clear. 

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Kudoed Authors