Qu

csvify

Builtin index · File I/O

result = csvify(table)

Input: table · Output: result

What it is

Converts table (Table) to CSV text — exactly write_csv's own formatting (Table::to_csv), just returned as a string instead of written to a file.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = csvify(table)
table Table or stringnot documented yet
Table scalar or vectora bare scalar/vector has no tabular shape
Returns a string. Errors clearly on anything that isn't a Table (a bare scalar/vector has no tabular shape).

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

t = parse_csv("product,price\nWidget,9.99\nGadget,4.50\n")

csv_text = csvify(t)
json_text = jsonify(t)

back_from_json = json2csv(json_text)   # csvify(parse_json(json_text))

print(back_from_json)

xml_from_csv = csv2xml(csv_text)       # xmlify(parse_csv(csv_text))

csv_from_xml = xml2csv(xml_from_csv)   # csvify(parse_xml(xml_from_csv))

print(csv_from_xml)

xml_from_json = json2xml(json_text)    # xmlify(parse_json(json_text))

json_from_xml = xml2json(xml_from_json) # the row-object array, not jsonify(parse_xml(...))

parsed = parse_json(json_from_xml)      # parse_json accepts that shape too -- back to a real Table

print(nrow(parsed))                     # 2

output
product,price
Widget,9.99
Gadget,4.5

product,price
Widget,9.99
Gadget,4.5

2

from file-io