Displaying 20 results from an estimated 6000 matches similar to: "Repeating the same calculation across multiple pairs of variables"
2011 Feb 02
2
Efficient way to determine if a data frame has missing observations
I have a data set covering a large number of cities with values for characteristics such as land area, population, and employment. The problem I have is that some cities lack observations for some of the characteristics and I'd like a quick way to determine which cities have missing data. For example:
2005 Dec 22
2
bVar slot of lmer objects and standard errors
Hello,
I am looking for a way to obtain standard errors for emprirical Bayes estimates of a model fitted with lmer (like the ones plotted on page 14 of the document available at http://www.eric.ed.gov/ERICDocs/data/ericdocs2/content_storage_01/0000000b/80/2b/b3/94.pdf). Harold Doran mentioned (http://tolstoy.newcastle.edu.au/~rking/R/help/05/08/10638.html) that the posterior modes' variances
2011 Jan 28
3
read.table() versus scan()
I need to import a large number of simple, space-delimited text files with a few columns of data each. The one quirk is that some rows are missing data and some contain junk text at the end of each line. A typical file might look like:
a b c d
1 2 3 x
4 5 6
7 8 9 x
1 2 3 x c c
4 5 6 x
7 8 9 x
I'm trying to avoid having to pre-process the text files, as they all sit on an ftp site that I
2011 Jul 05
3
plotting survival curves (multiple curves on single graph)
Hello.
This is a follow-up to a question I posted last week. With some
previous suggestions from the R-help community, I have been able to
plot survival (, hazard, and density) curves using published data for
Siler hazard parameters from a number of ethnographic populations.
Can the function below be modified, perhaps with a "for" statement, so
that multiple curves (different line
2003 Nov 18
1
aov with Error and lme
Hi
I searched in the list and only found questions
without answers e.g.
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/19955.html
: Is there a way to get the same results with lme as
with aov with Error()?
Can anybody reproduce the following results with lme:
id<-c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5)
2000 Jun 21
3
SAS dataset
Hello,
Is there any way we convert SAS dataset into R dataset?
Kindest Regards,
Peppy Adi-Purnomo
------
Peppy Adi-Purnomo
Energy Market Analyst
Energy Link Ltd
Dunedin - New Zealand
Ph.: +64 3 479 2475
Fax: +64 3 477 8424
Email: s.adi.purnomo at energylink.co.nz
www.EnergyLink.co.nz
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2011 Jun 28
1
plotting survival curves with model parameters
Hello.
I am trying to write an R function to plot the survival function (and
associated hazard and density) for a Siler competing hazards model.
This model is similar to the Gompertz-Makeham, with the addition of a
juvenile component that includes two parameters---one that describes
the initial infant mortality rate, and a negative exponential that
describes typical mortality decline over the
2009 Oct 29
3
Removing & generating data by category
Dear R users,
Basically, from the following arbitrary data set:
a <-
data.frame(id=c(c("A1","A2","A3","A4","A5"),c("A3","A2","A3","A4","A5")),loc=c("B1","B2","B3","B4","B5"),clm=c(rep(("General"),6),rep("Life",4)))
> a
2012 Jan 12
2
Function accepted by optim but not mle2 (?)
Dear Sir/ Madam,
I'm having trouble de-bugging the following - which works perfectly
well with optim or optimx - but not with mle2.
I'd be really grateful if someone could show me what is wrong. Many
thanks in advance. JSC:
gompertz<- function (x,t=data)
{
a3<-x[1]
b3<-x[2]
shift<-data[1]
h.t<-a3*exp(b3*(t-shift))
2013 Mar 12
2
big edge list to adjacency matrix
I have huge list of edges with weights.
a1 b1 w1
a2 b2 w2
a3 b3 w3
a1 b1 w4
a3 b1 w5
I have to convert it into 2 dim matrix
b1 b2 b3
a1 max(w1,w4) 0 0
a2 0 w2 0
a3 w5 0 w3
if edges repeated take the maximum weights. How do this efficiently without
using for loop? Any idea.
thanks
Avi
[[alternative
2012 Oct 18
7
summation coding
I would like to code the following in R: a1(b1+b2+b3) + a2(b1+b3+b4) +
a3(b1+b2+b4) + a4(b1+b2+b3)
or in summation notation: sum_{i=1, j\neq i}^{4} a_i * b_i
I realise this is the same as: sum_{i=1, j=1}^{4} a_i * b_i - sum_{i=j} a_i
* b_i
would appreciate some help.
Thank you.
--
View this message in context: http://r.789695.n4.nabble.com/summation-coding-tp4646678.html
Sent from the R
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?
2007 Mar 09
1
Applying some equations over all unique combinations of 4 variables
#I have a data set that looks like this. A bit more
complicated actually with
# three factor levels but these calculations need to
be done on one factor at a
#I then have a set of different rates that are applied
#to it.
#dataset
cata <- c( 1,1,6,1,1,2)
catb <- c( 1,2,3,4,5,6)
doga <- c(3,5,3,6,4, 0)
data1 <- data.frame(cata, catb, doga)
rm(cata,catb,doga)
data1
# start rates
#
2011 Apr 16
1
CairoPDF, Fonts, and Windows 7
Hi All:
I have some basic questions about Cairo graphics engine. I'm trying to use the Cairo package to produce PDF output, mainly because I perceive it to be easy to use with a wide variety of fonts.
But right now, I'm stuck trying to figure out what fonts are available to be used with Cairo, specifically the CairoPDF function. I've been able to successfully produce some test PDFs
2013 Apr 25
2
Decomposing a List
Greetings!
For some reason I am not managing to work out how to do this
(in principle) simple task!
As a result of applying strsplit() to a vector of character strings,
I have a long list L (N elements), where each element is a vector
of two character strings, like:
L[1] = c("A1","B1")
L[2] = c("A2","B2")
L[3] = c("A3","B3")
2011 May 30
2
Basic question about three factor Anova
Read the data using scan():
#
# a1 a2 a3 a4
# ------------- ------------- ------------- -------------
# b1 b2 b3 b1 b2 b3 b1 b2 b3 b1 b2 b3
# --- --- --- --- --- --- --- --- --- --- --- ---
#
# c1:
# 4.1 4.6 3.7 4.9 5.2 4.7 5.0 6.1 5.5 3.9 4.4 3.7
# 4.3 4.9
2005 Mar 19
2
simple problem, but not for me
Hello, I'm new in R and I want to do one thing that is very easy in excel, however, I cant do it in R.
Suppose we have the data frame:
data<- data.frame(A=c("a1","a2","a3","a4","a5"))
I need to obtain another column in the same data frame (lets say B=c(b1,b2,b3,b4,b5) in the following way:
b1=a1/(a1+a2+a3+a4+a5)
2012 Dec 16
3
averaging X of specific Y (latitude)
Hello
I have a table describing butterfly range traits.
It is composed of three columns as below
Species name range size (X) latitude of range midpoint (Y)
There are 11 kinds of butterflies.
Each has its range size, and the latitude of each range midpoint ranges
from 9 to 19.
I would like to have the average range size of every degree of latitude.
For example, the average range
2011 Aug 27
3
all combinations of the elements of two vectors
Dear R-help readers,
I'm sure this problem has been answered but I can't find the solution.
I have two vectors
v1 <- c("a","b")
v2 <- c(1,2,3)
I want an easy way to produce every possible combination of v1, v2 elements
Ie I want to produce
c("a1","a2","a3", "b1","b2","b3")
regards
Desmond
Desmond
2003 May 20
2
Extending %*%
I have lists of matrices stored in various ways. I'd like to extend
%*% to work on these. Is this possible, or should I create my own new
operator?
A simplified example would be as follows:
A <- list( A1, A2, A3)
B <- list( B1, B2, B3)
where A1,...,B3 are all matrices, and I'd like A %*% B to return
list( A1 %*% B1, A2 %*% B2, A3 %*% B3)
In the real case A and B are sometimes