ABSTRACT

The focus of this chapter is on creating data structures within R, importing data structures into R, and exporting or saving data structures for later recall. The chapter begins with some basic ways to create vectors, factors, lists, data frames, and matrices in R through coding in script files, and saving and recalling these at a later time. Included also are some coding tips and techniques on generating number sequences and random samples. Other ways of importing data into an R session include reading text and csv files, importing data from the internet, and from file formats other than text or csv formats. Also discussed are ways to code missing data and ways to handle datasets with missing entries. The methods demonstrated extend to larger datasets, and the reader is provided two useful directions to follow for very large datasets.