search for: varlist

Displaying 20 results from an estimated 60 matches for "varlist".

Did you mean: va_list
2020 Jan 13
0
Error in R CMD check --as-cran ?
...xes the issue.?? The function exists only to save some typing.? (No need to really read the block, just notice the multiple calls to ismat() ??? ismat <- function (x) { ??????? inherits(x, c("matrix", "bdsmatrix", "Matrix"), which=FALSE) ??? } ??? if (missing(varlist) || is.null(varlist)) { ??????? varlist <- vector('list', nrandom) ??????? for (i in 1:nrandom) varlist[[i]] <- coxmeFull() #default ??? } ??? else { ??????? if (is.function(varlist)) varlist <- varlist() ??????? if (inherits(varlist, 'coxmevar')) varlist <- list(v...
2005 Feb 08
5
How to get variable names in a function?
...(bravo); table(charly) > table(bravo); table(charly) bravo 1 2 3 5 2 1 1 3 charly 1 2 4 7 1 1 2 2 The results are two tables with the names of the variables above each. If I want to do the same thing by a function I find no way to get the variable names above the tables. demofn<-function(varlist) {for (i in seq(along=varlist)) {cat(deparse(varlist[i])) # < - - - - how to change this? print(table(varlist[i]))}} > demofn(list(bravo, charly)) list(c(1, 1, 2, 3, 5, 5, 5)) 1 2 3 5 2 1 1 3 list(c(7, 7, 4, 4, 2, 1)) 1 2 4 7 1 1 2 2 > Thanks, Heinz T?chler
2008 Mar 25
1
Error propagation
...he context of writing a general function for error propagation in R. There are somehow a few questions I would like to ask (discuss), as my statistical knowledge is somewhat restricted. Below is the function I wrote, the questions are marked. Many thanks in advance. propagate <- function(expr, varList, type = c("stat", "raw"), cov = TRUE) { require(gtools, quietly = TRUE) if (!is.expression(expr)) stop("not a valid expression!") if (!is.list(varList)) stop("values are not of type 'list'!") type <- match.arg(type)...
2010 Feb 18
1
variable substitution
...e, but can't figure out how to do the necessary variable substitution. In bash (or C) I would use "$var", but there seems to be no equivalent in R. The data.frame has 300 columns and 2500 rows. Not all columns are continuous variables, some are factors, descriptors, etc., so I use the varlist to pick which columns I want to analyze. #Example script varlist<-read.table(/path/to/varlist) for (i in 1:length(varlist)){ res<-mean(Dataset$SOMETHINGHERE_i ) write(res) somewhere } Something like that. Any suggestions? Thanks Jon Soli Deo Gloria Jon Erik Ween, MD, MS Scientist, Kun...
2003 Oct 08
2
Generating automatic plots
...ng' that has value 1 if some variable in a concrete case has at least one missing value, in order to check if the cases that don't enter in my analysis are biased. The first attempt was to start generating a list with the variables of contrast and then apply the list to the plots: > varlist <- c("var1", "var2", "var3", "var4", ...) > for (i in 1:length(varlist)) { + jpeg("varlist[i].jpg", width=480, heigth=480) + boxplot (varlist[i] ~ missing, xlab="missing values", ylab="varlist[i]) + } But I got 'Error i...
2012 Mar 10
1
Treat Variable as String and a String as variables name
Dear all. I am having ten variables (let's call the four of them as Alpha, Beta, Gamma and Delta.....) For each variable I have to print around 100 (plots). E So far I was copying paste the code below many times. pdf(file="DC_Alpha_All.pdf", width=15) # First Variable is treated as string plot_dc_for_multiple_kapas(Alpha, 4, c(5, 4), coloridx=c(24, 32)) # First Variable is
2012 Nov 24
1
Bootstrap lmekin model
...in order to estimate heritability. I want to estimate the confidence interval of the variance coefficient and so I should use a bootstrap simulation. The pedigree file has 1386 subjects so I create a kinship matrix [1386*1386].This is the code of R I use: kfit2 <- lmekin(IT~1+AGE +(1|ID), dati1, varlist=list(kmat))kfit2kfit2$vcoef library(boot) var <- function(formula,data,indices,varlist) { d <- data[indices,] # allows boot to select sample kfit2 <- lmekin(formula, data=d, varlist=list(kmat)) return(kfit2$vcoef)} # bootstrapping with 1000 replications results <- boot(data=dati1,...
2016 Dec 13
2
syntax difference clusterExport in parallel and snow
We got some errors and eventually figured out that parallel::clusterExport second argument is "varlist" while in snow::clusterExport it is "list". The user had loaded parallel first, but did something else which inadvertently loaded snow, then clusterExport failed because we had "varlist" and not "list". Are these different on purpose? pj -- Paul E. Johnson...
2010 Feb 25
3
variable substitution in for loops
...uestion from the lists, so here goes: I have several dataframes, 200+ columns 2000+ rows. I wish to script some operations to perform on some of the variables (columns) in the data frames not knowing what the column number is, hence have to refer by name. I have variable names in a text file "varlist". So, something like this: for (i in 1:length(varlist)){ j<-varlist[i] v<-mean(Dataset[[j]]) print(v) } Now, if I force it j<-"Var1" v<-mean(Dataset[[j]]) print(v) then it works, but not if i read the varlist as above. Looking at "j" I get: > print(...
2007 Oct 22
3
Elasticity in Leslie Matrix
Dear R-users, I would like to calculate elasticities and sensitivities of each parameters involved in the following transition matrix: A <- matrix(c( sigma*s0*f1, sigma*s0*f2, s, v ), nrow=2, byrow=TRUE,dimnames=list(stage,stage)) The command "eigen.analysis" avaliable in package "popbio" provides sensibility matrix and elasticity matrix
2009 Oct 11
1
How do you test if a number is in a list of numbers?
Hi, I want to subset a data frame if one of the variables matches any in a list. I could of course do something like this: subset(dataset, var == 1 | var == 2 | var ==3) but that's tedious. I tried varlist = c(1,2,3,4) subset(dataset, any(var == varlist)) but it doesn't work because 'any' doesn't go row-by-row and hence always returns TRUE. Is there any simple way to do this? Justin -- View this message in context: http://www.nabble.com/How-do-you-test-if-a-number-is-in-a-list-of-n...
2013 Feb 18
3
foreach loop, stata equivalent
Hi! I'm a recent convert from Stata, so forgive my ignorance. In Stata, I can write foreach loops (example below) foreach var of varlist p1-p14 { foreach y of varlist p15-p269 { reg `var' `y' } } It's looping p1-p15, p1-p16...., p1-p269, p2-p15, p2-p16,... p2-p269,... variable pairs. How can I write something similar in R? I 'tried' understanding the package.foreach but can't get it to work....
2007 Oct 25
0
libswfdec/swfdec_as_object.c
...dec_as_object.c +++ b/libswfdec/swfdec_as_object.c @@ -1518,14 +1518,11 @@ swfdec_as_object_toString (SwfdecAsContext *cx, SwfdecAsObject *object, void swfdec_as_object_decode (SwfdecAsObject *object, const char *str) { + SwfdecAsContext *cx = object->context; SwfdecAsValue val; char **varlist, *p; guint i; - str = swfdec_as_string_unescape (object->context, str); - if (str == NULL) - return; - varlist = g_strsplit (str, "&", -1); for (i = 0; varlist[i] != NULL; i++) { @@ -1538,13 +1535,16 @@ swfdec_as_object_decode (SwfdecAsObject *object, const char *...
2011 Apr 15
1
no solution yet, please help: extract p-value from mixed model in kinship package
...(100, 30, 5) > covtrait <- rnorm(100, 10, 5) > > mydata <- data.frame(id, yvar, covtrait, snpmat) > #******************************mixed model in lmekin ******************************************* > > fmod <- lmekin(yvar ~ mydata[,3] , data= mydata, random = ~1|id, > varlist=list(kmat)) $coefficients[2,4] # does not work > > # **************************************error > message******************************************** > Error message: Error in lmekin(yvar ~ mydata[, 3], data = mydata, random = ~1 | id, varlist = list(kmat))$coefficients[2, : inc...
2007 Oct 31
0
5 commits - libswfdec/swfdec_as_object.c libswfdec/swfdec_audio.c libswfdec/swfdec_sound.c libswfdec/swfdec_xml.c
...b/libswfdec/swfdec_as_object.c index 682cb2b..d0709ac 100644 --- a/libswfdec/swfdec_as_object.c +++ b/libswfdec/swfdec_as_object.c @@ -1557,7 +1557,7 @@ swfdec_as_object_decode (SwfdecAsObject *object, const char *str) { SwfdecAsContext *cx = object->context; SwfdecAsValue val; - char **varlist, *p; + char **varlist, *p, *unescaped; guint i; varlist = g_strsplit (str, "&", -1); @@ -1571,15 +1571,21 @@ swfdec_as_object_decode (SwfdecAsObject *object, const char *str) } if (p != NULL) { - SWFDEC_AS_VALUE_SET_STRING (&val, - swfdec_as_context_giv...
2012 Oct 18
1
Getting a table of coefficients from R
Hi,? I'm trying to obtain a table of coefficients and confidence intervals from a logistic regression analysis in R. My code is as follows: # read in csv file datafile<-read.csv("file.csv", row.names=1) # read in the variable list varlist<-names(datafile)[66:180] models<-lapply(varlist, function(x) {glm(substitute(outcome ~ i, list(i=as.name(x))), data=datafile, family = "binomial")}) # apply summary to each model stored in the list, models lapply(models, summary) tableofOddsRatios<-exp(cbind(OR = coef(models),...
2010 Oct 12
1
Help with function writing
...3){ model <- lm(outcome ~ exposure + covar1 + covar2 + covar3) expected <- predict(model) summary(expected) } library(MASS) attach(birthwt) custom(bwt, lwt, low, age, race) #Works when 3 covariates are specified custom(bwt,lwt,low,age) # Does not work with < or > 3 covariates varlist <- list(low,age,race) custom(bwt,lwt, varlist) #Does not work if covariates are included as a list Thanks very much for your help Tim -- Tim Elwell-Sutton University of Hong Kong
2010 Nov 11
3
Evaluation puzzle
...ll), and the following selected arguments m <- m[c(1, match(c('formula', 'data', 'weights', 'subset', 'na.action'), names(m), nomatch=0))] m[[1]] <- as.name("model.frame") # Add in the ratetable variables varlist <- attr(ratetable, 'dimid') tform <- paste(deparse(formula), paste(varlist, collapse='+'), sep='+') m$formula <- tform print(m) print(ls(parent.frame())) mf <- eval(m, parent.frame()) names(mf) } Here is the test data tdata &lt...
2013 Jan 11
0
Error with looping through a list of strings as variables
...ata = data, numeric_trafo = numeric_trafo, factor_trafo = factor_trafo, : data class character is not supported In addition: Warning message: In storage.mode(RET@predict_trafo) <- "double" : NAs introduced by coercion The code runs fine with the data before I add the > for (h in varlist){ loop. Loops i, k work without issue as long as I manually enter the response variable into the code below for h. Using R 2.15.0 (64bit), with cforest from the "party" package. Any thoughts would be of great help. Cheers Note : The data used in the script below is not the actual da...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add assignment built-in support again
...do { @@ -677,10 +698,10 @@ parse_command_args(char **argv, const char **path) } } while ((c = *cp++)); } - return argv; -} - + arglist->list = sp; + return DO_NOFUNC; +} /* * Execute a simple command. @@ -702,6 +723,7 @@ evalcommand(union node *cmd, int flags) struct arglist varlist; char **argv; int argc; + struct strlist *osp; struct strlist *sp; #ifdef notyet int pip[2]; @@ -711,6 +733,7 @@ evalcommand(union node *cmd, int flags) char *lastarg; const char *path; int spclbltin; + int cmd_flag; int execcmd; int status; char **nargv; @@ -733,13 +756,47 @@...