oliver at first.in-berlin.de
2009-Jan-07 19:50 UTC
[Rd] Parse-Error creates strange function calls (completely different printouts) (PR#13436)
Full_Name: Oliver Bandel Version: R version 2.7.1 (2008-06-23) OS: Linux (Debian Lenny) Submission from: (NULL) (88.73.82.147) Hello, I have written a small R-script. When I inserted one line of code, the behaviour was completely different! Instead of just printing one line more to the output, the complete call of the function in which this line was added, is different, and instead of one such call, the function seems to be called more than once! I just added a line, which prints some data, but then the printouts were completely different than expected; and when commenting the new stuff out, the OK-behaviour came back. Here a diff of the code: ====================================oliver at siouxsie:~/R-BUG$ diff ok.R buggy.R 64c64 < res.txt <- paste(# "\n\n Anzahl der Messungen:", sample_times, "\n", ---> res.txt <- paste("\n\n Anzahl der Messungen:", sample_times, "\n",oliver at siouxsie:~/R-BUG$ ===================================== You see, I only wanted to print out a variable. But the output is much bigger now: ************************************** oliver at siouxsie:~/R-BUG$ wc -l LOG.* 125 LOG.buggy 50 LOG.ok 175 insgesamt oliver at siouxsie:~/R-BUG$ ************************************** The variable sample_times is just an array with some numbers: ######################################> ls()[1] "anemo.freq" "anemo.impulse_times" "anemo.T" [4] "impulse_num" "impuls.messreihe" "make_one_sample_set" [7] "sample.dauer" "sample.freq" "sample_num" [10] "sample.T" "sample_times"> sample_times[1] 0 1 2 3 4 5 6 7 8 9> mode(sample_times)[1] "numeric"> class(sample_times)[1] "numeric">###################################### So, the change in the code could not bring such a strange result! I could provide the original code for you, if you need it for testing. Please send me email, if you need it. Best, Oliver Bandel
Duncan Murdoch
2009-Jan-08 11:22 UTC
[Rd] Parse-Error creates strange function calls (completely different printouts) (PR#13436)
This is not a bug. Read ?paste: if you give it a vector, it will give you a vector result. That's what you're seeing. Duncan Murdoch oliver at first.in-berlin.de wrote:> Full_Name: Oliver Bandel > Version: R version 2.7.1 (2008-06-23) > OS: Linux (Debian Lenny) > Submission from: (NULL) (88.73.82.147) > > > Hello, > > I have written a small R-script. > When I inserted one line of code, the behaviour was completely different! > > Instead of just printing one line more to the output, > the complete call of the function in which this line was added, > is different, and instead of one such call, the function seems to be > called more than once! > > I just added a line, which prints some data, > but then the printouts were completely different than > expected; and when commenting the new stuff out, > the OK-behaviour came back. > > > Here a diff of the code: > > ====================================> oliver at siouxsie:~/R-BUG$ diff ok.R buggy.R > 64c64 > < res.txt <- paste(# "\n\n Anzahl der Messungen:", sample_times, "\n", > --- > >> res.txt <- paste("\n\n Anzahl der Messungen:", sample_times, "\n", >> > oliver at siouxsie:~/R-BUG$ > =====================================> > You see, I only wanted to print out a variable. > > > But the output is much bigger now: > > ************************************** > oliver at siouxsie:~/R-BUG$ wc -l LOG.* > 125 LOG.buggy > 50 LOG.ok > 175 insgesamt > oliver at siouxsie:~/R-BUG$ > ************************************** > > > The variable sample_times is just an array with some numbers: > ###################################### > >> ls() >> > [1] "anemo.freq" "anemo.impulse_times" "anemo.T" > [4] "impulse_num" "impuls.messreihe" "make_one_sample_set" > [7] "sample.dauer" "sample.freq" "sample_num" > [10] "sample.T" "sample_times" > >> sample_times >> > [1] 0 1 2 3 4 5 6 7 8 9 > >> mode(sample_times) >> > [1] "numeric" > >> class(sample_times) >> > [1] "numeric" > > ###################################### > > > So, the change in the code could not bring such a strange result! > > I could provide the original code for you, > if you need it for testing. > Please send me email, if you need it. > > Best, > Oliver Bandel > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
Reasonably Related Threads
- Parse-Error creates strange function calls (completely different (PR#13438)
- Strange behaviour of paste
- Custom printouts in reports
- Suppressing final spaces in data.frame printouts
- [1122] trunk/wxruby2/swig/classes/PrintPreview.i: Mark the PrintOuts associated with a Preview to prevent premature