Displaying 20 results from an estimated 70000 matches similar to: "applying a function recursively"
2011 Jan 11
3
list concatenation
Dear R gurus,
first let me apologize for a question that might hve been answered
before. I was not able to find the solution yet. I want to concatenate
two lists of lists at their lowest level.
Suppose I have two lists of lists:
list.1 <- list("I"=list("A"=c("a", "b", "c"), "B"=c("d", "e", "f")),
2012 Mar 21
2
Type II and III sum of squares (R and SPSS)
To whom it may concern
I made some analysis with R using the command Anova. However, I found
some problmes with the output obtained by selecting type II o type III
sum of squares.
Briefly, I have to do a 2x3 mixed model anova, wherein the first factor
is a between factor and the second factor is a within factor. I use the
command Anova in the list below, because I want to obtain also the sum
2012 Jul 06
2
Anova Type II and Contrasts
the study design of the data I have to analyse is simple. There is 1 control group (CTRL) and 2 different treatment groups (TREAT_1 and TREAT_2).
The data also includes 2 covariates COV1 and COV2. I have been asked to check if there is a linear or quadratic treatment effect in the data.
I created a dummy data set to explain my situation:
df1 <- data.frame(
Observation =
2012 Apr 19
3
How to "flatten" a multidimensional array into a dataframe?
Hi,
I have a three dimensional array, e.g.,
my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c("A1","A2"),
d2=c("B1","B2","B3"), d3=c("C1","C2","C3","C4")) )
what I would like to get is then a dataframe:
d1 d2 d3 value
A1 B1 C1 0
A2 B1 C1 0
.
.
.
A2 B3 C4 0
I'm sure there is one function to do
2010 Feb 09
2
How can I rearange my dataframe
An embedded and charset-unspecified text was scrubbed...
Name: ???????????
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100209/db12d14b/attachment.pl>
2007 Sep 04
2
Recursive concatenation
Colleagues,
I want to create the following array:
"A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"
I recall that there is a trick using "c" or "paste" permitting me to
form all combinations of c("A", "B", "C") and 1:3. But, I can't
recall the
2013 Nov 21
1
how can I import a number of datsets in a folder in my working directory to a list in R
Hi,
Suppose, if I create 15 files in my working directory.
set.seed(48)
lapply(1:15,function(i) {m1 <- matrix(sample(1:20,1686*2,replace=TRUE),nrow=1686,ncol=2); write.table(m1,paste0("file_",i,".txt"),row.names=FALSE,quote=FALSE)})
?D <-dir()
D1 <- D[order(as.numeric(gsub("\\D+","",D)))]
D1
?res <- t(sapply(D1,function(x) {x1<-
2005 Jun 03
2
rearrange data
Dear all:
I have this:
A1 B1 C1 D1 E1
A2 B2 C2 D2 E2
A3 B3 C3 D3 E3
And I want this
A1 E1
B1 E1
C1 E1
D1 E1
A2 E2
B2 E2
C2 E2
D2 E2
A3 E3
B3 E3
C3 E3
D3 E3
Example:
m<- matrix(1:15,nrow=3,byrow=T)
m
v<- unlist(list(t(m[,1:4])))
u<- rep(c(5,10,15),c(4,4,4))
data.frame(v,u)
This is the result I want but I would like to learn a simpler way to do it.
Any clue?
2013 Nov 19
2
Optim function & Hessian matrix
Dear R Users
Hi,
I have very emergency problems in my programming about finding MLE
with optim command. I reproduced it with real data. I guess that my
function object in optim is very sensitive because it has power
function .
Then optim give me lower or initial values for estimates with these
warnings for Hessian matrix computation:
1: In log(B2 * (C2^(y + v))) : NaNs produced
2: In log(B3
2005 Nov 28
7
combine two columns
Hi,
I have an R programming problem and I havent found anything in the
documentation yet:
I have a data matrix, in which two neighbouring columns represent
replicates of the same experiment, e.g. something like this:
A A B B C C
row1 1 1 1 2 2 2
row2 1 1 1 1 1 2
I would like to test, if the values for the two replicates in a row
are the same or if they differ and generate a new
2011 Feb 17
1
Populate a list / recursively set list values to NA
Hello all,
Maybe I'm being thick, but I was trying to figure out a simple way to create
a list with the same dimension of another list, but populated with NA
values.
masterlist = list(
aa=list(
a=matrix(rnorm(100),10,10),
b=matrix(rnorm(130),13,10),
c=matrix(rnorm(140),14,10)),
bb=list(
2005 Aug 15
2
queer data set
I have a dataset that is basically structureless. Its dimension varies
from row to row and sep(s) are a mixture of tab and semi colon (;) and
example is
HEADER1 HEADER2 HEADER3 HEADER3
A1 B1 C1 X11;X12;X13
A2 B2 C2 X21;X22;X23;X24;X25
A3 B3 C3
A4 B4 C4 X41;X42;X43
A5 B5 C5 X51
etc., say. Note that a blank
2011 Mar 05
2
Repeating the same calculation across multiple pairs of variables
Hi all,
I frequently encounter datasets that require me to repeat the same calculation across many variables. For example, given a dataset with total employment variables and manufacturing employment variables for the years 1990-2010, I might have to calculate manufacturing's share of total employment in each year. I find it cumbersome to have to manually define a share for each year and
2010 Nov 27
4
Combind two different vector
Hi
I'm trying two combine two vectors that have different lengths. This without
recursive the shorter one. E.g.,
a <- seq(1:3)
b <- seq(1:6)
Thanks in advance
Serdar
[[alternative HTML version deleted]]
2008 Mar 05
3
legend for several graphics
Hi,
I am trying to generate a figure of 9 plots that are contained in one
device by using
par(mfrow = c(3,3,))
I would like to have 1 common legend for all 9 plots somewhere outside
of the plotting area (as opposed to one legend inside each of the 9
plots, which the function legend() seems to generate by default).
Any hint how to do this?
Best,
Georg
2017 Aug 07
3
AliasAnalysis: may-alias subcategory
There are function which does have optimization opportunities but because of may-alias memory dependencies sometimes optimization is not effective. May be runtime checks kills the gains of optimization. For such cases aiming to do interprocedural function specialization optimization where in the clone function version no-alias assumption can be assumed and the original function version will hold
2004 Jul 08
2
Getting elements of a matrix by a vector of column indice s
See if the following helps:
> m <- outer(letters[1:5], 1:4, paste, sep="")
> m
[,1] [,2] [,3] [,4]
[1,] "a1" "a2" "a3" "a4"
[2,] "b1" "b2" "b3" "b4"
[3,] "c1" "c2" "c3" "c4"
[4,] "d1" "d2" "d3" "d4"
[5,]
2007 Jul 12
1
how to estimate treatment-interaction contrasts
Hello, R experts,
Sorry for asking this question again again since I really want a help!
I have a two-factor experiment data and like to calculate estimates of
interation contrasts say factor A has levels of a1, a2, and B has
levels of b1, b2, b3, b4, and b5 with 3 replicates. I am not sure the
constrast estimate I got is right using the script below:
2007 Aug 28
7
Excel
A common process when data is obtained in an Excel spreadsheet is to save
the spreadsheet as a .csv file then read it into R. Experienced users
might have learned to be wary of dates (as I have) but possibly have not
experienced what just happened to me. I thought I might just share it with
r-help as a cautionary tale.
I received an Excel file giving patient details. Each patient had an ID
2005 May 12
2
mget empty strings
Dear R community,
I am a beginner to R and have a question concerning mget, about I could
not find anything in the various documentation.
I have a column in a dataframe x for which I want to get values in y:
mget(x[,1], env=y, ifnotfound=NA)
I receive an error mesage:
Error in mget(x[, 1], env = y, ifnotfound = NA) :
attempt to use zero-length variable name
this is probably due to