Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot create an fts object #2

Open
rhameysayed opened this issue Sep 5, 2014 · 3 comments
Open

cannot create an fts object #2

rhameysayed opened this issue Sep 5, 2014 · 3 comments

Comments

@rhameysayed
Copy link

I have count data for 6 categories of a multivariate time series. I have tried the following two methods fts() and as.fts()

I have an xts object with the 6 columns of count data and dates

index(count.xts[1])

"2009-01-01"
dim(count.xts)
730 6
dts = format(seq(from=index(count.xts[1]),length.out=dim(count.xts)[1],by="days"),"%Y-%m-%d")

# countData is the original data frame with the dates and count data

count.fts1 = fts(index=as.Date(dts), data=as.matrix(countData))

count.fts2 = as.fts(data.frame(asofdate=dts,as.matrix(countData)))

When input either data object into ftsm() or plot() I get the following error:

Error in 1:ncol(y$y) : argument of length 0

I ran the following diagnostics:

class(count.fts2)
[1] "fts" "zoo"

is.fts(count.fts2)
[1] FALSE

That doesn't really make any sense does it? It's a member of class fts but is NOT an fts object.

Just for good measure I did the following:

class(fts(index=as.Date(rownames(countData)),data=as.matrix(countData)))
[1] "fts" "zoo"

is.fts(fts(index=as.Date(rownames(new.count)),data=as.matrix(new.count)))
[1] FALSE

What gives?

@armstrtw
Copy link
Owner

armstrtw commented Sep 5, 2014

in what package is 'is.fts' defined? Is it a function in the zoo package, or perhaps in xts? It probably needs to be updated.

'is.fts' is not a function in the fts package...

warmstrong@krypton:/dvl/R.packages/core.stuff/fts/R$ pwd
/home/warmstrong/dvl/R.packages/core.stuff/fts/R
warmstrong@krypton:
/dvl/R.packages/core.stuff/fts/R$ grep 'is.fts' *
warmstrong@krypton:~/dvl/R.packages/core.stuff/fts/R$

@rhameysayed
Copy link
Author

My apologies, as.fts is a function in the ftsa package. I have asked the developer for assistance. Thank you for your help.

@armstrtw
Copy link
Owner

armstrtw commented Sep 5, 2014

well, I do have as.fts, but not is.fts

as.fts
function (x)
{
UseMethod("as.fts")
}
<environment: namespace:fts>
as.fts.matrix
Error: object 'as.fts.matrix' not found
as.fts.data.frame
function (x)
{
cnames <- colnames(x)
ans <- fts(index = x[, "asofdate"], data = as.matrix(x[,
-match("asofdate", cnames)]))
colnames(ans) <- cnames[-1]
ans
}
<environment: namespace:fts>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants