File Menu

(Getting data into and out of iNZight (Import, Paste, Examples, Export); Preferences=program controls)

The File menu provides 4 ways of getting data into iNZight
  •  Importing a file on your computer (Import data …)
  •  Importing a file from an internet url (Import data …)
  •  Copying and pasting data from programs like from Excel or Google sheets (Paste from …)
  •  Built-in Example data sets (Example data …)

The File menu also allows for saving/exporting data. e.g., if you have modified it in some way in iNZight (Export data …)

Contents

File Menu

Import data

Import dialog

By default imports from a file on your computer. Throws up a browser button to initiate a dialog for navigating to the file you want.

Import-file

On clicking the Import from url checkbox the behaviour changes (as below)

Import-url

Type or paste in the url address of the file you want to import
(when pasting a full url, ensure the prepopulated “https:// ” is overwritten)

File types

NZight assumes that data sets are in rows = cases by columns = variables format

iNZight can import files of the following types:
  •  Comma Separated Values text files (.csv)
  • Tab-delimited Text files (.txt)
  • 97-2003 Excel files (.xls)
  • 2007 Excel files (.xlsx)
  • SPSS files (.sav)
  • SAS Data files (.sas7bdat)
  • SAS Xport files (.xpt)
  • STATA fles (.dta)
  • R Object files (.rds)
  • RData files (.RData, .rda)

By default, iNZight identifies the type of the file being imported by looking for one of these filename extensions. iNZight attempts to read the file and populate the Preview panel. If no preview appears iNZight has been unable to read the file.

Click the Import button (at bottom right) when you are happy with what appears in the Preview panel.

The Advanced Options at the bottom-left of the Import dialog box (Click on the “+” to expand) allows you to change default behaviour.

Metadata in csv files

(Metadata is information about the data.)

When .csv files and are .txt files are imported into iNZight, all lines in the data file beginning with a "#" are ignored (there is one exception below).

This enables you to include metadata in your .csv or .txt data files by starting each line of metadata information with a "#".

With .csv files, you can go further and include instructions telling iNZight to treat variables in various ways. This is particularly useful for instructing iNZight to order the levels of a categorical variable in a desired way, rather than the default way.

Lines starting with #' @ are interpreted by iNZight's smart read function as containing instructions of this form

Example:
We will use the following lines from the top of the file at ... https://www.stat.auckland.ac.nz/~wild/data/test/CensusAtSchool-500-w-meta.csv to show how this works.

## --- Meta Data --- ##
#' @factor gender[male,female]
#' @factor cellsource[pocket,parent,job,other]
#' @factor getlunch[home,tuckshop,dairy,school,friend,none]
#' @numeric age
#' @factor year
#' @factor school=year[primary=5|6,intermediate=7|8,high=9|10|11]
#' @factor travel[walk,bike,car=motor,public=bus|train,other]
#' @factor cellsource
#' @numeric phonebill=cellcost
## --- Data --- ##

Note: By default in R, and therefore iNZight, the categories (levels) of a categorical variable (factor) are ordered alphanumerically.

The 1st (real) line above is an instruction for gender to be treated as a categorical variable (factor) with levels in the order "male, female", rather than the alphabetic default "female, male". The next 2 lines are doing the same sort of reorderings for cellsource and getlunch.

year in the data file has numeric values ranging from 4 to 13 and so by default will be treated as a numeric variable. "#' @factor year " is an instruction to treat it as a categorical variable (factor).

The next line, "#' @factor school=year[primary=5|6,intermediate=7|8,high=9|10|11]" is an instruction to construct a new categorical variable called school from year in which students in year-levels 5 & 6 become a category called "primary", ..., those in year-levels 9 to 11 become a category called "high". Year-levels 4, 12 an 13 are not mentioned in the statement so those categories remain unchanged and sort after those mentioned in the statement.

The next line redefines travel by combining categories "bus" and "train" into a category called "public".

Export dialog

Export data ...






Clicking “Open” initiates this dialog ...

Export-open dialog

















Export dialog This brings you back to ...

Choose from allowable file extensions and click OK

(If you have already put the correct extension on your filename you can click OK without choosing an file type extension)

Paste from ...

This enables copying and pasting data from sources like Excel files or Google sheets

Click Load when finished

Example data ...

Enables the loading of data files stored inside iNZight.

First select a Module (package) and then a Dataset stored with that Module.

Preferences dialog

Preferences ...

Preferences enables changing some of the behaviours of iNZight such as default window and font sizes.

Preference changes do not take effect until the next time you start up iNZIght.

Single window versus Dual-window display
While single-window is the default, dual-window mode is better for all Windows users except computer novices.

Window modes