similar to: subsetting a matrix and filling other

Displaying 20 results from an estimated 10000 matches similar to: "subsetting a matrix and filling other"

2010 Jan 29
1
use zoo package with multiple column data sets
Readers, I am trying to use the zoo package with an array of data: file1: hh:mm:ss 1 hh:mm:ss 2 hh:mm:ss 3 hh:mm:ss 4 file2: hh:mm:ss 11 55 hh:mm:ss 22 66 hh:mm:ss 33 77 hh:mm:ss 44 88 I wanted to merge these data set so I tried the following commands: library(chron) library(zoo) z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)
2013 Mar 08
2
Zoo Data
Hi Jakob, dat1<-read.table(text=" TIME, Value1, Value2 01.08.2011 02:30:00, 4.4, 4.7 01.09.2011 03:00:00, 4.2, 4.3 01.11.2011 01:00:00, 3.5, 4.3 01.12.2011 01:40:00, 3.4, 4.5 01.01.2012 02:00:00, 4.8, 5.3 01.02.2012 02:30:00, 4.9, 5.2 01.08.2012 02:30:00, 4.1, 4.7 01.12.2012 03:00:00, 4.7, 4.3 01.01.2013 01:00:00, 3, 4.3 01.01.2013 01:30:00, 3.8, 4.1 01.01.2013 02:00:00, 3.8,
2011 May 24
4
writing dates to a file
Hi, I have attached the data files to this note. I use this code: library(zoo) z1 <- read.zoo("baltimorefludata.txt", format = "%m/%d/%Y", header = TRUE) z2 <- read.zoo("baltimorew.txt", format = "%Y%m%d", header = TRUE) z3<-merge(z1,z2) write.table(z3, "fluweatherdata_baltimore2.txt", sep="\t") R is writing the other data
2007 Sep 12
1
warning upon automatic close of connection
I noticed that under R 2.6.0 there is a warning about closing the connection in the code from this post: https://stat.ethz.ch/pipermail/r-help/2007-September/140601.html which is evidently related to the following from the NEWS file: o Connections will be closed if there is no R object referring to them. A warning is issued if this is done, either at garbage collection or if all the
2008 Mar 03
1
write csv file from zoo object
# chron library(chron) fmt.chron <- function(x) { chron(sub(" .*", "", x), gsub(".* (.*)", "\\1:00", x)) } z1 <- read.zoo(SC3.csv, sep = ",", header = TRUE, FUN = fmt.chron) z2 <- read.zoo(SC2.csv, sep = ",", header = TRUE, FUN = fmt.chron) z3<-c(z1, z2) write.table(z3, sep="," , "SC.csv") How do you
2010 Mar 01
1
help with zoo
Hi, I am interested in decomposing a time series and getting the trend, seasonal and?irregular variations, as one can get with the "stl" command. My time series is fairly regular, but it has some breaks. From the zoo manual, I gather that it should be possible to convert it to a regular time series and then fill the NA entries by interpolation. I am not able to proceed beyond a certain
2010 Nov 05
1
prob with legend in my plots!
Hi, I have a problem with the appearance of legend in my plots. If I specify the legend positions in characters like "topright"..etc, it appears, if i specify it in terms of coordinates like "-1, 1" .. etc, it does not appear. Can anyone help me with this? script - x.date <- as.Date(paste(year, month, day, sep="-")) ts1.n.e3 <- ts(data.nemr.e3[,3]) z1.n.e3
2011 May 28
1
How to do operations on zoo/xts objects with Monthly and Daily periodicities
Is there an elegant way to do operations (+/-/*/ / ) on zoo/xts objects when one serie is monthly (end of month) and the other daily (weekdays only) - typically a monthly economic indicator and a stock index price? Thanks, TDB -- View this message in context: http://r.789695.n4.nabble.com/How-to-do-operations-on-zoo-xts-objects-with-Monthly-and-Daily-periodicities-tp3558081p3558081.html
2006 Dec 27
5
plotting time series with zoo pckg
Hi all, I am using the zoo package to plot time series. I have a problem with formatting the axes. my zoo object (z) looks like the following. c1 1992-01-10 21 1992-01-17 34 1992-01-24 33 1992-01-31 41 1992-02-07 39 1992-02-14 38 1992-02-21 37 1992-02-28 28 1992-03-06 33 1992-03-13 40
2006 Jul 08
2
String mathematical function to R-function
hello I make a subroutine that give-me a (mathematical) function in string format. I would like transform this string into function ( R function ). thanks for any tips. cleber #e.g. fun_String = "-100*x1 + 0*x2 + 100*x3" fun <- function(x1,x2,x3){ return( ############ evaluation( fun_String ) ############ ) True String mathematical function :-( :-( > nomes [1]
2010 May 20
2
Time problems (POSIXct)
Hello, I have a zoo time series object (say a) with the following time stamp/format [1] "1950-01-03 GMT" "1950-01-04 GMT" "1950-01-05 GMT" "1950-01-06 GMT" [5] "1950-01-09 GMT" "1950-01-10 GMT" and another (say b) with [1] "1950-01-05" "1950-01-06" "1950-01-09" "1950-01-10"
2008 Mar 05
1
plotting big zoo object memory problem
the comma seperated file is 37Mb, and I get the below message: it is zoo object read in this way: # chron > library(chron) > fmt.chron <- function(x) { + chron(sub(" .*", "", x), gsub(".* (.*)", "\\1:00", x)) + } > z1 <- read.zoo("all.csv", sep = ",", header = TRUE, FUN = fmt.chron) and then the plot is done with:
2003 Jul 14
2
Subsetting a matrix
I'd welcome some comments or advice regarding the situation described below. The following illustrates what seems to me to be an inconsistency in the behaviour of matrix subsetting: > Z<-matrix(c(1.1,2.1,3.1,1.2,2.2,3.2,1.3,2.3,3.3),nrow=3) > Z [,1] [,2] [,3] [1,] 1.1 1.2 1.3 [2,] 2.1 2.2 2.3 [3,] 3.1 3.2 3.3 > dim(Z) [1] 3 3 >
2009 Nov 09
3
How to transform the Matrix into the way I want it ???
Hi, R users, I'm trying to transform a matrix A into B (see below). Anyone knows how to do it in R? Thanks. Matrix A (zone to zone travel time) zone z1 z2 z3 z1 0 2.9 4.3 z2 2.9 0 2.5 z3 4.3 2.5 0 B: from to time z1 z1 0 z1 z2 2.9 z1 z3 4.3 z2 z1 2.9 z2 z2 0 z2 z3 2.5 z3 z1 4.3 z3 z2 2.5 z3 z3 0 The real matrix I have is much larger, with more than 2000 zones. But I think it should
2012 Aug 08
3
help, please! matrix operations inside 3 nested loops
hello, this is my script: #1) read in data: daten<-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt', header=TRUE, sep="\t") daten<-as.matrix(daten) #2) create empty matrix: indxind<-matrix(nrow=617, ncol=617) indxind[1:20,1:19] #3) compare cells to each other, score: for (s in 3:34) { #walks though the matrix colum by colum, starting at
2012 Aug 10
2
Zoo object problem: Find the column name of a univariate zoo object
Hi everyone and Achim, Achim, I appreciate your help about the function "NCOL". When I use "NCOL" instead of "ncol", I can find out the number of columns (number of time series) in the presence of only one time series (one variable, one column). Now I want to know how I can find out the column names of the zoo objects? In case of more than one time series, the
2008 Mar 07
1
zoo object won't plot
DateTime RM61 11/30/2006 12:31 NA 11/30/2006 12:46 NA 11/30/2006 13:01 2646784125 11/30/2006 13:16 NA 11/30/2006 13:31 NA 11/30/2006 13:46 NA 11/30/2006 14:01 2666435177 11/30/2006 14:16 NA 11/30/2006 14:31 NA 11/30/2006 14:46 NA 11/30/2006 15:01 2653041914 11/30/2006 15:16 NA 11/30/2006 15:31 NA 11/30/2006 15:46 NA 11/30/2006 16:01 2693126189 11/30/2006 16:16 NA 11/30/2006 16:31 NA 11/30/2006
2002 Mar 27
2
Error with nls
Dear R-group members, I use: platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 4.1 year 2002 month 01 day 30 language R I try to fit a 2 compartment model. The compartments are open, connected to each other and
2007 Mar 16
1
Revisiting multiple plots
Suppose I create a multiple plot with zoo, using: index <- ISOdatetime(2004, rep(1:2, 5), sample(28, 10), 0, 0, 0) foo <- zoo(rnorm(10), index) for (i in 1:9) { data <- rnorm(10) z1 <- zoo(data, index) foo <- cbind(foo, z1) } plot(foo) This creates 10 plots on one device, one for each column in foo. Now I want to go back and use abline to draw a line at the mean on each of
2006 Jun 15
3
matrix selection return types
Dear Rusers, I would like some comments about the following results (under R-2.2.0) > m = matrix(1:6 , 2 , 3) > m [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 > z1 = m[(m[,1]==2),] > z1 [1] 2 4 6 > is.matrix(z1) [1] FALSE > z2 = m[(m[,1]==0),] > z2 [,1] [,2] [,3] > is.matrix(z2) [1] TRUE Considered together, I'm a bit surprised about