Displaying 20 results from an estimated 3000 matches similar to: "vectorized plotmath expressions via substitute()"
2013 Feb 14
3
list of matrices --> array
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 other permutation of the dim
sizes) array.
i know i can initialize the array, then
2010 Jul 11
1
difficulty with R expressions in text/legend
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(x)$r.squared)),
bquote(R^2 == .(summary(y)$r.squared))), fill =
2009 Sep 27
2
dimension-preserving matrix coersion
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 my
function to do this, i coerce 'm' to a logical,
2010 Jul 16
2
aggregate(...) with multiple functions
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 median() to
col2.
if i wanted to apply mean() to both columns, i would call:
aggregate(x, list(f),
2013 Jan 20
2
"user units" in plotrix
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 inches, the device
has both outer and inner magins, and the plot region has
2014 Oct 27
1
proper use of reg.finalizer to close connections
Hi all, I have a question about finalizers...
I have a package that manages state for a few connections, and I'd
like to ensure that these connections are 'cleanly' closed upon either
(i) R quitting or (ii) an unloading of the package.
So, in a pared-down example package with a single R file, it looks
something like:
##### BEGIN PACKAGE CODE #####
.CONNS <- new.env(parent =
2006 Feb 16
1
R-help - Problem in drawing braplot with a huge value of data
Hello R-experts,
I am facing a strange problem while creating a barplot. I have serise of
data of which the first
on is around 162589 while the remaining data are around 0-150. so when I am
ploting the barplot
with all the data I am getting a single line -> test1.jpg.
But If I remove the 1st value i.e 162589 then I am getting a normal
barplot -> test2.jpg
Can some one help me regarding
2010 Jun 02
1
ESS (emacs speaks statistics) saving history
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 entered from a separate
buffer and sent to the process do not get registered with the R
history, and
2009 Sep 15
2
wilcox.test p-value = 0
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 (the algorithm of the test
itself), but without knowing the explicit steps of the algorithm
2010 Jul 28
1
specifying an unbalanced mixed-effects model for anova
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 : "Score2" (another continuous numeric measure, this time
bounded between 0
2009 Nov 11
1
fitting a glm with matrix of responses
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 data for the example
x1 <- 1:5
x2
2004 Apr 14
1
ltext, plotmath, and substitute
I am interested to use plotmath functions within a panel function but am having
some problems getting the code right. Within each panel I am plotting the data,
fitting a regression line, and would like to print the regression equation.
Here is a trivial example of what I'd like to do:
# generate simple data
tmp.df <- data.frame(id = rep(1:4, each=4),
time = rep(1:4, 4),
das =
2011 May 03
1
bootstrap vignette construction and package installation
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 install-able version of my package
in a clean state, i remove the original
2012 Aug 22
1
Plot label axis with expression
Hi all,
I need help with axis in plot.
I want to edit y axis label of my plot. My data is like:
x <- c(100,50,10,1,0.1,0.05,0.001)
plot(log(x))
axTicks(2) # Label of y axis
[1] -6 -4 -2 0 2 4
I'd like that y axis label was like: e^-6, e^-4, etc. (with text "e"
superscript -6, -4, etc.) I try to use expression(), but don't work.
plot(log(x), yaxt="n")
2010 Jun 28
1
advice on package devel with external libs
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 is not a standard library (i.e. i
doubt it will be installed on most users' machines).
i
2010 Aug 01
3
Constructing arguments for plotmath
Colleagues,
I am encountering difficulty adding formatted text to a graphic. Specifically, I want to add a superscript in the middle of a text string but I would like to format the text string on the fly. The commands:
plot(1,1)
ARG <- bquote('TEXT'^'\u00ae')
mtext(ARG, line=-2, side=1)
yield the desired output.
However, my goal is to paste together a string, then pass
2010 Oct 04
1
source package build/installation with subdirectory-lib
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, and it has it's own
configure file for the canonical './configure && make
2004 Feb 19
1
Possible error in ?axTicks
Hi all,
Before posting to r-bugs, I thought that I would just verify this one
first.
It looks like the help for axTicks() needs to be corrected.
It presently says:
'axTicks()' can be regarded as an R implementation of the C function
'CreateAtVector()' in '..../src/main/graphics.c' which is called by
'axis(side,*)' when no argument 'at' is specified.
2011 Feb 04
1
axTicks.Rd documentation bug
?axTicks says:
usr: numeric vector of length four, defaulting to ?par("usr")?
giving horizontal (?x?) and vertical (?y?) user coordinate
limits.
but this is not how the function is implemented -- in fact 'usr' should
be a vector of length two corresponding to the appropriate elements of
par("usr") [1:2 if side is 1 or 3, 3:4 if side is 2 or
2004 Mar 25
1
How to add a top X-axis with a different logarithmic scale?
Hi,
I am trying to put on one plot two different logarithmic
scales, using the bottom and top X-axes.
Below there is an example of what I am trying to achieve,
using axTicks() -- and fails.
I already spent few hours on that, and cannot figure out from
?par and ?axTicks what I am doing wrong.
Example follows:
############################################################
#### Data
x <-