Re: [R] How to import and create time series data frames in an efficient way?

2019-11-17 Thread Jeff Newmiller
The pattern argument is supposed to be a regular expression, not a file globbing expression, so "." matches anything, and "*" is not supposed to be the first character of the search string (read ?regex). Also, I think you forgot to indicate where the ldply function came from.. the plyr

Re: [R] How to import and create time series data frames in an efficient way?

2019-11-17 Thread Nhan La
Thanks Bert. I also managed to get this work files = list.files(pattern="*.txt") df = ldply(files, read_csv,col_names=c("ticker","date","open","high", "low", "close", "volume")) Cheers, Nathan On Fri, Nov 15, 2019 at 3:45 PM Bert Gunter wrote: > Ha! -- A bug! "Corrected" version inline below:

Re: [R] How to import and create time series data frames in an efficient way?

2019-11-14 Thread Bert Gunter
Ha! -- A bug! "Corrected" version inline below: Bert Gunter On Thu, Nov 14, 2019 at 8:10 PM Bert Gunter wrote: > Brute force approach, possibly inefficient: > > 1. You have a vector of file names. Sort them in the appropriate (time) > order. These names are also the component names of all the

Re: [R] How to import and create time series data frames in an efficient way?

2019-11-14 Thread Bert Gunter
Brute force approach, possibly inefficient: 1. You have a vector of file names. Sort them in the appropriate (time) order. These names are also the component names of all the data frames in your list that you read in, call it yourlist. 2. Create a vector of all the unique ticker names, perhaps

Re: [R] How to import and create time series data frames in an efficient way?

2019-11-14 Thread Nhan La
Hi Bert, I've attempted to find the answer and actually been able to import the individual data sets into a list of data frames. But I'm not sure how to go ahead with the next step. I'm not necessarily asking for a final answer. Perhaps if you (I mean others as well) would like a constructive

Re: [R] How to import and create time series data frames in an efficient way?

2019-11-14 Thread Bert Gunter
So you've made no attempt at all to do this for yourself?! That suggests to me that you need to spend time with some R tutorials. Also, please post in plain text on this plain text list. HTML can get mangled, as it may have here. -- Bert "The trouble with having an open mind is that people keep

[R] How to import and create time series data frames in an efficient way?

2019-11-14 Thread Nhan La
I have many separate data files in csv format for a lot of daily stock prices. Over a few years there are hundreds of those data files, whose names are the dates of data record. In each file there are variables of ticker (or stock trading code), date, open price, high price, low price, close