0

I have this reproducible set up.

temp <- tempfile()
download.file("https://d396qusza40orc.cloudfront.net/getdata%2Fprojectfiles%2FUCI%20HAR%20Dataset.zip",temp)
datafiles <- unzip(temp)
unlink(temp)

Printing datafiles gives a range of txt files. I can manually merge them by...

mdataset = merge(mydata1.txt, mydata2.txt)
mdataset = merge(mydataset, mydata3.txt)
.
.
.
mytempdata = merge(mytempdata, mydata20.txt)

But this would take a while, and I would rather do it more efficiently.

How would I do this (elegantly)?

  • Thanks for the link. I'm wondering instead of renaming my files, would it be possible to get it to read by the .txt pattern within ```datafiles``` ? –  Jan 19 '20 at 08:56
  • The zip file is the [Public Domain Data Set for Human Activity Recognition Using Smartphones](http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones) data, used for the final project in Johns Hopkins Getting & Cleaning Data course on Coursera. The files include test data, training data, and data dictionaries. You can't just merge them into a single data frame via Reduce. One needs to understand how each file is used to create the test and training data sets and code accordingly. – Len Greski Jan 19 '20 at 13:16
  • @LenGreski. Thanks for replying. Thanks for pointing out about reduce. I'm having trouble where R is sending me the message " Error: cannot allocate vector of size 15.6 Mb ". How can I resolve this? Because using memory.limit() tells me that I still have 16Gb memory. –  Jan 20 '20 at 00:30
  • How much RAM do you have on your machine, and what R function were you using when the memory allocation failed? – Len Greski Jan 20 '20 at 13:02

0 Answers0