Re: [Bioc-devel] [devteam-bioc] Use Imports instead of Depends in the DESCRIPTION files of bioconductor packages.
On Wed, Dec 31, 2014 at 9:41 AM, Martin Morgan mtmor...@fredhutch.org wrote: On 12/24/2014 07:31 PM, Maintainer wrote: Hi, Many bioconductor packages Depends on other packages but not Imports other packages. (e.g., IRanges Depends on BiocGenerics.) Imports is usually preferred to Depends. http://stackoverflow.com/questions/8637993/better-explanation-of-when-to-use-imports-depends http://obeautifulcode.com/R/How-R-Searches-And-Finds-Stuff/ Could the unnecessary Depends be forced to be replaced by Imports? This should improve the package load time significantly. R package symbols and other objects are collated at build time into a 'name space'. When used, - Import: loads the name space from disk. - Depends: loads the name space from disk, and attaches it to the search() path. Attaching is very inexpensive compared to loading, so there is no speed improvement gained by Import'ing instead of Depend'ing. Yes. For example, changing Depends to Imports does not improve the package load time much. But loading a package in 4 sec seems to be too long. system.time(suppressPackageStartupMessages(library(MBASED))) user system elapsed 4.404 0.100 4.553 For example, it only takes 10% of the time to load ggplot2. It seems that many bioconductor packages have similar problems. system.time(suppressPackageStartupMessages(library(ggplot2))) user system elapsed 0.394 0.036 0.460 The main reason to Depend: on a package is because the symbols defined by the package are needed by the end-user. Import'ing a package is appropriate when the package provides functionality only relevant to the package author. What causes the load time to be too long? Is it because exporting too many functions from all dependent packages to the global namespace? There are likely to be specific packages that mis-use Depends; packages such as IRanges, GenomicRanges, etc use Depends: as intended, to provide functions that are useful to the end user. Maintainers are certainly encouraged to think carefully about adding packages providing functionality irrelevant to the end-user to the Depends: field. The codetoolsBioC package (available from svn, see http://bioconductor.org/developers/how-to/source-control/) provides some mostly reliable hints to package authors about correctly formulating a NAMESPACE file to facilitate using Imports: instead of Depends:. General questions about Bioconductor packages should be addressed to the support forum https://support.bioconductor.org. Questions about Bioconductor development (such as this) should be addressed to the bioc-devel mailing list (subscription required) https://stat.ethz.ch/mailman/listinfo/bioc-devel. I have cc'd the bioc-devel mailing list; I hope that is ok. -- Regards, Peng ___ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
[Rd] Standalone example to use eval in C (not eval in R)?
'eval' is used in optim.c, but it is used along with other things. I'm looking for a standalone example to demonstrate the usage of eval in C. Does anybody have some a simple example? Thanks. -- Regards, Peng __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Is nested namespace supported?
Could somebody let me know if there is nested name space supported? For example, is it possible to define a function in the name space 'nested_namespace' which is nested in the name space 'some_namespace'? some_namespace:::nested_namespace:::a_function() I checked Section 1.6 of R-exts.pdf. It seems that nested namespace is not supported, right? __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Is nested namespace supported?
On Sat, Jan 9, 2010 at 3:03 PM, Romain Francois romain.franc...@dbmail.com wrote: On 01/09/2010 09:53 PM, Peng Yu wrote: Could somebody let me know if there is nested name space supported? For example, is it possible to define a function in the name space 'nested_namespace' which is nested in the name space 'some_namespace'? some_namespace:::nested_namespace:::a_function() I checked Section 1.6 of R-exts.pdf. It seems that nested namespace is not supported, right? It is not even grammatically valid: parse( text = foo::bar::foobar ) Error in parse(text = foo::bar::foobar) : unexpected '::' in foo::bar:: parse( text = foo:::bar:::foobar ) Error in parse(text = foo:::bar:::foobar) : unexpected ':::' in foo:::bar::: Do you mean nested namespace is not supported in R? __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] How x[, 'colname1'] is implemented?
On Fri, Jan 1, 2010 at 6:52 AM, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On Thu, Dec 31, 2009 at 11:27 PM, Peng Yu pengyu...@gmail.com wrote: I don't see where describes the implementation of '[]'. For example, if x is a matrix or a data.frame, how the lookup of 'colname1' is x[, 'colname1'] executed. Does R perform a lookup in the a hash of the colnames? Is the reference O(1) or O(n), where n is the second dim of x? Where have you looked? I doubt this kind of implementation detail is in the .Rd documentation since a regular user doesn't care for it. I'm not complaining that it is not documented. As Obi-wan Kenobi may have said in Star Wars: Use the source, Luke!: Line 450 of subscript.c of the source code of R 2.10 is the stringSubscript function. It has this comment: /* The original code (pre 2.0.0) used a ns x nx loop that was too * slow. So now we hash. Hashing is expensive on memory (up to 32nx * bytes) so it is only worth doing if ns * nx is large. If nx is * large, then it will be too slow unless ns is very small. */ Could you explain what ns and nx represent? The definition of large and small here appears to be such that: 457: Rboolean usehashing = in ( ((ns 1000 nx) || (nx 1000 ns)) || (ns * nx 15*nx + ns) ); __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] How x[, 'colname1'] is implemented?
I don't see where describes the implementation of '[]'. For example, if x is a matrix or a data.frame, how the lookup of 'colname1' is x[, 'colname1'] executed. Does R perform a lookup in the a hash of the colnames? Is the reference O(1) or O(n), where n is the second dim of x? __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Which version of findInterval is used?
In an R session, I see the following, which means that findInterval is an R function. findInterval function (x, vec, rightmost.closed = FALSE, all.inside = FALSE) { if (any(is.na(vec))) stop('vec' contains NAs) if (is.unsorted(vec)) stop('vec' must be sorted non-decreasingly) if (has.na - any(ix - is.na(x))) x - x[!ix] nx - length(x) index - integer(nx) .C(find_interv_vec, xt = as.double(vec), n = length(vec), x = as.double(x), nx = nx, as.logical(rightmost.closed), as.logical(all.inside), index, DUP = FALSE, NAOK = TRUE, PACKAGE = base) if (has.na) { ii - as.integer(ix) ii[ix] - NA ii[!ix] - index ii } else index } environment: namespace:base However, I also see a C function with the same name in src/appl/interv.c. I'm wondering where is this use? int findInterval(double *xt, int n, double x, Rboolean rightmost_closed, Rboolean all_inside, int ilo, int *mflag) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Request to add section number to the bookmarks of R pdf documents
It will be convenient to add section number to the bookmarks of R documents that are in pdf format. Could somebody take some time add the sections number? Writing R Extensions R Data Import/Export R Language Definition etc. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Which packages in R use C++?
I want to see some working examples on how to call C++ programs from R. Could somebody let me know which R packages mainly use C++ rather than C or Fortran? __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] How to organized code in the R/ directory of a package?
I'm making a package, Current, I put all R files in the R/ directory in the package (without using subdirectory). This will become a problem when there are many files in the directory. I'm wondering how to use subdirectories in R/? Does 'R CMD INSTALL' install the files in the subdirectories automatically? __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] How to organized code in the R/ directory of a package?
I don't have many files yet. I'm just wondering what the convention of organizing files is, as different programming languages have different ways of organizing source code. I don't want to start in a wrong way and later to correct it. I don't see ggplot in a tar.gz file on your website. It is also removed from cran. Would you please let me know where I can download the source code to take a look? What 'appropriate tool support' do you refer to? On Thu, Dec 10, 2009 at 4:29 PM, hadley wickham h.wick...@gmail.com wrote: I have 145 R files in ggplot2, but don't have any problems navigating them (with appropriate tool support). Just how many files do you have? Hadley On Thu, Dec 10, 2009 at 3:56 PM, Peng Yu pengyu...@gmail.com wrote: I'm making a package, Current, I put all R files in the R/ directory in the package (without using subdirectory). This will become a problem when there are many files in the directory. I'm wondering how to use subdirectories in R/? Does 'R CMD INSTALL' install the files in the subdirectories automatically? __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- http://had.co.nz/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] split() is slow on data.frame (PR#14123)
On Wed, Dec 9, 2009 at 5:44 PM, Charles C. Berry cbe...@tajo.ucsd.edu wrote: On Wed, 9 Dec 2009, William Dunlap wrote: Here are some differences between the current and proposed split.data.frame. Adding 'drop=FALSE' fixes this case. See in line correction below. Thank you for the correction. d-data.frame(Matrix=I(matrix(1:10, ncol=2)), Named=c(one=1,two=2,three=3,four=4,five=5), row.names=as.character(1001:1005)) group-c(A,B,A,A,B) split.data.frame(d,group) $A Matrix.1 Matrix.2 Named 1001 1 6 1 1003 3 8 3 1004 4 9 4 $B Matrix.1 Matrix.2 Named 1002 2 7 2 1005 5 10 5 mysplit.data.frame(d,group) # lost row.names and 2nd column of Matrix [1] processing data.frame $A Matrix Named [1,] 1 1 [2,] 3 3 [3,] 4 4 $B Matrix Named [1,] 2 2 [2,] 5 5 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On Behalf Of pengyu...@gmail.com Sent: Wednesday, December 09, 2009 2:10 PM To: r-de...@stat.math.ethz.ch Cc: r-b...@r-project.org Subject: [Rd] split() is slow on data.frame (PR#14123) Please see the following code for the runtime comparison between split() and mysplit.data.frame() (they do the same thing semantically). mysplit.data.frame() is a fix of split() in term of performance. Could somebody include this fix (with possible checking for corner cases) in future version of R and let me know the inclusion of the fix? m=30 n=6 k=3 set.seed(0) x=replicate(n,rnorm(m)) f=sample(1:k, size=m, replace=T) mysplit.data.frame-function(x,f) { print('processing data.frame') v=lapply( 1:dim(x)[[2]] , function(i) { split(x[,i],f) Change to: split(x[,i,drop=FALSE],f) } ) w=lapply( seq(along=v[[1]]) , function(i) { result=do.call( cbind , lapply(v, function(vj) { vj[[i]] } ) ) colnames(result)=colnames(x) return(result) } ) names(w)=names(v[[1]]) return(w) } system.time(split(as.data.frame(x),f)) system.time(mysplit.data.frame(as.data.frame(x),f)) __ 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 Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] split() is slow on data.frame (PR#14123)
I make a version for matrix. Because, it would be more efficient to split each column of a matrix than to convert a matrix to a data.frame then call split() on the data.frame. Note that the version for a matrix and a data.frame is slightly different. Would somebody add this in R as well? split.matrix-function(x,f) { #print('processing matrix') v=lapply( 1:dim(x)[[2]] , function(i) { base:::split.default(x[,i],f)#the difference is here } ) w=lapply( seq(along=v[[1]]) , function(i) { result=do.call( cbind , lapply(v, function(vj) { vj[[i]] } ) ) colnames(result)=colnames(x) return(result) } ) names(w)=names(v[[1]]) return(w) } On Wed, Dec 9, 2009 at 5:44 PM, Charles C. Berry cbe...@tajo.ucsd.edu wrote: On Wed, 9 Dec 2009, William Dunlap wrote: Here are some differences between the current and proposed split.data.frame. Adding 'drop=FALSE' fixes this case. See in line correction below. Chuck d-data.frame(Matrix=I(matrix(1:10, ncol=2)), Named=c(one=1,two=2,three=3,four=4,five=5), row.names=as.character(1001:1005)) group-c(A,B,A,A,B) split.data.frame(d,group) $A Matrix.1 Matrix.2 Named 1001 1 6 1 1003 3 8 3 1004 4 9 4 $B Matrix.1 Matrix.2 Named 1002 2 7 2 1005 5 10 5 mysplit.data.frame(d,group) # lost row.names and 2nd column of Matrix [1] processing data.frame $A Matrix Named [1,] 1 1 [2,] 3 3 [3,] 4 4 $B Matrix Named [1,] 2 2 [2,] 5 5 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On Behalf Of pengyu...@gmail.com Sent: Wednesday, December 09, 2009 2:10 PM To: r-de...@stat.math.ethz.ch Cc: r-b...@r-project.org Subject: [Rd] split() is slow on data.frame (PR#14123) Please see the following code for the runtime comparison between split() and mysplit.data.frame() (they do the same thing semantically). mysplit.data.frame() is a fix of split() in term of performance. Could somebody include this fix (with possible checking for corner cases) in future version of R and let me know the inclusion of the fix? m=30 n=6 k=3 set.seed(0) x=replicate(n,rnorm(m)) f=sample(1:k, size=m, replace=T) mysplit.data.frame-function(x,f) { print('processing data.frame') v=lapply( 1:dim(x)[[2]] , function(i) { split(x[,i],f) Change to: split(x[,i,drop=FALSE],f) } ) w=lapply( seq(along=v[[1]]) , function(i) { result=do.call( cbind , lapply(v, function(vj) { vj[[i]] } ) ) colnames(result)=colnames(x) return(result) } ) names(w)=names(v[[1]]) return(w) } system.time(split(as.data.frame(x),f)) system.time(mysplit.data.frame(as.data.frame(x),f)) __ 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 Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Tabs in R source code
On Sun, Nov 29, 2009 at 11:18 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 29/11/2009 11:50 AM, Peng Yu wrote: On Sun, Nov 29, 2009 at 10:40 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 29/11/2009 10:58 AM, Peng Yu wrote: Some lines are indented by tabs and some lines are indented by spaces, in R source code. This might due to the fact that the source code is not from a single person. But I think that it is better to enforce a single convention. My editor defaults a tab to 8 spaces. So some source doesn't seem to be indented correctly in my editor. Since tab may be displayed differently in different editor, I recommend to replace all the tabs by the appropriate number of spaces to ensure the same indentation display. The R source code assumes that tabs occur every 8 columns, so if your editor is working properly, it should display files as intended. Could somebody update the source code in the future version by replacing tabs by spaces and enforce such a coding convention in the future? No, that would not be feasible, for the reason you give in the second sentence of your post. I don't understand why it is not feasible. The spaces are displayed the same in all editors. If there are no tabs, the code should display the same in all editors. I know some languages that are recommended to have spaces rather than tabs for this reason. It is not feasible because it would require everyone who edits the source code to change the configuration of their editors. In my case, that would require changing about 3 different types of editors (I work on several different platforms). I would probably miss one, and re-introduce tabs the next time I edited a file on that editor. http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html Here is the R style, which does not recommend using tabs. Although it might take some time to forbidden the use of tabs, it will eventually be a good practice that benefits everyone in the future. I've already seen problems in the NEWS and CHANGES files, which have recently changed to UTF-8 encoding. It's very irritating that my editor switches back to the Windows default if it doesn't see a byte-order mark, and that some editors that I use automatically delete the BOM. Requiring a particular encoding for tabs (i.e. converting them to spaces) would lead to the same problems, but on a much bigger scale. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] [R] go back a block of code in history
2009/12/2 Uwe Ligges lig...@statistik.tu-dortmund.de: Peng Yu wrote: Suppose I run the following code in the R session. At the last prompt '', I want to retrieve the second command (staring with 'y'). But I have to type up arrow many times, which is very inconvenient. I'm wondering if there is a way to configure R to skip block of code in the history? I don't think so, but since you are writing your code in an editor (hopefully), it is probably easier to submit the relevant part of the code from the editor to R again. It would be more convenient if there is a way to roll back a block of code in the history. Could the development team add this feature to the to-do list? x=list(a=c(1,2),b=c(3,4,5)) y=list(a=c(1,2),b=c(3,4,5)) lapply(seq(along=x) + ,function(i){ + cbind( + x[[i]] + ,y[[i]] + ) + } + ) [[1]] [,1] [,2] [1,] 1 1 [2,] 2 2 [[2]] [,1] [,2] [1,] 3 3 [2,] 4 4 [3,] 5 5 __ r-h...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] [R] How to quit unwanted execution immediately?
The delay that I observe is when I type ctrl+C after I str() a long list. Since str() comes from the core R installation, maybe it should be improved? R can or cannot response immediately depending on the underlying C sources. If the underlying source code is written carefully enough, there are more or less regular checks for events such as this one. If you are using some contributed package, it may be an issue in this package's source code. Best wishes, Uwe Ligges Peng Yu wrote: Occasionally, I start a command (taking long time to finish) that I did not really want to start. I type 'ctrl+C' to try to quit the execution. However, R does not quit the execution of the command immediately. I'm wondering if R could response to ctrl+C immediately. __ r-h...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Tabs in R source code
Some lines are indented by tabs and some lines are indented by spaces, in R source code. This might due to the fact that the source code is not from a single person. But I think that it is better to enforce a single convention. My editor defaults a tab to 8 spaces. So some source doesn't seem to be indented correctly in my editor. Since tab may be displayed differently in different editor, I recommend to replace all the tabs by the appropriate number of spaces to ensure the same indentation display. Could somebody update the source code in the future version by replacing tabs by spaces and enforce such a coding convention in the future? __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Tabs in R source code
On Sun, Nov 29, 2009 at 10:40 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 29/11/2009 10:58 AM, Peng Yu wrote: Some lines are indented by tabs and some lines are indented by spaces, in R source code. This might due to the fact that the source code is not from a single person. But I think that it is better to enforce a single convention. My editor defaults a tab to 8 spaces. So some source doesn't seem to be indented correctly in my editor. Since tab may be displayed differently in different editor, I recommend to replace all the tabs by the appropriate number of spaces to ensure the same indentation display. The R source code assumes that tabs occur every 8 columns, so if your editor is working properly, it should display files as intended. Could somebody update the source code in the future version by replacing tabs by spaces and enforce such a coding convention in the future? No, that would not be feasible, for the reason you give in the second sentence of your post. I don't understand why it is not feasible. The spaces are displayed the same in all editors. If there are no tabs, the code should display the same in all editors. I know some languages that are recommended to have spaces rather than tabs for this reason. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] How to generate dependency file that can be used by gnu make?
This may not easy to do, when the filename are not hard coded strings. For example, the variable 'filename' is a vector of strings. for (i in 1:length(filename)){ do something... save(,file=filename[i]) } On Mon, Nov 16, 2009 at 11:33 PM, Linlin Yan yanlinli...@gmail.com wrote: I don't think this function is same as gcc's option -MM. Because gcc checks pre-compile command #include, in which the filename can be fetched definitely. But in your scenario, the filename may be from some variables, which can not be determined by the R script only. Maybe you can write a tool by yourself to parse the R syntax to resolve your problem. On Tue, Nov 17, 2009 at 11:51 AM, Peng Yu pengyu...@gmail.com wrote: On Sun, Nov 15, 2009 at 8:45 PM, Peng Yu pengyu...@gmail.com wrote: gcc has options like -MM, which can generate the dependence files for a C/C++ file that I can be used by gnu make. I'm wondering if there is a tool that can generate dependence file for an R script. For example, I have an R script test.R #test.R load('input.RData') save.image('output.RData') I want to generate a dependence file like the following. Is there a tool to do so? output.RData:test.R input.RData Is there a way to automatically generate the output files that depends on an R script and the input files and sourced files that are depended by an R script? I don't see this option in R. But I wish this can be implemented in future version of R. __ 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] How to generate dependency file that can be used by gnu make?
On Sun, Nov 15, 2009 at 8:45 PM, Peng Yu pengyu...@gmail.com wrote: gcc has options like -MM, which can generate the dependence files for a C/C++ file that I can be used by gnu make. I'm wondering if there is a tool that can generate dependence file for an R script. For example, I have an R script test.R #test.R load('input.RData') save.image('output.RData') I want to generate a dependence file like the following. Is there a tool to do so? output.RData:test.R input.RData Is there a way to automatically generate the output files that depends on an R script and the input files and sourced files that are depended by an R script? I don't see this option in R. But I wish this can be implemented in future version of R. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] How to compile R with command completion?
I compiled R-2.9.2 from source on Cent OS. But the compile R program does not support command completion. I get the following configure output that is related to readline. Why 'rl_completion_matches' doesn't exist? How should I make R support command completion? === checking readline/history.h usability... yes checking readline/history.h presence... yes checking for readline/history.h... yes checking readline/readline.h usability... yes checking readline/readline.h presence... yes checking for readline/readline.h... yes checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... yes checking for rl_callback_read_char in -lreadline... yes checking for history_truncate_file... yes checking whether rl_completion_matches exists and is declared... no checking readline/history.h usability... yes checking readline/history.h presence... yes checking for readline/history.h... yes checking readline/readline.h usability... yes checking readline/readline.h presence... yes checking for readline/readline.h... yes checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... yes checking for rl_callback_read_char in -lreadline... yes checking for history_truncate_file... yes checking whether rl_completion_matches exists and is declared... no = Here is my sessionInfo() of the compiled R. = $ R R version 2.9.2 (2009-08-24) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. sessionInfo() R version 2.9.2 (2009-08-24) x86_64-unknown-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;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 attached base packages: [1] stats graphics grDevices utils datasets methods base __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] How to compile R with command completion?
On Wed, Sep 30, 2009 at 9:58 AM, Simon Urbanek simon.urba...@r-project.org wrote: On Sep 30, 2009, at 10:13 , Peng Yu wrote: I compiled R-2.9.2 from source on Cent OS. But the compile R program does not support command completion. I get the following configure output that is related to readline. Why 'rl_completion_matches' doesn't exist? Maybe your readline is too old? Maybe you have a readline-replacement library (e.g. libedit) that poses as readline? Try installing some recent readline (incl. -dev part) - the current version is 6.0. If that doesn't help, look at config.log around the rl_completion_matches. I have installed readline 6.0. $ ls /home/pengy/utility/linux/lib/libreadline.* /home/pengy/utility/linux/lib/libreadline.a /home/pengy/utility/linux/lib/libreadline.so /home/pengy/utility/linux/lib/libreadline.so.6 /home/pengy/utility/linux/lib/libreadline.so.6.0 $ ls /home/pengy/utility/linux/lib/libhistory.* /home/pengy/utility/linux/lib/libhistory.a /home/pengy/utility/linux/lib/libhistory.so /home/pengy/utility/linux/lib/libhistory.so.6 /home/pengy/utility/linux/lib/libhistory.so.6.0 But R still doesn't configure it correctly. Would you please what might be the problem? Regards, Peng configure:22192: checking whether rl_completion_matches exists and is declared configure:4: gcc -o conftest -I/home/pengy/utility/linux/opt/gcc-4.3.4/include -I/home/pengy/utility/linux/include -I/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/include -I/home/pengy/utility/linux/opt/Python-2.6.2/include/python2.6 -I/home/pengy/utility/linux/opt/gcc-4.3.4/include -I/home/pengy/utility/linux/include -L/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/lib -L/home/pengy/utility/linux/opt/R-2.9.2/lib64/R/lib -L/home/pengy/utility/linux/opt/Python-2.6.2/lib -L/home/pengy/utility/linux/opt/gcc-4.3.4/lib64 -L/home/pengy/download/linux/qtsdk-2009.03/lib -L/home/pengy/utility/linux/lib64 -L/home/pengy/utility/linux/lib64 -L/home/pengy/utility/linux/lib conftest.c -ldl -lm 5 /home/pengy/.tmp/ccpZyEGH.o: In function `main': conftest.c:(.text+0x8): undefined reference to `rl_completion_matches' collect2: ld returned 1 exit status configure:22230: $? = 1 configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME R | #define PACKAGE_TARNAME R | #define PACKAGE_VERSION 2.9.2 | #define PACKAGE_STRING R 2.9.2 | #define PACKAGE_BUGREPORT r-b...@r-project.org | #define PACKAGE R | #define VERSION 2.9.2 | #define R_PLATFORM x86_64-unknown-linux-gnu | #define R_CPU x86_64 | #define R_VENDOR unknown | #define R_OS linux-gnu | #define Unix 1 | #define R_ARCH | #define HAVE_VISIBILITY_ATTRIBUTE 1 | #define _GNU_SOURCE 1 | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_DLFCN_H 1 | #define LT_OBJDIR .libs/ | #define HAVE_LIBM 1 | #define HAVE_LIBDL 1 | #define HAVE_READLINE_HISTORY_H 1 | #define HAVE_READLINE_READLINE_H 1 | #define HAVE_LIBNCURSES 1 | #define HAVE_LIBREADLINE 1 | #define HAVE_HISTORY_TRUNCATE_FILE 1 | /* end confdefs.h. */ | #include stdio.h | #include readline/readline.h | | | int | main () | { | #ifndef rl_completion_matches | char *p = (char *) rl_completion_matches; | #endif | | ; | return 0; | } configure:22248: result: no __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] How to compile R with command completion?
I didn't change anything except --prefix when I compile readline. Here is my $LD_LIBRARY_PATH which has the directory where libreadline.so is in. I also copied 'conftest.c' to a temp dir and compiled it with -lreadline and -lcurses (this is manual testing, not using configure). The problem of conftest.c:(.text+0x8): undefined reference to `rl_completion_matches' is resolved. Why '-lreadline' and '-lcurses' are not in the command called by 'configure'? Is this a bug in configure? How should I fix it? $ echo $LD_LIBRARY_PATH /home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/lib:/home/pengy/utility/linux/opt/R-2.9.2/lib64/R/lib:/home/pengy/utility/linux/opt/gcc-4.3.4/lib64:/home/pengy/utility/linux/opt/gcc-4.3.4/lib:/home/pengy/download/linux/qtsdk-2009.03/lib:/home/pengy/utility/linux/lib64:/home/pengy/utility/linux/lib $ cat conftest.c /* confdefs.h. */ #define PACKAGE_NAME R #define PACKAGE_TARNAME R #define PACKAGE_VERSION 2.9.2 #define PACKAGE_STRING R 2.9.2 #define PACKAGE_BUGREPORT r-b...@r-project.org #define PACKAGE R #define VERSION 2.9.2 #define R_PLATFORM x86_64-unknown-linux-gnu #define R_CPU x86_64 #define R_VENDOR unknown #define R_OS linux-gnu #define Unix 1 #define R_ARCH #define HAVE_VISIBILITY_ATTRIBUTE 1 #define _GNU_SOURCE 1 #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STRINGS_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_STDINT_H 1 #define HAVE_UNISTD_H 1 #define HAVE_DLFCN_H 1 #define LT_OBJDIR .libs/ #define HAVE_LIBM 1 #define HAVE_LIBDL 1 #define HAVE_READLINE_HISTORY_H 1 #define HAVE_READLINE_READLINE_H 1 #define HAVE_LIBNCURSES 1 #define HAVE_LIBREADLINE 1 #define HAVE_HISTORY_TRUNCATE_FILE 1 /* end confdefs.h. */ #include stdio.h #include readline/readline.h int main () { #ifndef rl_completion_matches char *p = (char *) rl_completion_matches; #endif ; return 0; } $ gcc -o conftest -I/home/pengy/utility/linux/opt/gcc-4.3.4/include -I/home/pengy/utility/linux/include -I/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/include -I/home/pengy/utility/linux/opt/Python-2.6.2/include/python2.6 -I/home/pengy/utility/linux/opt/gcc-4.3.4/include -I/home/pengy/utility/linux/include -L/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/lib -L/home/pengy/utility/linux/opt/R-2.9.2/lib64/R/lib -L/home/pengy/utility/linux/opt/Python-2.6.2/lib -L/home/pengy/utility/linux/opt/gcc-4.3.4/lib64 -L/home/pengy/download/linux/qtsdk-2009.03/lib -L/home/pengy/utility/linux/lib64 -L/home/pengy/utility/linux/lib64 -L/home/pengy/utility/linux/lib conftest.c -lreadline -ldl -lm -lcurses On Wed, Sep 30, 2009 at 3:47 PM, Simon Urbanek simon.urba...@r-project.org wrote: Peng, as you can see there is no -lreadline so I'd look further up in config.log to see why it's failing -- do you have LD_LIBRARY_PATH setup to match your custom location of libs? (Also I notice you are building x86_64 yet the readline you are showing is in /lib and not in /lib64 -- did you build it just in 32-bit?) Cheers, Simon On Sep 30, 2009, at 16:30 , Peng Yu wrote: On Wed, Sep 30, 2009 at 9:58 AM, Simon Urbanek simon.urba...@r-project.org wrote: On Sep 30, 2009, at 10:13 , Peng Yu wrote: I compiled R-2.9.2 from source on Cent OS. But the compile R program does not support command completion. I get the following configure output that is related to readline. Why 'rl_completion_matches' doesn't exist? Maybe your readline is too old? Maybe you have a readline-replacement library (e.g. libedit) that poses as readline? Try installing some recent readline (incl. -dev part) - the current version is 6.0. If that doesn't help, look at config.log around the rl_completion_matches. I have installed readline 6.0. $ ls /home/pengy/utility/linux/lib/libreadline.* /home/pengy/utility/linux/lib/libreadline.a /home/pengy/utility/linux/lib/libreadline.so /home/pengy/utility/linux/lib/libreadline.so.6 /home/pengy/utility/linux/lib/libreadline.so.6.0 $ ls /home/pengy/utility/linux/lib/libhistory.* /home/pengy/utility/linux/lib/libhistory.a /home/pengy/utility/linux/lib/libhistory.so /home/pengy/utility/linux/lib/libhistory.so.6 /home/pengy/utility/linux/lib/libhistory.so.6.0 But R still doesn't configure it correctly. Would you please what might be the problem? Regards, Peng configure:22192: checking whether rl_completion_matches exists and is declared configure:4: gcc -o conftest -I/home/pengy/utility/linux/opt/gcc-4.3.4/include -I/home/pengy/utility/linux/include -I/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/include -I/home/pengy/utility/linux/opt/Python-2.6.2/include/python2.6 -I/home/pengy/utility/linux/opt/gcc-4.3.4/include -I/home/pengy/utility/linux/include -L/home/pengy/utility/linux/usr/local/Trolltech/Qt-4.5.2/lib -L/home/pengy/utility/linux/opt/R-2.9.2/lib64/R/lib -L/home/pengy/utility/linux/opt/Python-2.6.2/lib -L/home/pengy/utility