Re: [Rd] possible bug: dev.copy / could not find any X11 fonts
2007/1/31, Tamas K Papp <[EMAIL PROTECTED]>: > Hi, > > I am experiencing something strange, and thought I would ask before > reporting a bug. I trimmed it down to a self-contained example, > attached as an R file. The purpose of the functions is to save the > plots into a ps file and simultaneously plot them on an x11 device, > but don't open a new one if there is already one opened (I don't want > the repositioning / flicker). > > When running the code: > > > source("plotf.r") > > plotf(avc,1) > Error in dev.copy(which = x11dev) : could not find any X11 fonts > Check that the Font Path is correct. > > The error message reappears whenever I switch to the plot window. A > partial plot is in the x11 window. > > When called in other contexts, plotting functions work perfectly, so I > don't see what the problem is. > > Thanks, > > Tamas > > > version information: >_ > platform i486-pc-linux-gnu > arch i486 > os linux-gnu > system i486, linux-gnu > status > major 2 > minor 4.1 > year 2006 > month 12 > day18 > svn rev40228 > language R > version.string R version 2.4.1 (2006-12-18) > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > > > I see this error last time in Ubuntu Edgy. Check your FontPath in /etc/X11/xorg.conf. __ 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
I don't know of any native xls read/write facility in R, either in core or as add-ons (I could be wrong), but if you want some source code to scavenge on to build some R package out of it, there are two perl modules, Spreadsheet::ParseExcel and Spreadsheet::WriteExcel which are small enough to "read from front cover to back cover", so to speak, might be useful for reference and steal code from. The other open-source packages which can read/write excel files are gnumeric and openoffice and probably too big to find one's way around the source code to steal there :-). Good luck. HTL Mark W Kimpel 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, so it keeps our virtual desks neater > and less confusing. > > Hans, if you could do this, it would be of tremendous benefit to me and > hopefully a lot of people. R developers tend to think that all > scientists are running Linux on 64-bit computers, but most biomedical > researches still store date in Excel files. This won't solve everybody's > needs, but it could be a start. > > Well, let me know what you think. I am cc'ing R-devel to see if any of > those guys have ideas as well. > > Thanks, > Mark > > > __ 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
Have you looked at RDCOMClient? I would imagine you could do what you want with this package. http://www.omegahat.org/RDCOMClient/ Best, Jim Hin-Tak Leung wrote: > I don't know of any native xls read/write facility in R, either > in core or as add-ons (I could be wrong), but if you want some source > code to scavenge on to build some R package out of it, there are two > perl modules, Spreadsheet::ParseExcel and Spreadsheet::WriteExcel > which are small enough to "read from front cover to back cover", > so to speak, might be useful for reference and steal code from. > > The other open-source packages which can read/write excel files > are gnumeric and openoffice and probably too big to find one's way > around the source code to steal there :-). > > Good luck. > > HTL > > Mark W Kimpel 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, so it keeps our virtual desks neater >>and less confusing. >> >>Hans, if you could do this, it would be of tremendous benefit to me and >>hopefully a lot of people. R developers tend to think that all >>scientists are running Linux on 64-bit computers, but most biomedical >>researches still store date in Excel files. This won't solve everybody's >>needs, but it could be a start. >> >>Well, let me know what you think. I am cc'ing R-devel to see if any of >>those guys have ideas as well. >> >>Thanks, >>Mark >> >> >> > > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- James W. MacDonald, M.S. Biostatistician Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 ** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues. __ 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
James W. MacDonald wrote: > Have you looked at RDCOMClient? I would imagine you could do what you > want with this package. > > http://www.omegahat.org/RDCOMClient/ Interesting point. But the dcom client would be windows-specific? (those I mentioned - the perl mondules, openoffice, run on windows, as well as unix boxes - not sure about gnumeric :-). In fact there is a very perverse way of doing it - ActiveState provides a PerlCom product for hooking up dcom with activestate perl. i.e. you can go via R -> RDComClient -> PerlCom -> ActiveState Perl -> SpreadSheet::* . Just so that it does not require Excel installed or an MS Office license... In that sense, probably technology based on bridging over odbc is also acceptable? HTL > Hin-Tak Leung wrote: >> I don't know of any native xls read/write facility in R, either >> in core or as add-ons (I could be wrong), but if you want some source >> code to scavenge on to build some R package out of it, there are two >> perl modules, Spreadsheet::ParseExcel and Spreadsheet::WriteExcel >> which are small enough to "read from front cover to back cover", >> so to speak, might be useful for reference and steal code from. >> >> The other open-source packages which can read/write excel files >> are gnumeric and openoffice and probably too big to find one's way >> around the source code to steal there :-). >> >> Good luck. >> >> HTL >> >> Mark W Kimpel 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, so it keeps our virtual >>> desks neater and less confusing. >>> >>> Hans, if you could do this, it would be of tremendous benefit to me >>> and hopefully a lot of people. R developers tend to think that all >>> scientists are running Linux on 64-bit computers, but most biomedical >>> researches still store date in Excel files. This won't solve >>> everybody's needs, but it could be a start. >>> >>> Well, let me know what you think. I am cc'ing R-devel to see if any >>> of those guys have ideas as well. >>> >>> Thanks, >>> Mark >>> >>> >>> >> >> >> __ >> 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] xlsReadWrite Pro and embedding objects and files in Excel worksheets
you can also use my package which uses Jakarta POI to write the excel files. It can be used on any platform that supports java. The Perl solution may be better if you want to do anything complicated, but this package supports writing all basic R objects. http://code.google.com/p/rexcelpoi/ > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Hin-Tak Leung > Sent: Thursday, February 08, 2007 8:50 AM > To: James W. MacDonald > Cc: [EMAIL PROTECTED]; Mark W. Kimpel MD > ([EMAIL PROTECTED]); r-devel@r-project.org > Subject: Re: [Rd] xlsReadWrite Pro and embedding objects and > files in Excel worksheets > > James W. MacDonald wrote: > > Have you looked at RDCOMClient? I would imagine you could > do what you > > want with this package. > > > > http://www.omegahat.org/RDCOMClient/ > > Interesting point. But the dcom client would be windows-specific? > (those I mentioned - the perl mondules, openoffice, run on > windows, as well as unix boxes - not sure about gnumeric :-). > > In fact there is a very perverse way of doing it - > ActiveState provides a PerlCom product for hooking up dcom > with activestate perl. i.e. you can go via R -> RDComClient > -> PerlCom -> ActiveState Perl -> > SpreadSheet::* . Just so that it does not require Excel > installed or an MS Office license... > > In that sense, probably technology based on bridging over > odbc is also acceptable? > > HTL > > > Hin-Tak Leung wrote: > >> I don't know of any native xls read/write facility in R, either in > >> core or as add-ons (I could be wrong), but if you want some source > >> code to scavenge on to build some R package out of it, > there are two > >> perl modules, Spreadsheet::ParseExcel and Spreadsheet::WriteExcel > >> which are small enough to "read from front cover to back > cover", so > >> to speak, might be useful for reference and steal code from. > >> > >> The other open-source packages which can read/write excel > files are > >> gnumeric and openoffice and probably too big to find one's > way around > >> the source code to steal there :-). > >> > >> Good luck. > >> > >> HTL > >> > >> Mark W Kimpel 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, so it keeps > our virtual > >>> desks neater and less confusing. > >>> > >>> Hans, if you could do this, it would be of tremendous > benefit to me > >>> and hopefully a lot of people. R developers tend to think > that all > >>> scientists are running Linux on 64-bit computers, but most > >>> biomedical researches still store date in Excel files. This won't > >>> solve everybody's needs, but it could be a start. > >>> > >>> Well, let me know what you think. I am cc'ing R-devel to > see if any > >>> of those guys have ideas as well. > >>> > >>> Thanks, > >>> Mark > >>> > >>> > >>> > >> > >> > >> __ > >> 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 > This e-mail message is intended only for the named recipient(s) above. It may contain confidential information. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying of this e-mail and any attachment(s) is st
[Rd] strategies for incorporating a data= argument
As I've mentioned here, before, I'm working on an extended version of mle(), a function from the stats4 package that's a wrapper for optim(). I'd like (against the advice of Peter Dalgaard -- sorry) to incorporate a "data" argument, similar to the arguments in lm, nls, nlme, etc., that would allow the log-likelihood function to be evaluated with different sets of data. (Peter's advice was to use closures, writing a function-to-generate-likelihood-functions such as fn0 <- function(x) { function(mu,sd) { -sum(dnorm(x,mu,sd,log=TRUE) } } mle(minuslogl=fn0(x),...) My feeling is that this will be somewhat mysterious to the intermediate R users who are my target audience.) I have three thoughts on how to allow different data sets to be substituted in the same objective function, and I'm not sure which is best. 1. passed in ... as in optim() advantages -- simple, not a lot of mucking around with environments etc.. disadvantages -- have to separate out arguments that are not intended for the objective function, either by messing with the argument string (e.g. matching against formals(fn)) or by isolating optim args in an optim.args list e.g. fn <- function(mu,sd,x) { -sum(dnorm(x,mu,sd)) } mle(minuslogl=fn,...,x=x) 2. passed as a separate argument (data=), where elements of data are taken as additional arguments to the function (e.g. do.call("fn",c(args,data))) e.g. fn <- function(mu,sd,x) { -sum(dnorm(x,mu,sd)) } mle(minuslogl=fn,...,data=list(x=x)) 3. passed as a separate argument, (data=), function BODY is evaluated in an environment containing the elements of data (or attach(data) before evaluating function; or with(data,...)) advantages: works well for a formula interface is there a better way to add objects from a list to an environment than mapply(function(name,obj) { assign(name,obj,envir=myenv) }, names(mylist),mylist) ? e.g. fn <- function(mu,sd) { -sum(dnorm(x,mu,sd)) } mle(minuslogl=fn,...,data=list(x=x)) For anyone who has read this far: right now I am calling my extended function mle(), but that seems to be asking for trouble [i.e. confused questions from users who don't know they're using bbmle::mle and not stats4::mle]. Any recommendations for what to call it? mle2? mlex ("extended mle") ? mlx? thanks for any input, Ben Bolker signature.asc Description: OpenPGP digital signature __ 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
Thanks for the useful suggestions. I am not as CS savvy as some of you, so maybe Hans-Peter could reply? I haven't checked into it, but does his package write to files that are OpenOffice compliant? Would that satisfy more users? Mark Hin-Tak Leung wrote: > James W. MacDonald wrote: >> Have you looked at RDCOMClient? I would imagine you could do what you >> want with this package. >> >> http://www.omegahat.org/RDCOMClient/ > > Interesting point. But the dcom client would be windows-specific? > (those I mentioned - the perl mondules, openoffice, run on windows, > as well as unix boxes - not sure about gnumeric :-). > > In fact there is a very perverse way of doing it - ActiveState provides > a PerlCom product for hooking up dcom with activestate perl. i.e. you > can go via R -> RDComClient -> PerlCom -> ActiveState Perl -> > SpreadSheet::* . Just so that it does not require Excel installed > or an MS Office license... > > In that sense, probably technology based on bridging over odbc > is also acceptable? > > HTL > >> Hin-Tak Leung wrote: >>> I don't know of any native xls read/write facility in R, either >>> in core or as add-ons (I could be wrong), but if you want some source >>> code to scavenge on to build some R package out of it, there are two >>> perl modules, Spreadsheet::ParseExcel and Spreadsheet::WriteExcel >>> which are small enough to "read from front cover to back cover", >>> so to speak, might be useful for reference and steal code from. >>> >>> The other open-source packages which can read/write excel files >>> are gnumeric and openoffice and probably too big to find one's way >>> around the source code to steal there :-). >>> >>> Good luck. >>> >>> HTL >>> >>> Mark W Kimpel 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, so it keeps our virtual desks neater and less confusing. Hans, if you could do this, it would be of tremendous benefit to me and hopefully a lot of people. R developers tend to think that all scientists are running Linux on 64-bit computers, but most biomedical researches still store date in Excel files. This won't solve everybody's needs, but it could be a start. Well, let me know what you think. I am cc'ing R-devel to see if any of those guys have ideas as well. Thanks, Mark >>> >>> >>> __ >>> R-devel@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-devel >> >> > > -- Mark W. Kimpel MD Neuroinformatics Department of Psychiatry Indiana University School of Medicine __ 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
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, so it keeps our virtual desks neater > and less confusing. > > Hans, if you could do this, it would be of tremendous benefit to me and > hopefully a lot of people. R developers tend to think that all > scientists are running Linux on 64-bit computers, but most biomedical > researches still store date in Excel files. This won't solve everybody's > needs, but it could be a start. > > Well, let me know what you think. I am cc'ing R-devel to see if any of > those guys have ideas as well. > > Thanks, > Mark > > > > -- > Mark W. Kimpel MD > Neuroinformatics > Department of Psychiatry > Indiana University School of Medicine > > __ > 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] RPM support for package installation?
I feel your pain. At my workplace, the network administrators insist that anything that is to be distributed across the network be packaged up in an RPM. I have my own library of packages accessible to my section members, but when I want to make something available to everyone, I have to create an RPM. After many trials and tribulations, here is the rpm spec file I created for Prof. Ripley's RODBC package. A few things to note: 1. R-2.4.0 was installed in /opt/r-2.4.0 by an RPM called R-arc 2. I create /opt/r-2.4.0/lib/R/src and unpack the source package there, so my users can look at the original code if they want to. 3. The rpm does R CMD INSTALL pkg twice: once when it is installing the rpm, and again in the post-install step. The reason for the second pass is to insure that the help index files get rebuilt with all of the packages that are installed in the production directory. My other rpms are similar to this one. With that, here is the spec file: -- Jeff %define rversion 2.4.0 %define rtopdir /opt/r-%{rversion} %define rhome %{rtopdir}/lib/R %define rbin %{rhome}/bin/R %define rSourcePackageDir %{rhome}/src %define rBinaryPackageDir %{rhome}/library %define arcrel 9 Name: R-rodbc-arc Version: %{rversion} Release: 1.1.REV.%{arcrel} Summary: Package ODBC Interface for R License: free Requires: R-arc >= %{rversion} Provides: R-rodbc Group: Applications/Engineering Source0: %{name}-%{version}.tar.gz Buildroot: /tmp/%{name}-%{version} %description CRAN version 1.1-7 of RODBC, an ODBC interface for R. %prep %build %install [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} mkdir -p %{buildroot}%{rBinaryPackageDir} mkdir -p %{buildroot}%{rSourcePackageDir} mkdir -p %{buildroot}%{rhome}/doc/html/search cd %{buildroot}%{rSourcePackageDir} tar -xzf $RPM_SOURCE_DIR/%{name}-%{version}.tar.gz %{rbin} CMD INSTALL -c -l %{buildroot}%{rBinaryPackageDir} RODBC %files %defattr(-, mathadm, appgrp) %{rSourcePackageDir}/* %{rBinaryPackageDir}/* %clean rm -rf %{buildroot} %post cd %{rSourcePackageDir} pwd %{rbin} CMD INSTALL -c RODBC chown -R mathadm:appgrp %{rBinaryPackageDir}/RODBC chown mathadm:appgrp %{rhome}/doc/html/packages.html chown mathadm:appgrp %{rhome}/doc/html/search/index.txt %preun __ 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
I meant that the machine has Excel on it. Excel does not have to be running prior to running the R code as the R code will start up and shut down Excel itself. On 2/8/07, Gabor Grothendieck <[EMAIL PROTECTED]> 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, so it keeps our virtual desks neater > > and less confusing. > > > > Hans, if you could do this, it would be of tremendous benefit to me and > > hopefully a lot of people. R developers tend to think that all > > scientists are running Linux on 64-bit computers, but most biomedical > > researches still store date in Excel files. This won't solve everybody's > > needs, but it could be a start. > > > > Well, let me know what you think. I am cc'ing R-devel to see if any of > > those guys have ideas as well. > > > > Thanks, > > Mark > > > > > > > > -- > > Mark W. Kimpel MD > > Neuroinformatics > > Department of Psychiatry > > Indiana University School of Medicine > > > > __ > > 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] xlsReadWrite Pro and embedding objects and files in Excel worksheets
The gdata etc. packages (I cannot remember which of the g* packages it is) contains a read.xls function which reads an excel file based on a PERL script. I have used it for small stuff and for that it worked fine. I don't think they contain a write module though. Kasper On Feb 8, 2007, at 3:16 AM, Hin-Tak Leung wrote: > I don't know of any native xls read/write facility in R, either > in core or as add-ons (I could be wrong), but if you want some source > code to scavenge on to build some R package out of it, there are two > perl modules, Spreadsheet::ParseExcel and Spreadsheet::WriteExcel > which are small enough to "read from front cover to back cover", > so to speak, might be useful for reference and steal code from. > > The other open-source packages which can read/write excel files > are gnumeric and openoffice and probably too big to find one's way > around the source code to steal there :-). > > Good luck. > > HTL > > Mark W Kimpel 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, so it keeps our virtual desks neater >> and less confusing. >> >> Hans, if you could do this, it would be of tremendous benefit to >> me and >> hopefully a lot of people. R developers tend to think that all >> scientists are running Linux on 64-bit computers, but most biomedical >> researches still store date in Excel files. This won't solve >> everybody's >> needs, but it could be a start. >> >> Well, let me know what you think. I am cc'ing R-devel to see if >> any of >> those guys have ideas as well. >> >> Thanks, >> Mark >> >> >> > > __ > 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] xlsReadWrite Pro and embedding objects and files in Excel worksheets
Another option for creating XLS files it to write out HTML instead. Excel can read html files just fine, and a useful trick is giving the html file a .xls extension. So, from the user's point of view, it is an excel file even though it's just an html file. Using html works great for embedding links and formatted tables. You can use the R2HTML package to generate HTML files, including formatting for a large number of R objects. One thing you can't do with this approach is include graphics. In theory you could do that by extending this approach. Excel can read in *.mhtml files, which are multipart mime-encoded bundles that include the html file plus mime-encoded graphics files that go with it. You could generate png files in R to include. Excel will also happily read in mhtml files with a .xls extension. The following links could help you get started: http://en.wikipedia.org/wiki/MHTML http://finzi.psych.upenn.edu/R/library/caTools/html/base64.html I don't know of an R package that has a function to encode files as a multipart mime, but the link above is a good start. - Tom Tom Short EPRI Mark W Kimpel 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, so it keeps our virtual desks neater > and less confusing. > > Hans, if you could do this, it would be of tremendous benefit to me and > hopefully a lot of people. R developers tend to think that all > scientists are running Linux on 64-bit computers, but most biomedical > researches still store date in Excel files. This won't solve everybody's > needs, but it could be a start. > > Well, let me know what you think. I am cc'ing R-devel to see if any of > those guys have ideas as well. > > Thanks, > Mark > > > > -- > Mark W. Kimpel MD > Neuroinformatics > Department of Psychiatry > Indiana University School of Medicine > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > > -- View this message in context: http://www.nabble.com/xlsReadWrite-Pro-and-embedding-objects-and-files-in-Excel-worksheets-tf3191737.html#a8871790 Sent from the R devel mailing list archive at Nabble.com. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] supsmu(periodic=TRUE) can crash R by reading before start of array (PR#9502)
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
Re: [Rd] xlsReadWrite Pro and embedding objects and files in Excel worksheets
On Thursday 08 February 2007 2:09 pm, tshort wrote: > I don't know of an R package that has a function to encode files as a > multipart mime, but the link above is a good start. Tclib has mime encoding module one could use it from within R with .Tcl("package require tcllib") best Vladimir Dergachev > > - Tom __ 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
On Sun, Feb 04, 2007 at 10:47:37PM +0100, cstrato wrote: > Seth Falcon wrote: > > cstrato <[EMAIL PROTECTED]> writes: > > > >> Thank you for your fast answer. > >> Sorrowly, I don´t know how to use a debugger on MacOS X, I am using > >> old-style print commands. > >> > > > > You should be able to use gdb on OS X (works for me, YMMV). So you > > could try: > > > > R -d gdb > > run > > # source a script that causes crash > > # back in gdb, use backtrace, etc. > > > > + seth > > > > > > > Dear Seth > > Thank you for this tip, I just tried it and here is the result: > > Welcome to MyClass > > writeFileCpp("myout_fileCpp.txt") > [1] "outfile = myout_fileCpp.txt" > Writing file myout_fileCpp.txt using C++ style. > ---MyClassA::MyClassA()- > ---MyClassA::WriteFileCpp- > > Program received signal EXC_BAD_ACCESS, Could not access memory. > Reason: KERN_PROTECTION_FAILURE at address: 0x0006 > 0x020fe231 in std::ostream::flush (this=0x214f178) at > /Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc:395 > 395 > /Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc: > No such file or directory. > in > /Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc > (gdb) > > It seems that it cannot find ostream.tcc, whatever this extension means. > > Best regards > Christian I also don't see what the problem is, but have a couple of thoughts. Under OS-X there is an environment variable you can define to get the dynamic linker to load debug versions of libraries. I can't remember what it is, but maybe something like DYLD_DEBUG (but probably DEBUG is part of the value of the variable). For that, or the tracing above, to be fully informative you need to have installed the appropriate debugging libraries and sources. You may need to set an explicit source search path in gdb to pick up the source files. Try stepping through the code from write before the crash to determine exactly where it runs into trouble. Does the output file you are trying to create exist? Unfortunately, none of this really gets at your core bug, but it might help track it down. Ross __ 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
Ross Boylan wrote: > On Sun, Feb 04, 2007 at 10:47:37PM +0100, cstrato wrote: > >> Seth Falcon wrote: >> >>> cstrato <[EMAIL PROTECTED]> writes: >>> >>> Thank you for your fast answer. Sorrowly, I don´t know how to use a debugger on MacOS X, I am using old-style print commands. >>> You should be able to use gdb on OS X (works for me, YMMV). So you >>> could try: >>> >>> R -d gdb >>> run >>> # source a script that causes crash >>> # back in gdb, use backtrace, etc. >>> >>> + seth >>> >>> >>> >>> >> Dear Seth >> >> Thank you for this tip, I just tried it and here is the result: >> >> Welcome to MyClass >> > writeFileCpp("myout_fileCpp.txt") >> [1] "outfile = myout_fileCpp.txt" >> Writing file myout_fileCpp.txt using C++ style. >> ---MyClassA::MyClassA()- >> ---MyClassA::WriteFileCpp- >> >> Program received signal EXC_BAD_ACCESS, Could not access memory. >> Reason: KERN_PROTECTION_FAILURE at address: 0x0006 >> 0x020fe231 in std::ostream::flush (this=0x214f178) at >> /Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc:395 >> 395 >> /Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc: >> No such file or directory. >> in >> /Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc >> (gdb) >> >> It seems that it cannot find ostream.tcc, whatever this extension means. >> >> Best regards >> Christian >> > > I also don't see what the problem is, but have a couple of thoughts. > Under OS-X there is an environment variable you can define to get the > dynamic linker to load debug versions of libraries. I can't remember > what it is, but maybe something like DYLD_DEBUG (but probably DEBUG is > part of the value of the variable). > > For that, or the tracing above, to be fully informative you need to > have installed the appropriate debugging libraries and sources. > > You may need to set an explicit source search path in gdb to pick up > the source files. > > Try stepping through the code from write before the crash to determine > exactly where it runs into trouble. > > Does the output file you are trying to create exist? > > Unfortunately, none of this really gets at your core bug, but it might > help track it down. > > Ross > > > Dear Ross Thank you, my problem is that I know exactly where the problem is but not how to solve it. I have installed R-2.4.1 on three different machines to test the package: - Intel-Laptop running Fedora Core 4: package is OK - PPC-PowerBook Titanium OS X 10.4.4: package is OK - Intel-MacBook Pro Core 2 Duo OS X 10.4.8: C output OK, C++ output crashes R The following code in method WriteFileCpp() works, but gives no result: { std::ofstream output(outfile); output.close(); } The following code in method WriteFileCpp() crashes R: { std::ofstream output(outfile); output << "21" << endl; output.close(); } It seems that on the Intel-MacBook Pro the operator "<<" is not recognized, when called from within my package in R. In contrast, when compiled as a C++ library, the same code does work on my Intel-Mac! Best regards Christian __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] One possible use for threads in R
I have been using R on a cluster with some work that does not parallelize neatly because the time individual computations take varies widely and unpredictably. So I've considered implementing a work-stealing arrangement, in which idle nodes grab tasks from busy nodes. It might also be useful for nodes to communicate results with each other. My first thought on handling this was to have one R thread that managed the communication, and 2 that managed computation (each node is dual-processor). Previous discussion has noted that R is not multi-threaded, and also asked what use cases multi-threading might address. So here's a use case. The advantage of having R doing the communication is that it's easy to pass R-level objects around using, e.g., Rmpi. The advantage of having the communicator and the calculators share the same thread is that work and information the communicator got would be immediately available to the calculators. Other comments suggested IPC is fast (though one comment referred specifically to Linux, and the cluster is OS-X), so it may be quite workable to have each thread in a separate process. I'm not at all sure the implementation I sketched above is the best approach to this problem (or even that it would be if R were multi-threaded), but it does seem to me this might be one area where threads would be handy in R. Ross Boylan __ 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
On Thu, Feb 08, 2007 at 10:04:14PM +0100, cstrato wrote: > Ross Boylan wrote: > >On Sun, Feb 04, 2007 at 10:47:37PM +0100, cstrato wrote: > > > >>Seth Falcon wrote: > >> > >>>cstrato <[EMAIL PROTECTED]> writes: > >>> > >>> > Thank you for your fast answer. > Sorrowly, I don´t know how to use a debugger on MacOS X, I am using > old-style print commands. > > > >>>You should be able to use gdb on OS X (works for me, YMMV). So you > >>>could try: > >>> > >>> R -d gdb > >>> run > >>> # source a script that causes crash > >>> # back in gdb, use backtrace, etc. > >>> > >>>+ seth > >>> > >>> > >>> > >>> > >>Dear Seth > >> > >>Thank you for this tip, I just tried it and here is the result: > >> > >>Welcome to MyClass > >> > writeFileCpp("myout_fileCpp.txt") > >>[1] "outfile = myout_fileCpp.txt" > >>Writing file myout_fileCpp.txt using C++ style. > >>---MyClassA::MyClassA()- > >>---MyClassA::WriteFileCpp- > >> > >>Program received signal EXC_BAD_ACCESS, Could not access memory. > >>Reason: KERN_PROTECTION_FAILURE at address: 0x0006 > >>0x020fe231 in std::ostream::flush (this=0x214f178) at > >>/Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc:395 > >>395 > >>/Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc: > >>No such file or directory. > >>in > >>/Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc > >>(gdb) > >> > >>It seems that it cannot find ostream.tcc, whatever this extension means. > >> > >>Best regards > >>Christian > >> > > > >I also don't see what the problem is, but have a couple of thoughts. > >Under OS-X there is an environment variable you can define to get the > >dynamic linker to load debug versions of libraries. I can't remember > >what it is, but maybe something like DYLD_DEBUG (but probably DEBUG is > >part of the value of the variable). > > > >For that, or the tracing above, to be fully informative you need to > >have installed the appropriate debugging libraries and sources. > > > >You may need to set an explicit source search path in gdb to pick up > >the source files. > > > >Try stepping through the code from write before the crash to determine > >exactly where it runs into trouble. > > > >Does the output file you are trying to create exist? > > > >Unfortunately, none of this really gets at your core bug, but it might > >help track it down. > > > >Ross > > > > > > > Dear Ross > > Thank you, my problem is that I know exactly where the problem is but > not how to solve it. > > I have installed R-2.4.1 on three different machines to test the package: > - Intel-Laptop running Fedora Core 4: package is OK > - PPC-PowerBook Titanium OS X 10.4.4: package is OK > - Intel-MacBook Pro Core 2 Duo OS X 10.4.8: C output OK, C++ output > crashes R > > The following code in method WriteFileCpp() works, but gives no result: > { > std::ofstream output(outfile); > output.close(); > } > > The following code in method WriteFileCpp() crashes R: > { > std::ofstream output(outfile); > output << "21" << endl; > output.close(); > } > > It seems that on the Intel-MacBook Pro the operator "<<" is not > recognized, when called from within my package in R. > In contrast, when compiled as a C++ library, the same code does work on > my Intel-Mac! > > Best regards > Christian > > Knowing the line isn't as specific as knowing exactly where it was when it crashed. Your stack trace was Thread 0 Crashed: 0 libstdc++.6.dylib 0x020fe231 std::basic_ostream >::flush() + 17 (ostream.tcc:395) 1 libstdc++.6.dylib 0x020fe358 std::basic_ostream >::sentry::sentry[in-charge](std::basic_ostream >&) + 120 (ostream.tcc:56) 2 libstdc++.6.dylib 0x02100b5d std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) + 29 (ostream.tcc:620) 3 MyClass.so0x0004a30f MyClassA::WriteFileCpp(char const*) which doesn't look as if the problem is that << isn't recognized. What is the thing that was at address 0x06? The flush is probably from the endl. If you traced it through, you could tell if the first << completed. Does output << endl; work? or output << "21"; or output << 21 << endl; or #include string s("21"); output << s; ? The different fates of the two OS-X platforms is certainly vexing. These are all shots in the dark, but 1) Was the complete system (i.e., R as well as your code) built with the the toolchain on both platforms? 2) Are your environments (e.g., environment variables) the same? 3) The recommended way to build stuff that will be talking to R is with R CMD config. Check first if that gives the same results on both systems, and second if your build is using them. 4) Maybe some dylib (e.g., stdc++) is not getting initialized properly. Maybe there's some subtle linker problem, or a problem with the representation of strings _
Re: [Rd] Problem using ofstream in C++ class in package for MacOS X
Ross Boylan wrote: > On Thu, Feb 08, 2007 at 10:04:14PM +0100, cstrato wrote: > >> Ross Boylan wrote: >> >>> On Sun, Feb 04, 2007 at 10:47:37PM +0100, cstrato wrote: >>> >>> Seth Falcon wrote: > cstrato <[EMAIL PROTECTED]> writes: > > > >> Thank you for your fast answer. >> Sorrowly, I don´t know how to use a debugger on MacOS X, I am using >> old-style print commands. >> >> >> > You should be able to use gdb on OS X (works for me, YMMV). So you > could try: > > R -d gdb > run > # source a script that causes crash > # back in gdb, use backtrace, etc. > > + seth > > > > > Dear Seth Thank you for this tip, I just tried it and here is the result: Welcome to MyClass > writeFileCpp("myout_fileCpp.txt") > [1] "outfile = myout_fileCpp.txt" Writing file myout_fileCpp.txt using C++ style. ---MyClassA::MyClassA()- ---MyClassA::WriteFileCpp- Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x0006 0x020fe231 in std::ostream::flush (this=0x214f178) at /Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc:395 395 /Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc: No such file or directory. in /Builds/unix/o403/i686-apple-darwin8/libstdc++-v3/include/bits/ostream.tcc (gdb) It seems that it cannot find ostream.tcc, whatever this extension means. Best regards Christian >>> I also don't see what the problem is, but have a couple of thoughts. >>> Under OS-X there is an environment variable you can define to get the >>> dynamic linker to load debug versions of libraries. I can't remember >>> what it is, but maybe something like DYLD_DEBUG (but probably DEBUG is >>> part of the value of the variable). >>> >>> For that, or the tracing above, to be fully informative you need to >>> have installed the appropriate debugging libraries and sources. >>> >>> You may need to set an explicit source search path in gdb to pick up >>> the source files. >>> >>> Try stepping through the code from write before the crash to determine >>> exactly where it runs into trouble. >>> >>> Does the output file you are trying to create exist? >>> >>> Unfortunately, none of this really gets at your core bug, but it might >>> help track it down. >>> >>> Ross >>> >>> >>> >>> >> Dear Ross >> >> Thank you, my problem is that I know exactly where the problem is but >> not how to solve it. >> >> I have installed R-2.4.1 on three different machines to test the package: >> - Intel-Laptop running Fedora Core 4: package is OK >> - PPC-PowerBook Titanium OS X 10.4.4: package is OK >> - Intel-MacBook Pro Core 2 Duo OS X 10.4.8: C output OK, C++ output >> crashes R >> >> The following code in method WriteFileCpp() works, but gives no result: >> { >> std::ofstream output(outfile); >> output.close(); >> } >> >> The following code in method WriteFileCpp() crashes R: >> { >> std::ofstream output(outfile); >> output << "21" << endl; >> output.close(); >> } >> >> It seems that on the Intel-MacBook Pro the operator "<<" is not >> recognized, when called from within my package in R. >> In contrast, when compiled as a C++ library, the same code does work on >> my Intel-Mac! >> >> Best regards >> Christian >> >> >> > Knowing the line isn't as specific as knowing exactly where it was > when it crashed. > > Your stack trace was > Thread 0 Crashed: > 0 libstdc++.6.dylib 0x020fe231 std::basic_ostream std::char_traits >::flush() + 17 (ostream.tcc:395) > 1 libstdc++.6.dylib 0x020fe358 std::basic_ostream std::char_traits > >::sentry::sentry[in-charge](std::basic_ostream std::char_traits >&) + 120 (ostream.tcc:56) > 2 libstdc++.6.dylib 0x02100b5d std::basic_ostream std::char_traits >& std::operator<< > >(std::basic_ostream >&, char const*) + 29 > (ostream.tcc:620) > 3 MyClass.so0x0004a30f MyClassA::WriteFileCpp(char const*) > which doesn't look as if the problem is that << isn't recognized. > What is the thing that was at address 0x06? > > The flush is probably from the endl. If you traced it through, you > could tell if the first << completed. > > Does > output << endl; > work? > Does not work! > or > output << "21"; > Does not work! > or > output << 21 << endl; > Does not work! > or > #include > string s("21"); > output << s; > ? > Does work! Even "output << s << endl;" works, but the outfile is empty! > The different fates of the two OS-X platforms is certainly vexing. > These are all shots in the dark, but > 1) Was the complete system (i.e.
[Rd] wheel ownership of new documents: OS X, (PR#9499)
Full_Name: William Doane Version: R version 2.4.1 (2006-12-18) R.app GUI 1.18 (4038) OS: OS X 10.4.8 Submission from: (NULL) (72.228.26.7) If one creates a new document within R.app and saves it, the group ownership is set to wheel, rather than the users' personal group: -rw-r--r--1 wejdoane wheel 3 Feb 8 12:01 abc.R Expected behavior: -rw-r--r--1 wejdoane wejdoane3 Feb 8 12:01 abc.R __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] obscure error with subsetting as.list() of a function then assigning that a (PR#9500)
Hello. I was writing some code that computes on the language and came across this. I can work around it, but thought you might like to know about it. > f <- function(x) { NULL } > a <- as.list(f)[[1]] > a # ie print(a) Error: argument "a" is missing, with no default Note it says *argument* "a", which is strange. In fact, and unsurprisingly, the bug lies with the object itself, not with print(): > typeof(a) Error in typeof(a) : argument "a" is missing, with no default > deparse(a) Error in deparse(a) : argument "a" is missing, with no default However, this does work: > as.list(f)[[1]] It prints nothing, which is correct, and there is no error. So it seems the bug lies with assigning a name to as.list(f)[[1]] as above, then trying to work with that new object. Regards, [EMAIL PROTECTED] --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status = major = 2 minor = 4.1 year = 2006 month = 12 day = 18 svn rev = 40228 language = R version.string = R version 2.4.1 (2006-12-18) Windows XP Professional (build 2600) Service Pack 2.0 Locale: LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 Search Path: .GlobalEnv, file:c:/schupl/R/myRLib/.RData, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, Autoloads, package:base --- This e-mail may contain confidential and/or privileged infor...{{dropped}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] obscure error with subsetting as.list() of a function then assigning that a (PR#9500)
Also note: missing(a) # TRUE On 2/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hello. I was writing some code that computes on the language and came across > this. I can work around it, but thought you might like to know about it. > > > f <- function(x) { NULL } > > a <- as.list(f)[[1]] > > a # ie print(a) > Error: argument "a" is missing, with no default > > Note it says *argument* "a", which is strange. In fact, and unsurprisingly, > the bug lies > with the object itself, not with print(): > > > typeof(a) > Error in typeof(a) : argument "a" is missing, with no default > > deparse(a) > Error in deparse(a) : argument "a" is missing, with no default > > However, this does work: > > as.list(f)[[1]] > > It prints nothing, which is correct, and there is no error. So it seems the > bug lies with > assigning a name to as.list(f)[[1]] as above, then trying to work with that > new object. > > Regards, > [EMAIL PROTECTED] > > > --please do not edit the information below-- > > Version: > platform = i386-pc-mingw32 > arch = i386 > os = mingw32 > system = i386, mingw32 > status = > major = 2 > minor = 4.1 > year = 2006 > month = 12 > day = 18 > svn rev = 40228 > language = R > version.string = R version 2.4.1 (2006-12-18) > > Windows XP Professional (build 2600) Service Pack 2.0 > > Locale: > LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United > Kingdom.1252;LC_MONETARY=English_United > Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 > > Search Path: > .GlobalEnv, file:c:/schupl/R/myRLib/.RData, package:stats, package:graphics, > package:grDevices, package:utils, package:datasets, package:methods, > Autoloads, package:base > --- > > This e-mail may contain confidential and/or privileged infor...{{dropped}} > > __ > 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] obscure error with subsetting as.list() of a function then assigning that a (PR#9500)
[EMAIL PROTECTED] writes: > Hello. I was writing some code that computes on the language and came across > this. I can work around it, but thought you might like to know about it. > >> f <- function(x) { NULL } >> a <- as.list(f)[[1]] >> a # ie print(a) > Error: argument "a" is missing, with no default > > Note it says *argument* "a", which is strange. In fact, and unsurprisingly, > the bug lies > with the object itself, not with print(): > >> typeof(a) > Error in typeof(a) : argument "a" is missing, with no default >> deparse(a) > Error in deparse(a) : argument "a" is missing, with no default > > However, this does work: >> as.list(f)[[1]] > > It prints nothing, which is correct, and there is no error. So it seems the > bug lies with > assigning a name to as.list(f)[[1]] as above, then trying to work with that > new object. 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? What you're seeing is R's "missing argument object", via the default value of the formal argument x. A slightly cleaner way to get your result is > formals(f) $x > a <-formals(f)$x > a Error: argument "a" is missing, with no default Technically, the missing argument object is a zero-length variable name: > mode(formals(f)$x) [1] "name" > as.character(formals(f)$x) [1] "" Except for direct meddling with the formals(f), the only way to assign the missing argument object is via parameter passing - any other attempt to access it gives an error. So the common case is that the object is indeed a function argument. > Regards, > [EMAIL PROTECTED] > > > --please do not edit the information below-- > > Version: > platform = i386-pc-mingw32 > arch = i386 > os = mingw32 > system = i386, mingw32 > status = > major = 2 > minor = 4.1 > year = 2006 > month = 12 > day = 18 > svn rev = 40228 > language = R > version.string = R version 2.4.1 (2006-12-18) > > Windows XP Professional (build 2600) Service Pack 2.0 > > Locale: > LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United > Kingdom.1252;LC_MONETARY=English_United > Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 > > Search Path: > .GlobalEnv, file:c:/schupl/R/myRLib/.RData, package:stats, package:graphics, > package:grDevices, package:utils, package:datasets, package:methods, > Autoloads, package:base > --- > > This e-mail may contain confidential and/or privileged infor...{{dropped}} > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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
On Thu, Feb 08, 2007 at 11:53:21PM +0100, cstrato wrote: ... > >Maybe there's some subtle linker problem, or a problem with the > >representation of strings > > > > > > > What do you mean with linker problem? > Nothing very specific, but generically wrong options, wrong objects/libraries, or wrong order of the first 2. "Wrong" includes omitting something that should be there or including something that shouldn't. Linking on OS-X is unconventional relative to other systems I have used. In particular, one usually gets lots of errors about duplicate symbols (which can be turned off, at some risk) and needs to specify flat rather than 2-level namespace. There's lots more if you look at the linker page (man ld). Similar issues can arise at the compiler phase too. Another fun thing on OS-X is that they have a libtool that is different from the GNU libtool, and your project might use both. So you need to be sure to get the right one. But it's unlikely you could even build if that were an issue. If different parts (e.g., R vs your code) are built with different options, that can cause trouble. For example, my Makefile has MAINCXXFLAGS := $(shell R CMD config --cppflags) -std=c++98 -Wall -I$(TRUESRCDIR) This relies on GNU make features. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] obscure error with subsetting as.list() of a function then (PR#9504)
[EMAIL PROTECTED] writes: > Hello. I was writing some code that computes on the language and came acr= oss > this. I can work around it, but thought you might like to know about it. > >> f <- function(x) { NULL } >> a <- as.list(f)[[1]] >> a # ie print(a) > Error: argument "a" is missing, with no default > > Note it says *argument* "a", which is strange. In fact, and unsurprisingl= y, the bug lies > with the object itself, not with print(): > >> typeof(a) > Error in typeof(a) : argument "a" is missing, with no default >> deparse(a) > Error in deparse(a) : argument "a" is missing, with no default > > However, this does work: >> as.list(f)[[1]] > > It prints nothing, which is correct, and there is no error. So it seems t= he bug lies with > assigning a name to as.list(f)[[1]] as above, then trying to work with th= at new object. 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? What you're seeing is R's "missing argument object", via the default value of the formal argument x. A slightly cleaner way to get your result is > formals(f) $x > a <-formals(f)$x > a Error: argument "a" is missing, with no default Technically, the missing argument object is a zero-length variable name:=20 > mode(formals(f)$x) [1] "name" > as.character(formals(f)$x) [1] "" Except for direct meddling with the formals(f), the only way to assign the missing argument object is via parameter passing - any other attempt to access it gives an error. So the common case is that the object is indeed a function argument. > Regards, > [EMAIL PROTECTED] > > > --please do not edit the information below-- > > Version: > platform =3D i386-pc-mingw32 > arch =3D i386 > os =3D mingw32 > system =3D i386, mingw32 > status =3D > major =3D 2 > minor =3D 4.1 > year =3D 2006 > month =3D 12 > day =3D 18 > svn rev =3D 40228 > language =3D R > version.string =3D R version 2.4.1 (2006-12-18) > > Windows XP Professional (build 2600) Service Pack 2.0 > > Locale: > LC_COLLATE=3DEnglish_United Kingdom.1252;LC_CTYPE=3DEnglish_United Kingdo= m.1252;LC_MONETARY=3DEnglish_United Kingdom.1252;LC_NUMERIC=3DC;LC_TIME=3DE= nglish_United Kingdom.1252 > > Search Path: > .GlobalEnv, file:c:/schupl/R/myRLib/.RData, package:stats, package:graph= ics, package:grDevices, package:utils, package:datasets, package:methods, A= utoloads, package:base > --- > > This e-mail may contain confidential and/or privileged infor...{{dropped}} > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel --=20 O__ Peter Dalgaard =D8ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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
On Thu, 8 Feb 2007, Ross Boylan wrote: > On Thu, Feb 08, 2007 at 11:53:21PM +0100, cstrato wrote: > ... > > >Maybe there's some subtle linker problem, or a problem with the > > >representation of strings > > > > What do you mean with linker problem? > > > Nothing very specific, but generically wrong options, wrong > objects/libraries, or wrong order of the first 2. "Wrong" includes > omitting something that should be there or including something that > shouldn't. > [SNIP] Ross, This is not the case as the package was converted to use Makevars and had the same results. It's probably something misconfigured on Christian's laptop; waiting for Simon to take a look. -- SIGSIG -- signature too long (core dumped) __ 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
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, so it keeps our virtual desks neater >> and less confusing. >> >> Hans, if you could do this, it would be of tremendous benefit to me and >> hopefully a lot of people. R developers tend to think that all >> scientists are running Linux on 64-bit computers, but most biomedical >> researches still store date in Excel files. This won't solve everybody's >> needs, but it could be a start. >> >> Well, let me know what you think. I am cc'ing R-devel to see if any of >> those guys have ideas as well. >> >> Thanks, >> Mark >> >> >> >> -- >> Mark W. Kimpel MD >> Neuroinformatics >> Department of Psychiatry >> Indiana University School of Medicine >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > -- Mark W. Kimpel MD Neuroinformatics Department of Psychiatry Indiana University School of
[Rd] append within worksheet in write.xls
I can currently append an entire worksheet with write.xls, but would also like to be able to append within the same worksheet. Is this possible? It doesn't seem to work if I use append = T Thanks, Mark -- Mark W. Kimpel MD Neuroinformatics Department of Psychiatry Indiana University School of Medicine __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] newline with cell of Excel worksheet created with write.xls
As part of my project to put different types of results into worksheets, I would like to be able to put an auto-generated methods section. If I compose in RWinEdt, read into R, and use write.table with a .txt file extension, what I get out has line-breaks that correspond to those I put in in the first place. If I do the same thing but write.xls with .xls extention, I get an Excel worksheet with the entire paragraph on one line (row). It seems to me that Excel uses a special character for new-lines (new-rows). Is there a way that write.xls could convert \n to this special character? I'm writing lots of posts on this, but trying to break up the subjects to create better threads. Mark -- Mark W. Kimpel MD Neuroinformatics Department of Psychiatry Indiana University School of Medicine __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel