'how to print user chosen YAML reference file when knitting RStudio

I have an .rmd where the user can input a file:

enter image description here

The first one, the user selects the path to the file The second one is put in as a default path.

I want to print these references out in my word document. But when I look at the output, I get what appears to be a file location (from the user selected file), and the correct file name and path from the default.

enter image description here Is there a way to get the full path as output from the user selected file?

The code I use is:

---
title: "Untitled"
output: word_document
params:
  data:
    input: file
    label: PA DQ All Member v Output
    value: ""
  data2:
    input: file
    label: PA DQ All Member v Output
    value: "C:/bug.Rmd"
---

`r params$data`

`r params$data2`


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source