Displaying 20 results from an estimated 600 matches similar to: "re ferring to data of previous rows"
2009 Nov 25
2
difference of two rows
Dear R user,
I'd like to calculate the difference of two rows, where "ID" is the same.
eg.: I've got the following dataframe:
ID YEAR
13 2007
15 2003
15 2006
15 2008
21 2006
21 2007
and I'd like to get the difference, like this:
ID YEAR diff
13 2007 NA
15 2003 3
15 2006 2
15 2008 NA
21 2006 1
21 2007 NA
that should be fairly
2009 Feb 09
2
length of object in repeated measures
Hi there.
I collectad data of several animals (Id) that were caught and measured at
several occasions.
The dataframe looks like this:
Grouped Data: mass ~ age | Id
Id age mass
1 1 5.4
1 3 6.2
1 15 10.0
2 3 8.1
2 10 12.8
3 2 5.9
3 10 7.1
3 15 15.4
3 17
2017 Nov 18
2
family
Hi all,
I am reading a huge data set(12M rows) that contains family information,
Offspring, Parent1 and Parent2
Parent1 and parent2 should be in the first column as an offspring
before their offspring information. Their parent information (parent1
and parent2) should be set to zero, if unknown. Also the first
column should be unique.
Here is my sample data set and desired output.
fam
2007 Oct 26
1
[Fwd: Re: subsetting]
Sorry that I was unclear. For an individual to qualify for my analysis I
want both of the following two criteria to be fulfilled:
First, I want to select measurement taken at a certain age: for the
focal individual the year of measurement (year) should be the same as
year.hatch
Second, I want the focal individual to be born by a mother that
reproduces for the first time.
So the /parents /of
2009 Feb 20
3
mean over previous cells
Dear RUsers,
I guess this is an easy question for someone a little familiar with
programming...(which I am not)...
I've got 2 colummns, one shows just dates(SST_date, Class 'Date' num), the
other one shows the SeaSurfaceTemperature (SST, num) at that certain date.
SST_date SST
2008-01-01 22.2
2008-01-02 21.8
2008-01-03 22.8
2008-01-04 22.9
2008-01-05 23.1
2008-01-06 23.2
...
2008 Oct 20
3
valid users and file permissions
Hi people,
I'd like to understand valid users and file permissions better. I have a
share which is not behaving as I expect.
[family]
path = /home/shares/family
create mask = 0664
directory mask = 0775
force group = parental
guest ok = No
valid users = @parental, @family
writeable = Yes
in Group parental are mum & dad; in group family are mum, dad and offspring.
With file permissions
2010 Jan 10
1
How to control number of significant digits (figures) in y-axis?
Dear R users,
I encounter a problem regarding number of significant digits on y-axis.
Below is my basic code:
myplotkid<-xyplot(expected_offspringnumber~afr|decade,groups=SES,data1,
auto.key=list(space="right"),layout=c(9,1),xlab="",ylab="Offspring number",
aspect="fill",scales=list(x=list(draw=F)),strip=T)
>From this code, you can see there are 9
2006 Dec 02
1
Chi-squared approximation may be incorrect in: chisq.test(x)
I am getting "Chi-squared approximation may be incorrect in:
chisq.test(x)" with the data bleow.
Frequency distribution of number of male offspring in families of size 5.
Number of Male Offspring N
0 518
1 2245
2 4621
3 4753
4 2476
5
2005 Jul 08
1
Overlying a Normal Dist in a Barplot
R-Users,
Hopefully someone can shed some light on these questions as I had
little luck searching the archives (although I probably missed something
in my search due to the search phrase). I estimated multinomial
probabilities for some count data (number successful offspring) ranging
from 0 to 8 (9 possible response categories). I constructed a barplot
(using barplot2) and I want to
2010 May 16
2
sample
Hi,
I am sampling two random columns from females and two random columns
from males to produce tetraploid offspring. For every female I am
sampling a random male.
In the end I want to write out a a matrix with all the offspring, but
that does not work. I get always only the offspring from the last
females. There must be a mistake in my script:
moms<-read.delim("females.txt",
2008 Sep 05
2
using nls to fit a curve to data
Hi,
I am trying to fit a curve to data. My command line is:
model10=nls(offspring~((A*c^k)/gamma(k))*((degdays-alpha)^(k-1))*exp(-c*(degdays-alpha)),
start=list(A=30,k=2,c=.018,alpha=131))
I get the error message:
Error in numericDeriv(form[[3]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
In addition: Warning message:
full precision was not
2009 Jun 26
2
Matching data to a new column
Hi all,
I wonder if anyone can help,
I have a dataframe with columns for...
'I.D' 'age' 'mothers I.D'
01 5 03
02 6 06
03 16 NA
04 8 06
05 3 NA
06 17 NA
I need to create a new column for 'mothers age' which puts the age of the individual with 'mothers i.d' into the row for her offspring (so
2005 Jul 01
2
loop over large dataset
Hi All,
I'd like to ask for a few clarifications. I am doing some calculations
over some biggish datasets. One has ~ 23000 rows, and 6 columns, the
other has ~620000 rows and 6 columns.
I am using these datasets to perform a simulation of of haplotype
coalescence over a pedigree (the datestes themselves are pedigree
information). I created a new dataset (same number of rows as the
pedigree
2008 Nov 14
1
Generating unique permutations of a vector
Hi all,
I try to generate sets of strategies that contain probability
distributions for a defined number of elements, e.g. imagine an
animal that can produce 5 different types of offspring and I want to
figure out which percentage of each type it should produce in order to
maximize its fitness. In order to do so, I need to calculate the fitness
for all potential strategies. As an example, if I
2002 Jun 13
1
A random insertion position in a vector
A student asked me about simulation he is doing. This simulation
presented an interesting R programming puzzle that we did solve but I
am not happy with the solution. I feel there should be a better way
of doing this.
Briefly, he is simulating births and deaths in a linear array of cells.
Births and deaths are required to alternate.
For a birth, one of the cells is selected at random to be the
2010 Jan 10
3
How to control spaces between axis, tick and label in xyplot or xYplot?
Dear R users,
I encounter a problem regarding space control in xyplot. Basically, I want
to control spaces between label, tick and axis. I remember there is a
function called mgp in general plot. Is there a similar function for xyplot
or xYplot?
Below is my basic code:
myplotkid<-xyplot(expected_offspringnumber~afr|decade,groups=SES,data1,
2007 Aug 29
2
Recoding multiple columns consistently
Hi,
I have a dataframe that contains pedigree information;
that is individual, sire and dam identities as separate
columns. It also has date of birth.
These identifiers are not numeric, or not sequential.
Obviously, an identifier can appear in one or two columns,
depending on whether it was a parent or not. These should
be consistent.
Not all identifiers appear in the individual column - it
is
2005 Jul 21
3
vectorising ifelse()
Hi All,
is there any chance of vectorising the two ifelse() statements in the
following code:
for(i in gp){
new[i,1] = ifelse(srow[i]>0, new[srow[i],zippo[i]], sample(1:100, 1,
prob =Y1, rep = T))
new[i,2] = ifelse(drow[i]>0, new[drow[i]>0,zappo[i]], sample(1:100,
1, prob =Y1, rep = T))
}
Where I am forced to check if the value of drow and srow are >0 for each
line... in
2008 Mar 03
1
Barplot with grouping x axis and count data
Hello,
I am trying to make a barplot with nested count data which is build like
this: first there are several birds (n)laying 3 clutches composed of 2 eggs
half of the second and third clutch received treatment and this treatment
was tested to influence sex of offspring. I want a barplot showing counts
for male and female for every egg of every clutch. can someone tell me what
to do? I drew a
2010 Jan 21
1
Fremingham Heart Study data set
Hey all,
I am just born today in the r language and I discover that it the language that I need for my research.
I don't too much yet about this language. I want to know if I can find in this language and install the
package data set related to " The Framingham Heart Study", see references here:
http://content.nejm.org/cgi/content/full/357/4/370