0

is there a way in R to assign a format to variables of a dataframe (I am looking for something comparable to the OUTFORMAT in SAS.)?

The canonical advice (like here ) is to use format(..) or formatC(..), but this appears to create just a character-variable. That is fine for printing once, but makes coding a bit burdensome for a sequence like - printing - manipulating - printing again -

Thanks in advance.

GIC
  • 3
  • 2
  • No, there's not a way to assign output formats with normal base R functions. The console output of R isn't meant to look "pretty." You are only expected to format when necessary. In theory you could create your own special data types with special print methods so nothing is impossible, but this isn't something that's built in for the general case. It usually easiest to just write your own function to do formatting when you need to print and then reuse it each time. – MrFlick Feb 28 '22 at 17:30

0 Answers0