similar to: NROW doesn't equal length(x)

Displaying 20 results from an estimated 5000 matches similar to: "NROW doesn't equal length(x)"

2011 Aug 22
2
Duplicate Rows in xts
I read enourmous comment about this questions stating that it was answered before.? I?have been looking for the answer for a week without luck !!!? I searched the archives the xts. vignitte , googled for an answer but couldn't find one so her it is: ? the Vignette states that xts "doesn't inforce the duplicate row requirement" but yet when I try to bring in tick stock data from
2011 Aug 26
2
cbind giving NA's?
I have two xts objects, call them "a" and "b", and am trying to merge them... > class(a) [1] "xts" "zoo" > class(b) [1] "xts" "zoo" > head(a) 2010-04-01 7.6343 2010-04-02 7.6343 2010-04-03 7.5458 2010-04-04 7.4532 2010-04-05 7.4040 2010-04-06 7.3317 > head(b) 2010-04-01 568.80 2010-04-05 571.01 2010-04-06
2011 Nov 08
3
window?
Can someone enlighten me on why the following doesn't work? setwd('C:/Temp/R') d <- rep(1:53,2) (s <- ts(d, frequency=53, start=c(2000,10))) n <- length(s) k <- n%/%3 for(i in (n-k):n) { st <- c(start(s)[1] + (start(s)[2] + i)%/%frequency(s), (start(s)[2] + i) %% frequency(s)) ed <- c(start(s)[1] +
2011 Sep 22
2
the opposite of lag() in panel data
Hi R-helpers I want a function that performs the opposite of lag() with panel data. I have transformed my data before with pdata.frame(mydata, index=c("groupindex", “timeindex")) And then I’ve done lag(mydata, -1) but it doesn’t work. The error message was: Error in rep(1, ak) : invalid ''times'' argument Thank you in advance, Cecília Carmo
2011 Nov 16
3
Interpolating hourly basis
I have a huge data set in the form of            V1           V2         V3   V4     V5  V6 1     201005010000201005010000 1.68291.38 1  0 2     201005010000201005010300 0.93335.10 1  0 3     201005010000201005010600 2.25 57.38 1  0 4     201005010000201005010900 0.43 13.76 1  0 5     201005010000201005011200 0.74101.14 1  0 I am interested in interpolating it on an hour basis(it's for avery
2012 Nov 09
2
TreynorRatio
i read about the performance analytics package i have a doubt about the TreynorRatio i have code g=getSymbols("IBM") > c=Cl(g) > r=Return.calculate(c) > SharpeRatio.annualized(r) IBM.Close Annualized Sharpe Ratio (Rf=0%) 0.3566339 > TreynorRatio (ret) Error in inherits(x, "xts") : argument "Rb" is missing, with
2011 Aug 10
1
How to get the date of specific value within a zoo object?
Hi all, I have a zoo time series object, see below code: ------------------------------------------------------------------------------------------- # This is a pasteable example library(zoo) x <- c(1, 2, 3, 4, 5) dt <- c("2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04", "201-01-05") ts <- zoo(x, ts)
2011 Oct 31
1
Significance of trend
Hi everyone, I'm trying to determine the significance of a trendline. From my internet search months ago, I came across the following post. I modified tim and dat for simiplicity. tim <- 1:10 dat <- c(0.17, 1.09 ,0.11, 0.82, 0.23, 0.38 ,2.47 ,0.41 ,0.75, 1.44) fstat <- summary(lm(dat~tim))$fstatistic p.val <-
2011 Oct 12
4
R and Forex
Hi all, I recently started learning about Forex and found this O'Reilly book in Barnes & Nobles about R. I bought it out of pure curiosity. I like what I see. However, I have a question. Has anyone tried to bring these two ideas together in a financial and trading sense? Are there any libraries or modules in R that can aid in this venture? --Yves [[alternative HTML version
2013 Jun 19
3
how to get growth rate of a (time series) data?
Hello all, now I'm trying to switch from Excel to R to deal with the data, and as a newbie i got the problem as follows. suppose I have a data named "test" test<- data.frame(year=c(1996:2011), Y=c(74163.6,81658.5,86531.6,91125.0,98749.0,109028.0,120475.6,136613.4,160956.6,187423.5,222712.5,266599.2,315974.6,348775.1,402816.5,465731.3)) in which Y means the GDP of a country If i
2011 Sep 12
5
completing missing samples
Hello, I have a time-series that has some missing samples. I was thinking on completing them using either zero-order hold or linear interpolation. I am looking for an efiicient way (other than a loop...) of identifiying the missing time slots and filling them. Can you think of any methods that might help here? (obviously which(diff(time)>min(diff(time))) will give the locations, but what
2011 Oct 17
2
Beginner's question about plotting variables in a time series object with the date on the x axis
Dear R helpers,   I am a beginner at R so please be gentle :) I have already read manuals and FAQs, with no help. I have a monthly time series data on public debt with 40 variables, it starts on January 1994 and ends on June 2011. I am loading the data into R using read.csv and the data looks ok when I do edit(dados): > dados<-read.csv("dadosR3.csv", header=T) then I tried making
2011 May 01
1
quick help needed: split a number and "find and replace" type of function that works like in MS excel
Hi R experts I have a couple of quick question: Q1 #my data set.seed(12341) SN <- 1:100 pool<- c(12,13,14, 23, 24, 34) CT1<- sample(pool, 100, replace= TRUE) set.seed(1242) CT2 <- sample(pool, 100, replace= TRUE) set.seed(142) CT3 <- sample(pool, 100, replace= TRUE) # the number of variables run to end of coulmn 20000 mydf <- data.frame(SN, CT1, CT2, CT3) First question:
2010 May 06
2
reading in file with different row length
Hi all, I have a file, say, test.txt, which contains the following information. I'm trying to read in the file and specifying the missing values as NA so that each column has the same number of rows. I've tried all sorts of manipulation but to no avail. r1 r2 r3 1 3 2 3 3 2 3 4 2 3 5 2 3 6 2 3 7 2 8 2 9 2 3 The output should be r1 r2 r3 1 NA 3 2 NA 3 3 2 3 4 2 3 5 2 3 6 2 3 7 2
2011 Aug 04
2
Efficient way of creating a shifted (lagged) variable?
Hello! I have a data set: set.seed(123) y<-data.frame(week=seq(as.Date("2010-01-03"), as.Date("2011-01-31"),by="week")) y$var1<-c(1,2,3,round(rnorm(54),1)) y$var2<-c(10,20,30,round(rnorm(54),1)) # All I need is to create lagged variables for var1 and var2. I looked around a bit and found several ways of doing it. They all seem quite complicated - while in
2013 Jan 22
6
plot two time series with different length and different starting point in one figure.
Hello, I do have two different time series A and B, they are different in length and starting point. A starts in Jan, 2012 and ends in Dec, 2012 and B starts in March, 2012 and ends in Nov, 2012. How can I plot those two series A and B in the same plot? I.E., from Jan. 2012 - Feb, 2012, it would have one data point from A and from Mar, 2012-Nov, 2012, it would have two data points from A and B,
2009 Dec 04
2
Standard deviation for each element in a set of matrices
Hello R-users, I would like to know how to find the standard deviation for each element in a set of matrices. Given the following files, File1 File2 File3 1 1 1 4 4 4 7 7 7 2 2 2 5 5 5 8 8 8 3 3 3 6 6 6 9 9 9 I want to calculate the standard deviation for every cell in the file (I'm using gridded data). The desired output is Output 3 3 3 3 3
2010 Apr 18
4
confused with yearmon, xts and maybe zoo
R-listers, I am using xts with a yearmon index, but am getting some inconsistent results with the date index when i drop observations (for example by using na.omit). The issue is illustrated in the example below. If I start with a monthly zooreg series starting in 2009, yearmon converts this to "Dec-2008". Not such a worry for my example, but strange. Having converted to xts, i drop
2008 Sep 10
6
request: most repeated component of a list
Dear R community I have stored the results of arrays in a list consist of J-components (say 200 components). Each component containing same no of columns but may be different no of rows. e.g [[1]] [,1] [,2] [,3] [,4] [,5] [1,] 4 0 0 0 0 [2,] 4 3 4 0 0 [3,] 4 3 4 0 0 [4,] 4 3 0 0 0 [[2]] [,1] [,2] [,3] [,4] [,5]
2012 Apr 25
2
On the Design of the R Language
http://www.cs.purdue.edu/homes/jv/pubs/ecoop12.pdf A new paper out on R the language -- I'm not all the way through it but it's been an interesting read so far. Thought it might be of interest to the list. Michael Weylandt [[alternative HTML version deleted]]