If possible I'd like to produce a function that applies a formula to a column
in a matrix (essentially calculating the mse) and then inserts it between
values of a an array ...
confusing I know, here is an example of what I'm trying to accomplish:
## create a matrix
(a <- matrix(c(3,6,4,8,5,9,1
Hi All,
I'm attempting to compile and run a BUGS model using OpenBUGS from R and
getting this message. I've googled around not found much, it may well
be a problem with OpenBUGS and not R. Any suggestions or clues as to
how to find the problem would be welcome. I'm wondering if I'm missing
What is the easiest way to extract a value from a 'mer' object from glmer? The
first I need is the
trtpair Std.Dev. which in this case is 0.17542?
I've managed to get the fixed effects numbers from
summary(fednmaout)@coeffs
but no luck with the Random effects stuff.
TIA
Jim
> fednmaout
Long story short, I have a big iterative procedure that produces a long list of
data.frames such as the one called
"results" here. Is there an easy way to produce a similar list of data.frames
comprised of the mean of each of the
columns in results, such that it ends up like the one I've shown i
I get an output from a glmer package, but would like to extract the variance of
the Random effects, in this case called trtpair and the value is 0.
Can I extract it directly or do I need to do some further calculations on the
"mer" object to get it?
Thanks
Jim
> class(fednmaout)
[1] "mer"
att
I'd like to save some calculation outputs as a pdf, to incorporate with others
in a document. I've tried
pdf("filename")
name_of_object_to_output
dev.off()
but it doesn't seem to work, appears that this pdf function is for graphics?
Is there a way to output numerical objects to pdf?
Thanks
J
Is there a way to convince R to create a character vector without using the
quotes?
This works
ex1 <- c("first","second")
but when I try this it doesn't
ext <- as.character(c(first,second))
it complains. I have many variables to put into character vectors so dispensing
with the quotes would
Question 1:
I have a long list of variable names such as
first <- c("one","two","three")
and what I want to do is create a list of lists ... where the names of each of
overall lists components are "one","two", and "three".
This is the same result as
second <- list(one=list(),two=list(),three
Hi Rex,
Thanks, this is exactly what I want but have to do it with many big arrays ...
thus if there were a way to do it with a vectorized function would it not be a
lot more efficient?
Much appreciated!
J
>Subject: RE: sort a 3 dimensional array across third dimension ?
>
>Although I suggest
I'm attempting to sort a 3 dimensional array that looks like this
> x
, , 1
[,1] [,2]
[1,]99
[2,]79
, , 2
[,1] [,2]
[1,]65
[2,]46
, , 3
[,1] [,2]
[1,]21
[2,]32
Such that it ends up like this
> y
, , 1
[,1] [,2]
[1,]21
I'm using the range command to get the minimum and maximum values of an array
as in
x <- range(array_y)
which gives me two values such as
[1] -2 9
I need to be able to test if this range of values includes a third value. For
example I'd like to query
1) does the range of -2 to 9 include 3,
I'm using the range command to get the minimum and maximum values of an array
as in
x <- range(array_y)
which gives me two values such as
[1] -2 9
I need to be able to test if this range of values includes a third value. For
example I'd like to query
1) does the range of -2 to 9 include 3
I'm trying to work out the simplest way to remove the upper and lower
quantiles, in this case upper and lower 25% from an array. I can do it in two
steps but when I try it in one, it fails. Is there something simple missing
from my syntax or are there other simple elegant way to accomplish thi
I'm attempting to run a rather complex routine that involves a few loops, and
even some use of foreach and doMPI. I just added another external loop and now
get this error message.
Error in { : task 3 failed - "NA/NaN argument"
Is there a way to debug what is causing this error or where? I re
I'm attempting to generalise a function that reads individual list components,
in this case they are matrices, and converts them into 3 dimensional array. I
can input each matrix individually, but want to do it for about 1,000 of them
...
This works
array2 <- abind(list1[[1]],list1[[2]],list1[
I get some results back from running an iterative analysis in the form of a
list of matrices. What I would like to do with this list is combine it such
that all the similar components get combined into a multidimensional array. If
possible I'd like to put results[[1]]$resultmean and results[[2
Is it possible to send data from an executing R script, to external R script
files, on linux in this case, get that external R script to execute, and pass
results back to the central script? If so what commands should I be looking
at? I've googled for R and external, stuff like that but no luc
Could anyone give me some clues as to the best way to debug this error message?
I think it is from the passing of variables back to R from the jags function
which does Bayesian fitting. The curious part for me is that the error
messages seem random, yet the input data are always the same. An
I'm using the following model to do an analysis
faicout <- glm(cbind(events,patnums-events) ~ as.factor(treat) +
as.factor(numtrial), family = binomial )
Is this example there are 4 treatments . In the glm object I can find the
contrasts of the main treats vs the first i.e. 2v1, 3v1 and 4v1 .
I can not understand why this fails
>
> faicoutput2 <- list(stuff21 = as.numeric(faicout$coefficients[2]),
+ stuff31=as.numeric(faicout$coefficients[3]),
+ stuff41=as.numeric(faicout$coefficients[4]),
+ stuff32=(stuff21-stuff31),
+
Sorry for the verbose example. I want to row bind two matrices, and all works
except I want the column labelled "row" to be sequential in the new matrix,
shown as "mat3" here, i.e. needs to be 1:6 and not 1:3 repeated twice. Any
suggestions?
Thanks
J
> colnm1 <- c("row","ti","counti")
> col
I've tried hard to find a way to exponentiate each element of a whole matrix
such that if I start with A
A = [ 2 3
2 4]
I can get back B
B = [ 7.38 20.08
7.38 54.60]
I've tried
B <- exp(A) but no luck.
Thanks
J
===
Dr. Jim Maas
University of
I'm attempting to learn how to use the debug function to find the values of
some variables. I've found a couple of documents describing the basics and
they show examples that the debugger returns
"Browse[1]>"
but for some reason when I follow the examples I get
"Browse[2]>"
What is the "2"
This code worked fine for me, then did some cleaning up of formatting using ESS
(Emacs) and now I get this error, no idea what is causing it, all the
brackets/parentheses seem to be balanced. What have I done wrong?
Thanks
Jim
p0.trial01 <- 0.25
TruOR01 <- 0.80
num.patients.01 <- 50
num.tri
Dr. Jim Maas
University of East Anglia
____
From: Michael Bedward [michael.bedw...@gmail.com]
Sent: 18 September 2010 04:14
To: Maas James Dr (MED)
Cc: r-help@r-project.org
Subject: Re: [R] removing specific rows from array
Here's one way...
treats <- c(&
I'm attempting to create an array of treatment comparisons for modelling data
generation. This involves comparison of one treatment (c2) with another (c3),
relative to a common comparator (c1).
Attached code gives me the correct array but need to remove duplicates.
Duplicates relate only to c
Simple one here ... but can't get it to work ...
for (i in 1:4){
paste("stuff",[i]),sep="") <- 3 + i
}
ls()
rm(list=ls())
I just want it to create 4 new variables called stuff1, stuff2, stuff3, stuff4
with the corresponding assignments. I realise that there are more elegant
functions bu
If possible I would like to combine two different character arrays in
combinations
Array1 <- c("height","weight","age","sex")
Array2 <- c("trt0","trt1","trt2")
I would like to combine these two character vectors to end up with such ...
Array3
"height.trt0.trt1"
"height.trt0.trt2"
"weight.trt0
Simple one, have read and googled, still no luck!
I want to create several empty vectors all of the same length.
I would like multiple empty vectors (vec1, vec2, vec3) and want to create them
all in one line.
I've tried
vec1,vec2,vec3 <- vector(length=5)
and
c(vec1,vec2,vec3) <- vector(length=
Is it possible to get R to output the value of an expression, that is being
calculated within a function? I've attached a very simple example but for more
complicated ones would like to be able to debug by seeing what the value of
specific expressions are each time it cycles through a loop that
I would appreciate any suggestions on which function to use to write subsequent
functions analysing combinations of treatments.
This refers to experimental trials of medical treatments. I want to write
routines to analyse various comparisons (combinations)
So if 5 treatments are available
Relative noob here, I have a data.frame and simply want to add an explicit
column of names in column 1 of the form
"trial_number01" for row 1, "trial_number02" for row 2 etc. It is simply
for visual purposes and to explain data to others. I've tried
Using row.names and other but still no l
32 matches
Mail list logo