Learn R Programming

prettifyAddins (version 2.6.1)

prettify_FCA: Prettify Java, JSON or Ruby

Description

Prettify Java code, JSON code or Ruby code.

Usage

prettify_FCA(contents = NA, language = NA)

Value

The pretty code in a character string.

Arguments

contents

the code to be prettified; there are three possibilities for this argument: NA (default), to use the file currently opened in RStudio; the path to a file; or the code given as a character vector

language

the language of the code, such as "json"; see getPrettifiableLanguages; if the contents are read from a file and language=NA, then the language is guessed from the file extension

Examples

Run this code
library(prettifyAddins)

code <- c(
  "{a: [0,1,  2   ],",
  "f:  function( x){return x+1}}" # this function will be prettified too
)

if (FALSE) {
cat(prettify_FCA(code, "json"))}

Run the code above in your browser using DataLab