Re: [Rd] sub returns garbage (PR#8687)
Peter Dalgaard <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] writes: > > > Full_Name: Todd Bailey > > Version: 2.1 > > Er, 2.2.1 > > > OS: Mac OS-X 10.4.3 > > Submission from: (NULL) (87.112.79.124) > > > > > > sub returns garbage in some strings when replacing something with nothing > > and > > fixed=TRUE. For example: > > > > > a=c('hello','hello'); sub('lo','',a,fixed=TRUE) > > [1] "hel" "hel\0\0" > > > a=c('hello','hello'); sub('lo','',a,fixed=FALSE) > > [1] "hel" "hel" > > Confirmed on Linux & Windows. We've seen this symptom a few times > before ...and fixed it, apparently! (Thanks Marc.) I claim XP braindamage -- I'm not Linuxifying my new ThinkPad until FC5 is out. -- 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] Wishlist: 'append' argument for write.ftable()
> "Stephen" == Stephen D Weigand <[EMAIL PROTECTED]> > on Thu, 16 Mar 2006 22:08:58 -0600 writes: Stephen> On Mar 16, 2006, at 9:48 PM, Stephen D. Weigand wrote: >> I would like to suggest that an 'append' argument be added to >> write.ftable(). This would allow, for example, the user to >> append ftable() output to a text report. >> >> I have attached an svn patch to ftable.R that makes the proposed >> change to write.ftable(). [A very trivial change since 'append' >> is simply passed to cat().] >> >> I have also attached a patch to read.ftable.Rd which documents >> the proposed argument (borrowing from cat.Rd). That's an obviously simple and useful proposal. It will be in R-devel (R 2.3.0 to be) -- with a slight modification of putting the new 'append' after the 'quote' argument: Will it make less likely to hurt anybody who has made use of "positional argumenting", i.e., had used write.ftable(tab, fil, TRUE) Martin Maechler, ETH Zurich __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] .Platform$eol.sep ? [Re: "\r" with RSQLite]
[ diverted from R-help to R-devel ] > "DJ" == David James <[EMAIL PROTECTED]> > on Thu, 16 Mar 2006 09:51:31 -0500 writes: DJ> That is a bug, namely, the default end of line on the windows version DJ> should be "\r\n" instead of "\n". The workaround is to specify DJ> eol="\r\n" in dbWriteTable(), e.g., DJ> dbWriteTable(con, "DF", df, eol = "\r\n") DJ> dbReadTable(con, "DF") DJ> Hope this helps, DJ> -- DJ> David DJ> PS The object .Platform includes path.sep and file.sep but not DJ> end of line separator (as of 2.2.0) -- would it make sense to DJ> also include eol.sep? I think it would. AFAIK, the Macs used to have "\r" such that Unix:"\n" Windoze: "\r\n" Mac :"\r" but it could well be that this has only been for Mac OS x.y, x <= 9, i.e., is no longer true for MacOS X (which would behave like `Unix' then). Brian Ripley is currently enjoying holidays AFAIK; I think he might want to shed more light on this as well. Martin __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] multiple packages using the same native code.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 There is work underway to be able to handle this concept of a package providing native code to other packages. It is done in several packages already, but it is time to make the package mechanism extensible and this feature is one of the motivating examples. It probably won't make it into 2.3.0 as I am only just finishing a quarter of intense teaching, but it will be available reasonably soon (i.e. a month or so). Copying the code is the most natural approach, but this does not support the important case where one wants a single instance of a shared native symbol, i.e. a global data object. There are several situations that we want to be able to support and these will be possible via a package mechanism that relies more on R code than shell & Perl scripts. James Bullard wrote: > Seth, thanks for the advice. This solution seems like it might work, but > then all errors occur at runtime rather than at compile time. This seems > like I am exchanging one evil for another (run time segfaults versus > code duplication) Lets say we have these three package A, B, and C > defined more or less like this: > > A/src/bar.c > int bar() > { > foo(); > } > > B/src/baz.c > int baz() > { > foo(); > } > > C/src/foo.c > int foo() > { > return 1; > } > > > Now, the only way I can see to do this is to copy foo.c into both src > directories of package A and B. This is not exactly what anyone wants, > but rather I'd rather just say that both package A and B depend on > package C. If I put them in a bundle then can I expect that the src will > always simultaneously be available? In this way I can easily modify the > configure script to handle this, but if I have no way to depend on the > presence of the code (ie. users could download and install packages > separately even if it's a bundle) then it seems like there is no way to > generally modify the configure file to do this. > > > thanks, jim > > > > > > Seth Falcon wrote: > > >>Hi Jim, >> >>James Bullard <[EMAIL PROTECTED]> writes: >> >> >> >>>I would like to construct two packages (A, B) which utilize a number of >>>common C functions. The most straightforward way to do this is just copy >>>the relevant .c and .h files from one src directory to the next, but >>>this is tedious especially in the face of multiple developers and >>>changes. >>> >>> >> >>I'm not sure I understand what you are after. One possible solution >>would be to create a third package 'C' that contains the common C >>code. This would allow you to call C function defined in 'C' from the >>C code in 'A' or 'B'. >> >>Using a .onLoad hook and getNativeSymbolInfo(), you can pass C >>function pointers to the code in packages A and B. >> >>Suppose in 'C' you have a C function foo() that is registered in the >>usual manner so that it can be called by .Call or .C. >> >>Then in 'A' you could have (all untested, sorry, but hopefully it >>sketches the idea for you): >> >>A/src/A.c >> >> static DL_FUNC C_foo; >> >> void init_funcs_from_C(SEXP foo_info) { >> C_foo = R_ExternalPtrAddr(foo_info); >> } >> >> void bar(int *x) { >> ... >> z = C_foo(); >> ... >> } >> >> >>A/R/zzz.R >> >> .onLoad <- function(libname, pkgname) { >> foo_info <- getNativeSymbolInfo("foo", PACKAGE="C") >> .Call("init_funcs_from_C", foo_info$address) >> } >> >> >>+ seth >> >>__ >>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 - -- Duncan Temple Lang[EMAIL PROTECTED] Department of Statistics work: (530) 752-4782 4210 Mathematical Sciences Building fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (Darwin) iD8DBQFEGrvp9p/Jzwa2QP4RAuoFAJ4ouFY/G21sWkw8fY/MCPc5GantdACdGFjE xWGG+UGbxs1sTKN5o1+j69A= =Isbq -END PGP SIGNATURE- __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] anova.mlm (single-model case) does not handle factors? (PR#8679)
Full_Name: Yves Rosseel Version: 2.2.1 OS: i686-pc-linux-gnu Submission from: (NULL) (157.193.116.152) Dear developers, For the single-model case, the anova.mlm() function does not seem to handle multi-parameter predictors (eg factors) correctly. A toy example illustrates the problem: Y <- cbind(rnorm(100),rnorm(100),rnorm(100)) A <- factor(rep(c(1,2,3,4), each=25)) fit <- lm(Y ~ A) anova.mlm(fit) gives Error in T %*% ss[[i]] : non-conformable arguments I think the problem lies in the computation of the 'ss' terms (line 237 in the file mlm.R in the source code). Changing this (and the following line) by something similar to what is done in summary.manova seems to resolve the problem: comp <- as.matrix(fit$effects)[seq(along=asgn), ,drop=FALSE] uasgn <- unique(asgn) nterms <- length(uasgn) ss <- list(nterms) df <- numeric(nterms) for(i in seq(nterms)) { ai <- (asgn == uasgn[i]) ss[[i]] <- crossprod(comp[ai, ,drop=FALSE]) df[i] <- sum(ai) } __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] wishlist: function mlh.mlm to test multivariate linear hypotheses of the form: LBT'=0 (PR#8680)
Full_Name: Yves Rosseel Version: 2.2.1 OS: Submission from: (NULL) (157.193.116.152) The code below sketches a possible implementation of a function 'mlh.mlm' which I think would be a good complement to the 'anova.mlm' function in the stats package. It tests a single linear hypothesis of the form H_0: LBT'= 0 where B is the matrix of regression coefficients; L is a matrix with rows giving linear combinations of the regressions coefficients; the transformation matrix T has the same meaning as in the anova.mlm function. An example and some bare-bones code is listed below (code depends on the Pillai, Wilks etc. functions defined in src/library/stats/R/mlm.R). Example model: 3 dependents, 1 between-subjects factor with 4 levels set.seed(123) Y <- cbind(rnorm(100), rnorm(100), rnorm(100)) A <- factor(rep(c(1,2,3,4), each=25)) fit <- lm(Y ~ A) Example 1: simple contrast: compare level 3 versus level 4 (multivariate) (note: first zero in l1 corresponds to the intercept, not the first level of A) l1 <- c(0, 0, 1, -1) L <- rbind(l1) mlh.mlm(fit, L=L, test="Wilks") Wilks approx F num Df den Df Pr(>F) 0.9874192 0.3992218 3.000 94.000 0.7538689 Example 2: suppose the three dependents are three timepoints (time); is there a contrast*time interaction (using the contrast above: level 3 versus level 4) t1 <- c(1,-1,0); t2 <- c(0,1,-1) T <- rbind(t1,t2) mlh.mlm(fit, L=L, T=T, test="Wilks") Wilks approx F num Df den Df Pr(>F) 0.9889929 0.5286555 2.000 95.000 0.5911205 Code: mlh.mlm <- function(object, L = null, T = diag(nrow = p), test = c("Pillai", "Wilks", "Hotelling-Lawley", "Roy")) { # test the multivariate linear hypothesis LBT'=0 # B = matrix of regression coefficients # L = matrix, each row is a linear combination of the parameters # T = transformation matrix if(!inherits(object, "mlm")) stop("object must be of class \"mlm\"") if( is.null(L) ) stop("L matrix is not specified.") # L must be a matrix if( is.null(dim(L)) ) L <- t(L) if( nrow(object$coef) != ncol(L) ) stop("nrow(object$coef) != ncol(L)") p <- ncol(SSD(object)$SSD) ssd <- SSD(object) df.res <- ssd$df rss.qr <- qr(T %*% ssd$SSD %*% t(T)) X <- as.matrix( model.matrix(object) ) B <- as.matrix( object$coef ) df <- nrow(L) ss <- t(L %*% B) %*% as.matrix(solve(L %*% solve(t(X) %*% X) %*% t(L))) %*% (L %*% B) eigs <- Re(eigen(qr.coef(rss.qr, T %*% ss %*% t(T)), symmetric = FALSE)$values) test <- match.arg(test) stats <- switch(test, "Pillai" = Pillai(eigs, df, df.res), "Wilks" = Wilks(eigs, df, df.res), "Hotelling-Lawley" = HL(eigs, df, df.res), "Roy"= Roy(eigs, df, df.res) ) stats[5] <- pf(stats[2], stats[3], stats[4], lower.tail = FALSE) names(stats) <- c(test, "approx F", "num Df", "den Df", "Pr(>F)") stats } __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] documentation for plot.default (PR#8689)
Full_Name: Doug Grove Version: 2.2.1 OS: SuSE 9.3 Linux Submission from: (NULL) (140.107.156.61) Could someone please alter the wording of the documentation of the 'xlim' argument in plot.default? It currently includes "(min,max)" which led me to think that I couldn't use a specification like xlim=c(10,1). The basic issue is that there is nothing (that I see) in the help page that suggests that one can specify the axis limits in a decreasing order and get a plot that corresponds to that. I had no idea this was possible 'til I saw a posting on r-help yesterday. Ideally it would be nice to somehow indicate this is possible, however at the least changing the "(min,max)" to "(begin,end)" or something more reflective of what the xlim/ylim arguments represent would be better. Thanks! Doug __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Open .ssc .S ... files in R (PR#8690)
- Quick summary: In the File:Open dialog, please change "S files (*.q)" to "S files (*.q, *.ssc, *.S)" and show the corresponding files (including .SSC and .s files). - Background This is motivated by the following query to R-help: >Date: Thu, 16 Mar 2006 22:44:11 -0600 >From: "xpRt.wannabe" <[EMAIL PROTECTED]> >Subject: [R] Is there a way to view S-PLUS script files in R >To: r-help@stat.math.ethz.ch > >Dear List, > >I have some S-PLUS script files (.ssc). Does there exist an R >function/command that can read such files? I simply want to view the >code and practice in R to help me learn the subject matter. > >Any help would be greatly appreciated. > >platform i386-pc-mingw32 >arch i386 >os mingw32 >system i386, mingw32 >status >major2 >minor2.1 >year 2005 >month12 >day 20 >svn rev 36812 >language R I responded: >You can open them in R. On Windows, File:Open Script, >change "Files of type" to "All Files", then open the .ssc file. So there is a workaround. But it is odd that the "S files" option doesn't actually include what are probably the most common S files. Thanks, Tim Hesterberg --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status = major = 2 minor = 2.1 year = 2005 month = 12 day = 20 svn rev = 36812 language = R Windows XP Professional (build 2600) Service Pack 2.0 Locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 Search Path: .GlobalEnv, package:glmpath, package:survival, package:splines, package:methods, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, Autoloads, package:base __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] About AHP (Analytic Hierachy process)
Dear Sir, I wander if, it existes in R,a library or a routine for AHP (Analytic Hiararchy Process). AHP is a kind of Multi criteria Analysis approach. Thanks, for help. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Open .ssc .S ... files in R (PR#8690)
On 3/17/2006 2:19 PM, [EMAIL PROTECTED] wrote: > - Quick summary: > > In the File:Open dialog, please change > "S files (*.q)" > to > "S files (*.q, *.ssc, *.S)" > and show the corresponding files (including .SSC and .s files). I'll make this change in the Windows Rgui. Is this an issue in the Mac gui too? Duncan Murdoch > > - Background > This is motivated by the following query to R-help: > >>Date: Thu, 16 Mar 2006 22:44:11 -0600 >>From: "xpRt.wannabe" <[EMAIL PROTECTED]> >>Subject: [R] Is there a way to view S-PLUS script files in R >>To: r-help@stat.math.ethz.ch >> >>Dear List, >> >>I have some S-PLUS script files (.ssc). Does there exist an R >>function/command that can read such files? I simply want to view the >>code and practice in R to help me learn the subject matter. >> >>Any help would be greatly appreciated. >> >>platform i386-pc-mingw32 >>arch i386 >>os mingw32 >>system i386, mingw32 >>status >>major2 >>minor2.1 >>year 2005 >>month12 >>day 20 >>svn rev 36812 >>language R > > I responded: >>You can open them in R. On Windows, File:Open Script, >>change "Files of type" to "All Files", then open the .ssc file. > > So there is a workaround. But it is odd that the "S files" option > doesn't actually include what are probably the most common S files. > > Thanks, > Tim Hesterberg > > > --please do not edit the information below-- > > Version: > platform = i386-pc-mingw32 > arch = i386 > os = mingw32 > system = i386, mingw32 > status = > major = 2 > minor = 2.1 > year = 2005 > month = 12 > day = 20 > svn rev = 36812 > language = R > > Windows XP Professional (build 2600) Service Pack 2.0 > > Locale: > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United > States.1252;LC_MONETARY=English_United > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 > > Search Path: > .GlobalEnv, package:glmpath, package:survival, package:splines, > package:methods, package:stats, package:graphics, package:grDevices, > package:utils, package:datasets, Autoloads, package:base > > __ > 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] Open .ssc .S ... files in R (PR#8690)
I think it would be good to make the change in the Mac gui too. This would help people on the mac who work on multiple platforms, or try scripts from other people. I forgot to mention one other extension, ".t", an extension often used for tests to be processed using do.test(). However, this is less common, could easily be excluded; people can use "all files" for this. Thanks, Tim >On 3/17/2006 2:19 PM, [EMAIL PROTECTED] wrote: >> - Quick summary: >> >> In the File:Open dialog, please change >> "S files (*.q)" >> to >> "S files (*.q, *.ssc, *.S)" >> and show the corresponding files (including .SSC and .s files). > >I'll make this change in the Windows Rgui. Is this an issue in the Mac >gui too? > >Duncan Murdoch > >> >> - Background >> This is motivated by the following query to R-help: >> >>>Date: Thu, 16 Mar 2006 22:44:11 -0600 >>>From: "xpRt.wannabe" <[EMAIL PROTECTED]> >>>Subject: [R] Is there a way to view S-PLUS script files in R >>>To: r-help@stat.math.ethz.ch >>> >>>Dear List, >>> >>>I have some S-PLUS script files (.ssc). Does there exist an R >>>function/command that can read such files? I simply want to view the >>>code and practice in R to help me learn the subject matter. >>> >>>Any help would be greatly appreciated. >>> >>>platform i386-pc-mingw32 >>>arch i386 >>>os mingw32 >>>system i386, mingw32 >>>status >>>major2 >>>minor2.1 >>>year 2005 >>>month12 >>>day 20 >>>svn rev 36812 >>>language R >> >> I responded: >>>You can open them in R. On Windows, File:Open Script, >>>change "Files of type" to "All Files", then open the .ssc file. >> >> So there is a workaround. But it is odd that the "S files" option >> doesn't actually include what are probably the most common S files. >> >> Thanks, >> Tim Hesterberg >> >> >> --please do not edit the information below-- >> >> Version: >> platform = i386-pc-mingw32 >> arch = i386 >> os = mingw32 >> system = i386, mingw32 >> status = >> major = 2 >> minor = 2.1 >> year = 2005 >> month = 12 >> day = 20 >> svn rev = 36812 >> language = R >> >> Windows XP Professional (build 2600) Service Pack 2.0 >> >> Locale: >> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United >> States.1252;LC_MONETARY=English_United >> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 >> >> Search Path: >> .GlobalEnv, package:glmpath, package:survival, package:splines, >> package:methods, package:stats, package:graphics, package:grDevices, >> package:utils, package:datasets, Autoloads, package:base >> >> __ >> 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] Open .ssc .S ... files in R (PR#8690)
On 3/17/2006 2:53 PM, Tim Hesterberg wrote: > I think it would be good to make the change in the Mac gui too. > This would help people on the mac who work on multiple platforms, > or try scripts from other people. I don't know anything about how file dialogs work there, so I won't touch this one. > I forgot to mention one other extension, ".t", an extension often > used for tests to be processed using do.test(). However, this > is less common, could easily be excluded; people can use "all files" > for this. I think "all files" is best for that. Duncan Murdoch > > Thanks, > Tim > >>On 3/17/2006 2:19 PM, [EMAIL PROTECTED] wrote: >>> - Quick summary: >>> >>> In the File:Open dialog, please change >>> "S files (*.q)" >>> to >>> "S files (*.q, *.ssc, *.S)" >>> and show the corresponding files (including .SSC and .s files). >> >>I'll make this change in the Windows Rgui. Is this an issue in the Mac >>gui too? >> >>Duncan Murdoch >> >>> >>> - Background >>> This is motivated by the following query to R-help: >>> Date: Thu, 16 Mar 2006 22:44:11 -0600 From: "xpRt.wannabe" <[EMAIL PROTECTED]> Subject: [R] Is there a way to view S-PLUS script files in R To: r-help@stat.math.ethz.ch Dear List, I have some S-PLUS script files (.ssc). Does there exist an R function/command that can read such files? I simply want to view the code and practice in R to help me learn the subject matter. Any help would be greatly appreciated. platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R >>> >>> I responded: You can open them in R. On Windows, File:Open Script, change "Files of type" to "All Files", then open the .ssc file. >>> >>> So there is a workaround. But it is odd that the "S files" option >>> doesn't actually include what are probably the most common S files. >>> >>> Thanks, >>> Tim Hesterberg >>> >>> >>> --please do not edit the information below-- >>> >>> Version: >>> platform = i386-pc-mingw32 >>> arch = i386 >>> os = mingw32 >>> system = i386, mingw32 >>> status = >>> major = 2 >>> minor = 2.1 >>> year = 2005 >>> month = 12 >>> day = 20 >>> svn rev = 36812 >>> language = R >>> >>> Windows XP Professional (build 2600) Service Pack 2.0 >>> >>> Locale: >>> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United >>> States.1252;LC_MONETARY=English_United >>> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 >>> >>> Search Path: >>> .GlobalEnv, package:glmpath, package:survival, package:splines, >>> package:methods, package:stats, package:graphics, package:grDevices, >>> package:utils, package:datasets, Autoloads, package:base >>> >>> __ >>> 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] Open .ssc .S ... files in R (PR#8690)
On Mar 17, 2006, at 2:45 PM, Duncan Murdoch wrote: > On 3/17/2006 2:19 PM, [EMAIL PROTECTED] wrote: >> - Quick summary: >> >> In the File:Open dialog, please change >> "S files (*.q)" >> to >> "S files (*.q, *.ssc, *.S)" >> and show the corresponding files (including .SSC and .s files). > > I'll make this change in the Windows Rgui. Is this an issue in the > Mac gui too? > Yes, I was not aware of .ssc, either. Will fix that. Thanks, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Open .ssc .S ... files in R (PR#8690)
On Mar 17, 2006, at 2:45 PM, Duncan Murdoch wrote: > On 3/17/2006 2:19 PM, [EMAIL PROTECTED] wrote: >> - Quick summary: >> >> In the File:Open dialog, please change >> "S files (*.q)" >> to >> "S files (*.q, *.ssc, *.S)" >> and show the corresponding files (including .SSC and .s files). > > I'll make this change in the Windows Rgui. Is this an issue in the > Mac gui too? > Yes, I was not aware of .ssc, either. Will fix that. Thanks, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] collation order
The following caused a hard-to-diagnose problem for a user of the survey package. Presumably this is a strange Unicode thing, but is there a convenient reference for how the collation order is determined? I am surprised that adding the same character to the end of two strings of the same length can change the sorting order. in en_US.utf8 locale > "1//"<"10/" [1] TRUE > "1//2"<"10/2" [1] FALSE in C locale on the same system. > "1//"<"10/" [1] TRUE > "1//2"<"10/2" [1] TRUE [This is in r-devel of March 6, but the problem that was reported to me involved Windows vs Linux on released versions] -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] collation order
On Mar 17, 2006, at 4:32 PM, Thomas Lumley wrote: > The following caused a hard-to-diagnose problem for a user of the > survey package. Presumably this is a strange Unicode thing, It is independent of the encoding: [EMAIL PROTECTED]:~$ LC_COLLATE=en_US R --vanilla -q "1//"<"10/" [1] TRUE > "1//2"<"10/2" [1] FALSE > Sys.getlocale("LC_COLLATE") [1] "en_US" (en_US is ISO-8859-1 on that machine) And systems don't seem to agree on anything but C locale: Mac OS X: caladan:urbanek$ LC_COLLATE=en_US R --vanilla -q "1//"<"10/" [1] TRUE > "1//2"<"10/2" [1] TRUE > Sys.getlocale("LC_COLLATE") [1] "en_US" IRIX: fry:urbanek$ LC_COLLATE=en_US R --vanilla -q "1//"<"10/" [1] FALSE > "1//2"<"10/2" [1] FALSE > Sys.getlocale("LC_COLLATE") [1] "en_US" But at least most systems are consistent in terms of adding a character, except for GNU/Linux. Looking at the locale definitions, GNU/Linux uses "iso14651_t1" template for many languages. Maybe the problem is that "/" is defined in the "SPECIAL" section of the ISO-14651 template, which possibly causes / to be completely ignored in the "LATIN" part, which would explain the behavior (("1"<"10")==TRUE, ("12"<"102")==FALSE). I couldn't find anything on what the "offical" en_** collating should be so I have no idea whether this is a bug in the GNU/Linux locales or not... Cheers, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] anova.mlm (single-model case) does not handle factors? (PR#8679)
[EMAIL PROTECTED] writes: > Full_Name: Yves Rosseel > Version: 2.2.1 > OS: i686-pc-linux-gnu > Submission from: (NULL) (157.193.116.152) > > > Dear developers, > > For the single-model case, the anova.mlm() function does not seem to handle > multi-parameter predictors (eg factors) correctly. A toy example illustrates > the > problem: > > Y <- cbind(rnorm(100),rnorm(100),rnorm(100)) > A <- factor(rep(c(1,2,3,4), each=25)) > fit <- lm(Y ~ A) > anova.mlm(fit) > > gives > > Error in T %*% ss[[i]] : non-conformable arguments > > I think the problem lies in the computation of the 'ss' terms (line 237 in the > file mlm.R in the source code). Changing this (and the following line) by > something similar to what is done in summary.manova seems to resolve the > problem: > > comp <- as.matrix(fit$effects)[seq(along=asgn), ,drop=FALSE] > uasgn <- unique(asgn) > nterms <- length(uasgn) > ss <- list(nterms) > df <- numeric(nterms) > for(i in seq(nterms)) { > ai <- (asgn == uasgn[i]) > ss[[i]] <- crossprod(comp[ai, ,drop=FALSE]) > df[i] <- sum(ai) > } Thanks for pointing this out. Amazing that it hasn't cropped up before... The culprit seems to be the line ss <- lapply(split(comp, asgn), function(x) crossprod(t(x))) in which "comp" (an effects by responses matrix) is effectively turned into a vector by split(). And, adding insult to injury, had you actually gotten a matrix result, you wouldn't want to transpose it before calculating the cross products. A simpler, but slightly dirty fix is to set ss <- lapply(split.data.frame(comp, asgn), crossprod) (the dirtiness is that split.data.frame actually does the right thing for matrices; possibly, an identically defined split.matrix() would be cleaner, although I'm never quite happy with matrix functions that aren't symmetric in rows/columns.) -- 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] collation order
Thomas Lumley <[EMAIL PROTECTED]> writes: > The following caused a hard-to-diagnose problem for a user of the survey > package. Presumably this is a strange Unicode thing, but is there a > convenient reference for how the collation order is determined? I am > surprised that adding the same character to the end of two strings of the > same length can change the sorting order. > > in en_US.utf8 locale > > "1//"<"10/" > [1] TRUE > > "1//2"<"10/2" > [1] FALSE > > in C locale on the same system. > > "1//"<"10/" > [1] TRUE > > "1//2"<"10/2" > [1] TRUE > > [This is in r-devel of March 6, but the problem that was reported to me > involved Windows vs Linux on released versions] Unicode has nothing to do with it (same thing in ISO-8859-1. It is (I think) about characters being skipped during collating, i.e. same effect as this: > Sys.setlocale(locale="C") [1] "C" > "Thomas O'Malley" < "Thomas Lumley" [1] TRUE > Sys.setlocale(locale="en_US.UTF8") [1] "LC_CTYPE=en_US.UTF8;LC_NUMERIC=C;LC_TIME=en_US.UTF8;LC_COLLATE=en_US.UTF8;LC_MONETARY=en_US.UTF8;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C" > "Thomas O'Malley" <" Thomas Lumley" [1] FALSE > > -thomas > > Thomas Lumley Assoc. Professor, Biostatistics > [EMAIL PROTECTED] University of Washington, Seattle > > __ > 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] collation order
Peter Dalgaard <[EMAIL PROTECTED]> writes: > > Sys.setlocale(locale="C") > [1] "C" > > "Thomas O'Malley" < "Thomas Lumley" > [1] TRUE > > Sys.setlocale(locale="en_US.UTF8") > [1] > "LC_CTYPE=en_US.UTF8;LC_NUMERIC=C;LC_TIME=en_US.UTF8;LC_COLLATE=en_US.UTF8;LC_MONETARY=en_US.UTF8;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C" > > "Thomas O'Malley" <" Thomas Lumley" Argh. The perils of beautifying code after the fact. The last line was of course intended to read "Thomas O'Malley" < "Thomas Lumley" -- 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] R make install and demo(graphics) issue
I've successfully gotten R 2.2.1 to compile on AIX 5.2. However, when I run "make install", I receive the following message: /appl/perform/workspace/R-2.2.1 [EMAIL PROTECTED]/appl/perform/workspace/R-2.2.1] make install /appl/perform/workspace/R-2.2.1/m4 Target "install" is up to date. /appl/perform/workspace/R-2.2.1/tools Target "install" is up to date. /appl/perform/workspace/R-2.2.1/doc installing doc ... ../tools/install-sh: no destination specified. make: The error code from the last command is 1. Stop. make: The error code from the last command is 1. Stop. R has been built as I can go into R-2.2.1/bin and launch R. However, I get the following when running demo(graphics): > if (dev.cur() <= 1) get(getOption("device"))() Error in get(getOption("device"))() : X11 module cannot be loaded In addition: Warning message: unable to load shared library '/appl/perform/workspace/R-2.2.1/modules/R_X11.so': Could not load module /appl/perform/workspace/mbeason/R-2.2.1/modules/R_X11.so. Dependent module /usr/java14/jre/bin/libjpeg.a(libjpeg.so.62) could not be loaded. File /usr/java14/jre/bin/libjpeg.a is not an archive or the file could not be read properly. System error: Exec format error System error: Exec format error Could not load module /usr/java14/jre/bin/libjpeg.a. Dependent module /usr/java14/jre/bin/libjpeg.a could not be loaded. Any thoughts on this would be greatly appreciated. I feel as though I'm VERY close to getting this fully functional. Thanks! Matt [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] R make install and demo(graphics) issue
On 17.3.2006, at 19:08, Matthew Beason wrote: > I've successfully gotten R 2.2.1 to compile on AIX 5.2. > > However, when I run "make install", I receive the following message: > > /appl/perform/workspace/R-2.2.1 > [EMAIL PROTECTED]/appl/perform/workspace/R-2.2.1] make install > /appl/perform/workspace/R-2.2.1/m4 > Target "install" is up to date. > /appl/perform/workspace/R-2.2.1/tools > Target "install" is up to date. > /appl/perform/workspace/R-2.2.1/doc > installing doc ... > ../tools/install-sh: no destination specified. > make: The error code from the last command is 1. > Chances are that this is related to an issue with some shells mentioned here before - you can either use R-2.2.1 patched from SVN where it is fixed, or alternatively edit configure at line 1913: if test -z ${rdocdir}; then into if test -z "${rdocdir}"; then and make the same modification to the subsequent two if statements as well. Cheers, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel