Displaying 20 results from an estimated 110 matches similar to: "Replicating output from a function"
2008 Aug 19
0
R-code: for those who like a challenge; HELP
I'll try to be more clear, but will have to give much more info. Here we go....
As part of my Masters in Public Health I writing a dissertation reviewing the mortality trend of internally displaced persons in camp settings in Sub Saharan Africa. I have 50 surveys with
- crude mortality rate (cmr), CMR lower confidence interval(cmrlci), CMR upper confidence interval(cmruci),
- recall period
2012 Jan 30
1
how to sum multiple data entries for the same sampling event?
I'm having trouble with some catch per unit effort data (CPUE, fisheries
data). Some of the samples were "retained" and some "unretained," and they
are entered as 2 separate entries for the same sampling event (Date and
time). I want to calculate the total CPUE (so sum the "retained" and
"unretained" number for each sampling event) and am having troubld
2005 Jun 28
2
function for cumulative occurrence of elements
Hello,
I have a data set with 9700 records, and 7 parameters.
The data were collected for a survey of forest communities. Sample plots
(1009) and species (139) are included in this data set. I need to determine
how species are accumulated as new plots are considered. Basically, I want
to develop a species area curve.
I've included the first 20 records from the data set. Point
2006 Aug 16
2
adding multiple fitted curves to xyplot graph
Hello RHelpers,
This may already have been answered, but despite days of scouring through the archives I haven't found it.
My goal is to add multiple fitted curves to a plot.
An example data set (a data frame named df in following code) is:
x1 y1 factor1
4 1298.25 0.00000000 1
5 1393.25 0.00000000 1
6 1471.50
2010 Jan 22
2
sorted reshaping?
dear R wizards:? I am wrestling with reshape.? I have a long data set
that I want to convert into a wide data set, in which rows are firms
and columns are years.
> summary(rin)
firm fyear sim1
Min. :1004.00 Min. :1964.0 Min. : -1.00000
1st Qu.:1010.00 1st Qu.:1979.0 1st Qu.: -0.14334
Median :1016.00 Median :1986.0 Median : 0.00116
Mean
2004 Aug 01
2
Strange Problem with "proj" and "aov" for split-plot analysis output
I'm using R 1.8.1 on Red Hat Linux 9. I've worked out the linear model
decomposition by hand. Using "aov" with "Error" to fit a split-plot
model, I get very different results depending on whether I use the
"data" argument for "aov" or not. When I use the "data" argument, the
ANOVA table from "summary" is correct but the
2010 Feb 20
3
aggregating using 'with' function
Hi All,
I am interested in aggregating a data frame based on 2
categories--mean effect size (r) for each 'id's' 'mod1'. The
'with' function works well when aggregating on one category (e.g.,
based on 'id' below) but doesnt work if I try 2 categories. How can
this be accomplished?
# sample data
id<-c(1,1,1,rep(4:12))
n<-c(10,20,13,22,28,12,12,36,19,12,
2003 May 13
1
assessing the fit of a LME model
Dear All,
I would like to ask a couple of questions on a LME model.
I tested 4 selection lines at 4 food concentrations against a standard
competitor stock. I had 3 replicate cages per selection line. In each cage
I have 10 vials. I counted the number of wild type flies and competitor
stock emerging in each vial. My main question is: is there any difference
between selection lines?
I did fit
2005 Dec 07
0
Are minbucket and minsplit rpart options working as expected?
Dear r-list:
I am using rpart to build a tree on a dataset. First I obtain a perhaps too
large tree:
> arbol.bsvg.02 <- rpart(formula, data = bsvg, subset=grp.entr,
control=rpart.control(cp=0.001))
> arbol.bsvg.02
n= 100000
node), split, n, loss, yval, (yprob)
* denotes terminal node
1) root 100000 6657 0 (0.93343000 0.06657000)
2) meses_antiguedad_svg>=10.5 73899 3658
2007 May 05
1
(no subject)
Dear Mailing-List,
I think this is a newbie question. However, i would like to integrate a
loop in the function below. So that the script calculates for each
variable within the dataframe df1 the connecting data in df2. Actually it
takes only the first row. I hope that's clear. My goal is to apply the
function for each data in df1. Many thanks in advance. An example is as
follows:
df1
2020 Oct 23
2
The presence/absence of `zone` in POSIXlt depending on time zone as a cause of possible inconsistences?
Dear all,
I have just detected what seems a minor inconsistence with data types. If one unlists a POSIXlt time with GMT zone gets a numeric vector, since the POSIXlt list has no `zone` element, while if one unlists a POSIXlt time with a non GMT zone (also non specifying tz if the Sys.timezone is not GMT) gets a character vector due to including the `zone` element.
> x <-
2020 Oct 23
0
The presence/absence of `zone` in POSIXlt depending on time zone as a cause of possible inconsistences?
?Hi again,
I take advantage of my previous mail to ask you a question for which I was looking for an answer when detected the behaviour I previously told. In the help of DataTimeClasses one can read:
"POSIXlt" objects will often have an attribute "tzone", a character vector of length 3 giving the time zone name from the TZ environment variable and the names of the base time
2009 May 19
3
how to calculate means of matrix elements
useR's,
I have several matrices of size 4x4 that I want to calculate means of their
respective positions with. For example, consider I have 3 matrices given by
the code:
mat1 <- matrix(sample(1:20,16,replace=T),4,4)
mat2 <- matrix(sample(-5:15,16,replace=T),4,4)
mat3 <- matrix(sample(5:25,16,replace=T),4,4)
The result I want is one matrix of size 4x4 in which position [1,1] is the
2017 Jun 20
0
translate formula into R code
Cc'd back to the list... always use reply-all.
You say res should have been LSS but LSS is a scalar so the for loop will only run once. What does a successful output look like for a sample input? How do you (we) know when success has been achieved?
In fact, what is the formula you want to implement? If your code below is the definition of your "formula" then we are left with no
2013 Aug 30
1
Outliers Help
This is my a part of my data set
> D[1:15,c(1,5:10)]
X. media IE.2005 IE.2006 IE.2007 IE.2008 IE.2009 IE.2010
1 1108 22.00000 60.0 39 4.0 8.0 16.0 5.0
2 1479 110.00000 NA NA 53.0 1166.0 344.8 110.0
3 1591 86.60000 247.0 87 95.0 94.0 81.0 76.0
4 3408 807.00000 302.0 322 621.0 1071.0 1301.0 1225.0
2009 Nov 23
3
FUN argument to return a vector in aggregate function
Hi All,
I am currently doing the following to compute summary statistics of
aggregated data:
a = aggregate(warpbreaks$breaks, warpbreaks[,-1], mean)
b = aggregate(warpbreaks$breaks, warpbreaks[,-1], sum)
c = aggregate(warpbreaks$breaks, warpbreaks[,-1], length)
ans = cbind(a, b[,3], c[,3])
This seems unnecessarily complex to me so I tried
> aggregate(warpbreaks$breaks, warpbreaks[,-1],
2013 Mar 25
2
Ordering a matrix by row value in R2.15
fitz_ra wrote
> I know this is posted a lot, I've been through about 40 messages reading
> how to do this so let me apologize in advance because I can't get this
> operation to work unlike the many examples shown.
>
> I have a 2 row matrix
>> temp
> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
> [,9] [,10]
> [1,] 17.000
2013 Feb 27
2
temp seems ineffective in SANN (optim)
I am trying to control the behavior of the SANN method in optim (R
2.14.1) via control$temp. In my toy tests it works; in my real use, it
doesn't.
As far as I can tell my code with different temp values is loaded; I
even traced into the function that calls optim and verified temp had the
value I had set.
Could the fact that I have NaN's coming back from the objective function
be a
2008 Feb 12
3
help with bwplot
Dear list,
I have following data set, which I want to plot the "Scale" variable on the
x-axis and "Mean"´on the y-axis for each Ageclass and for each sex. The Mean
value of each Ageclass for each sex would be connected by a line. Totally,
there should be 6 lines, from which three present the Mean values of each
Ageclass for respective sex. Are there any easy ways to do
2006 Apr 05
1
hist function: freq=FALSE for standardised histograms
Dear All,
I am a undergraduate using R for the first time. It seems like an excellent
program and one that I look forward to using a lot over the next few years,
but I have hit a very basic problem that I can't solve.
I want to produce a standardised histogram, i.e. one where the area under
the graph is equal to 1. I look at the manual for the histogram function and
find this:
freq: