Re: [Rd] Problem with tcltk package: tclfile.dir missing?
Seth Falcon [EMAIL PROTECTED] writes: Hi, In R version 2.4.0 beta (2006-09-24 r39502) I'm seeing the following behavior with the tcltk package: library(tcltk) Loading Tcl/Tk interface ... done tkfile.dir() Error: 'tkfile.dir' is defunct. Use 'tclfile.dir' instead. See help(Defunct) tclfile.dir Error: object tclfile.dir not found ## But the function is in the package, just not exported? tcltk:::tclfile.dir function (...) tcl(file, dir, ...) environment: namespace:tcltk Heh, this obviously hasn't been exercised much... The issue is that NAMESPACE contains exportPattern(^tcl[[:alnum:]]*($|-)) # skip S3 methods exportPattern(^tk) so the tk -- tcl prefix change doesn't automatically work on functions with a dot in them. tclfile.tail is the only other case that I can spot. Best to fix in the obvious way at the current stage, but I wonder whether it wouldn't have been better just to have tclfile(dir, myfile) -- or for that matter just let users use the straightforward tcl(file, dir, myfile). (Or dirname(myfile) for that matter). -- 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] sprintf behavior (PR#9250)
On Mon, 25 Sep 2006, [EMAIL PROTECTED] wrote: Full_Name: Michael Bauer Version: 2.3.1 OS: Mac OS X 10.4.7 Submission from: (NULL) (131.130.124.155) sessionInfo() Version 2.3.1 (2006-06-01) powerpc-apple-darwin8.6.0 attached base packages: [1] methods stats graphics grDevices utils [6] datasets base sprintf(\p) doesn't show the backslash, this occurs with all strings that start with certain letters. There is however no explanation to this behavior. There is: see ?Quote (and C behaves in the same way). And there seems to be no way to get a guaranteed backslash in sprintf. \\, see the FAQ 7.8 for example. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] sprintf behavior (PR#9250)
[EMAIL PROTECTED] writes: Full_Name: Michael Bauer Version: 2.3.1 OS: Mac OS X 10.4.7 Submission from: (NULL) (131.130.124.155) sessionInfo() Version 2.3.1 (2006-06-01) powerpc-apple-darwin8.6.0 attached base packages: [1] methods stats graphics grDevices utils [6] datasets base sprintf(\p) doesn't show the backslash, this occurs with all strings that start with certain letters. There is however no explanation to this behavior. And there seems to be no way to get a guaranteed backslash in sprintf. This is *not* a bug (it is also not a FAQ, although I'm beginning to think it should be). Please read up on R's string handling, with particular emphasis on the concept of escape characters. \\p\n [1] \\p\n cat(\\p\n) \p nchar(\\p\n) [1] 3 Also, do not report things as bugs before you are 100% certain that they are bugs. -- 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] sprintf behavior (PR#9250)
Peter Dalgaard [EMAIL PROTECTED] writes: This is *not* a bug (it is also not a FAQ, although I'm beginning to think it should be). Just to be clear: I'm aware of FAQ 7.8, but it is about file names. Issue is whether we need a generic backslashes in text strings entry. -- 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
[Rd] Fwd: Selfstarting models for soil hydrology using R
Dear, I have developed and tested some models in soil hydrology with NLME library in R. I want to ask if it could be possible to submit this to the NLME library (with sample data) as a toolbox or something so that anyone downloading new components of new versions of R may simply call (say SSbrookscorey function to predict water retention in the same way someone can call SSlogis to predict logistic function in the current version)? I would be grateful for your support. I can also give in-depth description and capabilities for white papers concerning the applications of R in soil hydrology. Please advice me. Dr. Christian Thine, University of Nairobi, Kenya. __ Do You Yahoo!? protection around http://mail.yahoo.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] alpha, portable use
I am still confused about this (and it is still happening with R-beta). Writing R Extensions suggests I need a Makefile or Makevars in my package, but that has not been the case previously. Is there now a requirement that all packages need Makefiles or Makevars if there is fortran to be compiled? This is only happening on one of my systems. Building R and make check work fine on that system, but it seems that not all the information gets passed along to package compiles. (BTW, this is just a warning, but Kurt suggested we try to eliminate warnings.) Paul Gilbert Prof Brian Ripley wrote: On Wed, 20 Sep 2006, Paul Gilbert wrote: When I build one of my packages with alpha from yesterday I am getting * checking for portable use of $BLAS_LIBS ... WARNING apparently missing $(FLIBS) in 'PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS)' Is this something I should worry about? (Possibly I got this before and didn't notice.) Yes, please do check Writing R Extensions La version française suit le texte anglais. This email may contain privileged and/or confidential inform...{{dropped}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] apply: new behaviour for factors in R-2.4.0
Christoph, This is more complicated than your analysis. 1) apply takes a matrix as an argument, not a data frame, and so first coerced 'dat' to a character matrix. 2) unlist is working quite correctly. The issue is array(), which contains as.vector(data). Thus although the result could be a factor matrix, as.vector is coercing it to a character matrix. It might be desirable to return a factor matrix, but we are not going to do that in feature freeze (if ever) and I really don't think it would be what you wanted. Perhaps the help page should contain an explicit statement that the result will be coerced to a basic vector type by as.vector(). On Mon, 25 Sep 2006, Christoph Buser wrote: Dear R-core There is a different output for the apply function due to the change of unlist as mentioned in the R news. Newly, applying as.factor() (or factor()) in str(dat - data.frame(x = 1:10, f1 = gl(2,5,labels = c(A, B (d1 - apply(dat,2,as.factor)) newly returns a character matrix while in R-2.3.1 the same command resulted in an integer matrix that was consistent (up to the ordering of the factor levels) with data.matrix(). That's coincidence -- try x=11:20. The change is caused by the change of unlist() that, used for a list of factors, newly returns a single factor instead of an integer. I am happy with this change, but: Is it desirable to change apply so that it does not return a character matrix in the example above or include a warning for such a case? Thank you very much for an answer. Regards, Christoph Buser -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH Zurich8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] alpha, portable use
Doug I do indeed have a Makevars file after all. Thanks for spelling out the interpretation of the warning message. Paul Douglas Bates wrote: On 9/25/06, Paul Gilbert [EMAIL PROTECTED] wrote: I am still confused about this (and it is still happening with R-beta). Writing R Extensions suggests I need a Makefile or Makevars in my package, but that has not been the case previously. Is there now a requirement that all packages need Makefiles or Makevars if there is fortran to be compiled? This is only happening on one of my systems. Building R and make check work fine on that system, but it seems that not all the information gets passed along to package compiles. (BTW, this is just a warning, but Kurt suggested we try to eliminate warnings.) From the warning it seems that you have a Makevars file in the src directory for your package. The change in R-2.4.0 is that packages that did have a Makevars file of the form PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) should change that to PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) Paul Gilbert Prof Brian Ripley wrote: On Wed, 20 Sep 2006, Paul Gilbert wrote: When I build one of my packages with alpha from yesterday I am getting * checking for portable use of $BLAS_LIBS ... WARNING apparently missing $(FLIBS) in 'PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS)' Is this something I should worry about? (Possibly I got this before and didn't notice.) Yes, please do check Writing R Extensions La version française suit le texte anglais. This email may contain privileged and/or confidential inform...{{dropped}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel La version française suit le texte anglais. This email may contain privileged and/or confidential inform...{{dropped}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] buglet in ?asin
This is fron R-2.5.0-to-be, windows XP The following excerpt from ?asin cannot be right: For asin() and acos(), there are two cuts, both along the real axis: *(-Inf, 1]* and *[1, Inf)*. Functions asin() and acos() are continuous from above on the interval *(-Inf, -1]* and continuous from below on *[1, Inf)*. Note the first interval should be (-Inf, -1) not (-Inf, 1) Kjetil [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] na.encode in format for Date and POSIXt classes
Hello! na.encode does not have any effect on format of NA values of Date and POSIXct (POSIXlt?) atomic classes in a data.frame. Here is the example (the same in R 2.3.1 and 2.5.0 (2006-09-19 r39409)): testData - data.frame(num=c(NA, 2.6), int=c(1, NA), fac=factor(c(NA, abc)), cha=c(a, NA), dat=as.Date(c(1900-1-1, NA)), POS=as.POSIXct(strptime(c(1900-1-1 01:01:01, NA), format=%Y-%m-%d %H:%M:%S))) testData$cha - as.character(testData$cha) testData num int fac chadat POS 1 NA 1 NAa 1900-01-01 1900-01-01 01:01:01 2 2.6 NA abc NA NANA format(testData) num int fac chadat POS 1 NA 1 NA a 1900-01-01 1900-01-01 01:01:01 2 2.6 NA abc NA NANA format(testData, na.encode=FALSE) num int fac chadat POS 1 NA 1 NAa 1900-01-01 1900-01-01 01:01:01 2 2.6 NA abc NA NANA format(testData, na.encode=TRUE) num int fac chadat POS 1 NA 1 NA a 1900-01-01 1900-01-01 01:01:01 2 2.6 NA abc NA NANA After a brief look into format.data.frame, format.POSIXct and format.POSIXlt I notice that na.encode is not used at all in (last line of format.POSIXlt) .Internal(format.POSIXlt(x, format, usetz)) but I get lost from this point forward. I guess that the same applies to format.Date as this coerces Date to POSIXlt before formatting. Additionally, I would suggest change in format help page for argument na.encode. It says now na.encode: logical: should 'NA' strings be encoded? If I am not wrong, this applies only to non-numeric columns. Something like the following might be more accurate: na.encode: logical: should 'NA' strings be encoded (applies only to non-numeric)? -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Wish: change behaviour of header in read.fwf (PR#9252)
Hello! In my opinion read.fwf()'s behaviour of header is not really useful. Say I have the following data: col1 col2 col3 123 123 123 a b 123412 1234 65.4 4.5 Now if I want to read this data into R I can not use read.table due to missing fields. read.table(file=test.txt) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 3 did not have 3 elements However, read.fwf() can help me. read.fwf(file=test.txt, widths=c(5, 6, 5)) V1 V2V3 1 col1 col2 col3 2 123123123 3a b 4 1234 12 1234 565.44.5 Upps, I need to specify header and help page says that header fields must be separated by sep. sep part of help page says sep: character; the separator used internally; should be a character that does not occur in the file (except in the header). This is quite limiting because I never know in advance which characters do not occur in a datafile and if I do, I have to properly modify header in the file before import. Naive use of read.fwf returns an error read.fwf(file=test.txt, widths=c(5, 6, 5), header=TRUE, sep= ) Error in read.table(file = FILE, header = header, sep = sep, as.is = as.is, : more columns than column names read.fwf(file=test.txt, widths=c(5, 6, 5), header=TRUE, sep= ) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : invalid 'sep' value: must be one byte I get lost in reading source of read.fwf, but I think that the following idea should be easy to implement and it would be also similar to read.table behaviour. ideaCode if(header) { ## sep is from read.fwf call header - unlist(strsplit(readLines(con=file, n=1), split=sep)) } ... ## tweaks related to issues with length(header), row.names, ncol(), ... read.table(..., col.names=header, ...) /ideaCode I know that FWF is not used much these days, but I would find proposed change really useful. -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] S4 accessors
I have a small S4 class for which I've written a page grouping many of the accessors and replacement functions together. I would be interested in people comments on the approach I've taken. The code has a couple of decisions for which I could imagine alternatives. First, even simple get/set operations on class elements are wrapped in functions. I suppose I could just use [EMAIL PROTECTED] to do some of these operations, though that is considered bad style in more traditional OO contexts. Second, even though the functions are tied to the class, I've defined them as free functions rather than methods. I suppose I could create a generic that would reject most arguments, and then make methods appropriately. For the documentation, I've created a single page that groups many of the functions together. This is a bit awkward, since the return values are necessarily the same. Things are worse for replacement functions; as I understand it, they must use value for their final argument, but the value has different meanings and types in different contexts. Any suggestions or comments? I've attached the .Rd file in case more specifics would help. -- Ross Boylan wk: (415) 514-8146 185 Berry St #5700 [EMAIL PROTECTED] Dept of Epidemiology and Biostatistics fax: (415) 514-8150 University of California, San Francisco San Francisco, CA 94107-1739 hm: (415) 550-1062 \name{runTime-accessors} \alias{startTime} \alias{endTime} \alias{wallTime} \alias{waitTime} \alias{cpuTime} \alias{mpirank} \alias{mpirank-} \alias{remoteTime-} \title{ Accessors for runTime class} \description{ Set and get runTime related information. } \usage{ startTime(runTime) endTime(runTime) wallTime(runTime) waitTime(runTime) cpuTime(runTime) mpirank(runTime) mpirank(runTime) - value remoteTime(runTime) - value } %- maybe also 'usage' for other objects documented here. \arguments{ \item{runTime}{a \code{runTime} object} \item{value}{for \code{mpirank}, the MPI rank of the associated job. For \code{remoteTime}, a vector of statistics from the remote processor: user cpu, system cpu, wall clock time for main job, wall clock time waiting for the root process.} } \details{ All times are measured from start of job. The sequence of events is that the job is created locally, started remotely, finished remotely, and completed locally. Scheduling and transmission delays may occur. \item{startTime}{When the job was created, locally.} \item{endTime}{When job finished locally.} \item{wallTime}{How many seconds between local start and completion.} \item{cpuTime}{Remote cpu seconds used, both system and user.} \item{waitTime}{Remote seconds waiting for response from the local system after the remote computation finished.} \item{mpirank}{The rank of the execution unit that handled the remote computation.} } \value{ Generally seconds, at a system-dependent resolution. \code{mpirank} is an integer. Replacement functions return the \code{runTime} object itself. } \author{Ross Boylan} \note{Clients that use replacement functions should respect the semantics above. } \seealso{\code{\link{runTime-class}}} \keyword{programming} \keyword{environment} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] S4 accessors (corrected)
On Tue, 2006-09-26 at 00:20 +, Ross Boylan wrote: I have a small S4 class for which I've written a page grouping many of the accessors and replacement functions together. I would be interested in people comments on the approach I've taken. The code has a couple of decisions for which I could imagine alternatives. First, even simple get/set operations on class elements are wrapped in functions. I suppose I could just use [EMAIL PROTECTED] to do some of these operations, though that is considered bad style in more traditional OO contexts. Second, even though the functions are tied to the class, I've defined them as free functions rather than methods. I suppose I could create a generic that would reject most arguments, and then make methods appropriately. For the documentation, I've created a single page that groups many of the functions together. This is a bit awkward, since the return values are NOT necessarily the same. Things are worse for replacement functions; as I understand it, they must use value for their final argument, but the value has different meanings and types in different contexts. Any suggestions or comments? I've attached the .Rd file in case more specifics would help. Sorry! __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] R CMD check and x11?
One of my demos runs x11() so that I can resize the window and avoid the too large for margins message from plot. This seems to have a problematic side effect. When I run R CMD check on the package that demo is displayed, because it appears as an example in one of the man pages, and after this happens EVERY demo that plots anything is displayed (probably because they are in man pages). Normally R CMD check does not cause anything to be displayed, and this may cause problems if I submit the package to CRAN. Any pointers would be appreciated. Thanks, ds __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] R script editor fails to read script longer then 1000 chars (non-English language settings) (PR#9254)
Full_Name: Otto Shtirlitz Version: 2.3.1 OS: Win XP SP2 Submission from: (NULL) (71.102.102.246) I believe it's the same situation as described in bug 9248. R script editor cannot open file exceeding 1000 characters even if created in the same editor. File is all ANSI with symbols 128 and with window line endings CR/LF (0x0D 0x0A). The trick is the local settings : even if the OS is US if the language settings for non-Unicode (Control Panel\Regional and Language options\Advanced\Language for non-Unicode programs) is set to Russian in my case R only reads the first 1000 chars (and appends some garbage). If this setting is switched back to English the problem goes away. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] S4 accessors
Ross Boylan [EMAIL PROTECTED] writes: The code has a couple of decisions for which I could imagine alternatives. First, even simple get/set operations on class elements are wrapped in functions. I suppose I could just use [EMAIL PROTECTED] to do some of these operations, though that is considered bad style in more traditional OO contexts. I like the get/set approach as opposed to using '@'. As long as users don't use '@' you have a fair amount of flexibility to redesign/refactor your code. Second, even though the functions are tied to the class, I've defined them as free functions rather than methods. I suppose I could create a generic that would reject most arguments, and then make methods appropriately. If anyone else is going to extend your classes, then you are doing them a disservice by not making these proper methods. It means that you can control what happens when they are called on a subclass. For the documentation, I've created a single page that groups many of the functions together. This is a bit awkward, since the return values are necessarily the same. Things are worse for replacement functions; as I understand it, they must use value for their final argument, but the value has different meanings and types in different contexts. Any suggestions or comments? For accessors, I like to document them in the methods section of the class documentation. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] R CMD check and x11?
You can close the x11() device using dev.off() in your example. You may also want to look at interactive() so you can test in your example is the code is run interactively or not; the latter is the case for R CMD check. /H On 9/25/06, Dominick Samperi [EMAIL PROTECTED] wrote: One of my demos runs x11() so that I can resize the window and avoid the too large for margins message from plot. This seems to have a problematic side effect. When I run R CMD check on the package that demo is displayed, because it appears as an example in one of the man pages, and after this happens EVERY demo that plots anything is displayed (probably because they are in man pages). Normally R CMD check does not cause anything to be displayed, and this may cause problems if I submit the package to CRAN. Any pointers would be appreciated. Thanks, ds __ 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