Search code examples
maple

using stats[importdata]( ) to import file


I want to import a file using statsimportdata and do an histogram but when i do:

with(stats);
newdata:=importdata("data1.dat"):
histogram(newdata)

it gives me an :Error, (in stats/statplots/functions/histogram) bad argument to histogram 95.0 I think the problem is that it saves a data into a sequence not into a list, but I am required to use the import data. Any idea what to do?


Solution

  • You can quickly turn an expression sequence into a list by wrapping it in square brackets.

    For example,

    newdata := [ importdata("data1.dat") ]:
    

    Judging solely from the error message you've cited, it does look as if your problem is that you were passing a sequence rather than a list.

    By the way, the command Statistics:-Histogram can handle large amounts of data much faster than can the command stats[statplots,histogram]. The former has been available for several years (several major releases of Maple), and is generally more powerful.