Displaying 4 results from an estimated 4 matches for "var100".
Did you mean:
var10
2012 Aug 27
2
looping through numbered variables
Hello,
This is a beginner question. I am trying to loop through numbered
variables with "apply" to calculate weighted means. My data is "data",
the variables are "var1" to "var100", the weight is "weight". The
command works using
sapply(paste('data$var', 1:100, sep=''), function(x)
weighted.mean(eval(parse(text=x)), data$weight))
but is there a way to avoid eval(parse())?
Thank you,
Daniel
2011 Feb 02
4
looping variable names
Hi all,
I've been looking for a simple answer to the following problem.
Let's say that I can loop through, say, 100 values that need to be assigned
to, say, the variables var1:var100.
Is there an elegant way to do this?
I have seen one or two similar questions...but they tend to be in more
complicated contexts.
Simple question, hopefully with a simple answer.
Thanks very much!
--
View this message in context: http://r.789695.n4.nabble.com/looping-variable-names-tp3255711p32...
2007 Feb 02
1
Access to column names stored in a vector in lm procedure
...ession
with each of theses variables and the variable “length” using e.g. the
while function. I would then extract e.g. the t-value and add it to a
vector (“result”) that contains all results. Something like that:
“variable” should contain the names of the 100 dependent variables (Var1,
Var2, … Var100)
while(i<101){
result<-c(result,coef(summary(lm(variable[i] ~ length, data = data2)))[2,4]);
i<-i+1
}
This example does not work since the lm function does not recognize the
dependent variable’s name.
Does somebody know how to store the names of the dependent variables in
e.g. a vector...
2011 Nov 27
1
sqldf if iif
...iso2 13 100
9999 diso3 2 100
9999 diso4 3 100
I would like subtract column "Num" between the two moments considering only
the changes, therefore I use the conditional if:
var100<-sqldf("select esf100.SAMPLE, esf100.SPECIES, esf100.Num, esf100.esf,
iif esf100.Num - esf50.Num >=0, esf100.Num-esf50.Num,
esf100.Num as PIPAS
from esf100 left join esf50 on esf100.SAMPLE =
esf50.SAMPLE
and esf100.SPECIES = es...