Displaying 20 results from an estimated 900 matches similar to: "assigning creating missing rows and values"
2011 May 05
6
Averaging uneven measurements by time with uneven numbers of measurements
I have a new device that takes measurements anywhere from every second, to
every 15 minutes (depending on changes). The matrix has a date, time and Y
column (Y is the measurement). For three days it is 25,000 rows. How do I
average the measurements by every 30 minutes so my matrix is 48 rows per
day? I have been working on this and cannot figure out a simple method. Any
ideas? Thank you.
-----
In
2011 May 12
1
separate date and time
I have a combined date and time. I would like to separate them out into two
columns so I can do things such as take the mean by time across all dates.
meas<-runif(435)
nTime<-seq(1303975800, 1304757000, 1800)
nDateT<-as.POSIXct(nTime, origin="1970-01-01")
mat1<-cbind(nDateT,meas)
means1<- aggregate(mat1$meas, list(nDateT), mean)
This doesn't do anything as each day
2011 May 09
2
Round down to earliest hour or half hour
I have times and would like to round down to the earliest 30 minute
increment. For instance, a time of
2011-04-28 09:02:00
(the as.numeric value = 1303999320)
I would like it to be rounded down to:
2011-04-28 09:00:00
(the as.numeric value = 1303999200)
Any ideas of how to do this?
-----
In theory, practice and theory are the same. In practice, they are not - Albert Einstein
--
View this
2006 Jul 18
4
How can I extract information from list which class is nls
Hello!
I work with :
R : Copyright 2006, The R Foundation for
Statistical Computing
Version 2.3.1 (2006-06-01)
On Windows XP Professional (Version 2002) SP2.
At this moment I use the function "nls" combined
with a selfStar model (SSmicmen, related to
Michaelis-Menten equation, and provided by the
"stats" package).
When I realise the following operation (cf. p 59
of the
2011 Oct 26
6
sometimes removing NAs from code
Sometimes I have NA values within specific columns of a dataframe (in this
example, the first two columns can have NAs). If there are NA values, I
would like them to be removed.
I have been using the code:
y<-c(NA,5,4,2,5,6,NA)
z<-c(NA,3,4,NA,1,3,7)
x<-1:7
adata<-data.frame(y,z,x)
adata<-adata[-which(apply(adata[,1:2],1,function(x)any(is.na(x)))),]
This works well if there are NA
2011 Nov 03
1
For loop to cycle through datasets of differing lengths
I have encountered this problem on several occasions and am not sure how to
handle it. I use for-loops to cycle through datasets. When each dataset is
of equal length, it works fine as I can combine the datasets and have each
loop pick up a different column, but when the datasets are differing
lengths, I am struggling. Here is an example:
A<-1:10
B<-1:15
C<-1:18
2011 Feb 28
3
nls not solving
I am running the following nls equation. I tried it with data that excel was
fitting and got the error:
singular gradient matrix at initial parameter estimates
I thought it was due to a low number of points (6), but when I create a
dataset, I get the same problem. If I remove the parameter "a," then it can
find a solution. Does anyone know what I can do to fit this model?
2011 Feb 08
2
Plot where points are treatment letter
I would like to create a plot of y vs x with different treatments where the
points are actually the letter of the treatment. Here is the code:
A<-as.matrix(rnorm(10,10))
B<-as.matrix(rnorm(10,9.5))
C<-as.matrix(rnorm(10,10.5))
Y<-as.matrix(rnorm(30,13))
X<-rbind(A,B,C)
nA<-matrix("A",10,1)
nB<-matrix("B",10,1)
nC<-matrix("C",10,1)
2005 Apr 15
4
aggregation question
Is length(unique()) what you are looking for?
Andy
> From: Christoph Lehmann
>
> Hi I have a question concerning aggregation
>
> (simple demo code S. below)
>
> I have the data.frame
>
> id meas date
> 1 a 0.637513747 1
> 2 a 0.187710063 2
> 3 a 0.247098459 2
> 4 a 0.306447690 3
> 5 b 0.407573577 2
> 6 b
2005 Nov 03
3
newbie graphics question: Two density plots in same frame ?
I swear I've scoured the help files and several texts before posting
what feels like a dumb newbie question.
How can I draw two kernel density plots in the same frame ? I have
similar variables in two separate data frames, and I would like to show
their two histograms/densities in a single picture. Same units, scale,
range for both, so I'm simply trying to draw one and then add the
2000 Jul 28
4
Language element manipulation
I am very confused about this. I want to convert a string to a name so I can
use it to extract an element of a data frame using `$'. Here is my
(non-working) code:
do.graph <- function (meas)
{
fn <- paste("a", meas, ".dat", sep='')
themeas <- read.table(fn, header=F)
ameas <- as.name(paste("a", meas, sep=''))
2006 Jul 18
1
Reconfiguring wide frame to long frame
Greetings, fellow R'ers.
How can I get this frame in R:
ID meas ID.1 meas.1
1 1.1 3 1.2
2 2.1 4 2.2
to look like this (stacking):
ID meas
1 1.1
2 2.1
3 1.2
4 2.2
It's not really the reshape function (or is it?) because we can consider
the additional columns, viz., ID.1 and meas.1, as independent of ID and
meas so it is basically a stacking
2008 Jul 05
2
Bland-Altman method to measure agreement with repeated measures
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?...
Nom : non disponible
URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20080705/878753db/attachment.pl>
2011 Jan 23
2
Ordering box plots
Hello all, I want box plots by group to display in order of increasing
mean (or median) of each group but can't seem to figure it out and
couldn't find anything on R-seek, either.
My data looks like this:
meas unit sid grade rsprti
1 2.24 1002 99999902 NA 0.8600000
2 3.04 1007 43589520 3 0.9400000
3 4.95 2002 39910470 5 1.5300000
4 2.24 2002 39986280 5
2008 Jul 25
1
glht after lmer with "$S4class-" and "missing model.matrix-" errors
Hello everybody.
In my case, calculating multiple comparisons (Tukey) after lmer
produced the following two errors:
> sv.mc <- glht(model.sv,linfct=mcp(comp="Tukey"))
Error in x$terms : $ operator not defined for this S4 class
Error in factor_contrasts(model) :
no 'model.matrix' method for 'model' found!
What I have done before:
> sv.growth <-
2011 Feb 24
1
accuracy of measurements
Dear R people
Could you please help with following
Trying to compare accuracy of tumor size evaluation by different
methods. So data looks like
id true metod1 method2 ...
1 2 2 2.5
2 1.5 2 2
3 2 2 2
etc.
Could you please give a hint how to deal with that.
Seems like {merror} does not suite to me because I am trying to compare
accuracy of measurements with their true known values not just
2011 Dec 07
1
Convert a string to a variable name
Hello,
I am trying to ask the user for which column their data is in, and then use
this information in a function. So far I have:
data <- read.csv(file.choose(), header=TRUE)
col <- (winDialogString("Which column contains your data?",""))
and I want to be able to reference such as:
meas <- data$col
and use this meas in the function.
However, I can't seem to
2016 Jan 14
2
Strange index consistency issue
Olly Betts <olly <at> survex.com> writes:
>
> On Thu, Jan 14, 2016 at 11:04:29AM +0100, Jean-Francois Dockes wrote:
> > Olly Betts writes:
> > > On Sun, Jan 10, 2016 at 02:53:14AM +0000, Bob Cargill wrote:
> > > > I will look into the bug you listed to see if it might be related.
If there
> > > > is anything else that I can do, please
2009 Feb 05
1
Multiple-Line Comment (PR#13503)
Hello,
sorry for writing here because my problem is not a realt bug but may be
a solution for many people working with R:
I miss the feature for commenting some lines of code at once without
writing a bunch of "#" in front of each line.
This is interesting for trying out some code.
I found some workarounds like
IFELSE(FALSE){} and
`!`<- function(x)
{
if (inherits(x,
2012 May 09
2
AD and SAMBA
Hello all,
I am trying to understand how SAMBA finds nearest Domain Controller when
configured to use Active Directory for AuthN.
There are some great articles and wikis about how to configure SAMBA
against AD, but couldn't find much on what I was looking for.
For example
1. Does Samba have built in dc locator functionality like windows
clients ?
2. What is the default authN it uses, NTLM