[R] splitting data matrix into submatrices
Avi Gross
@v|gro@@ @end|ng |rom ver|zon@net
Wed Jan 5 05:29:14 CET 2022
If you explain better, we can help. But first consider what you are asking and how it is relected in the data.
Is the first component a row number whose meaning is day 1 contains a 1 or perhaps 0 and the next row contains one more? Or is there some kind of date in there?
What day of the week is the first day? Is it a Sunday or a Wednesday or what?
Just for arguments sake, say the first row is a Sunday and all later rows are sequential. Then row 1 is a weekend and row 7 is a weekend and so are rows 7 more (8 and 18) and those 7 more and so on.
What do you call it when you are looking for the remainder after dividing by 7?
Can you make a list of indices that contain every possible weekend, and another index containing just the non-weekends?
If other things like Holidays do not matter, you can index the matrix many ways by asking for all columns but only the rows that your logical index wants.
If I have misunderstood the problem, ignore.
-----Original Message-----
From: Faheem Jan via R-help <r-help using r-project.org>
To: R-help Mailing List <r-help using r-project.org>
Sent: Tue, Jan 4, 2022 10:52 pm
Subject: [R] splitting data matrix into submatrices
I have data in a matrix form of order 1826*24 where 1826 represents the days and 24 hourly observations on each data. My objective is to split the matrix into working (Monday to Friday) and non-working (Saturday and Sunday) submatrices. Can anyone help me that how I will do that splitting using R?
[[alternative HTML version deleted]]
______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help
mailing list