Displaying 11 results from an estimated 11 matches similar to: "Trouble Passing a for loop variable (iteration #) to a data frame"
2011 Sep 12
2
Automated generation of combinations
Hello,
I'd like to generate automatically all the possible combinations of a set of 8 variables (there are 535, too many to do it by hand). For example:
input: varA, varB, varC
output: varA+varB+varC
varA+varB
varA+varC
varB+varC
varA
varB
varC
Is there any function that produces this option?
Thank you
[[alternative
2012 Jan 01
1
How to pass in a list of variables as an argument to a function?
Hello,
I have some code that currently works fine and I am endeavoring to
convert the major pieces of it into functions.
This involves taking "hard coded" names of variables that are used in
various places and figuring out how to
abstract them out into functions where the arguments (i.e. a list of
variables)?can be passed to the parent function
and used within that function for various
2007 Jul 12
1
ggplot doesnt work in loops?
Dear list members
I am still a newbie so might be asking a stupid question, but I can't get
ggplot to work in a loop (or a "while" statement for that matter).
# to take a minimal example -
mydata$varc = c(1,2,3)
for (i in 1:1){
jpeg("test3.jpg")
plot(mydata$varc)
#ggplot(mydata, aes(x=mydata$varc)) + geom_bar()
dev.off()
}
this produces
2006 Jan 26
1
Using special characters
Dear R users
I'm having problems in putting special characters (like 佱, 併, 佺 ) in my plots, as much in titles, as in axis names, as in legend...when I save them as a pdf document. They don't appear...
I don't know if it is because I'm using a linux platform...
The script is the following:
library(grDevices) jpeg(file="Fronteira/FronteiraNova.jpeg",
2007 Nov 07
2
creating a dynamic output vector
Let's say I have a program that returns variables whose names may be any
string within the vector
NAMES=c("varA","varB","varC","varD","varE","varF"..."varZ"), but I do
not ever know which ones have actually been created. So in one example
output, "varA", "varC", and "varD" could exist, but
2012 Jul 18
1
fitting several lme sistematically
Dear R-list,
I have a data set (in the following example called "a") which have:
one "subject indicator" variable (called "id")
three dependent variables (varD, varE, var F)
three independent variables (varA, varB, varC)
I want to fit 9 lme models, one per posible combination (DA, DB, DC, EA, EB, EC, FA, FB, FC).
In stead of writting the 9 lme models, I want to
2011 Aug 03
1
Coefficient names when using lm() with contrasts
Dear R Users,
Am using lm() with contrasts as below. If I skip the contrasts()
statement, I get the coefficient names to be
> names(results$coef)
[1] "(Intercept)" "VarAcat" "VarArat" "VarB"
which are much more meaningful than ones based on integers.
Can anyone tell me how to get R to keep the coefficient names based on the
factor levels
2005 Apr 07
2
newline in lattice axis label
Hi,
I have a 3 panel xyplot with different variables in the y axis. I'm trying
to insert a newline after "Width (cm)," in the ylab argument as in the
example below. My goal is to have the y axis label broken into two lines,
split after the string just mentioned.
plotfun <- function() {
fakedf <- data.frame(A = sample(1:100, 50),
B = rnorm(50),
2011 May 05
3
cross-correlation table with subscript or superscript to indicate significant differences
Hi, I wonder whether the following is possible with R, and whether anyone has done that and can share his/her code with me. I have a correlation matrix, and I want to create a correlation table that I can copy to Microsoft Word with a superscript above each correlation, indicating significant differences in the same row. That is, when correlations in the same row do not share superscript, it means
2008 Oct 29
0
reporting interactions of factors in linear mixed effects models
Hi,
I have a question about how I should report the results for a linear
mixed effects model where the model includes as predictors three
factors (facA, facB and facC), one of which (facA) interacts with the
other two. facA and facB have two levels and facC has 3 levels. There
are also several other continuous predictors (e.g. varA, varB, varC).
My mixed model is specified with the following
2009 Mar 27
2
Assignment to variables fails to loop
Dear all,
I think I'm nearly there in writing R code which will read in files with two variable parts to the file name and then assigning these file names to objects, which also have two variable parts. I have got the code running without encountering errors, however, I receive 50+ of the same warnings:
1: In assign(paste("Fekete_", index$year, index$month, sep = ""),