Re: [R] using cat to log to file with sapply

2018-02-14 Thread Bert Gunter
Not sure what you wanted to do.Note that you have "test'txt" and "log.txt" in your code. Using only "test.txt", the following worked fine for me: letters[1:5]->x logf<-"test.txt" cat('%%\n',file=logf) catf<-function(x,...,logfile='test.txt', append=TRUE){ cat(x,'\n',

Re: [R] using cat to log to file with sapply

2018-02-14 Thread Jeff Newmiller
Your call to catf in testit is after the return, so it is never called. FWIW my antibugging strategy (and readability strategy) is to never use the return function... I structure my logic to end up at the end with my desired function result in a variable and I simply put that variable on the

Re: [R] using cat to log to file with sapply

2018-02-14 Thread William Dunlap via R-help
testit<-function(x,...){ paste0('this is x: ',x)->y return(y) catf("++test=",...) } You return from the function before calling catf(). Remove the 'return(y)' and make 'y' the last expression in the function. Bill Dunlap TIBCO Software wdunlap tibco.com On

[R] using cat to log to file with sapply

2018-02-14 Thread Alexander.Herr
Hi List, I am trying to write unsuccessfully to a logfile with cat. Here my example code: letters[1:5]->x logf<-"test.txt" cat('%%\n',file=logf) catf<-function(x,...,logfile='log.txt', append=TRUE){ cat(x,'\n', file=logfile, append=append)} testit<-function(x,...){

Re: [R] using cat()

2009-08-13 Thread tsgiss
Ricardo Rodríguez wrote: Please, could you give me an example about how to use cat() to read the value of a variable in a function? Any other way? I've found how to make it globally available, thus printing it, but I don't know how to read out the value of any variable within the

Re: [R] using cat()

2009-08-07 Thread [Ricardo Rodriguez] Your XEN ICT Team
Thanks, Bill bill.venab...@csiro.au wrote: fn - function(x) { j - x+1 cat(the value of j is , j, \n) j } fn(1:10) It is clear for me now the use of cat(). As Steve pointed out in his mail, I've failed at providing an example, one of the rules of thumb of this list!

Re: [R] using cat()

2009-08-07 Thread [Ricardo Rodriguez] Your XEN ICT Team
Thanks, Steve, Steve Lianoglou wrote: It seems like you're asking to use cat() for something it's not meant to do. cat() is generally used to write output, either to the screen or to a file. Sorry for not adding an example to my first post! And yes, I was trying to use it for something it

Re: [R] using cat()

2009-08-07 Thread [Ricardo Rodriguez] Your XEN ICT Team
Sorry, [Ricardo Rodriguez] Your XEN ICT Team wrote: eval(parse(text=getauth('http://tinyurl.com/ne5bl3',user,pass))) I get NULL. Please, use DummyDummy as user and dummy as pass if you want to try it. Thanks. I think the proposed URL could present some more problems. Please, use this

[R] using cat()

2009-08-06 Thread [Ricardo Rodriguez] Your XEN ICT Team
Please, could you give me an example about how to use cat() to read the value of a variable in a function? Any other way? I've found how to make it globally available, thus printing it, but I don't know how to read out the value of any variable within the function. Thanks for your help,

Re: [R] using cat()

2009-08-06 Thread Steve Lianoglou
Hi, On Aug 6, 2009, at 7:25 PM, [Ricardo Rodriguez] Your XEN ICT Team wrote: Please, could you give me an example about how to use cat() to read the value of a variable in a function? Any other way? Can you please give an example of what you're trying to do? It seems like you're asking to

Re: [R] Using 'cat' on data frame

2008-12-24 Thread David Winsemius
On Dec 24, 2008, at 2:35 AM, Gundala Viswanath wrote: Dear all, I have the following data frame: raw.count Var1 Freq 1 AA 707 2 AC14 3

[R] Using 'cat' on data frame

2008-12-23 Thread Gundala Viswanath
Dear all, I have the following data frame: raw.count Var1 Freq 1 AA 707 2 AC14 3 AT 3 But why when printint it using 'cat',

Re: [R] Using 'cat' on data frame

2008-12-23 Thread Veslot Jacques
-Message d'origine- De : r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] De la part de Gundala Viswanath Envoyé : mercredi 24 décembre 2008 08:35 À : r-h...@stat.math.ethz.ch Objet : [R] Using 'cat' on data frame Dear all, I have the following data frame: raw.count