Re: [R] Numeric Column Labels in Excel Function

2014-01-28 Thread Gabor Grothendieck
On Tue, Jan 28, 2014 at 6:46 PM, David Winsemius wrote: > > On Jan 27, 2014, at 1:30 PM, Dustin Fife wrote: > > > Hi all, > > > > I frequently get requests to do data analysis where the person > > references an excel column. e.g., "I want to analyze [insert complex > > variable name], located at c

Re: [R] Numeric Column Labels in Excel Function

2014-01-28 Thread David Winsemius
On Jan 27, 2014, at 1:30 PM, Dustin Fife wrote: > Hi all, > > I frequently get requests to do data analysis where the person > references an excel column. e.g., "I want to analyze [insert complex > variable name], located at column AAQ in Excel." I've been doing is > gsub and inserting a part o

Re: [R] Numeric Column Labels in Excel Function

2014-01-27 Thread jim holtman
If you use XLConnect, to can reference the column symbolically to retrieve the data. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Jan 27, 2014 at 4:30 PM, Dustin Fife wrote: > Hi all, > > I freque

Re: [R] Numeric Column Labels in Excel Function

2014-01-27 Thread arun
Sorry, this should work fun1 <- function(n){ vec1 <- LETTERS  if(n <=26){  res <- vec1[seq_len(n)]  }  else if(n>26 & n <=702){ res <-  c(LETTERS,apply(expand.grid(vec1,vec1)[,2:1],1,paste,collapse=""))[1:n] } else if(n >702 & n <=18278){ res <- c(LETTERS,apply(expand.grid(vec1,vec1)[,2:1],1,past

Re: [R] Numeric Column Labels in Excel Function

2014-01-27 Thread Dustin Fife
There seems to be a problem with that function: object 'vec1' not found. On Mon, Jan 27, 2014 at 4:05 PM, arun wrote: > > > HI, > > May be you can try: > > fun1 <- function(n){ > if(n <=26){ > res <- LETTERS[seq_len(n)] > } > else if(n>26 & n <=702){ > res <- > c(LETTERS,apply(expand.grid(v

Re: [R] Numeric Column Labels in Excel Function

2014-01-27 Thread arun
HI, May be you can try: fun1 <- function(n){  if(n <=26){  res <- LETTERS[seq_len(n)]  }  else if(n>26 & n <=702){ res <-  c(LETTERS,apply(expand.grid(vec1,vec1)[,2:1],1,paste,collapse=""))[1:n] } else if(n >702 & n <=18278){ res <- c(LETTERS,apply(expand.grid(vec1,vec1)[,2:1],1,paste,collapse