[R] How to extract Friday data from daily data.
Gabor Grothendieck
ggrothendieck at gmail.com
Sun Nov 7 14:52:07 CET 2010
On Sat, Nov 6, 2010 at 11:05 PM, thornbird <huachang396 at gmail.com> wrote:
>
> Thank you very much. I learned a lot through your help. It worked great for
> the sample data. But when I try to apply the command to my dataset, I ran
> into two more problems.
>
> First, the dataset is huge, it has thousands of lines. I can read it in R.
> Using Lines <- " data " may not work such a huge dataset. Is there a way
> to use data name in the commands.
That was just to keep the example self contained. The commented out
line before the read.zoo line shows how it would be done with a file.
>
> Second, I have two more variables, webpage and item. Using your command, I
> can extract data for one item (say "fans") with no problem. But under
> "item", there is also "views", they may have same time and date as "fans",
> how can I sort it out without replacing the same date? Also, under
> "webpage", I have two actors/actresses, it has the similar issue. How can I
> sort it out without replacing the same date?
Please provide a reproducible example illustrating what is to be
produced and include code to do as much of it as you can.
>
> Thanks for the time and help.
>
>
> Below is the sample:
>
>
>> testdata <- read.csv("C:\\Users\\Kevin\\Desktop\\testdata.csv",
>> header=TRUE)
>> testdata
> webpage item value day date time
> 1 MattDamon fans 613031 Wed 10-Jun-09 9:40:53
> 2 MattDamon fans 630242 Thu 11-Jun-09 5:27:47
> 3 MattDamon fans 631966 Thu 11-Jun-09 9:23:23
> 4 MattDamon fans 642045 Thu 11-Jun-09 22:11:33
> 5 MattDamon fans 669791 Sat 13-Jun-09 13:07:53
> 6 MattDamon fans 700180 Mon 15-Jun-09 5:07:06
> 7 MattDamon fans 702949 Mon 15-Jun-09 13:09:43
> 8 MattDamon fans 726624 Tue 16-Jun-09 22:45:27
> 9 MattDamon fans 734412 Wed 17-Jun-09 13:08:19
> 10 MattDamon fans 765057 Fri 19-Jun-09 12:37:09
> 11 MattDamon fans 782741 Sat 20-Jun-09 12:38:36
> 12 MattDamon fans 796054 Sun 21-Jun-09 12:36:25
> 13 MattDamon fans 809816 Mon 22-Jun-09 12:39:36
> 14 MattDamon fans 833996 Tue 23-Jun-09 12:40:25
> 15 MattDamon fans 871237 Thu 25-Jun-09 12:38:27
> 16 MattDamon fans 887175 Fri 26-Jun-09 12:36:12
> 17 MattDamon fans 887195 Fri 26-Jun-09 13:36:12
> 18 MattDamon fans 899900 Sat 27-Jun-09 12:40:36
> 19 MattDamon fans 910401 Sun 28-Jun-09 12:38:07
> 20 MattDamon fans 921537 Mon 29-Jun-09 12:35:17
> 21 MattDamon fans 934280 Tue 30-Jun-09 12:36:43
> 22 MattDamon fans 986463 Mon 6-Jul-09 13:58:19
> 23 MattDamon views 613031 Wed 10-Jun-09 9:40:53
> 24 MattDamon views 630242 Thu 11-Jun-09 5:27:47
> 25 MattDamon views 631966 Thu 11-Jun-09 9:23:23
> 26 MattDamon views 642045 Thu 11-Jun-09 22:11:33
> 27 MattDamon views 669791 Sat 13-Jun-09 13:07:53
> 28 MattDamon views 700180 Mon 15-Jun-09 5:07:06
> 29 MattDamon views 702949 Mon 15-Jun-09 13:09:43
> 30 MattDamon views 726624 Tue 16-Jun-09 22:45:27
> 31 MattDamon views 734412 Wed 17-Jun-09 13:08:19
> 32 MattDamon views 765057 Fri 19-Jun-09 12:37:09
> 33 MattDamon views 782741 Sat 20-Jun-09 12:38:36
> 34 MattDamon views 796054 Sun 21-Jun-09 12:36:25
> 35 MattDamon views 809816 Mon 22-Jun-09 12:39:36
> 36 MattDamon views 833996 Tue 23-Jun-09 12:40:25
> 37 MattDamon views 871237 Thu 25-Jun-09 12:38:27
> 38 MattDamon views 887175 Fri 26-Jun-09 12:36:12
> 39 MattDamon views 887195 Fri 26-Jun-09 13:36:12
> 40 MattDamon views 899900 Sat 27-Jun-09 12:40:36
> 41 MattDamon views 910401 Sun 28-Jun-09 12:38:07
> 42 MattDamon views 921537 Mon 29-Jun-09 12:35:17
> 43 MattDamon views 934280 Tue 30-Jun-09 12:36:43
> 44 MattDamon views 986463 Mon 6-Jul-09 13:58:19
> 45 AngelinaJolie fans 613031 Wed 10-Jun-09 9:40:53
> 46 AngelinaJolie fans 630242 Thu 11-Jun-09 5:27:47
> 47 AngelinaJolie fans 631966 Thu 11-Jun-09 9:23:23
> 48 AngelinaJolie fans 642045 Thu 11-Jun-09 22:11:33
> 49 AngelinaJolie fans 669791 Sat 13-Jun-09 13:07:53
> 50 AngelinaJolie fans 700180 Mon 15-Jun-09 5:07:06
> 51 AngelinaJolie fans 702949 Mon 15-Jun-09 13:09:43
> 52 AngelinaJolie fans 726624 Tue 16-Jun-09 22:45:27
> 53 AngelinaJolie fans 734412 Wed 17-Jun-09 13:08:19
> 54 AngelinaJolie fans 765057 Fri 19-Jun-09 12:37:09
> 55 AngelinaJolie fans 782741 Sat 20-Jun-09 12:38:36
> 56 AngelinaJolie fans 796054 Sun 21-Jun-09 12:36:25
> 57 AngelinaJolie fans 809816 Mon 22-Jun-09 12:39:36
> 58 AngelinaJolie fans 833996 Tue 23-Jun-09 12:40:25
> 59 AngelinaJolie fans 871237 Thu 25-Jun-09 12:38:27
> 60 AngelinaJolie fans 887175 Fri 26-Jun-09 12:36:12
> 61 AngelinaJolie fans 887195 Fri 26-Jun-09 13:36:12
> 62 AngelinaJolie fans 899900 Sat 27-Jun-09 12:40:36
> 63 AngelinaJolie fans 910401 Sun 28-Jun-09 12:38:07
> 64 AngelinaJolie fans 921537 Mon 29-Jun-09 12:35:17
> 65 AngelinaJolie fans 934280 Tue 30-Jun-09 12:36:43
> 66 AngelinaJolie fans 986463 Mon 6-Jul-09 13:58:19
> 67 AngelinaJolie views 613031 Wed 10-Jun-09 9:40:53
> 68 AngelinaJolie views 630242 Thu 11-Jun-09 5:27:47
> 69 AngelinaJolie views 631966 Thu 11-Jun-09 9:23:23
> 70 AngelinaJolie views 642045 Thu 11-Jun-09 22:11:33
> 71 AngelinaJolie views 669791 Sat 13-Jun-09 13:07:53
> 72 AngelinaJolie views 700180 Mon 15-Jun-09 5:07:06
> 73 AngelinaJolie views 702949 Mon 15-Jun-09 13:09:43
> 74 AngelinaJolie views 726624 Tue 16-Jun-09 22:45:27
> 75 AngelinaJolie views 734412 Wed 17-Jun-09 13:08:19
> 76 AngelinaJolie views 765057 Fri 19-Jun-09 12:37:09
> 77 AngelinaJolie views 782741 Sat 20-Jun-09 12:38:36
> 78 AngelinaJolie views 796054 Sun 21-Jun-09 12:36:25
> 79 AngelinaJolie views 809816 Mon 22-Jun-09 12:39:36
> 80 AngelinaJolie views 833996 Tue 23-Jun-09 12:40:25
> 81 AngelinaJolie views 871237 Thu 25-Jun-09 12:38:27
> 82 AngelinaJolie views 887175 Fri 26-Jun-09 12:36:12
> 83 AngelinaJolie views 887195 Fri 26-Jun-09 13:36:12
> 84 AngelinaJolie views 899900 Sat 27-Jun-09 12:40:36
> 85 AngelinaJolie views 910401 Sun 28-Jun-09 12:38:07
> 86 AngelinaJolie views 921537 Mon 29-Jun-09 12:35:17
> 87 AngelinaJolie views 934280 Tue 30-Jun-09 12:36:43
> 88 AngelinaJolie views 986463 Mon 6-Jul-09 13:58:19
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-extract-Friday-data-from-daily-data-tp3029050p3030555.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list