Alas, I can’t find a way to add a file as an attachment, since I,m adding a foreign file, it’s a real pain, unless it created a DataFrame code line, that I can access. When I add the line you provided, I don’t get the matching error, now my error is
ERROR: MethodError: no method matching ChisqTest(::Array{Any,1})
I think that means it’s looking at all the values for Q1, but not all the data, that I want to compare actual to expected. Should I be using one of the packages you mentioned? I’m think I have the indexers mostly understood, but I’m not sure how to include all the rows in a column.
using XLSX, DataFrames, HypothesisTests
# Set up - create a dummy data set and write out to xlsx
out = DataFrame(Q1 = [1,2,3,4,5],
Q2 = [1.0, 2.0, 3.0, 4.0, 5.0])
XLSX.writetable("df.xlsx", collect(eachcol(out)), names(out))
# Use XLSX to read data into DataFrames
df = DataFrame(XLSX.readtable("df.xlsx", "Sheet1")...)
# Perform ChisqTest
ChisqTest(identity.(df.Q1))
The DataFrames indexing documentation is here, which explains amongst other things the usage of ! as a row indexer.
name in the above is just a temporary variable used in the loop to iterate over the column names (which are contained in names(df)). If this isn’t clear to you you might benefit from a more basic introduction to programming in Julia - the official manual is a good starting point, as is Ben Lauwens’ Think Julia