convert - Maple Help

DataSets[Builtin][Reference]

 convert
 convert built-in reference to another data type

 Calling Sequence convert(ref, conversion, extra)

Parameters

 ref - built-in data reference object conversion - name; convert to this type extra - (optional) extra arguments for the conversion

Description

 • The convert command can convert to an Array, Matrix, listlist, Vector, or list.
 • The conversions to Array, Matrix, and Vector accept any number of extra arguments which are passed to the appropriate data structure constructor. You can use this to, for example, set the order of the new data structure by passing a order = o option.
 • Data sets are typically large enough that converting the whole data set will require a substantial amount of time to download all the metadata. Converting smaller subsets will take less time.

Examples

 > $\mathrm{with}\left(\mathrm{DataSets}\right):$
 > $\mathrm{ref}≔\mathrm{Reference}\left("Builtin","Country"\right)$
 ${\mathrm{ref}}{≔}\left[\begin{array}{ccccc}{\mathrm{Country \left(Name\right)}}& {\mathrm{Currency Code}}& {\mathrm{2 Letter Country Code}}& {\dots }& {\mathrm{\left(57 more\right)}}\\ {\mathrm{Afghanistan}}& {"AFN"}& {"AF"}& {\dots }& {}\\ {\mathrm{Albania}}& {"ALL"}& {"AL"}& {\dots }& {}\\ {\mathrm{Algeria}}& {"DZD"}& {"DZ"}& {\dots }& {}\\ {⋮}& {⋮}& {⋮}& {\ddots }& {}\\ {\mathrm{\left(182 more\right)}}& {}& {}& {}& {}\end{array}\right]$ (1)

The data in this data set as a Matrix:

 > $\mathrm{convert}\left(\mathrm{ref}\left[1..3,1..3\right],'\mathrm{Matrix}'\right)$
 $\left[\begin{array}{cccc}{"Afghanistan"}& {"AFN"}& {"AF"}& {"af"}\\ {"Albania"}& {"ALL"}& {"AL"}& {"al"}\\ {"Algeria"}& {"DZD"}& {"DZ"}& {"dz"}\end{array}\right]$ (2)

The data as a list of lists:

 > $\mathrm{convert}\left(\mathrm{ref}\left[1..3,1..3\right],'\mathrm{listlist}'\right)$
 $\left[\left[{"Afghanistan"}{,}{"AFN"}{,}{"AF"}{,}{"af"}\right]{,}\left[{"Albania"}{,}{"ALL"}{,}{"AL"}{,}{"al"}\right]{,}\left[{"Algeria"}{,}{"DZD"}{,}{"DZ"}{,}{"dz"}\right]\right]$ (3)
 > $\mathrm{refg}≔\mathrm{Reference}\left("Builtin","GeoNames"\right)$
 ${\mathrm{refg}}{≔}\left[\begin{array}{ccccc}{\mathrm{Geonames \left(GeoNamesid\right)}}& {\mathrm{Name}}& {\mathrm{Type}}& {\dots }& {\mathrm{\left(7 more\right)}}\\ {\mathrm{68}}& {\mathrm{Boneh-ye Mehdi}}& {"section of populated place"}& {\dots }& {}\\ {\mathrm{121}}& {\mathrm{Lab Sefid}}& {"locality"}& {\dots }& {}\\ {\mathrm{166}}& {\mathrm{Gorizi}}& {"locality"}& {\dots }& {}\\ {⋮}& {⋮}& {⋮}& {\ddots }& {}\\ {\mathrm{\left(1155858 more\right)}}& {}& {}& {}& {}\end{array}\right]$ (4)
 > $\mathrm{convert}\left(\mathrm{refg}\left[\left[\mathrm{Name}="Paris",1000000<\mathrm{Population}\right]\right],'\mathrm{Matrix}'\right)$
 $\left[\begin{array}{cccccccccc}{"2968815"}& {"Paris"}& {"second-order administrative division"}& {48.8534000000000006}& {2.34859999999999980}& {"France"}& {"Ile-de-France"}& {"Paris"}& {2257981}& {"Europe/Paris"}\\ {"2988506"}& {"Paris"}& {"third-order administrative division"}& {48.8533899999999974}& {2.34864000000000006}& {"France"}& {"Ile-de-France"}& {"Paris"}& {2257981}& {"Europe/Paris"}\\ {"2988507"}& {"Paris"}& {"capital of a political entity"}& {48.8534099999999967}& {2.34880000000000022}& {"France"}& {"Ile-de-France"}& {"Paris"}& {2138551}& {"Europe/Paris"}\end{array}\right]$ (5)

Compatibility

 • The DataSets[Builtin][Reference][convert] command was introduced in Maple 2015.