similar to: Reconstruction of a "valid" expression within a function

Displaying 20 results from an estimated 1000 matches similar to: "Reconstruction of a "valid" expression within a function"

2009 Jan 23
3
Table Modification
I am trying to construct a two-way table where, instead of printing the two-way frequencies in the table, I would like to print the values of a third variable that correspond to the frequencies. For example, the following is easily constructed in R > fact1 <- factor(sample(LETTERS[1:3],10,replace=TRUE)) > fact2 <- factor(sample(LETTERS[25:26],10,replace=TRUE)) > fact3
2004 Aug 10
4
Enduring LME confusion… or Psychologists and Mixed-Effects
Dear ExpeRts, Suppose I have a typical psychological experiment that is a within-subjects design with multiple crossed variables and a continuous response variable. Subjects are considered a random effect. So I could model > aov1 <- aov(resp~fact1*fact2+Error(subj/(fact1*fact2)) However, this only holds for orthogonal designs with equal numbers of observation and no missing values.
2004 Aug 11
1
Fwd: Enduring LME confusion… or Psychologists and Mixed-Effects
In my undertstanding of the problem, the model lme1 <- lme(resp~fact1*fact2, random=~1|subj) should be ok, providing that variances are homogenous both between & within subjects. The function will sort out which factors & interactions are to be compared within subjects, & which between subjects. The problem with df's arises (for lme() in nlme, but not in lme4), when
2004 Aug 12
0
Re: R-help Digest, Vol 18, Issue 12
The message for aov1 was "Estimated effects <may> be unbalanced". The effects are not unbalanced. The design is 'orthogonal'. The problem is that there are not enough degrees of freedom to estimate all those error terms. If you change the model to: aov1 <- aov(RT~fact1*fact2*fact3+Error(sub/(fact1+fact2+fact3)),data=myData) or to aov2 <-
2007 May 15
3
aov problem
I am using R to make two-way ANOVA on a number of variables using g <- aov(var ~ fact1*fact2) where var is a matrix containing the variables. However the outcome seem to be dependent on the order of fact1 and fact2 (i.e. fact2*fact1) gives a slightly (factor of 1.5) different result. Any ideas why this is? Thanks for any help Anders
2009 Nov 12
1
Rearranging long tables, Sweave, xtable, LaTeX
Dear R-users, consider the two following outputs, ## 1 and ## 2 \begin{Scode}{Setup, echo = FALSE, print = FALSE, eval = TRUE} with(expand.grid(Fact1 = 1:3, Fact2 = 1:40), table(Fact1, Fact2)) ## 1 xtable(with(expand.grid(Fact1 = 1:3, Fact2 = 1:40), table(Fact1, Fact2))) ## 2 \end{Scode} The first line with(expand.grid(Fact1 = 1:3, Fact2 = 1:40), table(Fact1, Fact2))
2005 Apr 26
0
Construction of a "mean" contengency table
Hi List, Say I have a data.frame "DF" with 6 columns, 3 factors and 3 variables, with different number of repetitions for each combination of factors. I would like to build, for two given factors, a matrix per variable, containing in each cell the mean or sd for a given couple of factors. I have managed to get to the result I wanted step by step, but I would like to have it in a
2004 Jun 25
2
simple questions
Hello, I am a new user or R, and am so far very impressed with its capabilities. However, I have no programming experience, and am having some issues in trying to tell the software what I want done. There are basically two issues which I am currently grappling with. The first, I have a data matrix, with two factors and dozens of response variables. I am interested on conducting ANOVAs on
2002 Jan 22
1
lme and mixed effects
Dear r-help, With lme, is there a way to specify multiple fixed factors under one level of grouping? For example, for a single fixed factor, I use the following: fm1.lme <- lme(fixed=resp ~ fact1, random=~1|subj/fact1, data=mydata) I would like to have multiple factors under subj, like the following for a two-way design, but I get an error: fm2.lme <- lme(fixed=resp ~ fact1*fact2,
2004 May 28
1
dotchart questions
I am trying to put 3 dotcharts side-by-side with minimal space between each. Each chart is for a different variable, but the vertical axes are the same. I want to have vertical axis labels on the lefthand chart but no vertical axis labels on the other two. Plus, I would like very little space between charts 1 & 2 and between charts 2 & 3. I have one approach but am not too happy with
2008 Feb 20
3
reshaping data frame
Dear all, I'm having a few problems trying to reshape a data frame. I tried with reshape{stats} and melt{reshape} but I was missing something. Any help is very welcome. Please find details below: ################################# # data in its original shape: indiv <- rep(c("A","B"),c(10,10)) level.1 <- rpois(20, lambda=3) covar.1 <- rlnorm(20, 3, 1) level.2
2009 Dec 22
4
Problem with expand.grid
Hi All, This example code ---------------- dDF <- structure(list(y = c(4.75587, 4.8451, 5.04139, 4.85733, 5.20412, 5.92428, 5.69897, 4.78958, 4, 4), t = c(0, 48, 144, 192, 240, 312, 360, 0, 48, 144), Batch = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), T = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2), pH = c(4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6), S = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), N = c(0, 0, 0, 0,
2005 Dec 01
8
Impaired boxplot functionality - mean instead of median
Hello to all users and wizards. I am regulary using 'boxplot' function or its analogue - 'bwplot' from the 'lattice' library. But they are, as far as I understand, totally flawed in functionality: they miss ability to select what they would draw 'in the middle' - median, mean. What the box means - standard error, 90% or something else. What the whiskers mean -
2012 Jul 02
5
ggplot: dodge positions
Dear all, I want to get a series of boxplots (grouped by two factors) and I want to overlay the original observations and the following code does almost what I want: library(ggplot) ddf <- data.frame(x=factor(rep(LETTERS[1:4], each=30)), y = runif(120,0,10), grp = factor(rep(rep(1:3, 10), 4))) ggplot(ddf, aes(x, y, colour=grp)) + geom_boxplot() + geom_point() Yet the position of the points
2012 Jul 03
2
ggplot2: legend
Dear all, I produced the following graph with ggplot which is almost fine, yet I don't like that the legend for "Means" and "Observations" includes a line, though no line is used in the plot for those two (the line for "Overall Mean" on the other hand is wanted): library(ggplot2) ddf <- data.frame(x = factor(rep(LETTERS[1:2], 5)), y = rnorm(10)) p <-
2020 Jan 28
1
mrds function integratepdf cannot be found
Hi, Trying to use the function integratepdf of the mrds package, I get this message: |Error in integratepdf(fox.ds$ddf$ds$aux$ddfobj, select = rep(TRUE, nrow(fox.ds$ddf$ds$aux$ddfobj$xmat)), : could not find function "integratepdf" | Has anyone already had this issue ? Maybe the function is not exported in the namespace? Best, Patrick > library(mrds) This is mrds 2.2.0
2009 Jun 02
2
What do you think about my function?
Hello, I want to know what do you think about my function. I know that it isn't briliant :/ but what do you think? What I should do that my function will be better? (now is very slow and not ideal, sometimes I also get a mistake!) ########## My function ############################################# dzieci<-transform(dzieci, zywnosc=0) zywnoscCalosc<- function( jedzenie, sklep, n1, n2,
2010 Jul 20
1
apply: return list of matrices
Hi everybody, Suppose we have the following data structure: ddf <-data.frame(a=rep(1:4,3), b=rep(paste("p", 1:3, sep=""), each=4), c=c(1,0,0,1,1,1,0,1,1,1,1,1)) I want now to make a contingency table for each pair of values of p, i.e. a contingency table for each of the pairs (p1,p2), (p1,p3) and (p2,p3). The result should be given as a list of matrices: # [[1]]
2008 Aug 07
2
lattice: add vertical lines in xyplot
Hi list, This is a very basic question about lattice: I wish to add some vertical lines in each panel of a xyplot as demonstrated in this example: > library(lattice) > > xx <- seq(1, 10, length=100) > x <- rep(xx, 4) > y <- c(cos(xx), sin(xx), xx, xx^2/10) > fact <- factor(rep(c("cos", "sin", "id", "square"), each=100))
2008 Oct 07
2
panel.groups: use group.number to define colors
Dear list, I've been trying this for a few hours and I just don't understand how lattice works with groups and subscripts. Consider the following example, > xx <- seq(1, 10, length=100) > x <- rep(xx, 4) > y <- c(cos(xx), sin(xx), xx, xx^2/10) > fact <- factor(rep(c("cos", "sin", "id", "square"), each=100)) > fact2