Displaying 20 results from an estimated 20000 matches similar to: "summing columns of data frame by group"
2007 Oct 23
1
distributing the values of data frame to a vector based on......
I am trying to distribute the entries of a data frame (dat) to a vector (water) based on the values of two other vectors (region and year). region is also the columns and year the rows of the data frame (dat). I can write a bunch of ifelse statements or I created the for statement below - but there must be a simpler way?? The for statement probably won't work if I am distributing a non
2006 May 11
1
bug report - cor (PR#8852)
Full_Name: daniel t. O'Shea
Version: 2.2.1
OS: xp
Submission from: (NULL) (156.98.28.4)
using the cor command in the base package.
cor(x,y)
x is a matrix (15 rows and 1000 columns). I did not specify a column and R
crashed - shut down.
error signature
AppName:rgui.exe AppVer 2.21.51220.0
ModName: r.dll
ModVer: 2.21.51220.0
2007 Dec 30
2
refering to variable names in lm where the variable name is in another variable
I am trying to refer to a variable name in a lm regression where the variable name is in another variable, but it does seem to work. Here is an example:
y<-rnorm(10)
dat<-data.frame(x1=rnorm(10),x2=rnorm(10),x3=rnorm(10))
nam<-c('x1','x2','x3')
library(gtools)
com<-combinations(3,2,1:3)
mod<-lm(y~nam[com[1,1]],data=dat)
#error in model frame....:variable
2011 Mar 30
2
summing values by week - based on daily dates - but with some dates missing
Dear everybody,
I have the following challenge. I have a data set with 2 subgroups,
dates (days), and corresponding values (see example code below).
Within each subgroup: I need to aggregate (sum) the values by week -
for weeks that start on a Monday (for example, 2008-12-29 was a
Monday).
I find it difficult because I have missing dates in my data - so that
sometimes I don't even have the
2008 Sep 23
1
Summing up columns with NA elements in a data frame
Hi all,
When I try to sum a few columns in a data frame (which has NA?s randomly distributed as elements), I am not able to get the summing operation to ignore the NA?s.
Let me explain with the following code :
################################?
a<-structure(list(a1 = c(NA, 2, 3, NA, 5, 6, NA, 8, 9, NA), a2 = c(NA,
+ 4, 5, 5, NA, 7, 8, 8, NA, 10), a3 = c(2, NA, 6, 8, NA, 12, 14,
+ NA, 18, 20)),
2011 Jan 07
2
Summing over specific columns in a matrix
Hi,
I would like to sum some specific columns in my matrix- for example, my
matrix looks like this:
[,1] [,2] [,3] [,4] [,5]
[1,] 1 NA NA NA NA
[2,] 2 1 NA 1 NA
[3,] 3 2 1 2 1
[4,] 4 3 2 3 2
[5,] NA NA NA 4 3
[6,] NA NA NA 5 NA
I would like to find the sum of the first two columns, the second two
columns and
2011 Jan 17
2
Summing data frame columns on identical data
Dear all,
I have 9 data frames, and I'm simply trying to sum the values of column 3 (on a row-by-row basis). However, there are a slightly different number of rows in each data frame, so I'm receiving the following error: "Error in Ops.data.frame(mrunoff_207101[3], mrunoff_207102[3]) :
? + only defined for equally-sized data frames".
Here is what I'm attempting to do:
2009 Jan 20
2
Summing Select Columns of a Data Frame?
Hi,
I would like to operate on certain columns in a dataframe, but not
others. My data looks like this:
x1 x2 x3
1 2 3
4 5 6
7 8 9
I want to create a new column named x4 that is the sum of x1 and x2,
but NOT x3. I looked at colSums and apply, but those functions seem to
use all the columns in a dataframe. How do I only use select columns?
If it helps, in Stata this would be gen x4
2011 Oct 30
1
Normality tests on groups of rows in a data frame, grouped based on content in other columns
Dear R users,
I have a data frame in the form below, on which I would like to make normality tests on the values in the ExpressionLevel column.
> head(df)
ID Plant Tissue Gene ExpressionLevel
1 1 p1 t1 g1 366.53
2 2 p1 t1 g2 0.57
3 3 p1 t1 g3 11.81
4 4 p1 t2 g1 498.43
5 5 p1 t2 g2 2.14
6 6 p1 t2 g3 7.85
I
2010 Sep 06
1
combining collumns for data.frames
Hi
This question is far less simple than the title suggests, please read carefully, thanks.
I have 2 sets of data, both read into R
>data1<-read.table ("1.txt", header=T, sep="\t")
>data2<-read.table ("2.txt", header=T, sep="\t")
>data1
Taxon stage1 stage2 stage3 stage4
T1 0 0 1 1
T2 0
2006 Apr 11
2
Re: Received VNAK: resending outstanding frames?
Some more info:
Just tried this on a server without using any NAT and no port
forwarding, no masquerading, and I still have the same problem. So there
goes that idea. I do not know what this VNAK error means.
By the way, I am using the latest version (1.2.6) of asterisk, have also
tried other versions with the same problem [1.0.9 (Ubuntu Breezy) and
1.0.7 (Debian Sarge) and 1.2.1 (Ubuntu
2005 Feb 23
1
How to conctruct an inner grouping for nlme random statement?
Hello. Im hoping someone can help with a grouping
question related to the "random=" statement within the
nlme function. How do you specify that some grouping
levels are inner to others? I tried several things,
given below.
Lets say I have a data frame with five variables,
resp, cov1, ran1, ran2, group1, and group 2. The
formula is resp~cov1 + ran1 + ran2, where the ran are
random
2012 Jun 03
2
a question about subsetting
Hi all,
I started using R about 3 weeks ago, and now I've pretty much figured out how to do the types of statistical modeling, graphs, tables etc. that I frequently use (with zero background in computer languages or other statistical packages that are similar to R like S or SAS!). So it's been a quite rewarding process so far, and I thank you all R gurus for all your generous help!
That
2011 Jul 29
1
question about groups
Hi all,
I have a (simple?) question about groups.
this is my scenario:
Windows Active directory domain
Samba file server ADS integrated
2 shares on this last server (share1, share2)
2 groups on the AD (group1 and group2)
First share is only fully available to group1: this is easily done
second share is fully available to group2
---
Then I have some users belonging to both group1 and
2011 Apr 04
2
merging 2 frames while keeping all the entries from the "reference" frame
Hello!
I have my data frame "mydata" (below) and data frame "reference" -
that contains all the dates I would like to be present in the final
data frame.
I am trying to merge them so that the the result data frame contains
all 8 dates in both subgroups (i.e., Group1 should have 8 rows and
Group2 too). But when I merge it it's not coming out this way. Any
hint would be
2006 Jun 20
3
TDM400P bad echo problem, tried lots of things
I have a bad echo problem on my TDM400P with one FXO module installed.
I have tried a few things, such as:
* setting rxgain and txgain to 0
* setting echocancelwhenbridged to no / yes
* settting echocancel to 64 / no / yes
* setting echocanceltraining to 800 / no / yes
* MG2 echo cancellation
* MARK2 echo cancellation
* KB1 echo cancellation
* AGGRESSIVE_SUPPRESSOR option of MARK2
Each time
2008 Aug 01
3
Grouping Index of Matrix Based on Certain Condition
Hi,
I have the following (M x N) matrix, where M = 10 and N =2
What I intend to do is to group index of (M) based on this condition
of "x_mn" , namely
For each M,
If x_m1 > x_m2, assign index of M to Group1
otherwise assign index of M into Group 2
> x
[,1] [,2]
[1,] 4.482909e-01 0.55170907
[2,] 9.479594e-01 0.05204063
[3,] 8.923553e-01 0.10764474
2010 Jan 25
1
summing a large, partitioned data frame
Dear R community,
I'm trying to develop a fast way of summing specific rows of a large data frame.
Here is an example of the kind of data frames I'm dealing with:
> refls
H K L M/ISYM BATCH I SIGI
43247 1 0 5 21 79 61.44117 2.20553
1040 1 0 5 257 6 15.16316 0.54431
2324 1 0 5 257 5 46.76152 1.67858
31515 1 0 5 259 60 57.97305
2007 Oct 30
2
flexible processing
Hello,
unfortunately, I don't know a better subject. I would like to be very flexible
in how to process my data.
Assume the following dataset:
par1 <- seq(0,1,length.out = 100)
par2 <- seq(1,100)
fac1 <- factor(rep(c("group1", "group2"), each = 50))
fac2 <- factor(rep(c("group3", "group4", "group5", "group6"), each =
2009 Aug 07
1
Samba permission problem
Hi,
I have an Ubuntu server acting as PDC on a LAN whose client
have WIN Xp professional installed.
Domain's users are divided into different groups. Let's
focus on only two of them, say group1 and group2.
Now I have a share defined in smb.conf as follows:
[shareName]
comment =