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 ...
..
Thanks, Stefan, I'll take a look!
Also, I figured out another solution (~15 minutes after posting :-/):
```
row_normalized_P <- Matrix::Diagonal(x = 1 / sqrt(Matrix::rowSums(P^2)))
%*% P
```
Cheers,
-m
On Thu, May 4, 2017 at 12:23 PM, Stefan Evert
wrote:
>
> > On 4 May 2017
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)
> clea
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 so
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
unction that properly sets the clipping region (such as box)
> before plotting anything else
> 5 call clip(0,1,0,1) (or with the actual user coordinates) to manually
> set the clipping region
> 6 other?
>
>
> On Mon, Oct 6, 2014 at 12:00 PM, Murat Tasan wrote:
>> Hi all
re than one plot region on the page, depending on how complex your
> arrangement of plot regions is.
>
> Another alternative is to use the 'grid' graphics package, which is designed
> to allow for the flexible creation of multiple regions, depending on what
> you want to draw in
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.fram
4 6 8 10
-Murat
On Wed, Nov 12, 2014 at 10:02 PM, Murat Tasan 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 i
... 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 wrote:
> An
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 s
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 3, 2015 at 5:28 P
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
RPostgreSQL
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 algorithm-dependent
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
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
awesome! thanks much!
On Jul 24, 6:41 pm, Duncan Murdoch 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 col
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.
>
> [,1] [,2]
> [1,] FALSE TRUE
> [2,] TRUE FALSE
>
>
>
>
>
>
>
> On Sun, Sep 27, 2009 at 6:59 PM, Murat Tasan 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
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 wrote:
> I have a matrix 700x2000 which is sampled in each cycle from
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 da
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
, but is a
temporary requirement for my writing this package for some colleagues.
On Jan 26, 5:16 pm, Murat Tasan 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".
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(...)
metho
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-
to imagine there is some method in R that i just cannot
identify that will allow for linking/loading of shared objects along
the LD_LIBRARY_PATH.
On Jan 30, 5:52 pm, Murat Tasan wrote:
> The primary reason is for development.
> I do install via the traditional R CMD INSTALL (or variant) method
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"):
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
re, or plotting
> region.
>
>
> On Sun, Jan 20, 2013 at 2:59 PM, Murat Tasan 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
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 o
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 wrote:
> i'm somehow embarrassed to even ask thi
er wrote:
>>
>>
>> require(abind)
>> do.call(abind,c(my_list,list(along=0))) # Gives 2 x 4 x 5
>> do.call(abind,c(my_list,list(along=3))) # Gives 4 x 5 x 2
>>
>> The latter seems more natural to me.
>>
>> cheers,
>>
>> Rolf Turner
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"
c
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
ue
>
> would be fine. I don't know why Murat thought there would be different
> consistency checks; I'd assume the main difference would be that attr()
> would be quicker. (It does a lot less: attributes(x)[[attrib]] <- value
> essentially does
>
> temp <- attribu
lt;- "another attribute value"
> > my_obj
> [1] 37 38 39 40 41
> attr(,"myAttr")
> [1] MMXII MMXIII
> attr(,"anotherAttrName")
> [1] "another attribute value"
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
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 be
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
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, list(
> wdunlap tibco.com
>
>
> > -Original Message-
> > 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: [
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,
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
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 == .(summary
ot;,
"blue"))
note that you cannot simply add the prefix string as is to bquote (as
suggested), as bquote expects an R expression.
On Jul 10, 11:22 pm, David Winsemius wrote:
> On Jul 10, 2010, at 10:45 PM, David Winsemius wrote:
>
>
>
>
>
>
>
> > O
prefix string
and the typographically-correct expression with an evaluated term.
On Jul 10, 11:54 pm, David Winsemius wrote:
> On Jul 10, 2010, at 11:22 PM, David Winsemius wrote:
>
>
>
>
>
>
>
> > On Jul 10, 2010, at 10:45 PM, David Winsemius wrote:
>
> >
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 medi
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, an
c directory (with some other source files).
am i completely off here in my usage of Makevars?
thanks!
-murat
On Oct 4, 4:52 pm, Murat Tasan 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
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 =
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 : "Sc
a mixed effect model as it stands.
>
> If this is a homework problem, ask a teacher or classmate for help.
> Otherwise, try consulting your local statistician. You do not appear
> to understand the concepts of mixed effects models, so just walking
> you through a lme model speci
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 ins
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 entere
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 <- matri
54 matches
Mail list logo