search for: varb

Displaying 20 results from an estimated 20 matches for "varb".

Did you mean: var
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 HTML version deleted]]
2007 Dec 07
5
Grouping by interval
Hello, I have a dataframe of say 20 lines with one line per individual. I want to group these 20 individuals by length class (eg. of 5cm) and get the mean value of all the other variables (eg VarA and VarB) for each length class My dataframe is as follow: Length <- 10:30 VarA <- seq(1000,1200,10) VarB <- seq(500,700,10) Data <- cbind(Length,VarA,VarB) And I want to get something like: Length Class Mean VarA Mean VarB [10-15[ 1020 520 [15-20[...
2008 Mar 16
2
How to loop through all the columns in dataframe
...pd<- c(0.017046,0.018504,0.012157,0.012253,0.012348,0.011997,0.012825) td<- c(160524,163565,143973,111956,89677,95269,81558) mydf<-data.frame(xd,pd,td) trans<-t(mydf) trans I have these values that I need to include while looping: varA<- 0.0000036084 covAB<- (-0.0000013046) varB<- 0.00000052628 After transposing my dataframe I need something like the following: varA + col1*covAB + col2*covAB + col1*col2*varB varA + col1*covAB + col3*covAB + col1*col3*varB varA + col1*covAB + col4*covAB + col1*col4*varB varA + col1*covAB + col5*covAB + col1*col5*varB and so...
2012 Jan 01
1
How to pass in a list of variables as an argument to a function?
...as a string, not as individual arguments. Thanks in advance, Randall ################################################################# # libraries used library(reshape) # create some data similar to use case myData = data.frame(expand.grid(varA=c("a", "b", "c"), varB=c("d", "e", "f"), varC=c("g", "h", "i"), varD=c("old", "new")), n=1000, fail=rbinom(2700,1000, 0.01)) # add in one more column myData$pass = myData$n-myData$fail # List of grouping vars. ?I would like to pass this obj...
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
2011 Apr 08
0
dynamic argument names and values as variables inside a loop
...After much trial and error, and an exhaustive search of the archives, I'm writing to solicit help with a problem. I want to dynamically modify variable names and values as function arguments inside a loop. I have a canned function from a package that takes ellipsis (...) arguments of the form varb=vval where varb is a name and vval is either numeric or character. I want to create a dynamic version of this function for batch processing that allows the varb and vval to be variable. For instance, in this toy example: a.func<-function(...){ does.something(...) } #I need to pass varb as a...
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 whilst using contrasts rather than labelling them with integers? Many thanks in advance, Pete Cardiff, UK > dt=read.table("test...
2004 Dec 21
3
R code for var-cov matrix given variances and correlations
Dear list members, Where can I find code for computing the p*p variance-covariance matrix given a vector of p variances (ordered varA, varB, ..., varp) and a vector of all possible correlations (ordered corAB, corAC, ..., corp-1,p)? I know that the covariance between 2 variables is equal to the product of their correlation and their standard deviations: corAB * varA^.5 * varB^.5 and so: covAB <- function(corAB, varA, varB) {...
2007 Mar 16
1
multiple scores per subject
Hi, I have a data set that looks like this: > data vara varb S PC 1 None 250 1 80 2 None 250 1 70 3 Some 250 1 60 4 Some 250 1 70 5 None 1000 1 90 6 None 1000 1 90 7 Some 1000 1 80 8 Some 1000 1 70 9 None 250 2 100 10 None 250 2 80 11 Some 250 2 70 12 Some 250 2 70 13 None 1000 2 100 14 None 1000 2 90 15 Some 1000 2 50 16 Some...
2006 Aug 15
3
merge 2 data frame based on more than 2 variables
Dear Lister, I understand merge() can be used to join 2 data frames based on 1 variable. But how about merge based on more than 2 variables? Thank you so much! -- WenSui Liu (http://spaces.msn.com/statcompute/blog) Senior Decision Support Analyst Health Policy and Clinical Effectiveness Cincinnati Children Hospital Medical Center [[alternative HTML version deleted]]
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 do it sistematically (the example is a simplification of what I really have). Here you have the comands for the first model: library(nlme) set.s...
2004 Nov 01
1
plot time series / dates (basic)
...ame d). So, how can I use the name of a vector as title or label in a plot? Thank you, b. d <- ('data.csv', header = T, sep = ",", quote="", dec=".", fill = T, skip=0) attach(d) #function to plot a long time series piece by piece pl <- function(vara, varb, points) { date <- as.POSIXct(strptime(as.character(Date), "%d-%b-%y"), tz = "GMT") pr1 <- vector(mode="numeric") pr2 <- vector(mode="numeric") dat <- vector() for (j in 1:(round(length(Vol)/points)+1)) #number of plots { for (i in ((j-1...
2003 Apr 03
1
Tukey's one degree of freedom for nonadditivity?
Is there code available to decompose interactions involving at least one nominal factor with more than 2 levels as described, e.g., by Tukey or by Mandel (1971, Technometrics, 13: 1-18)? Tukey's model: E(y[i,j]) = mu0 + a[i] + b[j] + c*a[i]*b[j], estimating a, b, and c so sum(a) = sum(b)= 0. Mandel essentially describes a singular value decomposition of the interaction. Thanks,
2008 Oct 29
0
reporting interactions of factors in linear mixed effects models
...hould 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 formula: model <- lmer(RT~ facA*facB*facC - facA:facB:facC - facB:facC + + varA + varB + varC + ... + (1|subject) + (1| item), data=alldata) Here are the estimates of the fixed effects: Estimate...
2012 Sep 20
2
VarBrul in R
Several years ago there were R implementations of a socio-linguistics analysis method called Variable Rule Analysis namely rbrul and r-varb. Both neither of the sites listed (in the method's WikiPedia page http://en.wikipedia.org/wiki/Variable_rules_analysis ) appear to be online any more (one was at UPenn and the other at Indiana). Does anyone know a) whether the code for either or both of these implementations survives out there...
2005 Apr 07
2
newline in lattice axis label
...B = rnorm(50), C = rnorm(50), D = rnorm(50)) myplot <- xyplot(B + C + D ~ A, data = fakedf, outer = TRUE, allow.multiple = TRUE, layout = c(1,3), ylab = list(expression(paste( "VarB (cm" ^2, "), VarC (cm),\n or VarD (cm)"))), xlab = list("VarA (d)")) postscript("testfig.eps") print(myplot) dev.off() } As you can see, this is not producing the desired result, which is probably associated with 3 warnings: Warning mess...
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 in another example output "varA&qu...
2011 Nov 14
1
correlations between columns for each row
...have decided it is something I have to deal with but can’t, so here goes: I have a dataset (called maindata, it is 271 columns *13890 rows so I wont post the entire thing here, I’ll just explain the situation!) I am trying to calculate inter-environment correlation (rF = cov A,B / sq.root(varA * varB ) for each row of the dataset. the values needed are (in 80 of the columns 2*40) in columns 174-213, and 214-253 respectively which represent two environments (A or B). Each of those columns is labelled with Xnumber.A/B e.g. X208.A is column 174 (which also relates to the first column in...
2005 Aug 10
2
extend question
Is it possible to call the super class''s version of a function from a subclass? SuperClass = Class.create(); SuperClass.prototype = { initialize: function(){ this.varA = ''''; this.varB = ''''; } } SubClass = Class.create(); SubClass.prototype = (new SuperClass()).extend({ initialize: function(somevar) { this.somevar = somevar; } }); -- Ryan P. Miller ryan@numinalabs.com
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 = ""),