[Rd] Using a C++ library to read a binary file
Hello, I am trying to use a C++ library I have to read some data into R. I've gone over the "Writing R Extensions" page and some of the archives, but am left somewhat confused (and I'm still very new to R!). What I want to do is fairly simple. Given some parameters, I'd like to read a string of numbers from a proprietary binary file into an array. I have a C++ library that will read anything I need from this file. What is the best way to do this? Can someone give me any pointers to sample code? One possibility I've considered is writing a small unix command line program that, given the parameters, will return the string of numbers. Is there a way to "capture" this from R into an array? Cheers, Demitri __ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Non-nested testing and anova.lm()
I'd like to elicit comments on what I am sure is an ancient topic, but one for which I can't seem to google up a satisfactory reference. I'm curious about the laissez-faire attitude adopted in anova.lm and friends regarding non-nested hypothesis tests. I was under the misapprehension until yesterday that attempts to test non-nested hypotheses, i.e. compare lm objects with non-nested design matrices, produced an error. On the contrary, not even a warning is generated. The Ur text on this sort of thing (aka The White Book) seems to suggest (p 210) that test statistics are computed only when models are nested, but ?anova.lm is quite clear: For all but the first model, the change in degrees of freedom and sum of squares is also given. (This only make statistical sense if the models are nested.) It is conventional to list the models from smallest to largest, but this is up to the user. My motivation for the question is that I'm considering reworking the code for anova.rq in my quantreg package. Currently, I have a rather half-hearted attempt to check nesting using variable names, and was considering implementing something more algebraic based on explicitly looking at subspace inclusions, but now I'm wondering if R's caveat emptor policy might be a viable alternative. Any comments would be welcome. url:www.econ.uiuc.edu/~rogerRoger Koenker email [EMAIL PROTECTED] Department of Economics vox:217-333-4558University of Illinois fax:217-244-6678Champaign, IL 61820 __ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Reversing axis in a log plot (PR#7894)
Full_Name: Christian Marquardt Version: 2.1.0 OS: Linux (Redhat 9) Submission from: (NULL) (151.170.240.10) Following the advice of a reader of R-help, I would now like to submit this as a bug report: Say we have x = seq(1,3, by = 0.01) y = exp(x) Plotting and reversing linear axis is fine plot(x,y) plot(x,y, ylim = c(30,1)) as is a usual log-plot: plot(x,y, log = "y", ylim = c(1,30)) However, plot(x,y, log = "y", ylim = c(30,1)) fails with Error in axis(2, ...) : log - axis(), 'at' creation, _SMALL_ range: invalid {xy}axp or par; axp[0]= 10, usr[0:1]=(34.3721,0.872801) In addition: Warning message: CreateAtVector "log"(from axis()): usr[0] = 34.3721 > 0.872801 = usr[1] ! According to Petr Pikal , replacing the ylim argument by ylim = c(30,1.2) helps in the above example; but in my real world applications, it's actually difficult to find a working value for ylim. I hope this is useful, Christian. __ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] R OS X
Hi Volker, Just tried this with 1 of the few packages I had not installed yet systemwide. In the Startup preferences I selected to add $Home/R/Library and restarted R. Then installed package its and loaded the library and ran the example. Can you try if that sequence works for you? A better alias for Mac questions is R-SIG-Mac. Regards, Rob On May 24, 2005, at 6:11 AM, Volker Runkel wrote: Hi, with newest R.app (1.11) / R2.1.0a if a package is installed for the current user, it is not installed properly (does not get an installed version entry and is not loadable). If installed system wide it works. The package I installed is xgobi. MAC OS X 10.4.1 Volker - - - - - - - - - - - -- -- --- -- - - - - - - - - - - - -- - - Dipl.-Biol. Volker Runkel Lehrstuhl f. Zoologie II www.biologie.uni- erlangen.de/zoo2 Staudtstr. 5 Telefon: 09131-85 28788 91058 Erlangen [EMAIL PROTECTED] erlangen.de - - - - - - - - - - - -- -- --- -- - - - - - - - - - - - -- - - __ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] R OS X
Hi, with newest R.app (1.11) / R2.1.0a if a package is installed for the current user, it is not installed properly (does not get an installed version entry and is not loadable). If installed system wide it works. The package I installed is xgobi. MAC OS X 10.4.1 Volker - - - - - - - - - - - -- -- --- -- - - - - - - - - - - - -- - - Dipl.-Biol. Volker Runkel Lehrstuhl f. Zoologie II www.biologie.uni- erlangen.de/zoo2 Staudtstr. 5 Telefon: 09131-85 28788 91058 Erlangen [EMAIL PROTECTED] erlangen.de - - - - - - - - - - - -- -- --- -- - - - - - - - - - - - -- - - __ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Segmentation violation in eval.c (R 2.1.0) (PR#7893)
This is a multi-part message in MIME format. --080506050109020709090406 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Hi, I get a segmentation fault in eval.c: do_set (call=0x8ce166c, op=0x82b43b8, args=0x8ce1650, rho=0x8acf218) at eval.c:1309 1309switch (NAMED(s)) { The instruction is 0x080becf1 :movzbl (%eax),%edx and %eax contains a non-accessible address (gdb) x/x $eax 0x4a5bf008: Cannot access memory at address 0x4a5bf008 in another try it was (gdb) x/x $eax 0x59a5a008: Cannot access memory at address 0x59a5a008 This segmentation fault occurs reproducible in a long simulation script. However, I don't know the place in the .R file. I would like to isolate the bug but don't know how. I attached the gdb session. I use R 2.1.0 on a Linux machine (Athlon64). Maybe a package that I wrote and use for the simulation clobbers some memory (although I already added some sanity checks). But please let me know when you hear about this bug another time (or have an idea how to debug this or have a solution). Thank you, Andreas -- Andreas Westfeld, 0432 01CC F511 9E2B 0B57 5993 0B22 98F8 4AD8 EEEA <[EMAIL PROTECTED]> http://www.inf.tu-dresden.de/~aw4 TU Dresden Fakultät Informatik, Institut für Systemarchitektur Datenschutz und Datensicherheit, Tel. +49-351-463-37918 --080506050109020709090406 Content-Type: text/plain; name="debug.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="debug.txt" > source("ber3.R") Program received signal SIGSEGV, Segmentation fault. do_set (call=0x86c8770, op=0x82b43b8, args=0x86c878c, rho=0x8626404) at eval.c:1309 1309switch (NAMED(s)) { # PRIMVAL(op): is 1 (code = 1) (gdb) p R_FunTab[op->u.primsxp.offset] $14 = {name = 0x81d99e8 "<-", cfun = 0x80bec40 , code = 1, Rf_eval = 100, arity = -1, gram = {kind = PP_ASSIGN, precedence = PREC_LEFT, rightassoc = 1}} # isSymbol(CAR(args)): (gdb) p Rf_isSymbol(CAR(args)) $16 = TRUE # NAMED(s): (gdb) p s->sxpinfo.named $20 = 0 # (s =) eval(CADR(args), rho): (gdb) p *Rf_eval(CADR(args), rho) $27 = {sxpinfo = {type = 13, obj = 0, named = 0, gp = 0, mark = 0, debug = 0, trace = 0, fin = 0, gcgen = 0, gccls = 7}, attrib = 0x82a5588, gengc_next_node = 0x1ee60648, gengc_prev_node = 0x4b1cb008, u = {primsxp = { offset = 985600}, symsxp = {pname = 0xf0a00, value = 0x0, internal = 0x0}, listsxp = {carval = 0xf0a00, cdrval = 0x0, tagval = 0x0}, envsxp = {frame = 0xf0a00, enclos = 0x0, hashtab = 0x0}, closxp = {formals = 0xf0a00, body = 0x0, env = 0x0}, promsxp = { value = 0xf0a00, expr = 0x0, env = 0x0}}} # s: (gdb) p *s $28 = {sxpinfo = {type = 7, obj = 0, named = 0, gp = 0, mark = 1, debug = 0, trace = 0, fin = 0, gcgen = 1, gccls = 0}, attrib = 0x82a5588, gengc_next_node = 0x85ba270, gengc_prev_node = 0x85bb5c8, u = {primsxp = { offset = 25}, symsxp = {pname = 0x19, value = 0x82a5588, internal = 0x82a5588}, listsxp = {carval = 0x19, cdrval = 0x82a5588, tagval = 0x82a5588}, envsxp = {frame = 0x19, enclos = 0x82a5588, hashtab = 0x82a5588}, closxp = {formals = 0x19, body = 0x82a5588, env = 0x82a5588}, promsxp = {value = 0x19, expr = 0x82a5588, env = 0x82a5588}}} 0x080becd6 :call 0x815a720 ---Type to continue, or q to quit--- 0x080becdb :test %eax,%eax 0x080becdd :je 0x80bed36 0x080becdf :mov%edi,0x4(%esp) 0x080bece3 :mov0x14(%ebx),%eax 0x080bece6 :mov0x10(%eax),%eax 0x080bece9 :mov%eax,(%esp) 0x080becec :call 0x80bc530 # here the SIGSEGV occurs: 0x080becf1 :movzbl (%eax),%edx # %eax: (gdb) x/x $eax 0x4a5bf008: Cannot access memory at address 0x4a5bf008 SECOND TRY: Program received signal SIGSEGV, Segmentation fault. do_set (call=0x8ce166c, op=0x82b43b8, args=0x8ce1650, rho=0x8acf218) at eval.c:1309 1309switch (NAMED(s)) { (gdb) x/x $eax 0x59a5a008: Cannot access memory at address 0x59a5a008 (gdb) p *s $2 = {sxpinfo = {type = 7, obj = 0, named = 0, gp = 0, mark = 1, debug = 0, trace = 0, fin = 0, gcgen = 1, gccls = 0}, attrib = 0x82a5588, gengc_next_node = 0x85ba270, gengc_prev_node = 0x85bb5c8, u = {primsxp = { offset = 25}, symsxp = {pname = 0x19, value = 0x82a5588, internal = 0x82a5588}, listsxp = {carval = 0x19, cdrval = 0x82a5588, tagval = 0x82a5588}, envsxp = {frame = 0x19, enclos = 0x82a5588, hashtab = 0x82a5588}, closxp = {formals = 0x19, body = 0x82a5588, env = 0x82a5588}, promsxp = {value = 0x19, expr = 0x82a5588, env = 0x82a5588}}} (gdb) --080506050109020709090406-- __ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel