similar to: variable substitution

Displaying 20 results from an estimated 500 matches similar to: "variable substitution"

2010 Feb 25
3
variable substitution in for loops
Friends I can't quite find a direct answer to this question 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:
2010 Jun 09
1
generate list of variable names
Hi! Would anyone know how to generate a list of variable names from a data frame by the class of the variable? I have large tables with different numbers of columns and am trying to script some rote analyses. There are several categorizing variables (factors) and many response variables (integers and numeric). I want to extract a list of classifier column names in one list and response variable
2008 Jan 22
1
row-wise conditional update in dataframe
Hi! I need to conditionally update a dataframe field based on values in other fields and can't find even how to search for this right. Sorry if this has been asked before. But, specifically, I have a 490 X 221 dataframe and need to count, by row, how many fields in Dataframe$field_a...Dataframe$field_zz are non-null and enter this value in Dataset$ABCtaskNum. I have field name
2003 Oct 08
2
Generating automatic plots
Hello, I have been trying to write a small program to generate automatic plots. What I want is to draw boxplots for some variables in my data frame, contrasting with a variable called 'missing' 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
2012 Nov 24
1
Bootstrap lmekin model
Hi,I use the 'lmekin' model of the 'kinship' package of R 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,
2005 Feb 08
5
How to get variable names in a function?
Hello, applying a function to a list of variables I face the following problem: Let's say I want to compute tables for several variables. I could write a command for every single table, like bravo<-c(1,1,2,3,5,5,5,);charly<-c(7,7,4,4,2,1) table(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
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.
2011 Apr 15
1
no solution yet, please help: extract p-value from mixed model in kinship package
I am making the question clear. Please help. > Dear R experts > > I was using kinship package to fit mixed model with kinship matrix. > The package looks like lme4, but I could find a way to extract p-value > out of it. I need to extract is as I need to analyse large number of > variables (> 10000). > > Please help me: > > require(kinship) > > #Generating
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?
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
2010 Dec 09
4
lapply getting names of the list
Hello All, I have a toy dataframe like this. It has 8 columns separated by tab. Name SampleID Al1 Al2 X Y R Th rs191191 A1 A B 0.999 0.09 0.78 0.090 abc928291 A1 B J 0.3838 0.3839 0.028 0.888 abcnab A1 H K 0.3939 0.939 0.3939 0.77 rx82922 B1 J K 0.3838 0.393
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 =
2010 Oct 12
1
Help with function writing
Hello all I have what seems like a simple question but have not been able to find an answer on the forum. I'm trying to define a function which involves regression models and a large number of covariates. I would like the function to accept any number of covariates and, ideally, I would like to be able to enter the covariates in a group (e.g. as a list) rather than individually. Is there any
2010 Nov 11
3
Evaluation puzzle
The survexp function can fail when called from another function. The "why" of this has me baffled, however. Here is a simple test case, using a very stripped down version of survexp: survexp.test <- function(formula, data, weights, subset, na.action, rmap, times, cohort=TRUE, conditional=FALSE, ratetable=survexp.us, scale=1, npoints, se.fit,
2020 Jan 13
0
Error in R CMD check --as-cran ?
I've been fighting a CMD check error for coxme this morning.?? I thought I had it fixed, but instead I had forgotton --as-cran on my last test run.? So the version just submitted to CRAN has warning messages in the log. I think it is an issue with CRAN.?? I've sent a message to R-devel asking for help.?? Since then, as a guess, I renamed my internal "ismat" function to
2008 May 19
2
recoding data with loops
# I'm new to R and am trying to get the hang of how it handles # dataframes & loops. If anyone can help me with some simple tasks, # I'd be much obliged. # First, i'd like to generate some random data in a dataframe # to efficiently illustrate what I'm up to. # let's say I have six variables as listed below (I really # have hundreds, but a few will illustrate the point). #
2012 Oct 07
1
variances of random effects in coxme
Dear R users, I'm using the function coxme of the package coxme in order to build Cox models with complex random effects. Unfortunately, I sometimes get surprising estimations of the variances of the random effects. I ran models with different fixed covariates but always with the same 3 random effects defined by the argument varlist=coxmeMlist(list(mat1,mat2,mat3), rescale = F, pdcheck = F,
2008 Mar 05
1
coxme - fitting random treatment effect nested within centre
Dear all, I am using "coxme" function in Kinship library to fit random treatment effect nested within centre. I got 3 treatments (0,1,2) and 3 centres. I used following commands, but got an error. > ugroup=paste(rep(1:3,each=3),rep(0:2,3),sep='/') > mat1=bdsmatrix(rep(c(1,1,1,1,1,1,1,1,1),3),blocksize=rep(3,3),dimnames=list(ugroup,ugroup)) >
2011 Feb 04
1
GWAF package: lme.batch.imputed(): object 'kmat' not found
Hello, All, GWAF 1.2 R.Version() is below. system(lme.batch.imputed( phenfile = 'phenfile.csv', genfile = 'CARe_imputed_release.0.fhsR.gz', pedfile='pedfile.csv', phen='phen1', covar=c('covar1','covar2'), kinmat='imputed_fhs.kinship.RData', outfile='imputed.FHS.IBC.GWAF.LME.output.0.txt' )) Gives the error messages: Error in
2005 Feb 10
1
skip missing values in plots
I really like these Trellis graphics but how do I get this code to skip the missing? logreg<-read.csv("logreg.csv", header=TRUE, sep=",", na.string=" ") attach(logreg) bwplot(yesno~bc_pcb_tot |varlist, data=logreg, main="Box Cox PCB transformation", auto.key=TRUE, fontfamily = "HersheySans" ) Dean Sonneborn M.S. Public Health Sciences *