Hi,

I have a matrix with about 3000 rows, and 1 column. The contents of the matrix 
are stock symbols (IBM, AAPL, etc) for instance. I also have a function that 
takes a single stock symbol as an argument, parses the text of Google Finance 
and returns the related stock symbols that the page has listed into a CSV file. 
For example, IBM would return the following in a CSV file:
 rels
1  ORCL
2   HPQ
3  MSFT
4  CSCO
5   EMC
6  DELL
7   SAP
8  INTC
9    SY
10   CA

I'm  trying to use sapply (or any of the apply functions) to loop through  the 
matrix of 3000 stock symbols and pass them through to my function. I  get the 
following errors when using sapply:

1: In file(con, "r") : only first  element of 'description' argument used
2: In if (file == "") file <- stdout() else if (is.character(file)) { ... :
  the condition has length > 1 and only the first element will be used
3: In file(file, ifelse(append, "a", "w")) :
  only first element of 'description' argument used

I  think it has something to do with the fact that I'm trying to pass a  vector 
as an argument into a function which only accepts a scalar  argument. I've also 
tried "do.call" but can't get any results. How do I  loop through the matrix in 
order to pass each individual stock symbol as  an argument into the function? 
Thanks so much for your help.



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to