similar to: How to pass a string as an argument to a function?

Displaying 20 results from an estimated 8000 matches similar to: "How to pass a string as an argument to a function?"

2007 Aug 02
6
Error message in lmer
I do not think anyone has answered this. > I'm trying to run a simple one-way ANCOVA with the lmer > function in R package lme4, but have encountered some > conceptual problem. The data file MyData.txt is like this: > > Group Subj Cov Resp > A 1 3.90 4.05 > A 2 4.05 4.25 > A 3 4.25 3.60 > A 4 3.60 4.20 > A 5 4.20 4.05 > A 6 4.05 3.85
2008 Apr 07
3
Extract values from a named array
Sorry for this dumb question. Suppose I have a named array ww defined as ww <- 1:5 names(ww) <- c("a", "b", "c", "d", "e") How can I extract the whole array of numbers without the names? ww[1:5] does not work while ww[[1]] can only extract one number at a time. Thanks, Gang
2007 Aug 22
4
within-subject factors in lme
I don't think, this has been answered: > I'm trying to run a 3-way within-subject anova in lme with 3 > fixed factors (Trust, Sex, and Freq), but get stuck with handling > the random effects. As I want to include all the possible random > effects in the model, it would be something more or less > equivalent to using aov > > > fit.aov <- aov(Beta ~ >
2011 May 22
2
Convert dataframe with two factors from wide to long format
I know how to convert a simple dataframe from wide to long format with one varying factor. However, for a dataset with two factors like the following, Subj T1_Cond1 T1_Cond2 T2_Cond1 T2_Cond2 1 0.125869 4.108232 1.099392 5.556614 2 1.427940 2.170026 0.120748 1.176353 How to elegantly convert to a long form as Subj Time Cond Value 1 1 1 0.125869 1
2011 Oct 06
3
Wide to long form conversion
I have some data 'myData' in wide form (attached at the end), and would like to convert it to long form. I wish to have five variables in the result: 1) Subj: factor 2) Group: between-subjects factor (2 levels: s / w) 3) Reference: within-subject factor (2 levels: Me / She) 4) F: within-subject factor (2 levels: F1 / F2) 5) J: within-subject factor (2 levels: J1 / J2) As this is the
2008 Jan 25
1
Trouble setting up correlation structure in lme
Hi, I'm trying to set up AR(1) as a correlation structure in modeling some data (attached file data.txt in text format) with lme, but have trouble getting it to work. Incent, Correctness, and Oppor are 3 categorical variables, Beta is a response variable, and Time is an equally-spaced variable with 6 time points (treated as a categorical variable as well). Basically I want to model the
2007 Nov 13
1
TRUNCATED error with data frame
Hi , I am new to R. I am trying to run a simple R script as shown below: aov.R ------ data1<-c(49,47,46,47,48,47,41,46,43,47,46,45,48,46,47,45,49,44,44,45,42,45,45,40 ,49,46,47,45,49,45,41,43,44,46,45,40,45,43,44,45,48,46,40,45,40,45,47,40) matrix(data1, ncol= 4, dimnames = list(paste("subj", 1:12), c("Shape1.Color1", "Shape2.Color1", "Shape1.Color2",
2010 Aug 25
3
What does this warning message (from optim function) mean?
Hi R users, I am trying to use the optim function to maximize a likelihood funciton, and I got the following warning messages. Could anyone explain to me what messege 31 means exactly? Is it a cause for concern? Since the value of convergence turns out to be zero, it means that the converging is successful, right? So can I assume that the parameter estimates generated thereafter are reliable MLE
2008 May 30
2
inconsistent output when using variable substitution
I am extremely puzzled by this behavior in R. I have a data frame called Trials in which I have results from an experiment. I am trying to do a subjects analysis, but getting weird results. Each row has 1 trial in it, which includes a column for the subject number I get the list of subject numbers like so: > Subj=unique(sort(Trials$Subj)) Then I loop over them. But I get strange results. As
2011 May 03
3
na.omit - Is it working properly?
I have a work around for this, but can someone explain why the first example does not work properly? I believed it worked in the previous version of R, by selecting just the rows=200525 and omitting the na's. I just upgraded to 2.13. I am also concern with the row numbers being different in the selections, should I be worried? FYI, I just selected the first few rows for demonstration, please
2012 Jan 06
1
lme model specification problem (Error in MEEM...)
Dear all, In lme, models in which a factor is fully "contained" in another lead to an error. This is not the case when using lm/aov. I understand that these factors are aliased, but believe that such models make sense when the factors are fitted sequentially. For example, I sometimes fit a factor first as linear term (continuous variable with discrete levels, e.g. 1,2,4,6), and
2018 Jan 03
2
Nvidia maximum pixel clock issue in kmod-nvidia-384.98
Hi everyone, On CentOS 7 I'm running into an issue with the latest nvidia driver from elrepo: kmod-nvidia-384.98-1.el7_4.elrepo.x86_64 This driver version seem to introduce issue in detecting video modes when a monitor is connected using DVI. As soon as the machine attempts to start X, nothing happens and the monitor goes into sleep mode reporting that it has 'no signal'. It is
2012 Apr 23
2
plot function creating bars instead of lines
Hello, I am having a problem where code that plots lines using a different data frame plots bars with the current data frame (I am intended to plot lines). The code specifies lines (see below), so I can't figure out why the results are bars. I suspect that it may have something to do with the fact that in the data frame where the code worked as intended, the both variables specifying
2008 Feb 05
1
Extracting level-1 variance from lmer()
All, How does one extract the level-1 variance from a model fit via lmer()? In the code below the level-2 variance component may be obtained via subscripting, but what about the level-1 variance, viz., the 3.215072 term? (actually this term squared) Didn't see anything in the archives on this. Cheers, David > fm <- lmer( dv ~ time.num*drug + (1 | Patient.new), data=dat.new )
2004 Mar 19
2
for loop or Hmisc library trap.rule function syntax error
Hello: I am new R user stumped why the R code after this paragraph generates "Error: syntax error" messages after each of the last 2 lines. I have tried searching the manuals, Hmisc documentation, contributed manuals, help archives, and Internet. I am running R 1.7.1 under Windows 2000 (I will upgrade when my imminent OS upgrade happens). My data was successfully entered and
2008 Dec 17
1
repeated measures aov with weights
Dear R-help, I'm facing a problem with defining a repeated measures anova with weighted data. Here's the code to reproduce the problem: # generate some data seed=11 rtrep <- data.frame(rt=rnorm(100),ti=rep(1:5,20),subj=gl (20,5,100),we=runif(100)) # model with within factor for subjects/repeated measurements, no problem aov(rt~ti + Error(subj/ti),data=rtrep) #model with weights
2008 Sep 11
1
plot of all.effects object
All, I'm trying to plot an all.effects() object, as shown in the help for all.effects and also Crawley's R book (p.178, 2007). The data has a repeated measures structure, but I'm using all.effects for the simple lm() fit here. Below is a reproducible example that yields the error message. fm.ex = lm(dv ~ time.num*drug*X, data = dat.new) fm.effects = all.effects(fm.ex, xlevels =
2008 Sep 19
1
Type I SS and Type III SS problem
Dear all: I m a newer on R.? I have some problem when I use?anova function.? I use anova function to get Type I SS results, but I also need to get Type III SS results.? However, in my code, there is some different between the result of Type I SS and Type III SS.? I don?t know why the ?seqe? factor disappeared in the result of Type III SS.? How can I do?? Here is my example and result.
2003 Dec 17
1
repeated measures aov problem
Hi all, I have a strange problem and rigth now I can't figure out a solution. Trying to calculate an ANOVA with one between subject factor (group) and one within (hemisphere). My dependent variable is source localization (data). My N = 25. My data.frame looks like this: > ML.dist.stack subj group hemisphere data 1 1 tin left 0.7460840 2 2 tin left
2007 May 16
1
lmer error confusion
Hi All. I'm trying to run a simple model from Baayan, Davidson, & Bates and getting a confusing error message. Any ideas what I'm doing wrong here? # Here's the data..... Subj <- factor(rep(1:3,each=6)) Item <- factor(rep(1:3,6)) SOA <- factor(rep(0:1,3,each=3)) RT <- c(466,520,502,475,494,490,516,566,577,491,544,526,484,529,539,470,511,528) priming