Displaying 20 results from an estimated 45 matches for "grp2".
Did you mean:
grp
2010 Jun 29
1
Performance enhancement for ave
library(plyr)
n<-100000
grp1<-sample(1:750, n, replace=T)
grp2<-sample(1:750, n, replace=T)
d<-data.frame(x=rnorm(n), y=rnorm(n), grp1=grp1, grp2=grp2)
system.time({
d$avx1 <- ave(d$x, list(d$grp1, d$grp2))
d$avy1 <- ave(d$y, list(d$grp1, d$grp2))
})
# user system elapsed
# 39.300 0.279 40.809
system.time({
d$avx2 <- ave(d$x, intera...
2011 Jan 31
2
identify subsets based on two grouping factors
...frame that has a categorical variable, for which I
would like to look at the distribution of levels of this variable,
based on a grouping of two other variables.
As an example:
x <- data.frame(obs=sample(c('low', 'high'),100, replace=TRUE),
grp1=sample(1:10, 100, replace=TRUE),
grp2=runif(100))
cut.grp1 <- cut(x$grp1, 3)
cut.grp2 <- cut(x$grp2, 3)
Thus, for each combination of levels in cut.grp1 and cut.grp2, I'd
like to obtain the distribution of levels obs. I know I can loop over
each pair of levels in cut.grp1 and cut.grp2, but is there a more
elegant way to ach...
2011 Feb 08
2
Convert the output of by() to a data frame
I'd like to summarize several variables in a data frame, for multiple groups, and store the results in a data.frame. To do so, I'm using by(). For example:
df<-data.frame(a=1:10,b=11:20,c=21:30,grp1=c("x","y"),grp2=c("x","y"),grp3=c("x","y"))
dfsum<-by(df[c("a","b","c")], df[c("grp1","grp2","grp3")], range)
The result has a class of "by" and a mode of "list". I'm new to R and can'...
2011 Jan 31
1
arranging pie charts in a matrix layout with row/col labels
...correpsonding to the
levels of the two factors. But I am getting stuck on how to label the
rows and colums. My current approach looks like this:
x <- data.frame(obs=sample(c('low', 'high'),100, replace=TRUE),
grp1=sample(1:10, 100, replace=TRUE),
grp2=runif(100))
cut.grp1 <- cut(x$grp1, 3)
cut.grp2 <- cut(x$grp2, 3)
par(mfrow=c(3,3))
tapply(x$obs, list(cut.grp1, cut.grp2), function(z) {
pie(table(z), col=c('red', 'green'))
})
One possibility is to add an extra row and column to the layout and
loop over the results of t...
2008 Aug 18
3
Samba 3.0.x access rights issue with secondary groups or Unix rights
...set rights to access a sub folder of a Samba share. On Solaris the user
"toto" jdoe can write a new file. From Windows, the same user can't.
Itlooks like OK when the primary group (grp1) of the user is the group
that own the subtree but not when this owner group is a secondary group
(grp2).
It is OK If I set explicitly the user right from MS Windows
I can't change the access rights to the group from MS Windows
I suspect Unix ownership or ACL to be the root cause but I can't exclude a Samba issue
Thanks for help
Here a long details on my config (sorry for the parts that ta...
2018 Dec 05
6
Restricting sending mail to domain or group
...nybody a simple solution for the following request?
I have a group alias (all at company.com).
(1) Only company.com accounts should be able to send an email to everybody in that company via all at company.com.
(2) - rather optional: refine the restrictions, e.g. two groups, grp1 at company.com and grp2 at company.com. Grp1 members should be able to send mails to grp2 but not vice versa.
What else than sieve would keep dealing with that demands as simple as possible?
Thanks in advance and sorry for abusing this list for this kind of ?problem? which is not a bug.
Regards,
-M
2004 Oct 22
1
ave gives unexpected NA's
[R 2.0.0 on Linux]
I tried:
> df <- data.frame(
grp1=factor( c('A' ,'A' ,'A' ,'D', 'D' ) ) ,
grp2=factor( c('a1','a2','a2','d1','d1') )
)
> df
grp1 grp2 val
1 A a1 1
2 A a2 2
3 A a2 4
4 D d1 8
5 D d1 16
I got:
> with( df, ave( val, grp1, grp2, FUN=sum ) )
[1] 1 24 24 NA NA
I have expected to get:
[1] 1 6...
2011 Apr 07
1
plyr workaround to converting by() to a data frame
Dear all
Is there a clean plyr version of the following by() and do.call(rbind,
...) construct:
> df<-data.frame(a=1:10,b=11:20,c=21:30,grp1=c("x","y"),grp2=c("x","y"),grp3=c("x","y"))
> dfsum<-by(df[c("a","b","c")], df[c("grp1","grp2","grp3")], range)
> as.data.frame(dfsum)
Error in as.data.frame.default(dfsum) :
cannot coerce class '&quo...
2011 Apr 13
1
error for ttest
Hello all,
I have arranged my data as per Dennis's suggestion in this post
http://www.mail-archive.com/r-help at r-project.org/msg107156.html.
the posted code works fine but when I try to apply it to my data, i get ">
u2 <- ddply(xxm, .(plateid, cytokine), as.data.frame.function(f))
Error in t.test.formula(conc ~ Self_T1D, data = df, na.rm = T) :
grouping factor must have
2010 Aug 11
2
help to polish plot in ggplot2
Hi,
I wanted to generate a plot which is almost like the plot generated by the
following codes.
category <- paste("Geographical Category", 1:10)
grp1 <- rnorm(10, mean=10, sd=10)
grp2 <- rnorm(10, mean=20, sd=10)
grp3 <- rnorm(10, mean=15, sd=10)
grp4 <- rnorm(10, mean=12, sd=10)
mydat <- data.frame(category,grp1,grp2,grp3,grp4)
dat.m <- melt(mydat)
p <- qplot(1,value, data=dat.m, geom="bar", xlab="",ylab="Percentage of eco
change&q...
2016 Jan 27
1
permissions problem
Hello,
i'm using samba 4.1 on a debian stable, samba act as a NT4 PDC.
i have a permission problem in a samba share.
It's a public share where everybody can read/write and it works fine.
In this share, there is a directory with "specials" permissions
drwxrwx--- 20 root grp2 4096 nov. 16 14:36 Dossier
For me, these permissions allows someone from "grp2" group to go inside
this directory
but this user :
uid=30876(user) gid=687(grp1) groupes=687(grp1),30001(grp2)
cant go to this directory. As you can see, "grp2" is not the primary
group of the...
2009 Jun 30
0
anova with missing data (incomplete design)
hi,
I have the following data:
x1 y1 y2 y3
1.3 grp1 a1 NA
2.4 grp1 a1 NA
3.7 grp1 a2 NA
1.9 grp1 a2 NA
2.2 grp2 NA b1
3.5 grp2 NA b1
7.7 grp2 NA b2
6.0 grp2 NA b2
how can I analyse this with the anova-function?
I get the error message
"error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
contrasts can be applied only to factors with 2 or more levels"
2009 Dec 10
1
Help with beanplot fromatting
Dear Helpful R Users,
I am graphing some data using the beanplot, but I am having trouble
getting the output I desire. I have five tanks (A-E) and 2 groups for
each tank grp1 or grp2, except tank C where there is only grp1. (I only
changed the grouprep to "C grp1" for the example) When I plot them, I
would like A B C(only grp1 - half of the bean plot) then D and E (as
full beans). I assume there is some way to do this, but searching the
help archives, I haven'...
2005 Oct 31
7
Downloading zip files
I have not had a great amount of success installing/updating packages
from the "Packages" menu of Rgui under Windows XL. (Except for
installing from loacal zip files.)
But I am not asking for help in using these facilities because I prefer
to keep a folder of package zip files. On the other hand I do find it
tedious having to right-click "Save link as" on every individual
2013 Sep 26
1
Less than equal to symbol in ggplot2 legend text
...See sample code below. I have tried using the expression function and
\u2264. I also tried adding labels to legend.text under theme.
Neither of these 3 options work.
Please help,
Mahesh
++++++++++++++
Extra.column=ifelse(data[,covariate]>cutpoint,1,0)
Grp1 <- "\u2264 1.5"
Grp2 <- ">1.5"
Extra.column=factor(Extra.column,levels=c(0,1),labels=c(Grp1,Grp2))
data2=cbind.data.frame(data,Extra.column)
df <- ddply(data2, .(Time,Extra.column), summarize,
N = length(Yvar), meanYvar=mean(Yvar),
seYvar=sd(Yvar)/sqrt(length(Yvar)))
df = df[df$...
2010 Jun 24
1
two sample binomial test
I wanted to know if there is a way to perform a two sample binomial test in
R. I know you can use the proportion test i.e.:
prop.test(c(19,5),c(53,39),p=NULL,alternative="two.sided"). But I was
looking to use the exact binomial test, binom.test, however when I have
tried replacing prop.test with binom.test I get an error. Is there any way
to do this?
--
View this message in context:
2006 Dec 08
1
lattice: defining an own function using args for "formula" and "groups"
x.fun <- function( formula, data ) dotplot( formula, data )
x.grp <- function( formula, groups, data ) dotplot( formula, groups, data )
data( barley )
> x.fun( variety ~ yield | site, data=barley )
# no problem
> dotplot( variety ~ yield | site, groups=year, data=barley )
# no problem
> x.grp( variety ~ yield | site, groups=year, data=barley )
object "year" not found
2010 Nov 15
5
Sampling problem
Hey,
I am hoping someone can help me with a sampling question.
I have a data frame of 8 variables (the first column is the subjects' id):
SubID CSE1 CSE2 CSE3 CSE4 WSE1 WSE2 WSE3 WSE4
1 6 5 6 2 6 2 2 4
2 6 4 7 2 6 6 2 3
3 5 5 5 5 5 5
2007 Jul 19
3
Can I test if there are statistical significance between different rows in R*C table?
Dear friends,
My R*C table is as follow:
better
good
bad
Goup1
16
71
37
Group2
0
4
61
Group3
1
6
57
Can I test if there are statistical significant between Group1 and
Group2, Group2 and Group3, Group1 and Group2, taking into the multiple
comparisons?
The table can be set up using the following program:
a<-matrix(data=c(16,71,37,0,4,61,1,6,57),nrow=3,byrow=TRUE)
Thanks
2017 Oct 27
2
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
...(~(socst+grp)^2 ,data=df))
print("Example 2.1: drop socst")
print(model.matrix(~(socst+grp)^2 -socst ,data=df))
print("Example 2.2: drop grp")
print(model.matrix(~(socst+grp)^2 -grp ,data=df))
This gives indeed the following regressors:
"Full model"
(Intercept) socst grp2 grp3 grp4 socst:grp2 socst:grp3 socst:grp4
"Example 2.1: drop socst"
(Intercept) grp2 grp3 grp4 socst:grp1 socst:grp2 socst:grp3 socst:grp4
"Example 2.2: drop grp"
(Intercept) socst socst:grp2 socst:grp3 socst:grp4
There is a little bit of R documentation about this, based on t...