[R] R ignoring quantile() in source()d file

Andrew Perrin aperrin at socrates.berkeley.edu
Mon Feb 26 02:18:20 CET 2001


Can anyone explain this behavior? Essentially, I've created a short file
to be read in via source() that gets some descriptive information on a
series of variables in a data frame.  For each variable, I do three
things:

print('last.hc.actors')
quantile(last.hc.actors,probs=seq(0,1,0.1),na.rm=T)
stem(last.hc.actors)

where the variable name is (in this case) last.hc.actors.  All that is
fine, except that R seems to quietly ignore all the quantile() steps.  I
narrowed it down to bare minimum, trying with a file, test.R, that
contains simply:

quantile(last.hc.actors,probs=seq(0,1,0.1),na.rm=T)

and here's the result:
> source('test.R')
> 

on the other hand, if I make test.R be simply:

stem(last.hc.actors)

here's the result:
> source('test.R')

  The decimal point is 1 digit(s) to the right of the |

   0 |
00000000000000000000000000000000000000000000000000000000000000000000+451
   1 |
00000000000000000000000000000000000000000111111111111111111111111111+298
   2 |
00000000000000000000000000000000011111111111111111111111111111111222+227
   3 |
00000000000000000000000000001111111111111111111111111111222222222222+175
   4 |
00000000000000000000001111111111111111111111222222222222222222222233+139
   5 |
00000000000000000000111111111111111111122222222222222222223333333333+109
   6 |
00000000000000000011111111111111111122222222222222222233333333333333+100
   7 |
00000000000000000011111111111111111122222222222222222233333333333333+100
   8 |
00000000000000001111111111111111222222222222222233333333333333344444+61
   9 |
00000000000001111111111111222222222223333333333444444444555555556666+14
  10 | 00000001111111222222233333334444444555555666666777777888888999999
  11 | 00000111112222233333444445555566667777888999
  12 | 000111222333444555666777888999
  13 | 0011223456789
  14 | 0123456789
  15 | 0123456789
  16 | 0123456789
  17 | 0123456789
  18 | 01

> 
 (sorry for the poor line wrapping)

Finally, the quantile() command works fine directly pasted onto the
command line:

> quantile(last.hc.actors,probs=seq(0,1,0.1),na.rm=T)
  0%  10%  20%  30%  40%  50%  60%  70%  80%  90% 100% 
   0    4   10   16   24   34   45   59   74   91  181 
> 

any ideas? Thanks.
 
----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology  
Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin
        aperrin at socrates.berkeley.edu - aperrin at igc.apc.org

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list