Displaying 20 results from an estimated 10000 matches similar to: "Selecting subsamples"
2004 Jan 14
2
Generalized least squares using "gnls" function
Hi:
I have data from an assay in the form of two vectors, one is response
and the other is a predictor. When I attempt to fit a 5 parameter
logistic model with "nls", I get converged parameter estimates. I also
get the same answers with "gnls" without specifying the "weights"
argument.
However, when I attempt to use the "gnls" function and try to
2004 Jan 06
2
proxy
Hi all;
I?m working with the latest version of R under Win2000. My internet connection
(using a proxy) requires my username and password. In this situation I?m
not able to update the packages from CRAN (unless I download and install
them from a local drive). I tried looking at information on the list servers
but I couldn?t figure out how to change 'environment variables' or something
like
2004 Aug 15
1
index and by groups statement
Dear R-users
Im working with a dataset that contains information
for 8 groups of data and I need to select a sample of
certain size (100 cubic feet by group) from this
database for each of these 8 groups. To clarify, here
is the starting code Im working with:
k<-nrow(dataset)
ix<-sort(runif(k),index.return=TRUE)$ix
M<-max(which(cumsum(dataset$volume[ix])<100))+1
2009 Apr 13
4
Physical Units in Calculations
Back in 2005 I had been doing most of my work in Mathcad for over 10 years.
For a number of reasons I decided to switch over to R. After much effort and
help from you folks I am finally "thinking" in R rather than thinking in
Mathcad and trying to translating to R. Anyway, the only task I still use
Mathcad for is calculations that involve physical quantities and units. For
example, in
2011 Apr 21
1
numbers and superscripts in the same unit of measurement.
Hola everyone,
I'm doing an analisys about abundance of a planctonic specie in Robinson Crusoe Islan and I am having a hard time just adding the superscripts and the 100 (one hundred) in the measure of abundance.
Perhaps this is so basic to you, but I need to put the real unit of measure. Individuals / 100 cubic meters.
I have been looking in websites and R-list and there is not any
2012 May 23
2
Using NA as a break point for indicator variable?
Hi all,
I am working with a spatial data set for which I am only interested in high
concentration values ("leaks"). The low values (< 90th percentile) have
already been turned into NA's, leaving me with a matrix like this:
< CH4_leak
lon lat CH4
1 -71.11954 42.35068 2.595834
2 -71.11954 42.35068 2.595688
3 NA NA NA
4 NA
2010 May 13
1
aggregate.zoo
I have been using aggregate function to determine the annual minimum in
a daily time series. However, I was also hoping to determine the date of
occurrence without having to loop through each year to identify the date
of each minimum returned from aggregate(). Is there a more convenient
way of doing so?
Thanks in advance,
Dave
library(zoo)
n <- 1000
dly <- zoo( x = rnorm(n), order.by
2006 Dec 18
1
Aggregate with numerous factors
Dear list members,
I am facing some problems using the aggregate() function.
I want to calculate a sum and a mean of one variable over the
combination of 12 factors with the aggregate() function to avoid loops
but it doesn't work (or the job is far too long, it exceeds 2 hours). It
works with a fewer number of factors, so I constructed a factor being
the levels combination of 7 factors (I
2011 Sep 30
1
last observation carried forward +1
Hi R-helpers
I'm looking for a vectorised function which does missing value replacement
as in last observation carried forward in the zoo package but instead of a
locf, I would like the locf function to add +1 to each time a missing value
occurred. See below for an example.
> require(zoo)
> x <- 5:15
> x[4:7] <- NA
> coredata(na.locf(zoo(x)))
[1] 5 6 7 7 7 7 7 12 13
2018 May 11
2
add one variable to a data frame
Sarah et. al.:
As a matter of aesthetics (i.e. my personal ocd-ness) I prefer using the
public API of an object, i.e. *not* to makes use of the representation of a
factor as essentially an integer vector with labels, but rather to use its
documented behavior. (Feel free to ignore this remark!)
Anyway,
>cumsum(!duplicated(dat1$B))
[1] 1 1 1 2 2 3 3 3 3 3 4 4
will do it.
This is very
2012 Nov 13
9
Intel DC S3700
[This email is either empty or too large to be displayed at this time]
2010 Feb 07
2
Reading hierarchical data
I would like to read the following hierarchical data set. There is a family
record followed by one or more personal records.
If col. 7 is "1" it is a family record. If it is "2" it is a personal
record.
The family record is formatted as follows:
col. 1-5 family id
col. 7 "1"
col. 9 dwelling type code
The personal record is formatted as follows:
col.
2010 Oct 31
2
Randomly split a sample in two equal subsamples
Dear all,
I would like to randomly split a sample in two equally large
subsamples. The sample data is stored as a matrix with each row
representing an individual and each column representing some variable
(e.g., name, age, sex, etc.); the first row contains the names of the
variables; the first column contains the individual number (1:n, for n
individuals); the number of individuals is even (so,
2014 Mar 03
1
reference classes, LAZY_DUPLICATE_OK, and external pointers
We (the lme4 authors) are having a problem with doing a proper deep
copy of a reference class object in recent versions of R-devel with
the LAZY_DUPLICATE_OK flag in src/main/bind.c enabled.
Apologies in advance for any improper terminology.
TL;DR Is there an elegant way to force non-lazy/deep copying in our
case? Is anyone else using reference classes with a field that is an
external pointer?
2010 Jul 12
2
exercise in frustration: applying a function to subsamples
>From the documentation I have found, it seems that one of the functions from
package plyr, or a combination of functions like split and lapply would
allow me to have a really short R script to analyze all my data (I have
reduced it to a couple hundred thousand records with about half a dozen
records.
I get the same result from ddply and split/lapply:
>
2009 Jun 23
4
Apply as.factor (or as.numeric etc) to multiple columns
Hi R-helpers,
I have a dataframe with 60columns and I would like to convert several
columns to factor, others to numeric, and yet others to dates. Rather
than having 60 lines like this:
data$Var1<-as.factor(data$Var1)
I wonder if it's possible to write one line of code (per data type,
e.g. factor) that would apply a function (e.g., as.factor) to several
(non-contiguous) columns. So, I
2018 May 11
0
add one variable to a data frame
Hi,
Here's one way to approach it, using the coercion of factor to numeric.
Note that I changed your data.frame() statement to avoid coercing
strings to factors, just to make it simpler to set the levels.
dat1 <-data.frame(N=seq(1, 12,1), B=c("29_log","29_log", "29_log",
"27_cat", "27_cat", "1_log", "1_log",
2006 Jul 24
5
grouping by consecutive integers
Hello R-helpers!
I have a question concerning extracting sequence information from a
vector. I have a vector (representing the bins of a time series where
the frequency of occurrences is greater than some threshold) where I
would like to extract the min, median and max of each group of
consecutive numbers.
For Example:
tmp <- c(24,25,29,35,36,37,38,39,40,41,42,43,44,45,46,47,68,69,70,71)
I
2003 Nov 10
2
boot package question: sampling on factor, not row
Hi all:
I've been looking at the boot package to "bootstrap" sample my data in a particular way. I haven't figured out how to set this up using the boot() command and thus have resorted to trying to write my own script (although I'd prefer if I could get boot() to work for this problem!)
The dataset is set up in the following way:
ix(factor) value
1 5.73
1 6.99
1
2018 May 11
3
add one variable to a data frame
Hi All,
I have a data frame dat1:
dat1 <-data.frame(N=seq(1, 12,1), B=c("29_log","29_log", "29_log", "27_cat", "27_cat",
"1_log", "1_log", "1_log", "1_log", "1_log",