Re: [R] Nodes edges with similarity matrix
Birgit Lemcke [EMAIL PROTECTED] writes: Hello, sorry that I interfer, but I tried to do this The SymTest matrix: A B C D E F G A 0.3 0.1 0.5 0.7 0.2 0.8 0.1 B 0.1 0.5 0.4 0.6 0.7 0.3 0.7 C 0.5 0.4 0.3 0.5 0.1 0.1 0.5 D 0.7 0.6 0.5 0.4 0.3 0.5 0.7 E 0.2 0.7 0.1 0.3 0.5 0.2 0.1 F 0.8 0.3 0.1 0.5 0.2 0.3 0.5 G 0.1 0.7 0.5 0.7 0.1 0.5 0.1 g A graphAM graph with undirected edges Number of Nodes = 7 Number of Edges = 28 g - new(graphAM, adjMat=SymTest, values=list(weight=0)) plot(g) Fehler in as.vector(x, double) : kann nicht nach Vektor umwandeln (Error in as.vector(x, double) : can not convert to vector) what goes wrong? I suspect that you have not installed and loaded Rgraphviz which contains the code to plot graph objects from the graph package. Without further details, for example the output of sessionInfo(), it is difficult to say. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/ __ R-help@stat.math.ethz.ch 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.
Re: [R] Nodes edges with similarity matrix
Hi Paul, H. Paul Benton [EMAIL PROTECTED] writes: I have a matrix which gives me the similarity of each item to each other. I would like to turn this matrix into something like what they have in the graph package with the nodes and edges. http://cran.r-project.org/doc/packages/graph.pdf . However I cannot find a method to convert my matrix to an object that graph can use. my similarity matrix looks like: sim[1:4,] a b c d [a] 1.0 0.0223676 0.9723831 0.3943310 [b] 0.325141612 1.000 0.9644216 0.5460461 [c] 0.002109751 0.3426540 1.000 0.7080224 [d] 0.250153137 0.1987485 0.7391222 1.000 please don't get caught up with the numbers I simple made this to show. I have not produce the code yet to make my similitary matrix. Does anyone know a method to do this or do I have to write something. :( If I do any starter code :D jj. If I've read something wrong or misunderstood my apologies. The matrix you have can be interpreted as an adjacency matrix where a value of zero means no relationship and a non-zero value indicates an edge between two nodes with edge weight determined by the value. You can create a graph object like this: library(graph) g - new(graphAM, adjMat=sim, values=list(weight=0)) The default is to create an undirected graph and in this case you must provide a symmetric matrix. Generally I would expect a similarity matrix to be symmetric, but the similitary (sic) matrix you have above is not. In this case, you can use a directed graph: g - new(graphAM, adjMat=sim, values=list(weight=0), edgemode=directed) To visualize your graph you can use the Rgraphviz package which will allow you to do: plot(g) You might also be interested in the RBGL package which provides many powerful graph algorithms. All of these packages are available via Bioconductor (no bio required) and can be installed as: source(http://bioconductor.org/biocLite.R;) biocLite(c(RBGL, Rgraphviz)) + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/ __ R-help@stat.math.ethz.ch 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.
Re: [R] Nodes edges with similarity matrix
Along with the example I gave using graphAM, you might also want to look at the help page for the distGraph class which may be more directly what you want: library(graph) class ? distGraph __ R-help@stat.math.ethz.ch 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.
Re: [R] Suspected memory leak with R v.2.5.x and large matrices with dimnames set
Hi Peter, Peter Waltman [EMAIL PROTECTED] writes: Admittedly, this may not be the most sophisticated memory profiling performed, but when using unix's top command, I'm noticing a notable memory leak when using R with a large matrix that has dimnames set. I'm not sure I understand what you are reporting. One thing to keep in mind is that how memory released by R is handled is OS dependent and one will often observe that after R frees some memory, the OS does not report that amount as now free. Is what you are observing preventing you from getting things done, or just a concern that there is a leak that needs fixing? It is worth noting that the internal handling of character vectors has changed in R-devel and so IMO testing there would make sense before persuing this further, I suspect your results will be different. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/ __ R-help@stat.math.ethz.ch 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.
Re: [R] A clean way to initialize class slot of type numeric vector
[EMAIL PROTECTED] writes: Hi, I have a class definition like this: setClass(foo, representation(members=numeric), prototype(members=c())) I intend my class to have members, a slot whose value should be a vector of integer. When I initialize this class, I don't have any member yet. So my member is blank. But if I run the above definition into R, it will complain that my slot members is assigned to NULL which does not extend class numeric. So how can I fix this? Is there any clean way to do this? This is quite a common situation but I can't seem to find a way out. Any help would be really appreciated. Thank you. How about: setClass(foo, representation(members=numeric), prototype(members=numeric(0))) That is, use a zero-length vector to signify a vector that isn't there. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/ __ R-help@stat.math.ethz.ch 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.
Re: [R] tcltk error on Linux
Hi Mark, Prof Brian Ripley [EMAIL PROTECTED] writes: On Thu, 9 Aug 2007, Mark W Kimpel wrote: I am having trouble getting tcltk package to load on openSuse 10.2 running R-devel. I have specifically put my /usr/share/tcl directory in my PATH, but R doesn't seem to see it. I also have installed tk on my system. Any ideas on what the problem is? Any chance you are running R on a remote server using an ssh session? If that is the case, you may have an ssh/X11 config issue that prevents using tcl/tk from such a session. Rerun the configure script for R and verify that tcl/tk support is listed in the summary. Also, note that I have some warning messages on starting up R, not sure what they mean or if they are pertinent. Those are coming from a Bioconductor package: again you must be using development versions with R-devel and those are not stable (last time I looked even Biobase would not install, and the packages change daily). BioC devel tracks R-devel, but not on a daily basis -- because R changes daily. The recent issues with Biobase are a result of changes to R and have already been fixed. If you have all those packages in your startup, please don't -- there will be a considerable performance hit so only load them when you need them. Presumably, that's why they are there in the first place. The warning messages are a problem and suggest some needed improvements to the methods packages. These are being worked on. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/ __ R-help@stat.math.ethz.ch 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.
Re: [R] Need Help: Installing/Using xtable package
Peter Dalgaard [EMAIL PROTECTED] writes: M. Jankowski wrote: Hi all, Let me know if I need to ask this question of the bioconductor group. I used the bioconductor utility to install this package and also the CRAN package.install function. My computer crashed a week ago. Today I reinstalled all my bioconductor/R packages. One of my scripts is giving me the following error: in my script I set: library(xtable) print.xtable( and receive this error: Error : could not find function print.xtable This is a new error and I cannot find the source. Looks like the current xtable is no longer exporting its print methods. Why were you calling print.xtable explicitly in the first place? Indeed, xtable now has a namespace. The S3 methods are not exported because they should not be called directly; rather, the generic function (in this case print) should be called. The addition of the namespace is really a good. Yes, it will cause some hicups for folks who were calling the methods directory (tsk tsk). But the addition fixes breakage that was occuring due to internal xtable helper functions being masked. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/ __ R-help@stat.math.ethz.ch 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.
Re: [R] S4 methods: unable to find an inherited method
Hi Paul, H. Paul Benton [EMAIL PROTECTED] writes: I consider myself pretty new to the whole OO based programming so I'm sorry if I'm doing something stupid. These sorts of questions might be better sent to the R-devel list... xml-read.metlin(url) Error in function (classes, fdef, mtable) : unable to find an inherited method for function read.metlin, for signature url So the error message is telling you that it can't find a method for the read.metlin generic that matches the class of the xml argument you passed in. You defined: setMethod(read.metlin, xcmsRaw, function(xml) { #Parsing the METLIN XML File reading-readLines(xml) #do rest of script }) So there is a method for read.metlin when the xml argument is an xcmsRaw object. As you show, you passed in an object with class url. url description http://metlin.scripps.edu/download/MSMS_test.XML; class url Any help as to why I'm getting the inherited method error would be great. You either need to add a method specialized on the url class (warning, url is not an S4 class, there will be tricks required). Or you need to pass in an xcmsRaw object. Cheers, + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/ __ R-help@stat.math.ethz.ch 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.
Re: [R] Problems with expresso
Markus Schmidberger [EMAIL PROTECTED] writes: Hello, I want to use expresso for preprocessing the hgu133a-spikein data from affycompII. But there is an error: Please send questions regarding Bioconductor packages to the Bioconductor mailing list. I would recommend making sure all of your packages are up to date: ## *new* R session, no saved data loaded source(http://bioconductor.org/biocLite.R;) biocLite(Biobase) library(Biobase) update.packges(repos=biocReposList()) + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/ __ R-help@stat.math.ethz.ch 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.
Re: [R] Catch errors
Gang Chen [EMAIL PROTECTED] writes: I wanted something like this: tag - 0; tryCatch(fit.lme - lme(Beta ~ Trust*Sex*Freq, random = ~1|Subj, Model), error=function(err) tag - 1); but it seems not working because 'tag' does not get value of 1 when error occurs. How can I make it work? You can use '-' to assign to the parent frame like this: tag - 0 tryCatch({ print(inside tryCatch) print(paste(tag, tag)) stop(forcing an error) }, error=function(e) { print(caught an error) tag - 1 }) But you can also use the return value of tryCatch as a return code if that is what tag is. Like this: fail - TRUE tag - tryCatch({ print(inside tryCatch) if (fail) stop(forcing an error) 0 }, error=function(e) { print(caught an error) 1 }) tag + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center BioC: http://bioconductor.org/ Blog: http://userprimary.net/user/ __ R-help@stat.math.ethz.ch 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.
Re: [R] initalizing and checking validity of S4 classes
Martin Morgan [EMAIL PROTECTED] writes: Hi Michal -- Add validObject to your initialize method: Actually, a call to valid object is part of the default initialization method which has been masked. A different solution, which might have some other benefits is to delegate back to the default method using callNextMethod. So you could do: setMethod(initialize, someclass, function(.Object, v=numeric(0), l=character(0)) { # strip the vector names cv - v cl - l names(cv) - NULL names(cl) - NULL callNextMethod(.Object=.Object, v=cv, l=cl) } ) Here are two interpretations of this. (1) using 'initialize' means that you are taking control of the initialization process, and hence know when you need to call validObject. Yes. Anytime you specialize a method you must take responsibility for any less specific methods. In this case, the default 'initialize' does object validation. So if you want validation, you either need to do it directly or invoke the default method. (2) Responsibility for object validity is ambiguous -- does it belong with 'new', 'initialize', or a 'constructor' that the programmer might write? This is particularly problematic with R's copy semantics, where creating transiently invalid objects seems to be almost necessary (e.g., callNextMethod() in 'initialize' might initialize the inherited slots of the object, but the object itself is of the derived class and could well be invalid 'invalid' after the base class has finished with initialize). This is a good point. It suggests that, at least, one must initialize all non-inherited slots to valid values _before_ calling the next method. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] R and HTTP get 'has file changed'
Hi Dirk, Dirk Eddelbuettel [EMAIL PROTECTED] writes: Is there a way, maybe using Duncan TL's RCurl, to efficiently test whether an URL such as http://$CRAN/src/contrib/ has changed? I.e. one way is via a test of a page in that directory as per (sorry about the long line, and this would be on Linux with links and awk installed) strptime(system(links -width 160 -dump http://cran.r-project.org/src/contrib/ | awk '/PACKAGES.html/ {print $3,$4}\', intern=TRUE), %d-%b-%Y %H:%M) [1] 2007-07-12 18:16:00 and one can then compare the POSIXt with a cached value --- but requesting the header would presumably be more efficient. Is there are way to request the 'has changed' part of the http 1.1 spe directly in R? Here's a way to use RCurl obtain HTTP headers: h - basicTextGatherer() junk - getURI(url, writeheader=h$update, header=TRUE, nobody=TRUE) h - h$value() If you want to check many URLs, I think you will find the following much faster as opposed to looping the above: h - multiTextGatherer(urls) junk - getURIAsynchronous(urls, write=h, header=TRUE, nobody=TRUE) yourInfo - sapply(h, function(x) something(x$value())) I've used this in the pkgDepTools package to retrieve package download sizes. Cheers, + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] installing Rgraphviz under fedora 5
marco.R.help marco.R.help [EMAIL PROTECTED] writes: Dear list, I have a lot of troubles installing Rgraphviz. I installed graphviz 2.13 from graphviz-2.13.20061222.0540.tar I installed the library Rgraphviz I'm pretty sure that you will have problems with graphviz 2.13 and that you will need to use graphviz 2.12. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] locked environment and inheritance
johan Faux [EMAIL PROTECTED] writes: Thanks for your reply. Experimenting a little further, I was able to learn a bit more and find what is the real problem of mine what the real question is. I could create my S4 extended class by adding these two lines in my namespace file importClassesFrom(Matrix,Matrix) importClassesFrom(Matrix,dMatrix) You can also do: importClassesFrom(Matrix, Matrix, dMatrix) and then creating my new class in another R file library(Matrix) ^^^ I would not call library for such a case. If you are importing library in your package's namespace, then you probably want the following in your DESCRIPTION file: Depends: Matrix, methods Imports: Matrix [yes, there is a lot of duplication in how things are specified] setClass(myMatClass, representation(dMatrix,myslot=numeric)) which creates the new S4 class when my package is loaded. The problem is that I would like to create the class inside a function of mine: createMyS4Class() { library(Matrix) setClass(myMatClass, representation(dMatrix,myslot=numeric)) } Again, the call to library should not be needed. so that, at some point (after my package is loaded ), I can do something like: if (cond) createMyS4Class() How do you intend to use such a class? Is the real issue that you don't want to depend on Matrix and only use it if it is available? Now, I understand that at this point, my package environment is locked. So the question become: Is there any way that I can unlock my package environment, create my new S4 class and lock it back or something? I think that might be possible, but that doesn't make it a good idea :-) Please let me know if that makes sense ? I appreciate your comments. It might help to understand what your are trying to achieve overall. Perhaps there are other approaches... Also, at this point, the discussion is more appropriate for R-devel. Perhaps you can move the conversation there? Best, + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] locked environment and inheritance
johan Faux [EMAIL PROTECTED] writes: Hi, I have a S3 package with namespace called myS3Pkg. Inside my package I would like to create a S4 class which extends (adds 2 slots) another S4 class from some other package. The class should be created in myPkg environment (and not global environment). Using: setClass(myS4class, representation(otherS4class, mydata = numeric), where = topenv()) have you tried just omitting the where argument? Classes will get defined in the package environment and I think that's what you want. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] Affycoretools
Hi Tang, Please send questions about Bioconductor packages to the the Biocondcutor mailing list. Please also read over the posting guide for that list to make sure you provide enough information for folks to help you. http://bioconductor.org/docs/postingGuide.html Tang Lee [EMAIL PROTECTED] writes: I am having problem installing the affycoretools package. When I do it through biocLite, I get error messages saying the package XML cannot be installed and that I need a more recent version of libxml2. And did you resolve this by instaling a more recent libxml2? + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] summing up colum values for unique IDs when multiple ID's exist in data frame
Young Cho [EMAIL PROTECTED] writes: I have data.frame's with IDs and multiple columns. B/c some of IDs showed up more than once, I need sum up colum values to creat a new dataframe with unique ids. I hope there are some cheaper ways of doing it... Because the dataframe is huge, it takes almost an hour to do the task. Thanks so much in advance! Does this do what you want in a faster way? sum_dup - function(df) { idIdx - split(1:nrow(df), as.character(df$ID)) whID - match(ID, names(df)) colNms - names(df)[-whID] ans - lapply(colNms, function(cn) { unlist(lapply(idIdx, function(x) sum(df[[cn]][x])), use.names=FALSE) }) attributes(ans) - list(names=colNms, row.names=names(idIdx), class=data.frame) ans } -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] S4 object slot of type 'call'
Roberto Brunelli [EMAIL PROTECTED] writes: I'm using an S4 object with a slot of type 'call': I would like to be able to initialize it with something like NULL or NA (indicating that there is no information in the slot) but the value should comply with the fact that it must be of type call. Is there any simple way to obtain this? One possibility is to create a NullCall class: setClass(NullCall, contains=call) This can be put into a slot of type 'call' and identified by its class. One advantage of this is that you can write a few methods for NullCall and in many cases avoid explicit tests like: if (class(obj) == NullCall) ... else ... For example, you could define a show metho that printed 'NULL' or something. It is also possible to define a class union and use that as the slot type. I don't like this solution, but YMMV. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] accessing unexported functions
Erich Neuwirth [EMAIL PROTECTED] writes: I need to access some internal function of a package temporarily. These functions normally that are not visible outside of the package. I know the MyPackage:::myfunction mechanism, but that does not solve my problem. Instead, I need to add the internal namespace of the package to the search path, then I can run a few commands with these functions available, and then the internal namespace should become invisible again. Is there a code example to achieve this? Perhaps something like pkgEnv = getNamespace(MyPackage) attach(pkgEnv) You might also be interested in assignInNamespace -- perhaps you can add you function to the package's name space and then call it using :::. Be warned, this is the wrong way to solve a long-term problem. Bad things will happen and nobody will feel sorry for you. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] questions on package of KEGG
Li, Hua [EMAIL PROTECTED] writes: Dear list members: Once I know a KEGG pathway identifier, how can I check all its direct children identifiers? you know, I could use GOMFCHILDREN or GOCCCHILDREN to check the children terms for a specific GO term, but I don't know how to do it in the same way for KEGG in R? Many Thanks!! Hua I think you should ask this question on the bioconductor list. http://www.bioconductor.org/docs/postingGuide.html + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] names of objects in .rda
Christos Hatzis [EMAIL PROTECTED] writes: An approach would be to attach it and then use ls() No, that really is not an approach. If you load it, then there is no problem to read the names. The point is not to load it. This is important when dealing with large objects or large collections of objects. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] Unit Testing Frameworks: summary and brief discussion
Hans-Peter [EMAIL PROTECTED] writes: - My code gives error and warning messages in some situations. I want to test that the errors and warnings work, but these flags are the correct response to the test. In fact, it is an error if I don't get the flag. How easy is it to set up automatic tests to check warning and error messages work? Maybe like this: ### for errors: res1fkt - function() xls.info( exc ) res1 - try( res1fkt(), silent = TRUE ) if (class( res1 ) != try-error) stop( xls.info, data not equal ) cat( REQUIRED (EXPECTED) error message: , res1 ) Instead, see RUnit's checkException test. I don't see a checkWarning test, but imagine it could be added. Another feature that I imagine could be added is to actually compare the error/warning message. I'm not sure how much benefit there is to that since it basically means putting the error message in two places, but I suppose it can be useful to make sure that any formatting of inputs is being done properly. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] unable to find inherited method for function edges, for signature ugsh, missing
Søren Højsgaard [EMAIL PROTECTED] writes: I am new to using S4 methods and have run into this problem (on Windows XP using R 2.4.1): I am writing a package in which I use the graph package. I define my own classes of graphs as: setOldClass(graphsh) setOldClass(ugsh) setIs(ugsh, graphsh) (I know that I should have used setClass instead - and I will eventually - but right now I am just puzzled about the reason for my problem...) It isn't clear that your problems aren't being caused by your non-standard approach to defining classes and I would recommend you fix this part of your code first. If you are depending on the graph package, I'm surprised you don't want to extend one of the graph classes there. Perhaps: setClass(graphsh, contains=graph) Or setClass(graphsh, contains=graphNEL) You can override whatever methods you need to, but don't have to write new methods for those that work as you want. I need an 'edges' method for ugsh graphs, so I set: if (!isGeneric(edges)) { if (is.function(edges)) fun - edges else fun - function(object,which) standardGeneric(edges) setGeneric(edges, fun) } setMethod(edges, signature(object = graphsh), function(object, which) { .links(object) }) Do you want to have your own generic distinct from the edges generic defined in the graph package or do you want to simply attach new methods to the edges generic defined in graph. I see no benefit to this conditional approach and it _can_ cause confusion. I can get this to work in the sense that it passes R cmd check. However, if I add the following (to me innocently looking function) to my package I get problems: nodeJoint - function(bn, set, normalize=TRUE){ vars - set a- vallabels(gmd)[vars] ^^^ Where is that defined? levs - as.data.frame(table(a)) levs - levs[,1:length(a)] levs2 - do.call(cbind,lapply(levs, as.character)) p-sapply(1:nrow(levs2), function(i) pevidence(enterEvidence(bn, nodes=vars, states=levs2[i,])) ) if (normalize) p - p / sum(p) levs$.p - p return(levs) } I can't see where a call to edges is made. Is there one hiding in one of the function calls? When running R cmd check I get: ug - ugsh(c(me,ve),c(me,al),c(ve,al),c(al,an),c(al,st),c(an,st)) edges(ug) Error in function (classes, fdef, mtable) : unable to find an inherited method for function edges, for signature ugsh, missing Execution halted (I never use the function nodeJoint in my .Rd files, so it just sits there and causes problems. I am puzzled about what the error message means and about why this function causes problems. Can anyone help. Thanks in advance. Does your package have a name space? What does your package's DESCRIPTION file look like? Do any of the examples call library() or require()? + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] apply problem
aedin culhane [EMAIL PROTECTED] writes: Dear R-Help I am running apply on a data.frame containing factors and numeric columns. It appears to convert are columns into as.character? Does it convert data.frame into matrix? Is this expected? I wish it to recognise numerical columns and round numbers. Can I use another function instead of apply, or should I use a for loop in the case? If you want to modify the data.frame object, a for loop will likely be the best bet. As noted in other replies, lapply will operate on the columns of a data.frame since a data.frame is a list. But the return value will be a list, not a data.frame. I think for loops get a bad wrap. There are times when they are appropriate and even optimal in R programming. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ [EMAIL PROTECTED] 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.
Re: [R] Method dispatch for print() in package its
Albrecht, Dr. Stefan (AZ Private Equity Partner) [EMAIL PROTECTED] writes: Dear all, in the package its the print() method does not seem to correctly work in all circumstances: My understanding is that one should define only a method for the show generic for S4 classes and leave print alone. Not sure if that helps you. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ [EMAIL PROTECTED] 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.
Re: [R] Subsetting list of vectors with list of (boolean) vectors?
Johannes Graumann [EMAIL PROTECTED] writes: Dear Rologists, I'm stuck with this. How would you do this efficiently: aPGI [[1]] [1] 864 5576 aPGItest [[1]] [1] TRUE FALSE result - [magic box involving subset) result - aPGI[aPGItest[[1]]] result [[1]] [1] 864 + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ [EMAIL PROTECTED] 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.
Re: [R] how to reverse a list
Weiwei Shi [EMAIL PROTECTED] writes: I forgot to add my bad solution here: reverseList - function(xlist){ blist - xlist[!is.na(xlist)] x0 - unlist(blist) l0 - length(blist) d0 - as.data.frame(matrix(0, l0, 3)) d0[,1] - names(x0) d0[,2] - x0 There is a helper function in Biobase that does this: reverseSplit reverseSplit function (inList) { lens = sapply(inList, length) nms = rep(names(inList), lens) vals = unlist(inList) split(nms, vals) } environment: namespace:Biobase + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] RMySQL *was* working...
Pete Cap [EMAIL PROTECTED] writes: List, Last week with the help of Uwe and some other folks I was able to get RMySQL 0.5-7 compiled against R 2.4.1 and MySQL 5.0.27. It was working fine--I was able to send select queries to the db, put the results in a data frame, and so forth. Today, dbDriver() threw an error: dbDriver(MySQL) Error in function (classes, fdef, mtable) : unable to find an inherited method for function dbDriver, for signature function Do you mean dbDriver(MySQL)? + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] getting ess/emacs to link with a remote instance of R
Hi Mark, [I've cc'd the ess-help list and any further discussion should probably happen there with r-help removed] Mark W Kimpel [EMAIL PROTECTED] writes: I am running ess/emacs on Linux and have an R instance running on a remote Unix server. I would like to be able to direct input from my ess buffer to R (hope I am using the right lingo, I am new to emacs). The ess manual contains a section describing how to do just that, but a prerequisite is to install a lisp file ssh.el , which can be found at ftp://ftp.splode.com/pub/users/friedman/emacs-lisp/ssh . In my experience, ssh.el doesn't do anything all that great. Instead I would try: 1. Start a shell inside Emacs using 'M-x shell'. In this shell, ssh to your remote host and start R. 2. In the remote R session do: 'M-x ess-remote'. At the Emacs mini-buffer prompt type 'r'. 3. In a buffer containing R code, you should be able to send code to the remote session as usual (choose the shell buffer when prompted). Note: * C-c C-c will kill your ssh session (and R). IOW, you can't easily interrupt an R process running remotely. * I have never had success getting help to work via ESS when running R remotely. YMMV. * You may find that sending commands to the remote session without echoing is much faster. So you might try C-u C-c C-r to send a region. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] Over-writing functions from other packages? What is a good strategy??
Søren Højsgaard [EMAIL PROTECTED] writes: I am writing a package which uses the Rgraphviz package which in turn uses the graph package, but my question does not (I believe) pertain specifically to the these packages so therefore I dare to post the question here: I my package I have a function edges which works on some graphs I have defined. However, there is also a function edges (or rather a generic method) in the graph package (seemingly written in S4). Yes, edges is a generic function defined by the graph package. With methods for various graph representation classes. I load my package the Rgraphviz package is automatically loaded, but this means that the edges method of the the graph package overrides the edge function in my package. Is there a way of avoiding this? If there is, I guess that it is a dangerous path to take? But if so, what else is a good strategy to take? I'm pretty sure this is resolved by adding a NAMESPACE file to your package (see the Writing R Extensions Manual for details). I made a little test package that has Rgraphviz in Depends, defines an edges function and exports it in its NAMESPACE file. When I load this package, edges is the one from my test package and graph::edges is the one from graph. It won't solve your problem in general, but I will also look into having Rgraphviz only import graph and not Depend on it. This would avoid graph::edges polluting the search path when Rgraphviz gets loaded. This is a reason that import might be preferred over Depends for packages that have namespaces. Finally, if you were depending on graph and not Rgraphviz, then you could rename graph::edges when you import it in your NAMESPACE file: importFrom(graph, someOtherName=edges) + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] Fast lookup in ragged array
Peter McMahan [EMAIL PROTECTED] writes: That's a good point. What's a good point? [this is why top-posting isn't so helpful]. What's the overhead on digests like that? Depends on the digest algorithm, the implementation, etc. To some extent, you can just try it and see. Or you can compute the digest of an average sized subgraph node label list in a loop and estimate that way. Also, does that open up the possibility, exceedingly small though it may be, of misidentifying a branch as already searched and missing a qualifying subgraph? Yes and the size of exceedingly small depends on the digest. I don't think this is worth worrying about. Also, is it better to over-estimate or under-estimate the size parameter? I perhaps should have stressed that over-estimating is better. The way hashed environments work is that a vector is initialized to the desired size and collisions are resolved using chaining. To reduce collisions and have a more efficient hashtable, you want to have more slots in the vector than items since the hash function is rarely perfect for your data. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] Fast lookup in ragged array
Peter McMahan [EMAIL PROTECTED] writes: Well, I hadn't ever seen RBGL before, so that's great. I've been using igraph and sna mainly, but there are a few points lacking between these two. RBGL solves a lot of problems for me! But I'm not sure it will solve this specific problem. Are you suggesting I use RBGL to do a depth-first search of all the subgraphs? For this particular depth-first search I'm not searching every subgraph, but just those that are constructed from a minimal cutset of the parent subgraph. At each level of the search, I have to compute graph cohesion (vertex connectivity), which can take considerable time. A lot of computation time is saved by only searching subgraphs obtained through cutsets. So a complete search of all the subgraphs won't work, but the redundancy I come across is I think unavoidable. Perhaps you will need a combination of graph/RBGL and some custom memoization code to keep track of which subgraphs have already been searched. Some suggestions on that front: Don't use a list, use an environment. searchedBranched = new.env(hash=TRUE, parent=emptyenv(), size=X) where X is an estimate of the number of branches you will search. Using an environment implies you will need unique character names for each subgraph. Do you have that? If not, you could concatenate node names. For a 200 node graph, that should be ok. Hope that helps some. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] Fast lookup in ragged array
Peter McMahan [EMAIL PROTECTED] writes: Thanks, I'll give it a try. does R have a limit on variable name length? If you are going to have very long names, you might be better off computing a digest of some kind. You could use the digest package to compute an md5sum or the Ruuid package to generate a GUID. Also, is it better to over-estimate or under-estimate the size parameter? The environment will grow as needed. If you overestimate, you will use more memory than you need to. Whether this is a problem depends if you have extra memory available. Underestimating means that the underlying hashtable will need to be resized and this has a performance impact. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] Sweave question: prevent expansion of unevaluated reused code chunk
Kevin R. Coombes [EMAIL PROTECTED] writes: [2] You are also correct that there is no advantage if I just call them chunk1 and chunk2. But if I call them something more interesting, like perform.quantile.normalization or truncate.and.log.transform, then I can use this structure to explain the algorithm at a higher level. If you go back to Knuth's original literate programming examples, this is exactly how he presents his examples. For instance, on page 104 of the Literate Programming book, he has I suspect it would not be too hard to write an Sweave driver that would respond to an expand=FALSE argument in the way you want. -- But I'm not certain. I've never used nested code chunks (!) and that may make such a modification difficult. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Sweave question: prevent expansion of unevaluated reused code chunk
Kevin R. Coombes [EMAIL PROTECTED] writes: Hi, Consider the following (much simplified) Sweave example: -- First, we set the value of $x$: chunk1,eval=FALSE= x - 1 @ Then we set the value of $y$: chunk2,eval=FALSE= y - 2 @ Thus, the overall algorithm has this structure: combined,eval=FALSE= chunk1 chunk2 @ justDoIt,echo=FALSE= combined @ --- I'd like to be able to do something like this, where the combined chunk prints out in the final LaTeX document essentially verbatim. In particular, I want to see the chunk1 unexpanded in that block, since this gives me a nice conceptual overview of the algorithm. (Of courser, this is more useful when chunk1 and chunk2 are much longer than they are in this example) Is there an option that allows me to get this behavior? Maybe I'm not understanding what it is you want, but why not: \begin{verbatim} chunk1 chunk2 \end{verbatim} What does putting this in an unevaluated chunk buy you? The chunkName markers are an internal detail of the document and so must of the time these never appear in the rendered output. Even in your example, won't it be confusing that chunk1 and chunk2 won't have appeared in labels earlier in the rendered document? + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] RMySQL on win32
Pete Cap [EMAIL PROTECTED] writes: List, I am still unable to compile RMySQL on XP and would appreciate any assistance anyone could provide. I know that setting up RMySQL on win32 is not easy. The installation instructions are supposedly contained in ../src/README.win. They give instructions on creating a file, libmysql.a, which I was able to do successfully. Here is where the instructions basically break down. The creation of this file all occurs in \MySQL\..\lib\opt, after which the reader is instructed to copy libmysql.a to ..\lib\opt (huh? You mean, where it already is?). Then the reader is instructed to build the binaries with Rcmd build --binary RMySQL. Not sure about that part. From the windows command shell, the result is: C:\Rcmd build --binary RMySQL * checking for file RMySQL/DESCRIPTION' ... OK * preparing 'RMySQL': * checking DESCRIPTION meta-information ...'sh' is not recognized as an internal or external command, operable program or batch file. OK * cleaning src 'sh' is not recognized as an internal or external command, operable program or batch file. Error: cannot open file c:/TEMP/Rout381268676' for reading Apparently R is trying to call some shell script (from the windows prompt??) so I attempted this in cygwin. I don't think that will work. You need to install all the required tools for building source package with R on Windows. If there is a simply better solution that I should try, I would appreciate hearing about it as well. All I really need to do at this point is send select and join queries to the local server--perhaps I should just install RSQLite from CRAN? Well, if you don't need MySQL, then SQLite and RSQLite will get you going. If you do need MySQL, you can try RODBC. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] Download packages problem.
Luis Garavito [EMAIL PROTECTED] writes: Hi, I have a little problem with the installation of a new packages. The installation of R software is correct, but my server required authentication for use it, and for load a new package directly from R it is not possible. Is there a code or process for server authentication (put my login and password) in R for download directly the packages? Yes. Without telling us what operating system, what version of R, and some specifics of what you are trying and the error messages you are seeing, it is rather difficult to imagine that you will get any useful help. Please have a look at the posting guide and send an update. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] Error loading a dependency in a package: missing namespace?
Carlos J. Gil Bellosta [EMAIL PROTECTED] writes: import(methods, Biobase, outliers) * checking whether the package can be loaded ... ERROR Loading required package: Biobase Loading required package: tools Welcome to Bioconductor Vignettes contain introductory material. To view, type 'openVignette()' or start with 'help(Biobase)'. For details on reading vignettes, see the openVignette help page. Loading required package: outliers Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : in 'pcrAnalysis' classes for export not defined: pcrExprSet In addition: Warning message: package 'pcrAnalysis' contains no R code in: loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) Error: package/namespace load failed for 'pcrAnalysis' Execution halted It seems that the error is related to something having to do with namespaces. The thing is that package outliers does not have a NAMESPACE file. Could this be an issue? Yes, you cannot do import(pkg) in the NAMESPACE file if pkg doesn't itself have a NAMESPACE file. So try just removing that from your NAMESPACE file. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] from function to its name?
Ido M. Tamir [EMAIL PROTECTED] writes: I wanted to pass a vector of functions as an argument to a function to do some calculations and put the results in a list where each list entry has the name of the function. I thought I could either pass a vector of function names as character, then retrieve the functions etc... Or do the opposite, pass the functions and then retrieve the names, but this seems not to be possible it occurred to me, hence my question. Functions don't have to have names, by which I mean that the definition doesn't have to be bound to a symbol. If your function takes a list of functions then: yourFunc(theFuncs=list(function(x) x + 1)) You could force the list to have names and use them. Or you could force function names to be passed in (your other idea). + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] object is not subsettable
Hi Radek, Radek Blatny [EMAIL PROTECTED] writes: Dear colleagues, I've just come across a problem with the following command which is a part of the metaOverview.R code file provided as an monography- accompanying file at http://www.bioconductor.org/docs/mogr/metadata: The appropriate place to ask about Bioconductor packages (and the BCBS monograph) is on the bioconductor list. I've cc'd the bioconductor list, please send further replies or questions there. ## R hasChr - eapply(GOTERM, function(x) + x[grep(chromosome, Term(x))]) Error in x[grep(chromosome, Term(x))] : object is not subsettable ## I have run the command in the (PPC) Mac OS X R 2.4.1 and (AMD Ubuntu) Linux R 2.4.0 with the same result so it shouldn't be any distribution-dependent problem. Obviously the metaOverview.R is not up-to-date since I had few problems before as well (e.g. that a function is in another package in BioC 1.9 etc.) but I was able to repair everything myself. However, this one I don't understand. Anyone can help? Some classes have changed?! You are correct that this code is out of date. The reason is actually due to changes in R. Since R 2.4.0, S4 classes now have their own internal type and do not act like lists. This is a very good thing, but it means that some code that relied on it will break. The elements of the GOTERM environment are instances of the GOTerms class defined in the annotate package. So taking a look at the old code: hasChr - eapply(GOTERM, function(x) x[grep(chromosome, Term(x))]) This is looping over all GOTerms instances in the GOTERM environment and calling grep on the term summary: grep(chromosome, Term(x)) Since Term(x) returns a character vector of length one, if a match is found the return value of grep will be 1. If no match is found it will be integer(0) (a zero-length integer vector). If x (the GOTerms instance) was a list, then we would have either x[1] or x[integer(0)]. But since x is an S4 class with no [ method defined, you now get an error. The code example is just trying to count the number of GO Terms that have chromosome in their description. You can achieve this as follows: hasChr - eapply(GOTERM, function(x) length(grep(chromosome, Term(x sum(unlist(hasChr)) + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] help with RMySQL
Ravi S. Shankar [EMAIL PROTECTED] writes: Hi R users, I am using RMySQL to connect to a database in MySQL. I have 3 questions. 1)When I give the following command dbListTables(con) I get the output stack imbalance in .Call, 142 then 143 stack imbalance in -, 140 then 141 stack imbalance in {, 138 then 139 stack imbalance in standardGeneric, 126 then 127 stack imbalance in class, 121 then 122 stack imbalance in -, 119 then 120 stack imbalance in {, 117 then 118 stack imbalance in -, 111 then 112 stack imbalance in {, 109 then 110 [1] newtable ravi Could somebody tell me why it shows a stack imbalance? It most likely indicates a bug in the package's C code. But you need to tell us the output of sessionInfo() and the version of MySQLite you are using. You might also want to send such a message to the r-sig-db list. 2)For this command testcmd1-fetch(dbSendQuery(con,select ticker from ravi where banks=100)) dim(testcmd1) The output is [1] 500 1 However when I give the same command directly in MySQL command prompt I get an output greater than 2000!! (Does fetch have a limitation?) Read the doc for fetch. 3) Also is it possible to get output where the NA values are removed? Not sure what you mean, but you can always remove them afterwards. nulls in the DB should get pulled across as NA and so if your query excludes nulls... + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Problems with 'delay'/'delayedAssign' when installing data package
Hi Wolfram, Wolfram Fischer [EMAIL PROTECTED] writes: I downloaded: http://www.bioconductor.org/data/metaData/hgu95av2_1.7.0.tar.gz described as: Package: hgu95av2 Title: A data package containing annotation data for hgu95av2 Version: 1.7.0 Created: Wed Jan 12 16:57:23 2005 Author: Lin,Chenwei Description: Annotation data file for hgu95av2 assembled using data from public data repositories Maintainer: Lin,Chenwei [EMAIL PROTECTED] LazyLoad: yes Depends: R(= 2.0.0) License: LGPL Packaged: Thu Mar 3 15:43:00 2005; biocbuild That is not the recommended way to install Bioconductor packages (and of course, this is not the recommended place to ask questions about them: there is a dedicated bioconductor list). Based on this: ** Removing '/usr/local/lib64/R-2.4.1/library/hgu95av2' I take it you are using R-2.4.1 on a 64-bit Linux platform. It is good that you are using an up-to-date version of R. To install Bioconductor packages, please try: R source(http://bioconductor.org/biocLite.R;) R biocLite(hgu95av2) ## or to get everything geneplotter depends and suggests R biocLite(geneplotter, dependencies=TRUE) The error you are seeing is due to the fact that you have downloaded a very old version of the data annotation package. These packages are maintained and updated version appropriate for current R are available. The easiest way is to install using biocLite, but you can also get to the current stuff from the website. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] RES: RdbiPgSQL in R 2.4.1
Eduardo Dutra de Armas [EMAIL PROTECTED] writes: Hi Seth I'm running R on WinXP. On the first time I've installed Rdbi and RdbiPgSQL from zip files not downloaded from Bioconductor. No problems during installation. Now I tried to install from biocLite and a message was showed for RdbiPgSQL. biocLite(c(Rdbi, RdbiPgSQL)) Running getBioC version 0.1.8 with R version 2.4.1 Running biocinstall version 1.9.9 with R version 2.4.1 Your version of R requires version 1.9 of Bioconductor. Dependency ''RdbiPgSQL'' is not available ... I gave a look at Bioconductor site, where I saw an Error report during checking of BioC 1.9/RdbiPgSQL for Windows Server 2003. The same was reported for another BioC releases. Conclusion: Isn't possible access postgreSQL databases from R? You are partly right: We don't have Windows binary packages available for the RdbiPgSQL package. The source package works on Linux and OS X (if you have the appropriate tools to build source packages). You might be able to connect using the RODBC package. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] RdbiPgSQL in R 2.4.1
Hi Eduardo, It would probably be best to send question regarding Bioconductor packages to the bioconductor email list. Eduardo Dutra de Armas [EMAIL PROTECTED] writes: Hi R-users I recently downloaded RdbiPgSQL 1.8.0 and Rdbi 1.8.0 from Bioconductor to be installed under R 2.4.1. When requiring RdbiPgSQL an error message is showed as follows: require(RdbiPgSQL) Loading required package: RdbiPgSQL Error in library(package, lib.loc = lib.loc, character.only = TRUE, logical = TRUE, : RdbiPgSQL is not a valid package installed 2.0.0? There is no issue about version restriction in Description file. What OS are you running on? How did you install the packages? I'm not able to reproduce the message you posted. Perhaps try reinstalling using the biocLite install script. Like this: source(http://bioconductor.org/biocLite.R;) biocLite(c(Rdbi, RdbiPgSQL)) NB: normally, you don't need to specify dependencies, but this way it will reinstall Rdbi as well in case you have a bogus install... + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] R for bioinformatics
Benoit Ballester [EMAIL PROTECTED] writes: Hi, I was wondering if someone could tell me more about this book, (if it's a good or bad one). I can't find it, as it seems that O'Reilly doesn't publish any more. I've never seen a copy so I can't comment about its quality (has anyone seen a copy?). You might want to take a look at _Bioinformatics and Computational Biology Solutions Using R and Bioconductor_. http://www.bioconductor.org/pub/docs/mogr/ + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] help with regexpr in gsub
Kimpel, Mark William [EMAIL PROTECTED] writes: I have a very long vector of character strings of the format GO:0008104.ISS and need to strip off the dot and anything that follows it. There are always 10 characters before the dot. The actual characters and the number of them after the dot is variable. So, I would like to return in the format GO:0008104 . I could do this with substr and loop over the entire vector, but I thought there might be a more elegant (and faster) way to do this. I have tried gsub using regular expressions without success. The code gsub(pattern= \.*? , replacement=, x=character.vector) I guess you want: sub(([GO:0-9]+)\\..*$, \\1, goids) [You don't need gsub here] But I don't understand why you wouldn't want to use substr. At least for me substr looks to be about 20x faster than sub for this problem... library(GO) goids = ls(GOTERM) gids = paste(goids, ISS, sep=.) gids[1:10] [1] GO:001.ISS GO:002.ISS GO:003.ISS GO:004.ISS [5] GO:006.ISS GO:007.ISS GO:009.ISS GO:010.ISS [9] GO:011.ISS GO:012.ISS system.time(z - substr(gids, 0, 10)) user system elapsed 0.008 0.000 0.007 system.time(z2 - sub(([GO:0-9]+)\\..*$, \\1, gids)) user system elapsed 0.136 0.000 0.134 + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] RSQLite NA on input
Hi Richard, It would help if you provided a bit more on how you are going about the import (along with your version of R and RSQLite). R Gott [EMAIL PROTECTED] writes: I haev some .csv data files with missing values - eg below 1,'F','C04','X100',20.93,'C','B',7,8,7.5,2421,2230,2230,2,1,85,43,85,46,48,60 If I have a missing value - so file looks like ,85,46,,48, etc then RSQLite reads it as zero. ,85,46,0,48, etc I need it read it as NA. Tried various combinations with no success, adn found nothing on help site. Must be somehting very simple but . . . . Help much appreciated. The most flexible approach would be to use read.table to read in your csv file. Then use dbWriteTable to put the resulting data.frame object into the DB. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] listing all functions in R
Earl F. Glynn [EMAIL PROTECTED] writes: Prof Brian Ripley [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Here is a reasonable shot: findfuns - function(x) { if(require(x, character.only=TRUE)) { env - paste(package, x, sep=:) nm - ls(env, all=TRUE) nm[unlist(lapply(nm, function(n) exists(n, where=env, mode=function, inherits=FALSE)))] } else character(0) } pkgs - dir(.Library) z - lapply(pkgs, findfuns) names(z) - pkgs Any recommendations on how to trap problems with require when using findfuns? One bad package and the lapply above doesn't return anything. Are you sure you need to? I just tried your code above with: pkgs - c(Biobase, GOstats, flrblr, bazbaz) And while I see warning messages about the flrblr and bazbaz packages, the function completed and I get the expected results in z. Oh, perhaps you have some broken installs? Broken in the sense that you have a package installed but not its dependencies? How about this: safeRequire - function(x) { tryCatch(require(x, character.only=TRUE), error=function(e) FALSE) } And then replace the call to require in findfuns(). + seth __ R-help@stat.math.ethz.ch 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] [R-pkgs] RSQLite 0.4-18 sent to CRAN
A new version of RSQLite has been pushed to CRAN. In this version... * Further integration of the manifest type system available since SQLite 3. We now obtain the column type from the DB instead of pulling everything across as a character vector and calling type.convert. This should improve performance and provide a more reliable interface to build on top of. Note, however, that since type.convert is no longer called, return values will be different. In particular, text columns will come across as text, not factor. * dbWriteTable has been refactored and no longer uses temp files. This resolves performance issues and line ending quandries on Windows. * Fix for a bug in dbWriteTable when used to import text files; files lacking a trailing end of line marker can now be used. Questions? Send them to the r-sig-db mailing list. Best Wishes, + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch 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.
Re: [R] SQLite: When reading a table, a \r is padded onto the last column. Why?
Prof Brian Ripley [EMAIL PROTECTED] writes: [I am not sure who is actually maintaining RSQLite, so am Cc: both the stated maintainer and the person who prepared the package for distribution. The posting guide asked you to contact the maintainer: what response did _you_ get?] For the record, I will be (have been) taking on the maintainer role for RSQLite. The Maintainer field will be updated in the next version. As to the '\r' problem, a release candidate RSQLite 0.4-17 is available here: http://bioconductor.org/packages/misc/ This version uses prepared queries to implement dbWriteTable. This should resolve the '\r' issue on Windows and should also be considerably more efficient. Soren, can you give this one a try and let me know if it works for you? Recent work on RSQLite has focused on integrating SQLite3's type system into the interface. We now rely on the column type in the DB when retrieving results. Previously, type.convert was used. I'm fairly certain these changes will result in changes in behavior -- in most cases, I think the changes are for the better. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] package dependency tree
Matthias Kohl [EMAIL PROTECTED] writes: Hello, http://bioconductor.org/packages/1.9/bioc/html/pkgDepTools.html resp. http://bioconductor.org/packages/2.0/bioc/html/pkgDepTools.html may help you. [shameless plug] Last Month's RNews has an article that demonstrates the pkgDepTools package: [144] Seth Falcon. Modeling package dependencies using graphs. R News, 6(5):8-12, December 2006. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] biocondutor installation problem
I'm pretty sure your subject should be: Help configure R to use web proxy on RHEL4. You don't have a Bioconductor specific problem (yet). Kesavan Asaithambi [EMAIL PROTECTED] writes: source(http://www.bioconductor.org/biocLite.R;) Error in file(file, r, encoding = encoding) : unable to open connection In addition: Warning message: unable to connect to 'www.bioconductor.org' on port 80. Did you try reading the help for download.file? Start R and then do: help(download.file) + seth __ R-help@stat.math.ethz.ch 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] BioC Advanced Course Jan 10th-12th (Space Still Available)
Hello all, There is still space available for the upcoming BioC Advanced Course being held in Seattle January 10th-12th. For details and registration, please visit: https://secure.bioconductor.org/biocadv/ Best Wishes, + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] RSQLite +textConnection()
Alexander Nervedi [EMAIL PROTECTED] writes: Hi Seth, Thank you for taking the trouble to look. I have created some code that simulates the problem. SOme additional observations are: a) After giving the error Error in textConnection(readLines(f, n = 2)) : all connections are in use I cannot ask for sessionInfo(). I get the error message sessionInfo() Error in gzfile(file, rb) : all connections are in use So I am presenting the sessionInfo() output after reading in the first 124 files. sessionInfo() R version 2.4.0 (2006-10-03) i686-pc-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=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: RSQLite DBI 0.4-1 0.1-10 CRAN has RSQLite 0.4-13 and DBI 0.1-11. You are using old software. If you update, I think the problem will go away. I can run your example with N=130 without problem. Hopefully, this will be helpful in tracking down the source of the problem. # CLOSE THE CONNECTION You might want to clear the result set first: dbClearResult(query01) sqliteCloseConnection(connect); Why not: dbDisconnect(connect) + seth __ R-help@stat.math.ethz.ch 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] ANN: BioC Advanced Course, Jan 10-12 in Seattle
Hello all, We will be holding an advanced BioC course January 10th-12th in Seattle. Lectures will be based on content from _Bioinformatics and Computational Biology Solutions Using R and Bioconductor_. During the hands-on labs, attendees will learn how to use R and Bioconductor to: * perform quality assessment on microarray experiments * use Hypergeometric and GSEA tools for carrying out downstream analyses * integrate related, but different microarray experiments For more information and details on registering for this course, please visit: https://secure.bioconductor.org/biocadv/ + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ R-help@stat.math.ethz.ch 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.
Re: [R] RSQLite basic
Hi Alexander, Alexander Nervedi [EMAIL PROTECTED] writes: However, this gives all kinds of errors when I run it on a linux box and I am not sure what the error message is telling me. I thought I'd crave your indulgence and ask for advice. m - dbDriver(SQLite, max.con = 25) con - dbConnect(m, dbname=sqlite.db) Error in sqliteNewConnection(drv, ...) : RS-DBI driver: (could not connect to dbname sqlite.db ) What is your working directory when you run this command? getwd() will tell you. You should verify that you have write access there. Does sqlite.db already exist? If so, was it created with a different version of sqlite than you are running? Which brings me to: it would be helpful to see the output of sessionInfo() so we know what versions of DBI and RSQLite you are running. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] RSQLite +textConnection()
Alexander Nervedi [EMAIL PROTECTED] writes: Hi ! I am trying to read in 1000 really small text files. When on adams, R bails out after reading 125 files with the error message Error in textConnection(readLines(f, n = 2)) : all connections are in use Please try updating your version of DBI and RSQLite, I believe this has been fixed. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] RSQLite +textConnection()
Alexander Nervedi [EMAIL PROTECTED] writes: They are uptodate. When I run it on windows the i can load upto 200 files, while on Linux it stops after loading 125. Could you provide as much of a reproducible example as possible (along with sessionInfo())? I will try and have a look. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Rgraphviz -404 Page not found
j.joshua thomas [EMAIL PROTECTED] writes: Again i have problem in locating the package for clique-graphs I tried with BioConductor under Browse for packages, it doesn't work atall. Kindly guid me I think you already got an answer on the Bioconductor list: RBGL is likely the package you are looking for. __ R-help@stat.math.ethz.ch 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.
Re: [R] SNA packages/network package
Bagatti Davide wrote: Hello everyone, I am an italian student who is working with packages SNA (social network analysis) and network. I ask you if there is a simple way to write a R-script using these packages to extract from an adjacency matrix the following things: -number of cliques which are in the network; -number of k-cores (e.g. 3-cores, 4-cores); -cycles (e.g. 3-cycles, 4-cycles) -hub authorities. You might take a look at the 'graph' and 'RBGL' packages (both are Bioconductor packages). There is a graphAM class that can be initialized with an adjacency matrix. Most functions in RBGL take either any graph instance or a graphNEL. So you might have (approx. and untested): library(graph) library(RBGL) myAdjMat g1 = new(graphAM, myAdjMat) g2 = as(g1, graphNEL) ## call some RBGL function on g2 + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Forming SQL Query at run-time
Rahul Thathoo [EMAIL PROTECTED] writes: Hi. I am trying to get data from mysql database using a couple of queries. I do one query to find out the indexes. Then i need to use these indexes in another query, but i keep getting errors. Here is something: numb - dbSendQuery(con2, select distinct(comparison) from table1) count - fetch(numb, -1) my.matrix - as.matrix(count) You've selected one column, why is it a matrix? You index it as a vector, so I think you just want: count - fetch(numb, -1)[[1]] fetch returns a data.frame which for the select you gave will have one column. Extracting the column gives you the vector. rs - dbSendQuery(con2, select A.comparison,A.id, A.q_value, B.q_value from table1 as A, table1 as B where A.comparison = 'my.matrix[11481]' AND B.comparison = 250 AND A.id = B.id) As the other responder suggested, you need to create a string using paste. However, depending on how large length(count) is, you might be better off doing: where A.comparison IN ('1', '2', '3', ..., 'n') AND Which would be something like: where A.comparison in (, paste(', count, ', sep=, collapse=,), ) ... You might also see if mysql supports nested selects in which case you don't need two queries (from R) at all. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Install RMySQL with R 2.4.0
Joe W. Byers [EMAIL PROTECTED] writes: Seth Falcon wrote: Joe W. Byers [EMAIL PROTECTED] writes: I am having trouble as well with the new version of R 2.4. I downloaded the gz file from the cran website, followed the instructions in the README.win file and installed RMySQL. I have mysql installed under c:\mysql not the program files directory which is the only difference. I get the following error when I attempt to connect to the MySQL Db ## open a connection to a MySQL database con - dbConnect(dbDriver(MySQL),host='localhost', + username='',dbname = 'StorageSims'); Error in function (classes, fdef, mtable) : unable to find an inherited method for function dbConnect, for signature MySQLDriver Any help will be appreciated. I would like to note that there are no problems with RMySQL on my linux system, only on XP's. Just to make sure: Before trying the code you posted, you did library(RMySQL), right? YES Also, what versions of DBI and RMySQL are you using? RMySQL from http://cran.r-project.org/src/contrib/Descriptions/RMySQL.html DBI Version 0.1-10 according to the NEWS file in ../R/library Try updating DBI, the RMySQL on CRAN has: Depends:R (= 2.3.0), methods, DBI (= 0.1-11) __ R-help@stat.math.ethz.ch 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.
Re: [R] Install RMySQL with R 2.4.0
Joe W. Byers [EMAIL PROTECTED] writes: I am having trouble as well with the new version of R 2.4. I downloaded the gz file from the cran website, followed the instructions in the README.win file and installed RMySQL. I have mysql installed under c:\mysql not the program files directory which is the only difference. I get the following error when I attempt to connect to the MySQL Db ## open a connection to a MySQL database con - dbConnect(dbDriver(MySQL),host='localhost', + username='',dbname = 'StorageSims'); Error in function (classes, fdef, mtable) : unable to find an inherited method for function dbConnect, for signature MySQLDriver Any help will be appreciated. I would like to note that there are no problems with RMySQL on my linux system, only on XP's. Just to make sure: Before trying the code you posted, you did library(RMySQL), right? Also, what versions of DBI and RMySQL are you using? __ R-help@stat.math.ethz.ch 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.
Re: [R] accesing MySQL through JDBC
Your EPEC ICT Team - Ricardo Rodríguez [EMAIL PROTECTED] writes: Please, does R support JDBC access to MySQL databases? Could you point me in the right direction to find some documents about this issue? Have you found the RMySQL package? It allows you to talk to MySQL databases from R. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] 'weaver' package problem
Hi Michael, Michael Kubovy [EMAIL PROTECTED] writes: Hi Seth, The possibility of caching computations would be a great boon when one is iteratively refining a paper; so I'm most grateful for your work on this. Unfortunately I have a problem to report: **testing Sweave** testfile - system.file(Sweave, Sweave-test-1.Rnw, package = utils) **testing weaver** weaver(testfile) Error in weaver(testfile) : unused argument(s) (/Library/Frameworks/ R.framework/Resources/library/utils/Sweave/Sweave-test-1.Rnw) Actually, you want: Sweave(testfile, driver=weaver()) I will add something to the man page for weaver to make this more clear. You might want to have a look at the vignette included with the package: library(Biobase) library(weaver) openVignette(weaver) + seth __ R-help@stat.math.ethz.ch 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] [R-pkgs] DBI, RMySQL, RSQLite updated
Hello all, Just uploaded to CRAN updates for RSQLite, RMySQL, and DBI. The primary svn repository for these packages is now hosted by the Gentleman Lab in Seattle and our group is working with David James to help with maintenance. Details on the updates are below. RMySQL_0.5-9.tar.gz * Fixed unclosed textConnections RSQLite_0.4-4.tar.gz * Upgraded to SQLite 3.3.7 * Default when building from source is now to compile the included version of SQLite and link to it statically * Fixed unclosed textConnections DBI_0.1-11.tar.gz * Minor updates in package structure (no feature changes). Best Wishes, + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch 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.
Re: [R] Block comments in R?
Uwe Ligges [EMAIL PROTECTED] writes: Use an editor that comments out a whole block which is what I do all the time, e.g. use Tinn-R, Emacs or WinEdt, to mention just a few of them. This, of course, works. The if(FALSE) approach does not because it requires the comment to be syntactically correct. The multiline string trick is _almost_ there, the problem is that both and ' are fairly common in text and having to escape that is a pain. My wtf feature request is to add a multiline string delimiter ala Python like . 8-P + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] New project: littler for GNU R
Jeffrey Horner [EMAIL PROTECTED] writes: Seth Falcon wrote: Wow, looks neat. OS X users will be unhappy with your naming choice as the default filesystem there is not case-sensitive :-( IOW, r and R do the same thing. I would expect it to otherwise work on OS X so a change of some sort might be worthwhile. (I'm always amazed at how I can miss the simplest details. I probably knew at some point that OS X shipped with a case-sensitive file system, which you can turn off somehow, but forgot. Thank goodness for peer review.) littler will install into /usr/local/bin by default, so I don't think there's a clash with the Mac binary provided by CRAN, right? It depends what you mean by clash :-) If both are on the PATH, then you get the first one, I suspect, when running either 'R' or 'r'. I haven't tested this bit yet, but on my OS X laptop I can invoke a new R session using either 'R' or 'r' (using an R built from source, not the R GUI app thingie). So IMO, a different name or an integration into the R script in some way would be a big improvement. 'r' is cute, but going down the road of tools with the same name except for caps leads to confusion (for me). For example, R CMD build/INSTALL still catches me up after a number of years. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] New project: littler for GNU R
Wow, looks neat. OS X users will be unhappy with your naming choice as the default filesystem there is not case-sensitive :-( IOW, r and R do the same thing. I would expect it to otherwise work on OS X so a change of some sort might be worthwhile. + seth __ R-help@stat.math.ethz.ch 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] ANN: R/BioC Intro Course Oct 9th-11th in Seattle
Hello all, We will be holding an R/BioC intro course in Seattle. The dates are October 9th-11th. For more information, please visit: https://secure.bioconductor.org/biocintro/ Best Wishes, + seth PS: At the moment we are using a self-signed SSL certificate (this is just as secure encryption-wise, but you have to trust you are getting to the right site). You can verify the fingerprint by asking your browser to show you details about the certificate. MD5: C8 62 A0 E1 55 0F 9F 46 FE 9B 7C B8 53 49 5D D5 SHA1: 61 6D 13 72 FD 12 91 B3 F7 9F DC EB 9F 38 D1 95 E0 DB 7F 25 __ R-help@stat.math.ethz.ch 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.
Re: [R] AffyChip Background Analysis
Gunther Höning [EMAIL PROTECTED] writes: Dear list, I want to analyse some HG133Plus2.0 Affymetrix chips. The first thing I intent to do, is just to perform a background correction (mas, rma, gcrma,...) with the cel files. Then I want to take a look at the files. How can I do this ? You might want to take a look at some of the packages in the Bioconductor project. Here is a link to the BioC packages that deal with visualization: http://www.bioconductor.org/packages/release/Visualization.html + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Bioconductor installation errors
Ge, Weigong* [EMAIL PROTECTED] writes: Hello, I follow the Bioconductor instruction (http://www.bioconductor.org/download http://www.bioconductor.org/download ) to install Biocoductor, there have some errors: Please post questions about Bioconductor to the bioconductor mailing list: http://www.bioconductor.org/docs/mailList.html /usr/lib/R/bin/SHLIB: line 115: make: command not found Your system (Linux?) is missing very basic development tools. It seems you have no make program installed. Such a program, among many others, is required to build R packages from source. Try to install system packages for software development (C complier, etc). + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Rgraphviz - neato layout - edge weights do not have an effect
Hi Franz, This might be better directed to the bioconductor mail list. Franz Quehenberger [EMAIL PROTECTED] writes: Dear all, neato makes layouts according to a physical model in which the length of the edges is determined by springs. The weight of the edge is the strength of the spring. However, I was not able to find any influence of edge weight on the layout. In the http://www.graphviz.org/Documentation/neatoguide.pdf the attribute len is another parameter of the neato layout. set.seed(31) V=letters[1:5] g2=randomEGraph(V,0.5) plot(g2,neato,main=All weights 1) # change and edge weight edgeData(g2, from = d, to = e, attr = weight) - 20 plot(g2,neato,main=Nothing changed!) #try out length attribute change edgeDataDefaults(g2,len)=1 edgeData(g2, from = d, to = e, attr = len) - 5 plot(g2,neato,main=Nothing changed again!) Has anyone an idea how to achieve a change in the graph layout ? Have you read through the Rgraphviz vignettes? Rgraphviz currently ignores attributes of the graph. This is currently by design: display attributes are Rgraphviz's business. There are ways to specify node and edge attributes for Rgraphviz, but I'm not sure if the feature you want is implemented. + seth __ R-help@stat.math.ethz.ch 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] [R-pkgs] ANN: 'weaver' package, caching for Sweave
Hi all, I've added a new package 'weaver' to the BioC repository: http://www.bioconductor.org/packages/1.9/bioc/html/weaver.html The weaver package provides extensions to the Sweave utilities included in R's base package. The focus of the extensions is on caching computationally expensive (time consuming) code chunks in Sweave documents. Why would you want to cache code chunks? If your Sweave document includes one or more code chunks that take a long time to compute, you may find it frustrating to make small changes to the document. Each run requires recomputing the expensive code chunks. If these chunks aren't changing, you can benefit from the caching provided by weaver. To install: source(http://bioconductor.org/biocLite.R;) biocLite(weaver) If you give it a try and have any feedback, drop me a note. Best Wishes, + seth ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch 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.
Re: [R] [R-pkgs] ANN: 'weaver' package, caching for Sweave
Hi again, Sorry for the noise, but I need to make a correction: Seth Falcon [EMAIL PROTECTED] writes: To install: source(http://bioconductor.org/biocLite.R;) biocLite(weaver) At present, the above install sequence will _only_ work if you are using a development version of R. If you are using the current R release, you will have to work a bit harder to install (put weaver works there too): First install weaver's dependencies: digest (on CRAN) codetools: http://bioconductor.org/packages/1.9/omegahat/html/codetools.html Then install weaver: http://www.bioconductor.org/packages/1.9/bioc/html/weaver.html Finally, I will try to make Windows binaries available by the end of the week. + seth ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch 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.
Re: [R] Rgraphviz installation Problem
j.joshua thomas [EMAIL PROTECTED] writes: Dear Robert, Thanks for your time. I have downloaded Rgraphviz (windows binary) from www.bioconductor.org and put inside R2.3.0 library then i installed from the local zip its says package 'graph' couldnot be loaded. Am i doing the installation correctly? Still the new user. Can you guide me sir? Questions about BioC packages are best directed to the bioconductor mailing list. I would recommend trying: source(http://bioconductor.org/biocLite.R;) biocLite(Rgraphviz) Best, + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Running out of memory when using lapply
Hi Kamila, Kamila Naxerova [EMAIL PROTECTED] writes: Hi all! I'm afraid I programmed something totally non-sensical and inefficient, but I can't figure out how to do it better. I have a list of ~ 40 000 characters. I want to take each element at a time, map it to a large data frame with hit=which(data.frame$column==elementFromList), then compute some statistic on data.frame[hit,] and return a result that consists of either 1) a list of integers or 2) a character. res=lapply(listof4,myfunction,dataframeToSearchIn) On a small scale, this works and returns something like str(res) [[1]] [1] UNIQUE [[2]] [1] 405 406 407 16351 [[3]] [1] REMOVE [[4]] [1] REMOVE If I try this with the entire 40 000 character list, though, I get the Reached total allocation of 1022Mb: see help(memory.size) error message. Can someone please give me a hint how to solve this problem correctly? THANKS! One thing you might try is not running the entire 40K list at once. Perhaps try breaking it into 4 10K lists, running each, and combining the results. This may get you around the allocation problem. Another thing would be to find a system with more RAM (also read the FAQ regarding ways to make the most amount of RAM available to R on Windows, is that where you are?). + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] invisible() - does not return immediately as return() does
Matthias Burger [EMAIL PROTECTED] writes: Hi, I stumbled across the following (unexpected for me) behavior after replacing a return() statement in the middle of a function by invisible(). Example: foo - function() { cat(before\n); return(); cat(after\n)} foo() before NULL foo2 - function() { cat(before\n); invisible(TRUE); cat(after\n)} foo2() before after I expected invisible to have the same behavior as return, namely immediately return execution to the calling environment. I rechecked ?invisible and ?return and here I read in section 'See Also' [...] 'invisible' for 'return(.)'ing _invisibly_. Do I just misunderstand what this implies? Put another way what is the intention behind invisible() continuing until the last statement before returning? ?invisible does not hint at this. I can understand the confusion, but I think invisible is intended to return its argument invisibly and actually has nothing to do with returning from a function (except that is where you are going to use it almost always ;-). So you want return(invisible(foo)) in the middle of a function. The man page for invisible says: Return a (temporarily) invisible copy of an object. But the man page for return has the return(.)'ing _invisibly_ statement which I think is confusing. Cheers, + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] RCurl
Rajarshi Guha [EMAIL PROTECTED] writes: Hi, does anybody know where I might the RCurl package - the omegahat.org server seems to be down The Bioconductor project hosts a mirror of a subset of Omegahat packages (RCurl is included). You can find the listing here: http://www.bioconductor.org/packages/release/omegahat/ There is a browsable HTML package listing at the above URL which is also a valid CRAN-style package repository. So, for example, you should be able to do: install.packages(RCurl, repos=http://www.bioconductor.org/packages/release/omegahat/;, dependencies=TRUE) + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Drosophila Genome 2.0 annaffy annotation
Hi Marco, I'm pretty sure you want to resend your question to the Bioconductor mailing list. AFAICT your question is rather BioC specific and you will likely get a more helpful response there. + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] cluster analysis of microarray data
Mahdi Osman [EMAIL PROTECTED] writes: Hi list, I am interested in cluster analysis of microarray data. The data was generated using cDNA method and a loop design. I was wondering if any one has a suggestion about which package I can use to analyse such data. There are many packages within the Bioconductor project that provide tools for analysis of microarray data. I would start by taking a look at the Microarray and TwoChannel BiocViews: http://bioconductor.org/packages/1.8/Microarray.html http://bioconductor.org/packages/1.8/TwoChannel.html + seth __ R-help@stat.math.ethz.ch 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.
Re: [R] Rgraphviz: Setting the edge width
Søren Højsgaard [EMAIL PROTECTED] writes: I create an undirected graph with Rgraphviz (see code below). I would like to make the edges thicker. Can anyone help on this?? Questions on Rgraphviz are best directed to the bioconductor mail list. I think you already discovered that, but for the archives... As to your question, adjusting edge display options such as width and style is not supported in the current release, but is supported in the current development version of Rgraphviz. + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Installing bioconductor
Hi Kristine, Kristine Kleivi [EMAIL PROTECTED] writes: I been trying to install bioconducter into R using the script on the bioconductor home page. However, I get this error message: source(http://www.bioconductor.org/biocLite.R;) Error in file(file, r, encoding = encoding) : unable to open connection In addition: Warning message: unable to connect to 'www.bioconductor.org' on port 80. Bioconductor has its own mailing lists and issues with BioC installation, etc are best directed there. (http://www.bioconductor.org/docs/mailList.html) It is maybe due to security systems at my computer that I cannot go through this port? Does anyone know how I can change the port in R, so I can install the pakages from the bioconductor home page through another port? Most likely, your access to the internet is via a web proxy. Try reading the help page for download.packages, there are details there on how to configure R to connect to the internet via a web proxy. + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] BioC2006 Conference, Aug 3-4 in Seattle
Early registration ends July 1 BioC2006August 3-4 in Seattle, WA, USA http://bioconductor.org/BioC2006/ About BioC2006: This conference highlights developments within and beyond Bioconductor and provides a forum to discuss the use and design of software for analyzing data arising in biology. Format: * Scientific talks on both days from 8:30-12:00 * Hands-on lab sessions on both afternoons 2:00-5:00 Find out who is speaking and more by visiting the website: http://bioconductor.org/BioC2006/ (You will be redirected to our secure server: https://cobra.fhcrc.org/BioC2006/) Best Wishes, + seth PS: There will also be a developer focused meeting the day before the conference, August 2nd. For details, please see: http://wiki.fhcrc.org/bioc/BioC2006/DeveloperDay __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] apologies if you aready received this ?
[EMAIL PROTECTED] writes: Basically, I wrote a function called wait() wait-function() { cat(press return to continue) unix(read stuff) } Is readline what you want? See help(readline). __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Building packages in R - 'private' functions
Antonio, Fabio Di Narzo [EMAIL PROTECTED] writes: 1. If you have time to change internal functions naming, you can rename internal functions by putting a leading '.'. Even without namespace, I have noticed there is no check for corresponding docs for such functions. 2. If you don't want to rename all internal functions, the best way is writing an 'internals.Rd' file with an alias for each internal function (documented in 'writing R extensions'). 3.Finally, you can add a NAMESPACE (see writing R extensions). However, if you use S3/S4 classes, this can be much more tedious to do. I think the no. 2 to be the fastest/safer way. I think adding a NAMESPACE file is the best solution and I don't think that the process needs to be particularly tedious. Having a naming convention for private functions is fine and you can still do that with a NAMESPACE. Non-exported functions do not get checked for documentation, so there is no need for an internals.Rd (of course, it doesn't hurt to give yourself some documentation for when you return to the project 3 months later :-) Besides hiding your private functions, a NAMESPACE protects you from users or other packages redefining functions that you rely on. As an extreme example, if a user redefined length(), many packages without namespaces would break. + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] vague errors on R CMD check for very minimal S4-style package
Roels, Steven [EMAIL PROTECTED] writes: Hello, I have a very minimal package simplepkg (DESCRIPTION, NAMESPACE, and R) with S4 classes/methods (defines a class foo and a show method for that class - both the class and show method are exported). I can seemingly install the package, then load and use it: Error: package/namespace load failed for 'simplepkg' Call sequence: 2: stop(gettextf(package/namespace load failed for '%s', libraryPkgName(package)), call. = FALSE, domain = NA) 1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) Execution halted Here are the file contents: --- sun890% cat DESCRIPTION Package: simplepkg Type: Package Title: Does stuff Version: 0.1-1 Date: 2006-06-06 Author: Me Maintainer: Also Me [EMAIL PROTECTED] Description: Does interesting stuff License: GPL Try adding LazyLoad: yes to DESCRIPTION (or SaveImage: yes). __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Install R problem
Pramod Anugu [EMAIL PROTECTED] writes: I have copied R-2.3.0.tar.gx and uncompressed the directory R-2.3.0 is created. ./configure Make Typed R in the directory /root/downloads/R-2.3.0/bin/exec -bash-2.05b# pwd /root/downloads/R-2.3.0/bin/exec -bash-2.05b# R Fatal error: R home directory is not defined Try: .../R-2.3.0/bin/R Or consider make install. + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Too many open files
Omar Lakkis [EMAIL PROTECTED] writes: This may be more of an OS question ... I have this call r = get.hist.quote(symbol, start= format(start, %Y-%m-%d), end= format(end, %Y-%m-%d)) which does a url request in a loop and my program runs out of file handlers after few hundred rotations. The error message is: 'Too many open files'. Other than increasing the file handlers assigned to my process, is there a way to cleanly release and reuse these connections? Inside your loop you need to close the connection object created by url(). for (i in 1:500) { con - url(urls[i]) ## ... stuff here ... close(con) } R only allows you to have a fixed number of open connections at one time, and they do not get closed automatically when they go out of scope. These commands may help make clear how things work... showConnections() description class mode text isopen can read can write f = url(http://www.r-project.org;, open=r) showConnections() descriptionclass mode text isopen can read can write 3 http://www.r-project.org; url r text opened yesno rm(f) showConnections() descriptionclass mode text isopen can read can write 3 http://www.r-project.org; url r text opened yesno f - getConnection(3) close(f) f Error in summary.connection(x) : invalid connection showConnections() description class mode text isopen can read can write + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Manipulating code?
Johannes Hüsing [EMAIL PROTECTED] writes: Dear expeRts, I am currently struggling with the problem of finding cut points for a set of stimulus variables. I would like to obtain cut points iteratively for each variable by re-applying a dichotomised variable in the model and then recalculate it. I planned to have fixed names for the dichotomised variables so I could use the same syntax for every recalculation of the whole model. I furthermore want to reiterate the process until no cut point changes any more. My problem is in accomplishing this syntactically. How can I pass a variable name to a function without getting lost in as.symbol and eval and parse mayhem? I am feeling I am thinking too much in macro expansion à la SAS when trying to tackle this. I think a simple example of what you are trying to do might be needed. But take a look at the help pages for assign() and get(). These functions make it easy to go from string containing name of variable to the actual variable, etc. + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] RMySQL on Mac OS 10.4
Ryan Hafen [EMAIL PROTECTED] writes: dbWriteTable(con, test, rnorm(100)) Error in .class1(object) : no direct or inherited method for function 'dbWriteTable' for this call For more info, I am running OS X 10.4.6, R 2.2.1, I have compiled RMySQL from source version 0.5-7, and I'm running MySQL 4.1.19. I have no idea what this error means and I have not found anything about it anywhere else in the help files. If anyone knows what I can do to fix this, I would really really appreciate it. I think this just means that dbWriteTable doesn't know how to write vectors, it knows how to write data frames (according to the man page). So you could test: dbWriteTable(con, test, data.frame(rng=rnorm(100))) + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to a handle an error in a loop
Farrel Buchinsky [EMAIL PROTECTED] writes: No heaven on earth yet. how would I incorporate this kind of functionality into Resultdt-lapply(PGWide[,240:389], tdt) If you want to do more than one thing, you want to create an anonymous function. Here's an example: d - runif(20, min=-2, max=8) # test data aFunc - function(x) { # gives error occasionally if (x 0) x else stop(encountered bad x) } result - lapply(d, function(z) { ans - tryCatch(aFunc(z), error=function(e) NULL) ans }) result - result[!sapply(result, is.null)] Along these lines, here's a helper function that behaves similarly to lapply, but by default _ignores errors_ and returns a vector of _only_ the good values. WARNING: lightly tested, may not be useful, doesn't behave exactly like lapply, money back only if unopened. collect - function(x, FUN, skip_error=TRUE, args_list=NULL) { if (!is.vector(x)) stop(arg x must be a vector) fname - deparse(substitute(FUN)) xvar - deparse(substitute(x)) i - 1 j - 1 result - vector(mode=mode(x), length=length(x)) while (i = length(x)) { tryCatch({ args - list(x[i]) if (length(args_list)) args - c(args, args_list) ans - do.call(FUN, args) result[j] - ans j - j + 1 }, error=function(e) { if (!skip_error) { msg - paste(collect\n, call to, fname, failed at, paste(xvar, [, i, ]\n, sep=), Message:\n, conditionMessage(e)) stop(msg, call.=FALSE) } NULL }, finally={i - i + 1}) } if (j 1) result[1:(j-1)] else vector(mode=mode(x), length=0) } ## Example collect(d, aFunc, skip_error=FALSE) Error: collect call to aFunc failed at d[2] Message: encountered bad x collect(d, aFunc, skip_error=TRUE) [1] 7.7380303 0.7554328 1.8352623 0.5136118 4.4231091 2.5368103 1.8656615 [8] 2.9244200 2.1364120 7.6711189 0.2141325 7.8216620 5.8347576 5.3939892 Cheers, + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] accessing a SOAP based web service from R
Rajarshi Guha [EMAIL PROTECTED] writes: Hi, I have a number of web services that run on a server and can be accessed via SOAP as well as by creating a specific URL. Now, for certain services, the argument that I need to send is about 10 to 20 characters and the URL approach works fine. However if the argument is a few kilobytes I would rather create a SOAP packet and send that off. So my first question is: is there a package that can create SOAP packets and communicate with a web service via SOAP? SSOAP http://www.omegahat.org/SSOAP/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] programming advice?
Charles Annis, P.E. [EMAIL PROTECTED] writes: Dear R-helpers: I am doing some exploratory programming and am considering a routine that has several other routines defined within it, so that I can avoid a large and messy global re-programming to avoid naming conflicts. My question is this: Because it is interpreted, does R have to re-build these internal routines every time the new routine is called? If you mean: f - function(x) { f1 - function(y) {...} f2 - function(y) {...} f3 - function(y) {...} f1(x) + f2(x) + f3(x) } Then, yes, as I understand it, each call to f() will include the overhead of defining functions f1, f2, and f3. In most cases, I would expect this overhead to be quite small in relation to the actual computations you are doing. You can probably use Rprof() to confirm this. You can also look at local() which I think provides a similar local namespace, but would not require redefinition of the helper functions. Here is a small example: f - local({ f1 - function(y) 2*y f2 - function(y) y + 10 function(x) { f1(x) + f2(x) } }) + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] suppressing output
Florian Koller [EMAIL PROTECTED] writes: Dear all, I am using the multinom() function from the nnet library within my own code and I want to suppress multinom's output (#weights, iter 10, 20...). My code generates output too, and I don't want it to be mixed with the output messages the multinom function generates. Is there a way to temporarily suppress this output? Try setting trace=FALSE in the call to nnet. + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] load file RData which store in zip file
Prof Brian Ripley [EMAIL PROTECTED] writes: [As an aside, I wonder whether compress=TRUE should not be the default for binary save/save.image. It adds little time and may save a lot of disc space.] Here's one user who thinks that is a great idea. I often have to remind developers who contribute packages to Bioconductor to use the compress=TRUE option to save(). I think it is a sensible default. + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Help understanding behavior of apply vs sapply
Hi, I was surprised that apply and sapply don't return the same results in the example below. Can someone tell me what I'm missing? zls - function(x) character(0) m - matrix(0, nrow=2, ncol=2) apply(m, 1, zls) character(0) sapply(m, zls) [[1]] character(0) [[2]] character(0) [[3]] character(0) [[4]] character(0) R.version _ platform powerpc-apple-darwin8.5.0 arch powerpc os darwin8.5.0 system powerpc, darwin8.5.0 status alpha major 2 minor 3.0 year 2006 month 03 day27 svn rev37590 language R version.string Version 2.3.0 alpha (2006-03-27 r37590) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] setting argument defaults in setMethod
Steven Lacey [EMAIL PROTECTED] writes: I want to set a default value in a method of a generic function. This seems as though it should be possible. From R help on setMethod... So, I try this... setGeneric(test,function(x,y){standardGeneric(test)}) setMethod(test,numeric, function(x,y=FALSE){ browser() } ) I think you have to actually specify a default value in the definition of the generic (I don't claim this makes any sense). That value won't get used as long as you specify a default in the method. setGeneric(foo, function(x, y=1) standardGeneric(foo)) setMethod(foo, signature(x=character), function(x, y=world) cat(x, y, \n)) foo(hello) setMethod(foo, signature(x=character), function(x, y) cat(x, y, \n)) foo(hello) + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] installation problem with Biobase
Haleh, This question would be better asked on the Bioconductor mailing list. You haven't told us what version of R you are using. I suspect you have a version mismatch. With R 2.2.x you should be able to do the following to get MergeMaid installed: From the R prompt do: source(http://bioconductor.org/biocLite.R;) biocLite(MergeMaid) And if you have further questions, please review the posting guide__ and then send a msg to the bioc list! __ http://www.bioconductor.org/docs/postingGuide.html Best, + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lapply and list attributes
Hi, michael watson (IAH-C) [EMAIL PROTECTED] writes: I have a list that has attributes: attributes(lis[2]) $names [1] 150096_at I want to use those attributes in a function and then use lapply to apply that function to every element of the list, eg for simplicity's sake: my.fun - function(x) { attributes(x) } This gets tricky. You said the right thing: you have a _list_ with attributes. This does not mean the elements of the list have attributes (unless they happen to). It seems that attributes(x) within the function is not the same as eg. attributes(lis[2]) used outside of the function, ie the attributes have changed. [ on a list returns a sublist (with names copied over). The lapply function is equivalent to accessing elements via [[ which pulls out a single element (no names). For the specific case of processing a list with names, you may want: for (name in names(x)) { el - x[[name]] ... } You could also try mapply. + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html