MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Import of NIST ANOVA data sets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100087] Re: Import of NIST ANOVA data sets
  • From: Bob F <deepyogurt at gmail.com>
  • Date: Fri, 22 May 2009 23:40:52 -0400 (EDT)
  • References: <gv2juc$9ef$1@smc.vnet.net>

On May 20, 10:05 pm, Adrian <morej... at theward.com> wrote:
> Hello,
>
> I am using Mathematica 7 and if I bring the data set into Excel 2007
> then save it as an .xls file, Mathematica imports the data fine but
> the then the ANOVA fails (Error: "ANOVA::arg1:The 1st argument has
> unequal columns or rows.").  If I save the .xls file as a CSV file,
> import it into Mathematica and run the ANOVA, it runs successfully.
> Any ideas on why the xls import is breaking the ANOVA?
>
> Thanks,
> Adrian.

I believe the issue is that there is the idea of the worksheet that is
part of the Excel data structure. So when Mathematica imports an Excel
file, that data is imported with one additional level of structure
that is associated with which sheet number the data is part of. For
example if the data is:

Needs["ANOVA`"]
llist = {{1, 1, 2}, {1, 1, 3}, {1, 2, 4}, {1, 2, 3}, {2, 1, 5}, {2, 1,
     4}, {2, 2, 4}, {2, 2, 2}};
ANOVA[llist, {x, y}, {x, y}]

Export["xxx.xls", llist]
Export["xxx.csv", llist]

xlist = Import["xxx.xls"]
clist = Import["xxx.csv"]
ANOVA[nlist, {x, y}, {x, y}]
ANOVA[clist, {x, y}, {x, y}]

You will notice that the import of the XLS file comes in as a list
with one element having 8 more elements each having 3 values, and the
CSV import comes in as a list of 8 elements each having 3 values.

So all you need to do is specify just the first element of the XLS
data, e.g.

ANOVA[nlist[[1]], {x,y}, {x,y}]

to get the desired result. If you had multiple worksheets in the XLS
file, you could also get at them with the appropriate element
specifier.

-Bob


  • Prev by Date: Re: Re: math glyphs from non-Mathematica font
  • Next by Date: Copy error message from messages window to clipboard?
  • Previous by thread: Re: Import of NIST ANOVA data sets
  • Next by thread: Legend for DateListPlot