.format | R Documentation |
Format objects for error logging
.formatQuote(v) .formatComma(v) .formatParams(v, con = "and") .formatData(v) .formatLog(v, fname = c()) .formatO(v, fname)
v |
character vector; just some strings |
fname |
character; function name |
.log |
character; previous called functions |
character
.formatQuote
: add quotes to the vector elements: "<v[i]>"
.formatComma
: add commas between the vector elements: <v[1]>, <v[2]>, <v[3]>
.formatParams
: format the vector: "<v[1]>", "<v[2]>" and "<v[3]>"
.formatData
: format the vector: <v[1]>$<v[2]>$<v[3]>
.formatLog
: format the vector: "<v[1]>", "<v[2]>" and "<v[3]>" (in <fname>)
.formatO
: format a object name with its calling function
Internal function only for convenience
## Not run: v <- c("one", "two", "three") fname <- "foo" .log <- c("foo1", "foo2", "foo3") .formatQuote(v) #[1] "\"one\"" "\"two\"" "\"three\"" .formatComma(v) #[1] "one, two, three" .formatParams(v) #[1] "\"one\", \"two\" and \"three\"" .formatData(v) #[1] "one$two$three" .formatLog(v) #[1] "\"one\", \"two\" and \"three\"" .formatLog(v, fname) #[1] "\"one\", \"two\" and \"three\" (in foo)" .formatO(.formatLog(v), fname) #[1] "\"\"one\", \"two\" and \"three\"\" (foo)" ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.