Re: [R] __stdcall funcitons called using .C() on win32 chokes
Just add a glue routine to provide a _cdecl interface. Note, it is a .C interface and not a .Pascal interface. You could write a .Pascal, of course. On Sat, 15 Feb 2003, Jeff D. Hamann wrote: I've developed a dll (win32) of a bunch of functions prototypes as: /* for building on *nix */ #ifndef WIN32 #define __stdcall /*nothing*/ #endif void __stdcall dbh_2_height( const unsigned long*func_idx, const unsigned long*metric, const unsigned long*species, const double *dbh, double*pred_height ); and have created a R interface function as, ## wrapper function for dbh_2_height / dbh2height - function( func, metric, sp, dbh ) { d - double(length(func)) .C(dbh_2_height, as.integer(func), as.integer(metric), as.integer(sp), as.double(dbh), d )[[5]] } I would like to keep the __stdcall in the source code and still use the .C() in R to call the function as the library is already used for many other projects. When I attempt to call the function (win32) I get an application error. I've commented out the __stdcall and the library works fine. Does anyone see a good solution around this? I would like to make use of the library and the tcltk library to use R as a simulation environment. Jeff. Jeff D. Hamann PO Box 1421 Corvallis, Oregon USA 97339-1421 541-753-7333 www.hamanndonald.com [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] RMySQL installation and loading errors
The message does not say that RMySQL is empty, indeed finds a DLL there, so please check your facts and the R-help archives for *yesterday*. I suspect all you need to do is to put .../library/RMySQL/lib in your path. On Sun, 16 Feb 2003 [EMAIL PROTECTED] wrote: Hi R users, I have been trying to install and use RMySQL on Windows98 for MySQL3.23.55-max using the pulldown menu. I am getting the following errors. I read the doc and some archived mails about a similar problem on unix like systems. Still can't get it to work. Some info below that may indicated where the problem is: * The directory RMySQL\libs is empty---I was not expecting this. * There is a file README.windows in RMySQL directory which suggests some changes using the re-import utility reimp, available at http://mefriss1.swan.ac.uk/~jfonseca/gnu-win32/software/reimp/index.html This file is missing at this location. Instead there is a note stating that it is included in MinGW distribution. I installed this, but did not find this file. * Below is the info from the installation and loading the library: {a - CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a)} trying URL `http://cran.r-project.org/bin/windows/contrib/PACKAGES' Content type `text/plain; charset=iso-8859-1' length 8948 bytes opened URL downloaded 8948 bytes trying URL `http://cran.r-project.org/bin/windows/contrib/RMySQL.zip' Content type `application/zip' length 322573 bytes opened URL downloaded 315Kb Delete downloaded files (y/N)? y updating HTML package descriptions Warning message: DLL attempted to change FPU control word from 8001f to 9001f library(RMySQL) Loading required package: methods Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library H:/PROGRAMLOCAL/RW1062/library/RMySQL/libs/RMySQL.dll: LoadLibrary failure: One of the library files needed to run this application cannot be found. Error in library(RMySQL) : .First.lib failed -at * Prediction is very difficult, especially about the future. -- Niels Bohr __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] RMySQL installation and loading errors
In a message dated 2/16/03 6:24:53 AM Eastern Standard Time, [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: Thanks. The file is indeed there. By default Windows Explorer makes the *.dll files invisible. The file seem to be in a branch of the default library. I am missing something here. .libPaths() [1] H:/PROGRAMLOCAL/RW1062/library library(RMySQL) Loading required package: methods Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library H:/PROGRAMLOCAL/RW1062/library/RMySQL/libs/RMySQL.dll: LoadLibrary failure: One of the library files needed to run this application cannot be found. Error in library(RMySQL) : .First.lib failed You missed to read README.windows in the packages' directory and Brian Ripley's mail carefully (citing the latter): I suspect all you need to do is to put .../library/RMySQL/lib in your path, where path means the *environment variable* of your OS called PATH. If you don't know how to set environment variables, please contact the IT stuff of your department or the OS manuals / support. Uwe Ligges Thanks. Just did it in Autoexec.bat file. It seems to be working well. While loading the library there is still a warning. Is this something to worry about? {pkg - select.list(sort(.packages(all.available = TRUE))) + if(nchar(pkg)) library(pkg, character.only=TRUE)} Loading required package: methods Warning message: DLL attempted to change FPU control word from 8001f to 9001f * Prediction is very difficult, especially about the future. -- Niels Bohr * [[alternate HTML version deleted]] __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] download CRAN packages and proxy config.
Dear R users, I'm starting to get acquainted with R. I've been reading the manual, and I understood that if I wanted to install a user written package on R, I could do it directly from the Internet, by typing the line install.packages(quantreg) in an R session. To my surprise this command did not work, nor did the command update packages from CRAN... from the menu option. In the latter I got the following error message: - CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a)} trying URL `http://cran.r-project.org/bin/windows/contrib/PACKAGES' unable to connect to 'cran.r-project.org'. Error in download.file(url = paste(contriburl, PACKAGES, sep = /), : cannot open URL `http://cran.r-project.org/bin/windows/contrib/PACKAGES' The strange thing was that I was able to visit the internet address the R was trying to connect, from my web browser. Thus I imagine that the problem was a proxy issue on R. I would sincerely appreciate if one of the more experience R user could help me to sort this issue out. I found a way to configure my proxy setting by typing on the main window 'http://wwwcache.ncl.ac.uk:8080/;', however it didn't seem to have worked, as I kept getting the same error message when I tried to connect the CRAN. Any help would be extremely appreciated, Joao Pedro/ __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] RMySQL installation and loading errors
[EMAIL PROTECTED] wrote: In a message dated 2/16/03 6:24:53 AM Eastern Standard Time, [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: Thanks. The file is indeed there. By default Windows Explorer makes the *.dll files invisible. The file seem to be in a branch of the default library. I am missing something here. .libPaths() [1] H:/PROGRAMLOCAL/RW1062/library library(RMySQL) Loading required package: methods Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library H:/PROGRAMLOCAL/RW1062/library/RMySQL/libs/RMySQL.dll: LoadLibrary failure: One of the library files needed to run this application cannot be found. Error in library(RMySQL) : .First.lib failed You missed to read README.windows in the packages' directory and Brian Ripley's mail carefully (citing the latter): I suspect all you need to do is to put .../library/RMySQL/lib in your path, where path means the *environment variable* of your OS called PATH. If you don't know how to set environment variables, please contact the IT stuff of your department or the OS manuals / support. Uwe Ligges Thanks. Just did it in Autoexec.bat file. It seems to be working well. While loading the library there is still a warning. Is this something to worry about? {pkg - select.list(sort(.packages(all.available = TRUE))) + if(nchar(pkg)) library(pkg, character.only=TRUE)} Loading required package: methods Warning message: DLL attempted to change FPU control word from 8001f to 9001f From file CHANGES: Warnings are printed if a loaded DLL changes the floating point control word: see ?dyn.load for the details. So just read ?dyn.load. Additionally, search the mailing list archives for a discussion about that warning message. Uwe Ligges * Prediction is very difficult, especially about the future. -- Niels Bohr * [[alternate HTML version deleted]] __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] download CRAN packages and proxy config.
Joao Pedro W. de Azevedo wrote: Dear R users, I'm starting to get acquainted with R. I've been reading the manual, and I understood that if I wanted to install a user written package on R, I could do it directly from the Internet, by typing the line install.packages(quantreg) in an R session. To my surprise this command did not work, nor did the command update packages from CRAN... from the menu option. In the latter I got the following error message: - CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a)} trying URL `http://cran.r-project.org/bin/windows/contrib/PACKAGES' unable to connect to 'cran.r-project.org'. Error in download.file(url = paste(contriburl, PACKAGES, sep = /), : cannot open URL `http://cran.r-project.org/bin/windows/contrib/PACKAGES' The strange thing was that I was able to visit the internet address the R was trying to connect, from my web browser. Thus I imagine that the problem was a proxy issue on R. I would sincerely appreciate if one of the more experience R user could help me to sort this issue out. I found a way to configure my proxy setting by typing on the main window 'http://wwwcache.ncl.ac.uk:8080/;', however it didn't seem to have worked, as I kept getting the same error message when I tried to connect the CRAN. Any help would be extremely appreciated, Joao Pedro/ Please read Section 2.16 The internet download functions fail. of the R for Windows FAQ. Uwe Ligges __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: Re: [R] ESRI shape file import and time-space models
Thanks for providing your functions, especially those for reading and writing dBase files (read.dbf and write.dbf), which presumably are of general interest because there is no other implementation for reading and writing these formats (apart from ODBC), as far as I know. However, I suggest changing one byte character readBin to readChar as the latter does not expect zero-terminated strings which were not present in my dBase-III-files' headers. One such header entry for example was (hex): 4B 4C 49 4e 00 00 00 00 00 00 00 43 2B 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 (field KLIN, type C [note 43 followed by 2B, not 00], width/length 2, padded to size 32) ## --- ## From read.dbf: ## Field Descriptions (32 bytes each) for (i in 1:num.fields) { field.name.test - readBin (infile, character(), 1, size=10, endian=little) field.name - c (field.name, field.name.test) if (nchar (field.name.test)!=10) { file.temp - readBin (infile,integer(), 10 - (nchar (field.name.test)), 1, endian=little) } ## RH 2003-02-16: replaced readBin by readChar in next line field.type - c (field.type, readChar (infile, 1)) ## RH 2003-02-16: incremented by 1 to 4 items in next line ## to compensate for above change file.temp- readBin (infile, integer(), 4, 1, endian=little) field.length - c (field.length, readBin (infile, integer(), 1, 1, endian=little)) file.temp- readBin (infile, integer(), 15, 1, endian=little) } ## --- An enhancement might be to also set the appropriate type for date fields, maybe like this (although I don't know internals of dBase date and time storage variants): ## --- ## From read.dbf: ## Set the numeric fields to numeric for (i in 1:ncol(dbf)) { ## RH 2003-02-16: added next line for date type setting if(fields$TYPE[i]==D) {dbf[,i] - strptime (as.character (dbf[,i]), format=%Y%m%d)} if(fields$TYPE[i]==C) {dbf[,i] - as.character (dbf[,i])} if(fields$TYPE[i]==N) {dbf[,i] - as.numeric (as.character (dbf[,i]))} if(fields$TYPE[i]==F) {dbf[,i] - as.numeric (as.character (dbf[,i])) warning(Possible trouble converting numeric field in the DBF\n) } } ## --- Thanks and greetings - Ralf Herold -- Dr. med. Ralf Herold | Koordinationszentrale Kompetenznetz | Pädiatrische Onkologie und Hämatologie | http://www.kinderkrebsinfo.de/ | Charité Campus Virchow-Klinikum | Medizinische Fakultät Humboldt-Universität | D-13353 Berlin, Augustenburger Platz 1 | Raum 4.3425 4. Etage Mittelallee 8 | Tel. +49 (30) 450-566834 Fax -566906 | mailto:[EMAIL PROTECTED] - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [R] ESRI shape file import and time-space models Date: Fri, 14 Feb 2003 08:29:12 -0800 [...] Attached are some functions that I wrote to read and write shapefiles and dbfs easily from within R. You do not need any additional libraries or C code. I am still working out a few bugs but I have tested it [...] Benjamin Stabler Transportation Planning Analysis Unit Oregon Department of Transportation 555 13th Street NE, Suite 2 Salem, OR 97301 Ph: 503-986-4104 [...] __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Re: ROC
In addition to the Bioconductor package, I have a few routines for estimation of ROC curves (including kernel estimates) on my web page at http://www-personal.buseco.monash.edu.au/~hyndman/Rlibrary/ROC.htm Best wishes, Rob ___ Rob J Hyndman Associate Professor Director of Consulting Department of Econometrics Business Statistics Monash University, VIC 3800, Australia. http://www-personal.buseco.monash.edu.au/~hyndman/ __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] lda on curves
I'm working on a rather interesting consulting problem with a client. A number of physical variables are measured on a number of cricket bowlers in the performance of a delivery. An example variable might be a directional component of angular momentum for a particular joint measured at a large number (101) of equally spaced timepoints. Each bowler generates a (fairly smooth) curve for each variable measured. I decided to represent each curve by a few orthogonal polynomial constrasts. There are 4 groups of bowlers corresponding to various speeds of delivery. I want to use canonical variant analysis to find linear combinations of my transformed variables discriminating well between the groups of bowlers. I used lda() from the MASS library to do this, but examining the output I notice that the higher-order orthogonal polynomials are getting larger coefficients than the more important lower-order ones. This is clearly because some scaling of the variables is being done by lda(), and because the higher-order polynomial vaiable values are smaller, they are scaled up. I would like to turn off this scaling as it is not what is needed in this problem and will cause the tail to wag the dog. There is no obvious parameter to do this in lda(x, grouping, prior = proportions, tol = 1.0e-4, subset, na.action = na.fail, method, CV = FALSE, nu) so I thought that I might try a hack. However: lda function (x, ...) { if (is.null(class(x))) class(x) - data.class(x) UseMethod(lda, x, ...) } which isn't very helpful. Any ideas about how to perform an unscaled canonical variates analysis? Cheers, Murray -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: [EMAIL PROTECTED]Fax 7 838 4155 Phone +64 7 838 4773 wk+64 7 849 6486 homeMobile 021 1395 862 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help