Displaying 20 results from an estimated 3000 matches similar to: "need to delete by time, not date"
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
2013 Jun 26
3
XYZ data
I have x, y, z data. The x, y fields dont change but Z does. How do I add a
very small number onto the end of each x, y data point.
For example:
Original (X) Original (Y) Original (Z)
15 20 30
15 20 40
New (X) New (Y)
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
2010 Feb 12
3
Code working but too slow, any idea for how to speed it up ?(no loop in it)
Hello my friends,
here is a code I wrote with no loops on matrix that is taking too long (2
seconds and I call him 720 times --> 12 minutes):
mat1 and mat2 are both matrix with 103 columns and 164 rows.
sequence <- matrix(seq(1 : ncol(mat1)))
returns <- apply(sequence, 1, function, mat1= mat1, mat2 = mat2, day = 1)
function<- function(mat1, mat2, colNb, day){
2007 Nov 12
1
update matrix with subset of it where only row names match
I guess this has a simple solution:
I have matrix 'mat1' which has row and column names, e.g.:
A B C
row1 0 0 0
row2 0 0 0
....
rown 0 0 0
I have a another matrix 'mat2', essentially a subset of 'mat1' where the
rownames are all in 'mat1' e.g.:
B
row3 5
row8 6
row54 7
I want to insert the values of matrix mat2 for column B (in reality it
could be some or
2010 Jan 27
1
How to sort data.frame
Dear R heleprs
Suppose I have following data
Scenarios
combination_names
series1
series2
Sc1
MAT2 GAU1
7.26554
8.409778
Sc2
MAT2 GAU2
7.438128
8.130275
Sc3
MAT3 GAU1
8.058422
8.06457
Sc4
MAT1 GAU2
8.179855
8.022071
Sc5
MAT3 GAU2
8.184033
8.191831
Sc6
MAT3 GAU2
7.50312
8.232425
Sc7
MAT1 GAU2
7.603291
8.200993
Sc8
MAT1 GAU1
8.221755
8.380097
Sc9
MAT3 GAU2
7.904908
2009 Apr 16
2
error bars in matplot
Hi,
I was trying to get error bars in my matplot. I looked at an earlier thread, and the sample code that I made is:
#------------------
library(plotrix)
mat1 <- matrix(sample(1:30,10),nrow=5,ncol=2)
ses <- matrix(sample(1:3,10,replace=T),nrow=5,ncol=2)
vect <- seq(20,100,20)
rownames(mat1) <- rownames(ses) <- vect
colnames(mat1) <- colnames(ses) <- letters[1:2]
2005 Nov 03
4
merging dataframes
Dear List,
I often have to merge two or more data frames containing unique row
names but with some columns (names) common to the two data frames and
some columns not common. This toy example will explain the kind of setup
I am talking about:
mat1 <- as.data.frame(matrix(rnorm(20), nrow = 5))
mat2 <- as.data.frame(matrix(rnorm(20), nrow = 4))
rownames(mat1) <- paste("site",
2013 Jan 31
1
lower corner cumulative probability
Dear useRs,
With the following set of command i managed to create the copula density
================================================
>library(MASS) >library(evd) >X<-matrix(sample(1:3000), ncol=2) >U=cbind(rank(X[,1])/(nrow(X)+1),rank(X[,2])/(nrow(X)+1))
> mat1=kde2d(U[,1],U[,2],n=150) image(mat1$x,mat1$y,mat1$z,col=
rev(heat.colors(1500)),xlab="",ylab="")
2013 Sep 26
1
Grouping Matrix by Columns; OHLC Data
HI,
May be this helps:
set.seed(24)
?mat1<- matrix(sample(1:60,30*24,replace=TRUE),ncol=24)
colnames(mat1)<- rep(c("O","H","L","C"),6)
indx<-seq_along(colnames(mat1))
n<- length(unique(colnames(mat1)))
?res<- lapply(split(indx,(indx-1)%%n+1),function(i) mat1[,i])
lapply(res,head,2)
#$`1`
#????? O? O? O? O? O? O
#[1,] 18 56 51 24 24 52
#[2,]
2007 Jul 24
1
cor inside/outside a function has different output
I'm calculating correlations between two matrices
mat1 <- matrix(sample(1:500,25), ncol = 5,
dimnames=list(paste("mat1row", 1:5, sep=""),
paste("mat1col", 1:5, sep="")))
mat2 <- matrix(sample(501:1000,25), ncol = 5,
dimnames=list(paste("mat2row", 1:5, sep=""),
paste("mat2col", 1:5, sep="")))
2011 Dec 21
1
Gps fraction of degrees function
Dear all, I have the following written example
> coords <- "51°30'48.58\"N"
>
> as.integer(strsplit(coords, "°")[[1]][1])
[1] 51
> as.integer(strsplit(strsplit(coords, "°")[[1]][2], "'")[[1]][1])
[1] 30
> as.numeric(strsplit(strsplit(strsplit(coords, "°")[[1]][2], "'")[[1]][2],
2011 Dec 27
2
importing NPDB
Does anyone have information about using the National Practitioner Data Bank (NPDB) in R? It's public use data available from the U.S. Department of Health and Human Services that can be downloaded as a .dat or .por file. I can't even figure out how to open the file in R.
[[alternative HTML version deleted]]
2003 Oct 31
2
Summing elements in a list
Hi,
Suppose that I have a list where each component is a list of two
matrices. I also have a vector of weights. How can I collapse my
list of lists into a single list of two matrices where each matrix
in the result is the weighted sum of the corresponding matrices.
I could use a loop but this is a nested calculation so I was hoping
there is a more efficient way to do this. To help clarify,
2010 Oct 14
1
rbind ing matrices and resetting column numbers
Sorry for the verbose example. I want to row bind two matrices, and all works except I want the column labelled "row" to be sequential in the new matrix, shown as "mat3" here, i.e. needs to be 1:6 and not 1:3 repeated twice. Any suggestions?
Thanks
J
> colnm1 <- c("row","ti","counti")
> colnm2 <-
2010 Jan 29
7
Simple question on replace a matrix row
Hello, I have a matrix mat1 of dim [1,8] and mat2 of dim[30,8], I want to
replace the first row of mat2 with mat1, this is what I do:
mat2[1,]<-mat1 but it transforms mat2 in a list I don't understand, I want
it to stay a matrix...
-----
Anna Lippel
--
View this message in context: http://n4.nabble.com/Simple-question-on-replace-a-matrix-row-tp1427857p1427857.html
Sent from the R help
2010 Oct 15
1
Dealing with Non-Standard Hours
A data set I obtained has the hours running from 01 through 24
rather than the conventional 00 through 23. My favorite, strptime,
balks at hour 24.
I thought it would be easy to correct but it must be too late on
Friday for my brain and caffeine isn't helping.
TIA for a hint,
Clint
--
Clint Bowman INTERNET: clint at ecy.wa.gov
Air Quality Modeler INTERNET: clint at math.utah.edu
2006 Aug 28
2
Cannot get simple data.frame binding.
I am stuck on a simple problem where an example works
fine but the real one does not.
I have a data.frame where I wish to sum up some values
across the rows and create a new data.frame with some
of old data.frame variables and the new summed
variable.
It works fine in my simple example but I am doing
something wrong in the real world. In the real world
I am loading a labeled data.frame. The
2013 Jan 10
1
merging command
HI Eliza,
You could do this:
set.seed(15)
mat1<-matrix(sample(1:800,124*12,replace=TRUE),nrow=12) # smaller dataset
#Your codes
?list1<-list()
?for(i in 1:ncol(mat1)){
? list1[[i]]<-t(apply(mat1,1,function(x) x[i]-x))
? list1}
?x<-list1??
x<-matrix(unlist(x),nrow=12)
x<-abs(x)
?y<-colSums(x, na.rm=FALSE)
z<-matrix(y,ncol=10)
?z<-as.dist(z)
?z
?# ?? 1?? 2?? 3?? 4?? 5??