Re: [Rd] supsmu(periodic=TRUE) can crash R by reading before start of array (PR#9502)
Thank you for the comprehensive report and fix. Now incorporated in R-devel. Brian On Thu, 8 Feb 2007, [EMAIL PROTECTED] wrote: > supsmu(periodic=TRUE) can crash R by reading before start of array. > > To reproduce: > set.seed(1) > xx <- runif(29000) > yy <- rnorm(29000) > span <- 0.49 > i <- 1 > while(i < 200){ > cat(i,"\n") > int <- supsmu(xx,yy,periodic=T,span=span) > i <-i+1 > } > > results in: > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > > Program received signal SIGSEGV, Segmentation fault. > smooth_ (n=0xeffe, x=0xb6a7f020, y=0xb6993020, w=0xb6921020, > span=0xeffe, iper=0xeffe, vsmlsq=0xeffe, smo=0xb68e8020, > acvr=0x9c7e7c8) at ppr.f:1087 > 1087 xti=x(j) > Current language: auto; currently fortran > (gdb) list > 1082 if (ibw.lt.2) ibw=2 > 1083 it=2*ibw+1 > 1084 do 20 i=1,it > 1085 j=i > 1086 if (jper.eq.2) j=i-ibw-1 > -> 1087 xti=x(j) > 1088 if (j.ge.1) go to 10 > 1089 j=n+j > 1090 xti=x(j)-1d0 > 1091 10 wt=w(j) > (gdb) print jper > $1 = 2 > (gdb) print j > $2 = -4099 > > If you use 'R -d valgrind' it stops in the same spot > on the first call to supsmu: > 1 > ==8058== Invalid read of size 8 > ==8058==at 0x56A65DA: smooth_ (ppr.f:1087) > ==8058==by 0x56A64D5: supsmu_ (ppr.f:1028) > ==8058==by 0x80B2488: do_dotCode (dotcode.c:1753) > ==8058==by 0x80C9405: Rf_eval (eval.c:441) > ... > ==8058== Address 0x5EFDA80 is 0 bytes after a block of size 232,024 alloc'd > ==8058==at 0x401A6EE: malloc (vg_replace_malloc.c:149) > ==8058==by 0x80EFBC9: Rf_allocVector (memory.c:1952) > ==8058==by 0x807B6CB: do_makevector (builtin.c:558) > ==8058==by 0x80F9946: do_internal (names.c:1091) > ==8058==by 0x80C9478: Rf_eval (eval.c:424) > > Note that it computes x(j) and then, if j is out of > bounds, resets j to be at the end of the x array > and recomputes x(j). It should not compute x(j) if > j is out of bounds. > > A fix that keeps this looking like Fortran IV is > to put 'if (j.ge.1)' at the start of line 1087 > (in R_HOME/src/library/stats/src/ppr.f). This stops > the crash and makes valgrind happy. > > (Splus has the identical problem and fix.) > > *** ppr.f~2007-02-08 11:31:50.0 -0800 > --- ppr.f 2007-02-08 11:32:07.0 -0800 > *** > *** 1084,1090 >do 20 i=1,it > j=i > if (jper.eq.2) j=i-ibw-1 > ! xti=x(j) > if (j.ge.1) go to 10 > j=n+j > xti=x(j)-1d0 > --- 1084,1090 >do 20 i=1,it > j=i > if (jper.eq.2) j=i-ibw-1 > ! if (j.ge.1) xti=x(j) > if (j.ge.1) go to 10 > j=n+j > xti=x(j)-1d0 > > --please do not edit the information below-- > > Version: > platform = i686-pc-linux-gnu > arch = i686 > os = linux-gnu > system = i686, linux-gnu > status = Under development (unstable) > major = 2 > minor = 5.0 > year = 2007 > month = 02 > day = 05 > svn rev = 40659 > language = R > version.string = R version 2.5.0 Under development (unstable) (2007-02-05 > r40659) > > Locale: > LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C > > Search Path: > .GlobalEnv, package:stats, package:graphics, package:grDevices, > package:utils, package:datasets, package:methods, Autoloads, package:base > > > Bill Dunlap > Insightful Corporation > bill at insightful dot com > 360-428-8146 > > "All statements in this message represent the opinions of the author and do > not necessarily reflect Insightful Corporation policy or position." > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] xlsReadWrite Pro and embedding objects and files in Excel worksheets
If Excel has the capability to do it then by controlling Excel from R using RDCOMClient or rcom packages you can do it (in Windows). For example, the code below creates a plot in R and then creates an Excel spreadsheet and inserts it. Get up to speed on VBA and then use the Macro recorder in Excel while you do it manually and look at the macro source that it generates to find out what VBA commands it uses for a particular task. plot(1:10) savePlot("c:\\myplot", "wmf") library(RDCOMClient) xl <- COMCreate("Excel.Application") xl[["Visible"]] <- TRUE wkbk <- xl$Workbooks()$Add() sh <- xl$ActiveSheet() sh$Pictures()$Insert("C:\\myplot.wmf") wkbk$SaveAs("\\test-pic.xls") xl$Quit() On 2/9/07, Mark W Kimpel <[EMAIL PROTECTED]> wrote: > Gabor, > > What I want is a bit more than hyperlinks, although I did ask the > package developer about that to. My idea is, from within R, place things > like pdf files and .Rdata directly into an Excel spreadsheet. As a > practical matter, if I can create a report with some data that someone > else can manipulate as a "regular" spreadsheet (ex. sort gene lists) and > then have other sheets that contain pdf output files of graphs I do > within R. I would also like to archive my R workspace at time of > analysis so that I could, if I had to, the analysis again. As I and > others are constantly tweaking what functions do, it is sometimes > impossible for me to go back and figure out what versions of what > functions I was using. sessionInfo won't do what I want. > > Since Hans-Peter came up with his really nice package, I thought I would > throw this out as an idea. I have been doing this manually for some time > and my boss likes it because he only has to get one file from me, not > 10. I include worksheets with the values of parameters passed to > functions, abbreviations, etc. Then 5 months from now and he wants me to > explain the sheet to him, everything is in one place. > > In a way, I want to treat an Excel spreadsheet as a list (the workbook) > that can contain different kinds of objects (spreadsheets, pdfs, Rdata, > ex.). The Excel file acts as a binder for these different files. My boss > doesn't even want to deal with zipped files because when they are > unzipped he ends up with tons of files. > > I know this might not make a lot of sense to UNIX users who mostly > interact with other programmers, but for those of us who deal with the > computer-barely-literate biologists who run Windows, it could be a nice > way of keeping things together. > > BTW, I only mention Excel and Windows because that is what I use. I > think it would be great to come up with a common format that Linux, Mac, > and UNIX users could use. Could openOffice serve that purpose? > > Thanks for your input. > > Mark > > Gabor Grothendieck wrote: > > Its not entirely clear to me what it is that you are looking > > for. Maybe you want to create an Excel spreadsheet with a hyperlink > > to a web page? This R code will do that. It requires a Windows machine > > that > > has Excel running on it. > > > > > > library(RDCOMClient) > > xl <- COMCreate("Excel.Application") > > xl[["Visible"]] <- TRUE > > wkbk <- xl$Workbooks()$Add() > > > > sh <- xl$ActiveSheet() > > > > B2R <- sh$Range("B3") > > B2R[["Formula"]] <- '=HYPERLINK("http://www.r-project.org";)' > > > > wkbk$SaveAs("\\test-url.xls") > > xl$Quit() > > > > > > > > > > On 2/8/07, Mark W Kimpel <[EMAIL PROTECTED]> wrote: > >> Hans-Peter and other R developers, > >> > >> How are you? Have you made any progess with embedding Url's in Excel? > >> > >> Well, I have been busy thinking of more things for you to do;) > >> > >> My colleagues in the lab are not R literate, and some are barely > >> computer literate, so I give them everything in Excel workbooks. I have > >> gradually evolved a system such that these workbooks have become > >> compendia of my data, output, and methods. That, in fact, is why I > >> bought the Pro version of xlsReadWritePro. I have been saving graphics > >> as PDF files, then inserting them as object in Excel sheets. > >> > >> What I would like to be able to do is to embed objects (files) in sheets > >> of a workbook directly from within R. I would also like to be able to > >> save my current R workspace as an object embedded in a sheet so that in > >> the future, if packages change, I could go back and recreate the > >> analysis. I do not need to be able to manuipulate files that R has not > >> created, like a PDF file from another user. I would, however, like to be > >> able to save my graphics as PDF files inside a worksheet, even if it > >> meant creating a temp file or something. > >> > >> Before people begin talking about how MySQL or some other database could > >> handle all that archiving, let me say that that is not what my > >> colleagues want. They want a nice Excel file that they can take home on > >> there laptops. One thing I like about worksheets is that they themselves > >> can contain many embedded files,
Re: [Rd] obscure error with subsetting as.list() of a function then assigning that a (PR#9500)
Ok, thanks for clearing it up. But: > It's not a bug things work in ways that confuse users when they pry > into things they were not expected to pry into Do you have a good > reason to call this a bug? Well if it's intended to work that way then it's not a bug. As I said, I was computing on the language, in particular writing code that processes the parse tree of a function. But I guess I need to avoid certain gotchas like this one. Regards, Peter Peter Dalgaard <[EMAIL PROTECTED]> 08/02/2007 23:39 To Peter-M Schumacher/DMGGM/DMG UK/[EMAIL PROTECTED]
Re: [Rd] obscure error with subsetting as.list() of a function then (PR#9506)
Ok, thanks for clearing it up. But: > It's not a bug things work in ways that confuse users when they pry > into things they were not expected to pry into Do you have a good= > reason to call this a bug? Well if it's intended to work that way then it's not a bug. As I said, I was computing on the language, in particular writing code = that processes the parse tree of a function. But I guess I need to avoid cer= tain gotchas like this one. Regards, Peter = = = = = = = = = = = = = Peter Dalgaard <[EMAIL PROTECTED]> = = = = = = = = = = = = = = = = = = = = = = = = = = 08/02/2007 23:39 = = = = = = = = = = = = = To = = = = = Peter-M Schumacher= /DMGGM/DMG UK/[EMAIL PROTECTED
[Rd] Problem using ofstream in C++ class in package for MacOS X
Dear Ross Thank you for this clarification, maybe there is something misconfigured on my Intel-Mac. BTW, I have now upgraded to XCode 2.4.1 from 2.4, but the result remains the same. I don´t know if this could help clarify what might be wrong, but I am not able to compile plier, a simple package containing an R-wrapper around Affymetrix C++ plier code. This is the output I get when trying to compile plier: m3450p027:/Volumes/CoreData/CRAN/Bioconductor/packages rabbitus$ R_ARCH=/i386 R CMD INSTALL -l ~/Library/R/library plier_1.4.0.tar.gz * Installing *source* package 'plier' ... ** libs ** arch - i386 g++-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -msse3 -fPIC -g -O2 -march=nocona -c affyplier.cpp -o affyplier.o /Volumes/CoreData/temp/cc3VRxb1.s:4750:indirect jmp without `*' /Volumes/CoreData/temp/cc3VRxb1.s:4769:indirect jmp without `*' /Volumes/CoreData/temp/cc3VRxb1.s:4784:indirect jmp without `*' /Volumes/CoreData/temp/cc3VRxb1.s:4799:indirect jmp without `*' /Volumes/CoreData/temp/cc3VRxb1.s:4818:indirect jmp without `*' /Volumes/CoreData/temp/cc3VRxb1.s:4833:indirect jmp without `*' g++-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -msse3 -fPIC -g -O2 -march=nocona -c plier_impl.cpp -o plier_impl.o /Volumes/CoreData/temp/ccLq6FYI.s:554:indirect jmp without `*' /Volumes/CoreData/temp/ccLq6FYI.s:569:indirect jmp without `*' /Volumes/CoreData/temp/ccLq6FYI.s:584:indirect jmp without `*' /Volumes/CoreData/temp/ccLq6FYI.s:599:indirect jmp without `*' /Volumes/CoreData/temp/ccLq6FYI.s:618:indirect jmp without `*' g++-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -msse3 -fPIC -g -O2 -march=nocona -c plieralg.cpp -o plieralg.o plieralg.cpp:30:20: error: malloc.h: No such file or directory make: *** [plieralg.o] Error 1 chmod: /Users/rabbitus/Library/R/library/plier/libs/i386/*: No such file or directory ** arch - ppc g++-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/ppc -I/usr/local/include-fPIC -g -O2 -c affyplier.cpp -o affyplier.o g++-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/ppc -I/usr/local/include-fPIC -g -O2 -c plier_impl.cpp -o plier_impl.o g++-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/ppc -I/usr/local/include-fPIC -g -O2 -c plieralg.cpp -o plieralg.o plieralg.cpp:30:20: error: malloc.h: No such file or directory make: *** [plieralg.o] Error 1 chmod: /Users/rabbitus/Library/R/library/plier/libs/ppc/*: No such file or directory ERROR: compilation failed for package 'plier' ** Removing '/Users/rabbitus/Library/R/library/plier In any case, the problem seems to be R-specific, since the same code for my package MyClass runs fine, when compiled as a shared library and called from other C++ code. BTW, since I do not have an url, I would like to attach my package, so that people could try it. In my initial mailing I have attached my package as MyClass_0.1.2.tar.gz, but it got scrambled as https://stat.ethz.ch/pipermail/r-devel/attachments/20070204/2e7fb79c/attachment.gz Is there a possibility to attach it in a way so that people can use it? Thank you Best regards Christian __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problem using ofstream in C++ class in package for MacOS X
I have some experience wrapping code from Affymetrix in R (see the affxparser package). Depending on who actually wrote the package, you may find that it is not trivial to get it to work on different platforms. They are not always carefully to think about different compilers etc. You may want to look at the plier package in Bioconductor to who they do it. Of course this may or may not be related to your other C++ problems. Kasper On Feb 9, 2007, at 8:11 AM, cstrato wrote: > Dear Ross > > Thank you for this clarification, maybe there is something > misconfigured on my Intel-Mac. > BTW, I have now upgraded to XCode 2.4.1 from 2.4, but the result > remains > the same. > > I don´t know if this could help clarify what might be wrong, but I am > not able to compile > plier, a simple package containing an R-wrapper around Affymetrix C++ > plier code. > This is the output I get when trying to compile plier: > > m3450p027:/Volumes/CoreData/CRAN/Bioconductor/packages rabbitus$ > R_ARCH=/i386 R CMD INSTALL -l ~/Library/R/library plier_1.4.0.tar.gz > * Installing *source* package 'plier' ... > ** libs > ** arch - i386 > g++-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/include > -I/Library/Frameworks/R.framework/Resources/include/i386 -msse3 > -fPIC -g -O2 -march=nocona -c affyplier.cpp -o affyplier.o > /Volumes/CoreData/temp/cc3VRxb1.s:4750:indirect jmp without `*' > /Volumes/CoreData/temp/cc3VRxb1.s:4769:indirect jmp without `*' > /Volumes/CoreData/temp/cc3VRxb1.s:4784:indirect jmp without `*' > /Volumes/CoreData/temp/cc3VRxb1.s:4799:indirect jmp without `*' > /Volumes/CoreData/temp/cc3VRxb1.s:4818:indirect jmp without `*' > /Volumes/CoreData/temp/cc3VRxb1.s:4833:indirect jmp without `*' > g++-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/include > -I/Library/Frameworks/R.framework/Resources/include/i386 -msse3 > -fPIC -g -O2 -march=nocona -c plier_impl.cpp -o plier_impl.o > /Volumes/CoreData/temp/ccLq6FYI.s:554:indirect jmp without `*' > /Volumes/CoreData/temp/ccLq6FYI.s:569:indirect jmp without `*' > /Volumes/CoreData/temp/ccLq6FYI.s:584:indirect jmp without `*' > /Volumes/CoreData/temp/ccLq6FYI.s:599:indirect jmp without `*' > /Volumes/CoreData/temp/ccLq6FYI.s:618:indirect jmp without `*' > g++-4.0 -arch i386 -I/Library/Frameworks/R.framework/Resources/include > -I/Library/Frameworks/R.framework/Resources/include/i386 -msse3 > -fPIC -g -O2 -march=nocona -c plieralg.cpp -o plieralg.o > plieralg.cpp:30:20: error: malloc.h: No such file or directory > make: *** [plieralg.o] Error 1 > chmod: /Users/rabbitus/Library/R/library/plier/libs/i386/*: No such > file > or directory > ** arch - ppc > g++-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include > -I/Library/Frameworks/R.framework/Resources/include/ppc > -I/usr/local/include-fPIC -g -O2 -c affyplier.cpp -o affyplier.o > g++-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include > -I/Library/Frameworks/R.framework/Resources/include/ppc > -I/usr/local/include-fPIC -g -O2 -c plier_impl.cpp -o > plier_impl.o > g++-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include > -I/Library/Frameworks/R.framework/Resources/include/ppc > -I/usr/local/include-fPIC -g -O2 -c plieralg.cpp -o plieralg.o > plieralg.cpp:30:20: error: malloc.h: No such file or directory > make: *** [plieralg.o] Error 1 > chmod: /Users/rabbitus/Library/R/library/plier/libs/ppc/*: No such > file > or directory > ERROR: compilation failed for package 'plier' > ** Removing '/Users/rabbitus/Library/R/library/plier > > In any case, the problem seems to be R-specific, since the same > code for > my package MyClass > runs fine, when compiled as a shared library and called from other C > ++ code. > > BTW, since I do not have an url, I would like to attach my package, so > that people could try it. > In my initial mailing I have attached my package as > MyClass_0.1.2.tar.gz, but it got scrambled > as > https://stat.ethz.ch/pipermail/r-devel/attachments/ > 20070204/2e7fb79c/attachment.gz > > Is there a possibility to attach it in a way so that people can use > it? > > Thank you > Best regards > Christian > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problem using ofstream in C++ class in package for MacOS X
Dear Kasper Thank you, but I want to keep the focus on my own problem (I can indeed compile your package). Since I do not have an url, I would like to attach my package, so that people could try it. In my initial mailing I have attached my package as MyClass_0.1.2.tar.gz, but it got scrambled as https://stat.ethz.ch/pipermail/r-devel/attachments/20070204/2e7fb79c/attachment.gz Is there a possibility to attach it in a way so that people can use it? Thank you Best regards Christian Kasper Daniel Hansen wrote: > I have some experience wrapping code from Affymetrix in R (see the > affxparser package). Depending on who actually wrote the package, you > may find that it is not trivial to get it to work on different > platforms. They are not always carefully to think about different > compilers etc. > > You may want to look at the plier package in Bioconductor to who they > do it. > > Of course this may or may not be related to your other C++ problems. > > Kasper > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel