I am studying R and within the first 3 lines of demo("graphics") I get completely stuck. could you 1. give me the answer so I can move on 2. tell me how I might find the answer. On my mac OSX, the first command is equivalent to get("quartz")() now get("quartz") would be a regular function format but what is get () ()? what kind of beast? does get() return a function? I run demo("graphics") and of course I want to stop it right away, without running through the whole demo, how do I STOP IT! CANCEL IT? (it gets stuck on hit return to continue lines) Then I want to look at the program that generated demo("graphics") and I find a graphic file, but no demo fx. where is the demo("graphics") fx physically on my computer? how do I find it on a Mac? Then I want to list the program, but I can't fine a fx which list the code of a function. Sorry, it must seem very basic. But I searched through the R intro and through the R lists and I can't find the answer. Thanks for your help Anne
Anne G <anne at wjh.harvard.edu> writes:> I am studying R and within the first 3 lines of > demo("graphics") I get completely stuck. > > could you 1. give me the answer so I can move on 2. tell me > how I might find the answer.Well, y'know, sometimes obstacles are more easily handled by walking around them than by climbing over them. Who said you need to understand demo("graphics") in order to get to know R? It's a demo, a show-off of what glitzy graphics we can do, not a tutorial. Actually, it might be sensible to walk through some of its examples, but the first couple of setup lines can certainly be skipped.> On my mac OSX, the first command is equivalent to > get("quartz")() > > now get("quartz") would be a regular function format > but what is get () ()? what kind of beast? does get() return > a function?In this case, yes, exactly. In general, get() returns the R object of the given name, which may or may not be a funtion.> I run demo("graphics") and of course I want to stop it right > away, without running through the whole demo, how do I STOP > IT! CANCEL IT? (it gets stuck on hit return to continue > lines)This is OS and GUI dependent. On unix text terminals you can generally hit Ctrl-C, in the Windows GUI there's a Stop button (I think), and Aqua seems to have an Abort button.> Then I want to look at the program that generated > demo("graphics") and I find a graphic file, but no demo fx. > where is the demo("graphics") fx physically on my computer? > how do I find it on a Mac?Somewhere in the R installation directory. system.file("demo/graphics.R",package="graphics") should tell you exactly, on all systems. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
in R, the source code for functions can be displayed by typing the function name without the brackets. Therefore , demo produces the source code and demo() runs the function - which in this case provides a list of available demos. The source for the graphics demo is a R source file named graphics.R which is located in (on my Mandrake linux system, OSX may differ) /usr/lib/R/library/graphics/ The source code for functions demonstrated can be similarly displayed, although some functions will call C or Fortran modules. Paul Bivand On Tuesday 02 Nov 2004 22:35, Anne G wrote:> I am studying R and within the first 3 lines of > demo("graphics") I get completely stuck. > > could you 1. give me the answer so I can move on 2. tell me > how I might find the answer. > > On my mac OSX, the first command is equivalent to > get("quartz")() > > now get("quartz") would be a regular function format > but what is get () ()? what kind of beast? does get() return > a function? > > I run demo("graphics") and of course I want to stop it right > away, without running through the whole demo, how do I STOP > IT! CANCEL IT? (it gets stuck on hit return to continue > lines) > > Then I want to look at the program that generated > demo("graphics") and I find a graphic file, but no demo fx. > where is the demo("graphics") fx physically on my computer? > how do I find it on a Mac? > > Then I want to list the program, but I can't fine a fx which > list the code of a function. > > Sorry, it must seem very basic. But I searched through the > R intro and through the R lists and I can't find the answer. > > Thanks for your help > > Anne > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html