Re: [R] Sparse (dgCMatrix) Matrix row-wise normalization

2017-05-04 Thread Murat Tasan
gt; > > On 4 May 2017, at 20:13, Murat Tasan <mmu...@gmail.com> wrote: > > > > The only semi-efficient method I've found around this is to `apply` > across > > rows (more accurately through blocks of rows coerced into dense > > sub-matrices of P), but I'

[R] Sparse (dgCMatrix) Matrix row-wise normalization

2017-05-04 Thread Murat Tasan
Hi all --- I have a large sparse matrix, call it P: ``` > str(P) Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:7868093] 4221 6098 8780 10313 11102 14243 20570 22145 24468 24977 ... ..@ p : int [1:7357] 0 0 269 388 692 2434 3662 4179 4205 4256 ...

[R] RPostgreSQL (or even ANSI DBI) parameterized query with IN (...)

2015-12-04 Thread Murat Tasan
Using PostgreSQL's parameterized query form, this works: R> dbSendQuery(CONN, "SELECT * FROM foo WHERE val = $1 OR val = $2", list("bar", "baz")) ... and becomes: SELECT * FROM foo WHERE val = 'bar' OR val = 'baz'; I cannot figure out, however, if something like this is possible with

Re: [R] system.file(...) self-referencing the containing package

2015-12-04 Thread Murat Tasan
ter it is installed, a character object > called ".packageName" containing its name. It is not exported from > the package. Functions in your package can refer to it as just > .packageName. > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > > On Thu, Dec

[R] system.file(...) self-referencing the containing package

2015-12-03 Thread Murat Tasan
In a package I'm writing, I'm placing all SQL code here: /inst/sql/ And so when referring to these blocks of code from the package's R code, I do something like so: system.file("sql", "my_example_file.sql", package = "ThisPackage", mustWork = TRUE) But, referring to the package itself with the

[R] hash::hash(...) assignment clearing

2015-06-16 Thread Murat Tasan
The hash package implements hashmaps which must be cleared prior to removal to free memory, e.g.: x - hash(some_long_list_of_keys_and_values_here) clear(x) rm(x) I first assumed this held for re-assignment, too... e.g. one should: x - hash(some_long_list_of_keys_and_values_here) clear(x)

[R] subset drops S3 classes?

2014-11-12 Thread Murat Tasan
Hi all --- I've stumbled upon some pretty annoying behavior, and I'm curious how others may have gotten around it. When using subset(...) on a data frame that contains a custom S3 field, the class is dropped in the result: MyClass - function(x) structure(x, class = MyClass) df - data.frame(x =

Re: [R] subset drops S3 classes?

2014-11-12 Thread Murat Tasan
:02 PM, Murat Tasan mmu...@gmail.com wrote: Hi all --- I've stumbled upon some pretty annoying behavior, and I'm curious how others may have gotten around it. When using subset(...) on a data frame that contains a custom S3 field, the class is dropped in the result: MyClass - function(x

Re: [R] subset drops S3 classes?

2014-11-12 Thread Murat Tasan
... nd nevermind, figured it out (from the final example on the Extract.data.frame page): `[.MyClass` - function(x, i, ...) { NextMethod([) mostattributes(RV) - attribute(x) RV } cheers, -m On Wed, Nov 12, 2014 at 11:02 PM, Murat Tasan mmu...@gmail.com wrote: And as a follow

Re: [R] par(plt) behaving inconsistely? bug?

2014-10-12 Thread Murat Tasan
for the flexible creation of multiple regions, depending on what you want to draw in each of those regions. Paul On 10/07/14 15:33, Murat Tasan wrote: 6. iteratively downgrade to earlier versions of R until it's working again... then try to diff out the offending source code change. i can try

Re: [R] par(plt) behaving inconsistely? bug?

2014-10-07 Thread Murat Tasan
coordinates) to manually set the clipping region 6 other? On Mon, Oct 6, 2014 at 12:00 PM, Murat Tasan mmu...@gmail.com wrote: Hi all -- I just encountered a behavior that I believe has changed from previous versions, though I haven't chased back the last version that behaves as my existing code

[R] par(plt) behaving inconsistely? bug?

2014-10-06 Thread Murat Tasan
Hi all -- I just encountered a behavior that I believe has changed from previous versions, though I haven't chased back the last version that behaves as my existing code expects quite yet. Perhaps this is a bug, though perhaps I'm missing a subtle detail somewhere in the documentation... Here's

Re: [R] par(plt) behaving inconsistely? bug?

2014-10-06 Thread Murat Tasan
Another (easier) kludge is augmenting a call to each par(plt = ...) call: par(plt = some_plt_coordinates); box(lty = 0) The box(lty = 0) addition makes downstream calls work as expected, but yeah... this is a kuldge. -m On Mon, Oct 6, 2014 at 12:00 PM, Murat Tasan mmu...@gmail.com wrote: Hi

Re: [R] pROC plot.roc - Plotting more than two curves - Is it possible

2013-12-04 Thread Murat Tasan
have you looked at the ROCR package? there are at least a few ways to plot multiple ROC curves with the ROCR functions that come to mind. e.g. if you pass lists of 'scores' and 'labels' in to the prediction(...) method, the default plot(...) method will display all of the ROC (or precision-recall,

[R] predict.glm with constant non-zero response intercept

2013-08-26 Thread Murat Tasan
hi all -- i'm running into a strange problem that i can't seem to easily get around, but i'm probably just missing something obvious. i have a model to which some data is fit using glm with no intercept term (using my data variables x and y and a specific link function mylink):

[R] plyr _aply simplifying return-value dimensions

2013-06-04 Thread Murat Tasan
hi all -- let's say i have the following simplified plyr code: factor_table - data.frame(dim1 = 1:10, dim2 = 1:4) foo - maply(factor_table, function(dim1, dim2) list(a = foo, b = runif(10))) foo will now be a 10 x 4 x 2 array (of mode 'list'), and i'll have to access a b element like so:

[R] cut.dendrogram bug?

2013-05-11 Thread Murat Tasan
hi all -- i don't know if this is a bug or not, thought i would survey the crowd before trying to submit a report... if i specify a cut height for a dendrogram that is higher than the full dendrogram itself, my expectation is that the $upper value would be NULL or NA, and the $lower value would

[R] helper function to pluck dendrogram attributes

2013-05-10 Thread Murat Tasan
hi all -- i've written a series of procedures to annotate nodes in a dendrogram object. i'd like to be able to easily pluck out some of these attributes and view them in tree form. in a regular list, i'd do something like: sapply(my_list, function(x) x$my_entry) and in a dendrogram, i can use

Re: [R] attr vs attributes

2013-05-10 Thread Murat Tasan
attributes(x) - temp and there are a lot of wasted operations there.) Duncan Murdoch Hope this helps, Rui Barradas Em 09-05-2013 18:35, Murat Tasan escreveu: hi all -- i looked through the R Language Definition document, but couldn't find any particular warning or example that would

Re: [R] attr vs attributes

2013-05-10 Thread Murat Tasan
-project.org] On Behalf Of Murat Tasan Sent: Friday, May 10, 2013 8:16 AM To: Duncan Murdoch Cc: r-help@r-project.org Subject: Re: [R] attr vs attributes thanks, both. the only real difference between the two approaches that i can see is when assigning _new_ attributes to an object

[R] attr vs attributes

2013-05-09 Thread Murat Tasan
hi all -- i looked through the R Language Definition document, but couldn't find any particular warning or example that would clarify the best use of attribute setting for R objects. let x be some R object, and i'd like to add attribute foo with value bar. case 1: attr(x, foo) - bar case 2:

Re: [R] list of matrices -- array

2013-02-17 Thread Murat Tasan
, Murat Tasan wrote: i'm somehow embarrassed to even ask this, but is there any built-in method for doing this: my_list - list() my_list[[1]] - matrix(1:20, ncol = 5) my_list[[2]] - matrix(20:1, ncol = 5) now, knowing that these matrices are identical in dimension, i'd like to unfold the list

[R] list of matrices -- array

2013-02-13 Thread Murat Tasan
i'm somehow embarrassed to even ask this, but is there any built-in method for doing this: my_list - list() my_list[[1]] - matrix(1:20, ncol = 5) my_list[[2]] - matrix(20:1, ncol = 5) now, knowing that these matrices are identical in dimension, i'd like to unfold the list to a 2x4x5 (or some

Re: [R] list of matrices -- array

2013-02-13 Thread Murat Tasan
FYI - this is my current method, but somehow i just don't like it ;-) foo - array(NA, dim = c(4,5,length(my_list))) for(k in 1:length(my_list)) { foo[,,k] - my_list[[k]] } -m On Thu, Feb 14, 2013 at 1:03 AM, Murat Tasan mmu...@gmail.com wrote: i'm somehow embarrassed to even ask

Re: [R] user units in plotrix

2013-01-22 Thread Murat Tasan
. On Sun, Jan 20, 2013 at 2:59 PM, Murat Tasan mmu...@gmail.com wrote: hi all - i'm having some difficulty figuring out how to convert between user units (which i can't find a definition for in the plotrix package) and either (a) device units (e.g. inches with PDFs) or (b) user coordinates along any

[R] user units in plotrix

2013-01-20 Thread Murat Tasan
hi all - i'm having some difficulty figuring out how to convert between user units (which i can't find a definition for in the plotrix package) and either (a) device units (e.g. inches with PDFs) or (b) user coordinates along any particular axis. as an example, suppose i set up a PDF device with

[R] vectorized plotmath expressions via substitute()

2012-11-14 Thread Murat Tasan
hi all - i've seen versions of this question before, but none seem to get directly at my solving my (probably very simple) issue: i simply want to annotate the tick marks on an axis with (superscripted) 10^x notation, and tried this: axis(1, at = axTicks(1), as.expression(substitute(10^foo,

Re: [R] vectorized plotmath expressions via substitute()

2012-11-14 Thread Murat Tasan
- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Murat Tasan Sent: Wednesday, November 14, 2012 9:06 AM To: r-help@r-project.org Subject: [R] vectorized plotmath expressions via substitute() hi all - i've seen versions of this question before

[R] bootstrap vignette construction and package installation

2011-05-03 Thread Murat Tasan
hi all - i'm trying to 'R CMD build' a package, but i have what appears to be a bootstrapping problem: i've included a vignette in my package, with R code interwoven (and built using Sweave), but in this documentation i have a code line: library(MyPackage) now, when trying to build a .tar.gz

[R] source package build/installation with subdirectory-lib

2010-10-04 Thread Murat Tasan
hi all - i have a source package i'm writing that i'd like to be able to install with a special library that my R src files rely on. to be more precise, i have a normal R package directory structure (i.e. src/ R/ man/ DESCRIPTION NAMESPACE etc.). i also have another directory here called depPkg,

Re: [R] source package build/installation with subdirectory-lib

2010-10-04 Thread Murat Tasan
files). am i completely off here in my usage of Makevars? thanks! -murat On Oct 4, 4:52 pm, Murat Tasan mmu...@gmail.com wrote: hi all - i have a source package i'm writing that i'd like to be able to install with a special library that my R src files rely on. to be more precise, i have a normal

Re: [R] source package build/installation with subdirectory-lib

2010-10-04 Thread Murat Tasan
so i've narrowed it down to a case that works, and one that doesn't (but i think should?) here's the working Makevars file (copied directly): -- WORKING EXAMPLE JANSSON_DIR = $(PWD)/jansson-1.3 JANSSON_LIB_DIR = $(PWD)/jansson-1.3/lib JANSSON_INCLUDE_DIR

[R] specifying an unbalanced mixed-effects model for anova

2010-07-27 Thread Murat Tasan
hi all - i'm having trouble using lme to specify a mixed effects model. i'm pretty sure this is quite easy for the experienced anova-er, which i unfortunately am not. i have a data frame with the following columns: col 1 : Score1 (this is a continuous numeric measure between 0 and 1) col 2 :

Re: [R] specifying an unbalanced mixed-effects model for anova

2010-07-27 Thread Murat Tasan
to understand the concepts of mixed effects models, so just walking you through a lme model specification is not likely to help. Bert Gunter On Tue, Jul 27, 2010 at 8:24 PM, Murat Tasan mmu...@gmail.com wrote: hi all - i'm having trouble using lme to specify a mixed effects model. i'm

[R] aggregate(...) with multiple functions

2010-07-15 Thread Murat Tasan
hi all - i'm just wondering what sort of code people write to essentially performa an aggregate call, but with different functions being applied to the various columns. for example, if i have a data frame x and would like to marginalize by a factor f for the rows, but apply mean() to col1 and

[R] difficulty with R expressions in text/legend

2010-07-10 Thread Murat Tasan
hi, i'm trying to prepend some plain (i.e. unevalutated) text to a typographically evaluated R expression in a legend(...) call. here's a working legend(...) call that is close to what i'd like (where x and y are returned from an lm(...) call): legend(topleft, legend = c(bquote(R^2 ==

Re: [R] difficulty with R expressions in text/legend

2010-07-10 Thread Murat Tasan
), as bquote expects an R expression. On Jul 10, 11:22 pm, David Winsemius dwinsem...@comcast.net wrote: On Jul 10, 2010, at 10:45 PM, David Winsemius wrote: On Jul 10, 2010, at 8:58 PM, Murat Tasan wrote: hi, i'm trying to prepend some plain (i.e. unevalutated) text

Re: [R] difficulty with R expressions in text/legend

2010-07-10 Thread Murat Tasan
, David Winsemius dwinsem...@comcast.net wrote: On Jul 10, 2010, at 11:22 PM, David Winsemius wrote: On Jul 10, 2010, at 10:45 PM, David Winsemius wrote: On Jul 10, 2010, at 8:58 PM, Murat Tasan wrote: hi, i'm trying to prepend some plain (i.e. unevalutated) text

[R] advice on package devel with external libs

2010-06-28 Thread Murat Tasan
hi all - i'm working on an R package that makes use of my own shared library written in C. but i also am making use of another C-written library. (my package is for facilitating biological namespace translations via online (i.e. up-to-date) biological databases.) problem is, the library i'm using

[R] ESS (emacs speaks statistics) saving history

2010-06-02 Thread Murat Tasan
hi folks, i use ESS mode in emacs often to interact with R, and while i know how to save a session transcript, i'm wondering how to save just the history of the commands (i.e. identically to how R gives the history save option from its native CLI). if you use ESS with an R process, commands

Re: [R] why the dim gave me different results

2010-06-02 Thread Murat Tasan
row names are not the same as line numbers or indices. you've likely done some row-based selection on an original matrix or data frame. observe from the example below. (and in the future please don't expect people to sort through your 500+ line matrices by hand to find your problems.) x -

Re: [R] shared object location

2010-01-30 Thread Murat Tasan
The primary reason is for development. I do install via the traditional R CMD INSTALL (or variant) method, but I want to keep the C code external from the R package. In particular, I want to be able to modify the C code (and thus the compiled .so library functions) without having to constantly re-

Re: [R] shared object location

2010-01-30 Thread Murat Tasan
identify that will allow for linking/loading of shared objects along the LD_LIBRARY_PATH. On Jan 30, 5:52 pm, Murat Tasan mmu...@gmail.com wrote: The primary reason is for development. I do install via the traditional R CMD INSTALL (or variant) method, but I want to keep the C code external from

[R] shared object location

2010-01-29 Thread Murat Tasan
hi all, i posted a question before about this, but i may have been too cryptic to understand. in short, there exists an R package that someone is writing. this package depends on a custom library (written in C,), compiled as a shared, and called by the package's functions via the .Call(...)

[R] library.dynam

2010-01-26 Thread Murat Tasan
hi, i'm having some trouble getting a package to load a shared library object in .onLoad(...) i have a shared object file, say mylib.so. if i start an R session, and via the CLI specify the actual library via: dyn.load(mylib.so) everything works quite well (i.e. i can then follow with some

Re: [R] library.dynam

2010-01-26 Thread Murat Tasan
, but is a temporary requirement for my writing this package for some colleagues. On Jan 26, 5:16 pm, Murat Tasan mmu...@gmail.com wrote: hi, i'm having some trouble getting a package to load a shared library object in .onLoad(...) i have a shared object file, say mylib.so. if i start an R

[R] fitting a glm with matrix of responses

2009-11-11 Thread Murat Tasan
hi all - quick question: i have a matrix 'y' of response values, with two explanatory variables 'x1' and 'x2'. tested values of 'x1' and 'x2' are sitting in two vectors 'x1' and 'x2'. i want to learn model parameters without unrolling the matrix of response values. example below: # some fake

[R] dimension-preserving matrix coersion

2009-09-27 Thread Murat Tasan
i've written a function to coerce a matrix (e.g. from numeric to logical), but i'd like to know if someone has a more elegant method for this: m - matrix(c(0, 1, 1, 0), ncol = 2) m - as.logical(m) m [1] FALSE TRUE TRUE FALSE i'd like 'm' to still be a matrix with the original dimensions. in

Re: [R] dimension-preserving matrix coersion

2009-09-27 Thread Murat Tasan
,]  TRUE FALSE On Sun, Sep 27, 2009 at 6:59 PM, Murat Tasan mmu...@gmail.com wrote: i've written a function to coerce a matrix (e.g. from numeric to logical), but i'd like to know if someone has a more elegant method for this: m - matrix(c(0, 1, 1, 0), ncol = 2) m - as.logical(m) m

Re: [R] Count number of zeros in a collumn

2009-09-27 Thread Murat Tasan
more generally, if you want to test for some minimum threshold T on the number of zeros, try: if(length(which(dart[,1977] == 0)) T) { # some code to handle the too-few-zeros-case } On Sep 27, 4:54 pm, Marcio Resende mresende...@yahoo.com.br wrote: I have a matrix 700x2000 which is

[R] wilcox.test p-value = 0

2009-09-15 Thread Murat Tasan
hi, folks, how have you gone about reporting a p-value from a test when the returned value from a test (in this case a rank-sum test) is numerically equal to 0 according to the machine? the next lowest value greater than zero that is distinct from zero on the machine is likely

[R] single row/column-indexing on matrices

2009-07-24 Thread Murat Tasan
hi all - quick question: i have a matrix m, say nrow=5, ncol=4. in a function i'd like to retrieve certain rows or columns from m, but which rows/cols are not known ahead of time. the function should return a sub-matrix (i.e. still of class 'matrix'). when selecting a single column (or row), the

Re: [R] single row/column-indexing on matrices

2009-07-24 Thread Murat Tasan
awesome! thanks much! On Jul 24, 6:41 pm, Duncan Murdoch murd...@stats.uwo.ca wrote: On 24/07/2009 6:34 PM, Murat Tasan wrote: hi all - quick question: i have a matrix m, say nrow=5, ncol=4. in a function i'd like to retrieve certain rows or columns from m, but which rows/cols

[R] Rgraphviz ignoring outputorder attribute

2009-07-13 Thread Murat Tasan
Hi - since Rgraphviz was officially moved over to Bioconductor, this might be a misguided post, but it's worth a shot: I'm plotting a graph using Rgraphviz and in an attempt to force the edges to be behind the nodes (on a fairly complex graph), I set the outputorder graph attribute to edgesfirst