[R] data manipulation

Duncan Mackay dulcalma at bigpond.com
Tue Dec 20 00:03:36 CET 2016


Hi David

Thank you for the information

I accidentally deleted my reply coming in from Rhelp and I have not  had a
look at at the  list to see what happened.

I thought that I had set everything up correctly when I had to switch to my
new ISP and use MS Outlook for my email. 

Below is a dput of the file 

dput(cbe)
structure(list(choc = c(1451L, 2037L, 2477L, 2785L, 2994L, 2681L, 
3098L, 2708L, 2517L, 2445L, 2087L, 1801L, 1216L, 2173L, 2286L, 
3121L, 3458L, 3511L, 3524L, 2767L, 2744L, 2603L, 2527L, 1846L, 
1066L, 2327L, 3066L, 3048L, 3806L, 4042L, 3583L, 3438L, 2957L, 
2885L, 2744L, 1837L, 1447L, 2504L, 3248L, 3098L, 4318L, 3561L, 
3316L, 3379L, 2717L, 2354L, 2445L, 1542L, 1606L, 2590L, 3588L, 
3202L, 4704L, 4005L, 3810L, 3488L, 2781L, 2944L, 2817L, 1960L, 
1937L, 2903L, 3357L, 3552L, 4581L, 3905L, 4581L, 4037L, 3345L, 
3175L, 2808L, 2050L, 1719L, 3143L, 3756L, 4776L, 4540L, 4309L, 
4563L, 3506L, 3665L, 3361L, 3094L, 2440L, 1633L, 2935L, 4159L, 
4159L, 4894L, 4921L, 4577L, 4155L, 3851L, 3429L, 3370L, 2726L, 
1674L, 3257L, 4731L, 4481L, 5443L, 5566L, 5044L, 4781L, 4014L, 
3561L, 3801L, 2685L, 1805L, 3756L, 4227L, 4595L, 5702L, 4681L, 
4395L, 4459L, 4191L, 3742L, 3279L, 2468L, 1742L, 3366L, 3633L, 
3701L, 4926L, 4522L, 5275L, 4717L, 4114L, 3851L, 3493L, 2654L, 
2168L, 3561L, 4305L, 4413L, 5307L, 5361L, 4948L, 4472L, 3846L, 
3715L, 3343L, 2939L, 1615L, 3497L, 3915L, 4858L, 4962L, 4504L, 
4767L, 4291L, 4091L, 4164L, 3915L, 3130L, 1696L, 3887L, 4749L, 
4781L, 5089L, 5484L, 5072L, 4611L, 4117L, 3910L, 4252L, 3624L, 
1678L, 3851L, 5021L, 4581L, 6195L, 5338L, 4909L, 4640L, 3706L, 
4113L, 3879L, 3411L, 2043L, 3736L, 4490L, 3715L, 5623L, 4671L, 
5591L, 5461L, 4795L, 4846L, 4843L, 3278L, 2411L, 4278L, 4639L, 
4559L, 6404L, 4851L, 6480L, 6394L, 5752L, 4718L, 4659L, 3842L, 
2873L, 5556L, 5389L, 6135L, 6707L, 5220L, 6249L, 5281L, 4192L, 
4867L, 3752L, 3492L, 1979L, 4584L, 5139L, 5044L, 5501L, 5044L, 
5035L, 5167L, 4650L, 5298L, 4373L, 3941L, 2334L, 4381L, 5665L, 
4393L, 5232L, 5876L, 5900L, 5704L, 4718L, 4650L, 4446L, 3061L, 
2155L, 4274L, 4695L, 4362L, 4889L, 5370L, 5072L, 4985L, 3978L, 
4139L, 3995L, 3025L, 1949L, 4357L, 4638L, 3994L, 6174L, 5656L, 
4411L, 5504L, 4463L, 4458L, 4528L, 2830L, 1843L, 5042L, 5348L, 
5257L, 6699L, 5388L, 6001L, 5966L, 4845L, 4507L, 4214L, 3460L, 
1833L, 4978L, 6464L, 5820L, 6447L, 6191L, 6628L, 5452L, 5295L, 
5080L, 5564L, 3965L, 2062L, 5099L, 6162L, 5529L, 6416L, 6382L, 
5624L, 5785L, 4644L, 5331L, 5143L, 4596L, 2180L, 5786L, 5840L, 
5666L, 6360L, 6219L, 6082L, 5653L, 5726L, 5049L, 5859L, 4091L, 
2167L, 6480L, 7375L, 6583L, 7251L, 6730L, 6428L, 5228L, 4716L, 
6101L, 5753L, 4000L, 2691L, 5898L, 6526L, 5840L, 6650L, 5717L, 
7236L, 6523L, 5729L, 6004L, 5950L, 4690L, 3687L, 7791L, 7153L, 
6434L, 7850L, 6809L, 8379L, 6914L, 6919L, 7265L, 6994L, 5503L, 
3782L, 7502L, 8119L, 7292L, 6886L, 7049L, 7977L, 8519L, 6680L, 
7994L, 7047L, 5782L, 3771L, 7906L, 8970L, 6077L, 7919L, 7340L, 
7791L, 7368L, 8255L, 7816L, 7476L, 6696L, 4484L, 8274L, 8866L, 
8572L, 9176L, 8645L, 8265L, 9558L, 7037L, 9101L, 8180L, 7072L, 
3832L, 7253L, 8667L, 7658L, 8859L, 7291L, 7529L, 8715L, 8450L, 
9085L, 8350L, 7080L), beer = c(96.3, 84.4, 91.2, 81.9, 80.5, 
70.4, 74.8, 75.9, 86.3, 98.7, 100.9, 113.8, 89.8, 84.4, 87.2, 
85.6, 72, 69.2, 77.5, 78.1, 94.3, 97.7, 100.2, 116.4, 97.1, 93, 
96, 80.5, 76.1, 69.9, 73.6, 92.6, 94.2, 93.5, 108.5, 109.4, 105.1, 
92.5, 97.1, 81.4, 79.1, 72.1, 78.7, 87.1, 91.4, 109.9, 116.3, 
113, 100, 84.8, 94.3, 87.1, 90.3, 72.4, 84.9, 92.7, 92.2, 114.9, 
112.5, 118.3, 106, 91.2, 96.6, 96.3, 88.2, 70.2, 86.5, 88.2, 
102.8, 119.1, 119.2, 125.1, 106.1, 102.1, 105.2, 101, 84.3, 87.5, 
92.7, 94.4, 113, 113.9, 122.9, 132.7, 106.9, 96.6, 127.3, 98.2, 
100.2, 89.4, 95.3, 104.2, 106.4, 116.2, 135.9, 134, 104.6, 107.1, 
123.5, 98.8, 98.6, 90.6, 89.1, 105.2, 114, 122.1, 138, 142.2, 
116.4, 112.6, 123.8, 103.6, 113.9, 98.6, 95, 116, 113.9, 127.5, 
131.4, 145.9, 131.5, 131, 130.5, 118.9, 114.3, 85.7, 104.6, 105.1, 
117.3, 142.5, 140, 159.8, 131.2, 125.4, 126.5, 119.4, 113.5, 
98.7, 114.5, 113.8, 133.1, 143.4, 137.3, 165.2, 126.9, 124, 135.7, 
130, 109.4, 117.8, 120.3, 121, 132.3, 142.9, 147.4, 175.9, 132.6, 
123.7, 153.3, 134, 119.6, 116.2, 118.6, 130.7, 129.3, 144.4, 
163.2, 179.4, 128.1, 138.4, 152.7, 120, 140.5, 116.2, 121.4, 
127.8, 143.6, 157.6, 166.2, 182.3, 153.1, 147.6, 157.7, 137.2, 
151.5, 98.7, 145.8, 151.7, 129.4, 174.1, 197, 193.9, 164.1, 142.8, 
157.9, 159.2, 162.2, 123.1, 130, 150.1, 169.4, 179.7, 182.1, 
194.3, 161.4, 169.4, 168.8, 158.1, 158.5, 135.3, 149.3, 143.4, 
142.2, 188.4, 166.2, 199.2, 182.7, 145.2, 182.1, 158.7, 141.6, 
132.6, 139.6, 147, 166.6, 157, 180.4, 210.2, 159.8, 157.8, 168.2, 
158.4, 152, 142.2, 137.2, 152.6, 166.8, 165.6, 198.6, 201.5, 
170.7, 164.4, 179.7, 157, 168, 139.3, 138.6, 153.4, 138.9, 172.1, 
198.4, 217.8, 173.7, 153.8, 175.6, 147.1, 160.3, 135.2, 148.8, 
151, 148.2, 182.2, 189.2, 183.1, 170, 158.4, 176.1, 156.2, 153.2, 
117.9, 149.8, 156.6, 166.7, 156.8, 158.6, 210.8, 203.6, 175.2, 
168.7, 155.9, 147.3, 137, 141.1, 167.4, 160.2, 191.9, 174.4, 
208.2, 159.4, 161.1, 172.1, 158.4, 114.6, 159.6, 159.7, 159.4, 
160.7, 165.5, 205, 205.2, 141.6, 148.1, 184.9, 132.5, 137.3, 
135.5, 121.7, 166.1, 146.8, 162.8, 186.8, 185.5, 151.5, 158.1, 
143, 151.2, 147.6, 130.7, 137.5, 146.1, 133.6, 167.9, 181.9, 
202, 166.5, 151.3, 146.2, 148.3, 144.7, 123.6, 151.6, 133.9, 
137.4, 181.6, 182, 190, 161.2, 155.5, 141.9, 164.6, 136.2, 126.8, 
152.5, 126.6, 150.1, 186.3, 147.5, 200.4, 177.2, 127.4, 177.1, 
154.4, 135.2, 126.4, 147.3, 140.6, 152.3, 151.2, 172.2, 215.3, 
154.1, 159.3, 160.4, 151.9, 148.4, 139.6, 148.2, 153.5, 145.1, 
183.7, 210.5, 203.3, 153.3, 144.3, 169.6, 143.7, 160, 135.5, 
141.7, 159.9, 145.6, 183.4, 198.1, 186.7, 171.9, 150.5, 163, 
153.6, 152.8, 135.4, 148.3, 148.3, 133.5, 193.8, 208.4, 197), 
    elec = c(1497L, 1463L, 1648L, 1595L, 1777L, 1824L, 1994L, 
    1835L, 1787L, 1699L, 1633L, 1645L, 1597L, 1577L, 1709L, 1756L, 
    1936L, 2052L, 2105L, 2016L, 1914L, 1925L, 1824L, 1765L, 1721L, 
    1752L, 1914L, 1857L, 2159L, 2195L, 2287L, 2276L, 2096L, 2055L, 
    2004L, 1924L, 1851L, 1839L, 2019L, 1937L, 2270L, 2251L, 2382L, 
    2364L, 2129L, 2110L, 2072L, 1980L, 1995L, 1932L, 2171L, 2162L, 
    2489L, 2424L, 2641L, 2630L, 2324L, 2412L, 2284L, 2186L, 2184L, 
    2144L, 2379L, 2383L, 2717L, 2774L, 3051L, 2891L, 2613L, 2600L, 
    2493L, 2410L, 2390L, 2463L, 2616L, 2734L, 2970L, 3125L, 3342L, 
    3207L, 2964L, 2919L, 2764L, 2732L, 2622L, 2698L, 2950L, 2895L, 
    3200L, 3408L, 3679L, 3473L, 3154L, 3107L, 3052L, 2918L, 2786L, 
    2739L, 3125L, 3033L, 3486L, 3661L, 3927L, 3851L, 3456L, 3390L, 
    3280L, 3166L, 3080L, 3069L, 3340L, 3310L, 3798L, 3883L, 4191L, 
    4213L, 3766L, 3628L, 3520L, 3322L, 3250L, 3287L, 3552L, 3440L, 
    4153L, 4265L, 4655L, 4492L, 4051L, 3967L, 3807L, 3639L, 3647L, 
    3560L, 3929L, 3858L, 4485L, 4697L, 4977L, 4675L, 4596L, 4491L, 
    4127L, 4144L, 4014L, 3994L, 4320L, 4400L, 5002L, 5091L, 5471L, 
    5193L, 4997L, 4737L, 4546L, 4498L, 4350L, 4206L, 4743L, 4582L, 
    5191L, 5457L, 5891L, 5618L, 5158L, 5030L, 4800L, 4654L, 4453L, 
    4440L, 4945L, 4788L, 5425L, 5706L, 6061L, 5846L, 5242L, 5408L, 
    5114L, 5042L, 5008L, 4657L, 5359L, 5193L, 5891L, 5980L, 6390L, 
    6366L, 5756L, 5640L, 5429L, 5398L, 5413L, 5141L, 5695L, 5554L, 
    6369L, 6592L, 7107L, 6917L, 6353L, 6205L, 5830L, 5646L, 5379L, 
    5489L, 5824L, 5907L, 6482L, 6795L, 7028L, 6776L, 6274L, 6362L, 
    5940L, 5958L, 5769L, 5887L, 6367L, 6165L, 6868L, 7201L, 7601L, 
    7581L, 7090L, 6841L, 6408L, 6435L, 6176L, 6138L, 6717L, 6470L, 
    7312L, 7763L, 8171L, 7788L, 7311L, 6679L, 6704L, 6724L, 6552L, 
    6427L, 7105L, 6869L, 7683L, 8082L, 8555L, 8386L, 7553L, 7398L, 
    7112L, 6886L, 7077L, 6820L, 7426L, 7143L, 8261L, 8240L, 8977L, 
    8991L, 8026L, 7911L, 7510L, 7381L, 7366L, 7414L, 7824L, 7524L, 
    8279L, 8707L, 9486L, 8973L, 8231L, 8206L, 7927L, 7999L, 7834L, 
    7521L, 8284L, 7999L, 8940L, 9381L, 10078L, 9796L, 8471L, 
    8572L, 8150L, 8168L, 8166L, 7903L, 8606L, 8071L, 9178L, 9873L, 
    10476L, 9296L, 8818L, 8697L, 8381L, 8293L, 7942L, 8001L, 
    8744L, 8397L, 9115L, 9773L, 10358L, 9849L, 9083L, 9143L, 
    8800L, 8741L, 8492L, 8795L, 9354L, 8796L, 10072L, 10174L, 
    11326L, 10744L, 9806L, 9740L, 9373L, 9244L, 9407L, 8827L, 
    9880L, 9364L, 10580L, 10899L, 11687L, 11280L, 10208L, 10212L, 
    9725L, 9721L, 9846L, 9407L, 10265L, 9970L, 10801L, 11246L, 
    12167L, 11578L, 10645L, 10613L, 10104L, 10348L, 10263L, 9973L, 
    10803L, 10409L, 11458L, 11845L, 12559L, 12070L, 11221L, 11338L, 
    10761L, 11012L, 10923L, 10790L, 11427L, 10788L, 11772L, 12104L, 
    12634L, 12772L, 11764L, 11956L, 11646L, 11750L, 11485L, 11198L, 
    12265L, 11704L, 12419L, 13259L, 13945L, 13839L, 12387L, 12546L, 
    12038L, 11977L, 12336L, 11793L, 12877L, 11923L, 13306L, 13988L, 
    14002L, 14338L, 12867L, 12761L, 12449L, 12658L)), .Names = c("choc", 
"beer", "elec"), class = "data.frame", row.names = c(NA, -396L
))

Regards

Duncan

-----Original Message-----
From: David Winsemius [mailto:dwinsemius at comcast.net] 
Sent: Monday, 19 December 2016 13:47
To: Duncan Mackay
Cc: R
Subject: Re: [R] data manipulation


> On Dec 18, 2016, at 5:39 PM, Duncan Mackay <dulcalma at bigpond.com> wrote:
> 
> 
> Hi David
> 
> Thanks for the info. 
> As a test I am attaching it anyway

Nothing allowed as an attachment by the server.

--
David.
> 
> Regards
> 
> Duncan
> 
> -----Original Message-----
> From: David Winsemius [mailto:dwinsemius at comcast.net] 
> Sent: Monday, 19 December 2016 05:36
> To: Duncan Mackay
> Cc: R
> Subject: Re: [R] data manipulation
> 
> 
>> On Dec 17, 2016, at 7:57 PM, Duncan Mackay <dulcalma at bigpond.com> wrote:
>> 
>> Hi 
>> 
>> Coming late to the discussion  - I deleted the original message
>> I found that I have a cbe.dat that I downloaded some years ago from
>> cowpertwaite's site .
>> 
>> And have attached it
> 
> Experience has shown that when you attach a file that you hope to be
> distributed to the list it needs to have a .txt extension. Leaving it with
a
> .csv, .tsv, or .dat extension will cause it to be dropped by the server,
> even if the contents of the file are ASCII text.
> 
> The URL I offered earlier should have made the file available:
>
https://web.archive.org/web/20130501161812/http://staff.elena.aut.ac.nz/Paul
> -Cowpertwait/ts/cbe.dat
> 
> ... but if there is interest in having it in the Rhelp Archive, I can
attach
> it.
> 
> 
> 
> -- 
> David.
>> 
>> If it does not get through will do a dput as the file is only 7K
>> 
>> Regards
>> 
>> Duncan
>> Duncan Mackay
>> Department of Agronomy and Soil Science
>> University of New England
>> Armidale NSW 2351
>> Email: home: mackay at northnet.com.au
>> 
>> -----Original Message-----
>> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Rui
> Barradas
>> Sent: Thursday, 15 December 2016 01:19
>> To: Farshad Fathian; r-help
>> Subject: Re: [R] data manipulation
>> 
>> Hello,
>> 
>> Please cc your mails to the list.
>> As for your data, your url is wrong, you need to contact Massey or maybe 
>> the source of your information and get a valid internet address.
>> Without one there's not much we can do.
>> 
>> Rui Barradas
>> 
>> Em 14-12-2016 12:16, Farshad Fathian escreveu:
>>> Hello,
>>> 
>>> Thanks for your e-mail. I was reading "Introductory Time Series with R"
>>> by PS. Cowperwait. I am going to run the R codes in this book, but I
>>> don't access to the input data from
>>> ("http://massey.ac.nz/~pscoperwait/ts/cbe.dat
>>> <http://massey.ac.nz/~pscoperwait/ts/cbe.dat>") website.
>>> 
>>> Regards,
>>> 
>>> On Wed, Dec 14, 2016 at 3:42 PM, Rui Barradas <ruipbarradas at sapo.pt
>>> <mailto:ruipbarradas at sapo.pt>> wrote:
>>> 
>>>   Hello,
>>> 
>>>   What do you mean by "gives me something"?
>>> 
>>>   xx <- read.csv("http://massey.ac.nz/~pscoperwait/ts/cbe.dat
>>>   <http://massey.ac.nz/~pscoperwait/ts/cbe.dat>")
>>>   Error in file(file, "rt") : cannot open the connection
>>>   In addition: Warning message:
>>>   In file(file, "rt") :
>>>      cannot open URL 'http://massey.ac.nz/~pscoperwait/ts/cbe.dat
>>>   <http://massey.ac.nz/~pscoperwait/ts/cbe.dat>': HTTP status was '404
>>>   Not Found'
>>> 
>>>   Rui Barradas
>>> 
>>> 
>>>   Em 14-12-2016 11:56, John Kane via R-help escreveu:
>>> 
>>>       xx <- read.csv("http://massey.ac.nz/~pscoperwait/ts/cbe.dat
>>>       <http://massey.ac.nz/~pscoperwait/ts/cbe.dat>")
>>>       gives me something. Since we have no idea of what you are doing
>>>       I don't know if the data has downloaded correctly
>>> 
>>>             On Tuesday, December 13, 2016 1:38 PM, Farshad Fathian
>>>       <farshad.fathian at gmail.com <mailto:farshad.fathian at gmail.com>>
>>>       wrote:
>>> 
>>> 
>>>          Hi,
>>> 
>>> 
>>> 
>>>       I couldn't access to data file about PSCoperwait by
>>>       http://massey.ac.nz/~pscoperwait/ts/cbe.dat
>>>       <http://massey.ac.nz/~pscoperwait/ts/cbe.dat>.
>>> 
>>> 
>>> 
>>>       Looking forward to hearing from you,
>>> 
>>> 
>>>             [[alternative HTML version deleted]]
>>> 
>>>       ______________________________________________
>>>       R-help at r-project.org <mailto:R-help at r-project.org> mailing list
>>>       -- To UNSUBSCRIBE and more, see
>>>       https://stat.ethz.ch/mailman/listinfo/r-help
>>>       <https://stat.ethz.ch/mailman/listinfo/r-help>
>>>       PLEASE do read the posting guide
>>>       http://www.R-project.org/posting-guide.html
>>>       <http://www.R-project.org/posting-guide.html>
>>>       and provide commented, minimal, self-contained, reproducible code.
>>> 
>>> 
>>> 
>>>                [[alternative HTML version deleted]]
>>> 
>>>       ______________________________________________
>>>       R-help at r-project.org <mailto:R-help at r-project.org> mailing list
>>>       -- To UNSUBSCRIBE and more, see
>>>       https://stat.ethz.ch/mailman/listinfo/r-help
>>>       <https://stat.ethz.ch/mailman/listinfo/r-help>
>>>       PLEASE do read the posting guide
>>>       http://www.R-project.org/posting-guide.html
>>>       <http://www.R-project.org/posting-guide.html>
>>>       and provide commented, minimal, self-contained, reproducible code.
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> ______________________________________________
>> R-help at 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.
>> ______________________________________________
>> R-help at 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.
> 
> David Winsemius
> Alameda, CA, USA
> 
> ______________________________________________
> R-help at 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list