Displaying 20 results from an estimated 3000 matches similar to: "fitting a glm with matrix of responses"
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
2012 Nov 14
2
vectorized plotmath expressions via substitute()
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(foo =
axTicks(1))))
thinking the as.expression/substitute would create the appropriate
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
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
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 =
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 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
2017 Sep 16
2
require help
You can just use the same code that I provided before but now use your
dataset. Like this
df <- read.csv(file="data2.csv",header=TRUE)
dates <- as.Date(paste(df$year,"-01-01",sep=""))
myXts <- xts(df,order.by=dates)
head(myXts)
#The last command "head(myXts)" shows you the first few rows of the xts
object
year cnsm incm wlth
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
2017 Sep 16
0
require help
> On 15 Sep 2017, at 11:38, yadav neog <yadavneog at gmail.com> wrote:
>
> hello to all. I am working on macroeconomic data series of India, which in
> a yearly basis. I am unable to convert my data frame into time series.
> kindly help me.
> also using zoo and xts packages. but they take only monthly observations.
>
> 'data.frame': 30 obs. of 4 variables:
2017 Sep 15
7
require help
hello to all. I am working on macroeconomic data series of India, which in
a yearly basis. I am unable to convert my data frame into time series.
kindly help me.
also using zoo and xts packages. but they take only monthly observations.
'data.frame': 30 obs. of 4 variables:
$ year: int 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
$ cnsm: num 174 175 175 172 173 ...
$ incm:
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 =
2017 Sep 16
0
require help
oky.. thank you very much to all of you
On Sat, Sep 16, 2017 at 2:06 PM, Eric Berger <ericjberger at gmail.com> wrote:
> You can just use the same code that I provided before but now use your
> dataset. Like this
>
> df <- read.csv(file="data2.csv",header=TRUE)
> dates <- as.Date(paste(df$year,"-01-01",sep=""))
> myXts <-
2018 May 30
2
Hang generating sanitizer tests
When I run "make check-all" with ToT I am seeing what looks like a hang
generating sanitizer tests:
[...]
[100%] Generating dynamic/Asan-x86_64-calls-Dynamic-Test
make[3]: Leaving directory '/build/debug'
[100%] Built target TAsan-x86_64-calls-Dynamic-Test
[100%] Generating default/Asan-x86_64-inline-Test
make[3]: Leaving directory '/build/debug'
[100%] Built target
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
2009 Mar 25
2
need help with ordering of plots
I want to do a series of contour plots, 4 in all. The data is coming
from a data frame named "nd.frame", which has elements "xdf", "ydf",
"zdf", and "pndt". I am treating "pndt" as a factor, and it has four
levels. I make a call to the lattice graphics routine "contourplot"
like so:
2017 Sep 22
2
require help
Assuming the input data.frame, DF, is of the form shown reproducibly
in the Note below, to convert the series to zoo or ts:
library(zoo)
# convert to zoo
z <- read.zoo(DF)
# convert to ts
as.ts(z) #
Note:
DF <- structure(list(year = c(1980, 1981, 1982, 1983, 1984), cnsm = c(174,
175, 175, 172, 173), incm = c(53.4, 53.7, 53.5, 53.2, 53.3),
with = c(60.3, 60.5, 60.2, 60.1, 60.7)),
2009 Jul 24
1
single row/column-indexing on matrices
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 indexing operation
converts the object of class 'matrix' into a vector of