Re: [R] plot with different symbols and colors according to the factor levels

2016-08-30 Thread Clint Bowman


with(lili,plot(y,conc,pch=sample,col=sample,log="y"))

gives a better plot


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 30 Aug 2016, Clint Bowman wrote:


Hanna,

lili<-read.table("lili.txt",header=T)  # don't forget to label the row number 
if it's in your data


with(lili,plot(y,conc,pch=sample,col=sample))

Clint


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 30 Aug 2016, li li wrote:


 Hi all,
 I have the following data. I want to plot the data (y ~ conc)
 with different symbols and colors corresponding to different levels of the
 factor sample.
 I could create a column with color and pch and then do the plot, but I am
 sure there are much better ways.
 Can anyone make suggestions?
  Hanna



   y conc sample
 1  33 20.0  1
 2  33  5.0  1
 3  35  1.25000  1
 4  43  0.31250  1
 5  58  0.078125000  1
 6  54  0.019531250  1
 7  57  0.004882812  1
 8  57  0.001220703  1
 9  32 20.0  1
 10 32  5.0  1
 11 34  1.25000  1
 12 52  0.31250  1
 13 57  0.078125000  1
 14 58  0.019531250  1
 15 59  0.004882812  1
 16 50  0.001220703  1
 17 34 20.0  2
 18 34  5.0  2
 19 38  1.25000  2
 20 53  0.31250  2
 21 57  0.078125000  2
 22 57  0.019531250  2
 23 57  0.004882812  2
 24 52  0.001220703  2
 25 34 20.0  2
 26 33  5.0  2
 27 36  1.25000  2
 28 48  0.31250  2
 29 58  0.078125000  2
 30 57  0.019531250  2
 31 58  0.004882812  2
 32 53  0.001220703  2
 33 34 20.0  2
 34 35  5.0  2
 35 37  1.25000  2
 36 49  0.31250  2
 37 55  0.078125000  2
 38 59  0.019531250  2
 39 57  0.004882812  2
 40 54  0.001220703  2
 41 36 20.0  3
 42 33  5.0  3
 43 36  1.25000  3
 44 51  0.31250  3
 45 57  0.078125000  3
 46 57  0.019531250  3
 47 59  0.004882812  3
 48 56  0.001220703  3
 49 33 20.0  3
 50 32  5.0  3
 51 35  1.25000  3
 52 47  0.31250  3
 53 57  0.078125000  3
 54 56  0.019531250  3
 55 57  0.004882812  3
 56 53  0.001220703  3
 57 33 20.0  3
 58 34  5.0  3
 59 38  1.25000  3
 60 52  0.31250  3
 61 56  0.078125000  3
 62 61  0.019531250  3
 63 56  0.004882812  3
 64 55  0.001220703  3

  [[alternative HTML version deleted]]

 __
 R-help@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@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@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.


Re: [R] plot with different symbols and colors according to the factor levels

2016-08-30 Thread Clint Bowman

Hanna,

lili<-read.table("lili.txt",header=T)  # don't forget to label the row 
number if it's in your data


with(lili,plot(y,conc,pch=sample,col=sample))

Clint


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 30 Aug 2016, li li wrote:


Hi all,
I have the following data. I want to plot the data (y ~ conc)
with different symbols and colors corresponding to different levels of the
factor sample.
I could create a column with color and pch and then do the plot, but I am
sure there are much better ways.
Can anyone make suggestions?
 Hanna



  y conc sample
1  33 20.0  1
2  33  5.0  1
3  35  1.25000  1
4  43  0.31250  1
5  58  0.078125000  1
6  54  0.019531250  1
7  57  0.004882812  1
8  57  0.001220703  1
9  32 20.0  1
10 32  5.0  1
11 34  1.25000  1
12 52  0.31250  1
13 57  0.078125000  1
14 58  0.019531250  1
15 59  0.004882812  1
16 50  0.001220703  1
17 34 20.0  2
18 34  5.0  2
19 38  1.25000  2
20 53  0.31250  2
21 57  0.078125000  2
22 57  0.019531250  2
23 57  0.004882812  2
24 52  0.001220703  2
25 34 20.0  2
26 33  5.0  2
27 36  1.25000  2
28 48  0.31250  2
29 58  0.078125000  2
30 57  0.019531250  2
31 58  0.004882812  2
32 53  0.001220703  2
33 34 20.0  2
34 35  5.0  2
35 37  1.25000  2
36 49  0.31250  2
37 55  0.078125000  2
38 59  0.019531250  2
39 57  0.004882812  2
40 54  0.001220703  2
41 36 20.0  3
42 33  5.0  3
43 36  1.25000  3
44 51  0.31250  3
45 57  0.078125000  3
46 57  0.019531250  3
47 59  0.004882812  3
48 56  0.001220703  3
49 33 20.0  3
50 32  5.0  3
51 35  1.25000  3
52 47  0.31250  3
53 57  0.078125000  3
54 56  0.019531250  3
55 57  0.004882812  3
56 53  0.001220703  3
57 33 20.0  3
58 34  5.0  3
59 38  1.25000  3
60 52  0.31250  3
61 56  0.078125000  3
62 61  0.019531250  3
63 56  0.004882812  3
64 55  0.001220703  3

[[alternative HTML version deleted]]

__
R-help@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@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.


Re: [R] Retrieving data from survey in R Studio

2016-08-18 Thread Clint Bowman

After:

survey <- 
read.csv(file="http://www.maths.usyd.edu.au/u/UG/IM/STAT2012/r/survey.csv;)


do:

summary(survey)

then bone up on "attach" and "with".

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 18 Aug 2016, Ulrik Stervbo wrote:


I don't think you can read files into R like that. This answer
http://stackoverflow.com/questions/3236651/read-data-from-internet on Stack
Overflow tells you, you could use the RCurl package.

Here are more examples on getting data from online sources
https://www.r-bloggers.com/getting-data-from-an-online-source/

You could also just download the file manually and open it using read.scv

Hope this helps,
Ulrik

On Thu, 18 Aug 2016 at 19:10 Barathan Roy Pinas <bpin3...@uni.sydney.edu.au>
wrote:


Hello,


I have been given a .csv file and it is not loading. This is what I did.


survey=read.csv("
http://www.maths.usyd.edu.au/u/UG/IM/STAT2012/r/survey.csv;)
attach(survey)
pulse.sf=pulse[smoke==1 & sex==2]
pulse.sf

Template link here<http://www.maths.usyd.edu.au/u/UG/IM/STAT2012/r/p4.Rnw

.


I insert the file into the R commands section for question 1. Doing that
produces the following below:


survey <- read.csv(file="
http://www.maths.usyd.edu.au/u/UG/IM/STAT2012/r/survey.csv;)
attach(survey)

## Error in attach(survey): object 'survey' not found
pulse.sf=pulse[smoke==1 & sex==2]
## Error in eval(expr, envir, enclos): object 'pulse' not found
pulse.sf
## Error in eval(expr, envir, enclos): object 'pulse.sf' not
found

What's going on? I can actually download the survey and view it on Excel.

Appreciate any help that I can get.

[[alternative HTML version deleted]]

__
R-help@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]]

__
R-help@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@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.


Re: [R] How to identify runs or clusters of events in time

2016-07-01 Thread Clint Bowman

Mark,

I did something similar a couple of year ago by coding non-events as 0, 
positive events as +1 and negative events as -1 then summing the value 
through time.  In my case the patterns showed up quite clearly and I used 
other criteria to define the actual periods.


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 1 Jul 2016, Mark Shanks wrote:


Hi,


Imagine the two problems:


1) You have an event that occurs repeatedly over time. You want to identify 
periods when the event occurs more frequently than the base rate of occurrence. 
Ideally, you don't want to have to specify the period (e.g., break into 
months), so the analysis can be sensitive to scenarios such as many events 
happening only between, e.g., June 10 and June 15 - even though the overall 
number of events for the month may not be much greater than usual. Similarly, 
there may be a cluster of events that occur from March 28 to April 3. Ideally, 
you want to pull out the base rate of occurrence and highlight only the periods 
when the frequency is less or greater than the base rate.


2) Events again occur repeatedly over time in an inconsistent way. However, 
this time, the event has positive or negative outcomes - such as a spot check 
of conformity to regulations. You again want to know whether there is a group 
of negative outcomes close together in time. This analysis should take into 
account the negative outcomes as well though. E.g., if from June 10 to June 15 
you get 5 negative outcomes and no positive outcomes it should be flagged. On 
the other hand, if from June 10 to June 15 you get 5 negative outcomes 
interspersed between many positive outcomes it should be ignored.


I'm guessing that there is some statistical approach designed to look at these 
types of issues. What is it called? What package in R implements it? I 
basically just need to know where to start.


Thanks,


Mark

[[alternative HTML version deleted]]

__
R-help@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@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.


Re: [R] New installation

2016-06-09 Thread Clint Bowman
I "experiment" with the Fedora distribution at home but am very satisfied 
with the Scientific Linux distribution here at work--I'm currently using 
SL7.2.


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 9 Jun 2016, Leonardo Ferreira Fontenelle wrote:


I have tried many Linux distributions before, and never looked back
after switching for Arch Linux. It is one of the best distributions with
regard to having an up to date but still reasonably stable system. Other
options are Fedora  Rawhide (there's a Fedora SIG mailing list) or
Debian Sid (as others mentioned, there's a Debian SIG mailing list), but
I don't know how dependable those versions are.

Leonardo Ferreira Fontenelle
Former GNOME translator

Em Qui 9 jun. 2016, às 20:08, Ista Zahn escreveu:

Perhaps r-sig-debian is more appropriate, though it is not clear to me
that
a debian based linux is in fact the best for running R. Of course "best"
is
not clearly defined here, but I highly recommend Archlinux.

Best,
Ista
On Jun 9, 2016 6:47 PM, "Bert Gunter" <bgunter.4...@gmail.com> wrote:

> I suggest that you post to the r-sig-debian list instead of here. I
> think you are more likely to get good answers to your query there.
>
> Cheers,
> Bert
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Thu, Jun 9, 2016 at 1:44 PM, jax200 <jax...@gmail.com> wrote:
> > Hi
> >
> > I'm starting off with both R and Linux Mint.  During a recent R course, I
> > had multiple difficulties with installing updates needed for the course.
> >
> > As such, I'd like to hit the restart button with fresh installs of Linux
> > and R.  I would appreciate your help with which Linux platform works best
> > with R, and how to go about getting all the updates installed for both
> > programs.
> >
> > Many thanks,  Jack
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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@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]]

__
R-help@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@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@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.

Re: [R] find high correlated variables in a big matrix

2016-05-06 Thread Clint Bowman
Are you rying to find clusters of variables according to some distance 
metric?


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 6 May 2016, Lida Zeighami wrote:


Hi there,

Is there any way to find out high correlated variables among a big matrix?
for example I have a matrix called data= 2000*5000 and I need to find the
high correlated variables between the variables in the columns! (Need 100
high correlated variables from 5000 variables in column)

I could calculate the correlation matrix and pick the high correlated ones
but my problem is, I just can pick pairs of variables with high correlation
and may be we have low correlation across the pairs! Means, in my 100*100
correlation matrix, there are some pairs with low correlation and I
couldn't find the 100 variables which they all have high correlation
together!!!
Would you please ley me know if there is any way?

Thanks

[[alternative HTML version deleted]]

__
R-help@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@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.


Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-15 Thread Clint Bowman

Martin,

I grew up in the Midwest of the United States--about as native English 
speaker as you could find.  I was taught exactly the same as you have 
learned.


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 15 Dec 2015, Martin Maechler wrote:




  []

   > You are missing the closing bracket on the boxplot()
   > command.  Just finish with a ')'

Hmm... I once learned

'()' =: parenthesis/es
'[]' =: bracket(s)
'{}' =: brace(s)

Of course, I'm not a native English speaker, and my teacher(s) /
teaching material may have been biased ... but, as all three
symbol pairs play an important role in R, I think it would be
really really helpful,  if we could agree on using the same
precise English here.

I'm happy to re-learn, but I'd really like to end up with three
different simple English words, if possible.
(Yes, I know and have seen/heard "curly braces", "round
parentheses", ... but I'd hope we can do without the extra adjective.)

Thank you, well versed English (or "American") learned readers
of R-help, for wise guidance on this ...

Martin

__
R-help@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@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.


Re: [R] how to work with time of day (independent of date)

2015-10-30 Thread Clint Bowman

Bill,

Your final words, "changes in spring and fall" reminds me of a problem 
I have yet to solve.  Most of my data is logged in standard time (no 
daylight times) but often I see the note "daylight time encountered 
switching to UTC" even when I've specified "tz="PST".


I hope I've been missing something simple--any suggestions?

TIA

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 30 Oct 2015, William Dunlap wrote:


You can use difftime objects to get the amount of time since the start of
the current day.  E.g.,
 > dateTime <- as.POSIXlt( c("2015-10-29 00:50:00",
 + "2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
 + "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
 + "2015-10-31 10:30:00"))
 > date <- trunc(dateTime, units="days")
 > sinceMidnight <- difftime(dateTime, date, units="mins")
 > sinceMidnight
 Time differences in mins
 [1]   50  570 1270   50  570 1270   50  630

I use difftime(x, y, units=) instead of the similar x-y because the latter
chooses
the units based on how far apart x and y are, while the former gives me
consistent
units:
 > dateTime[1] - date[1]
 Time difference of 50 mins
 > as.numeric(.Last.value)
 [1] 50
 > dateTime[5:6] - date[5:6]
 Time differences in hours
 [1]  9.5 21.16667
 > as.numeric(.Last.value)
 [1]  9.5 21.16667

Depending on what you are using this for, you might want to compute time
since 3am
of the current day so you don't get discontinuities for most times when the
time
changes in spring and fall.



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Oct 30, 2015 at 10:35 AM, Daniel Nordlund <djnordl...@frontier.com>
wrote:


I have a data frame with date/times represented as charaacter strings and
and a value at that date/time.  I want to get the mean value for each time
of day, across days, and then plot time of day on the x-axis and means on
the y-axis.  R doesn't appear to have a built-in time of day time type
(independent of a date), unless I have missed something. What is the best
way to create a time variable so that I can aggregate and plot by time of
day, with time labelled in HH:MM format.  My current approach is to convert
all date/times to the same date.  I can then manage the rest of what I want
with ggplot2.  But I am  wondering if there is an easier/better way to do
deal with time of day.

Here is a sample data frame.

df <- structure(list(date = structure(1:8, .Label = c("2015-10-29
00:50:00",
"2015-10-29 09:30:00", "2015-10-29 21:10:00", "2015-10-30 00:50:00",
"2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00",
"2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L,
80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"), row.names =
c(NA,
-8L), class = "data.frame")


Any suggestions appreciated.

Dan

--
Daniel Nordlund
Bothell, WA  USA

__
R-help@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]]

__
R-help@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@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.


Re: [R] Visualization of people's interactions by participation to parties

2015-09-04 Thread Clint Bowman

Hendrik,

As a start, I'd make a matrix of zeros with the parties in rows 
and all of the participants as columns and put a one for each participant 
at each party.  The matrix will consist of a vector for each 
participant showing the parties attended. The pattern may suggest the next 
step.  Similarity of vectors could be an indication of interaction.


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 4 Sep 2015, Adams, Jean wrote:


Hendrik,

It's not clear to me what kind of R help you are looking for.  I suggest
you provide more information on the data that you have and the questions
that you want answered.  Is it in an external file?  Is it an R object?
What code have you written or tried?  Including example data, for example
the output from dput(), is very helpful.

Jean

On Wed, Sep 2, 2015 at 1:46 AM, Voxcoelestis via R-help <
r-help@r-project.org> wrote:


Dear all,

I have a long list of parties and participants over many years and want to
extract network relations between people to identify groups of friends. My
list looks like this:

Party 1; date party 1; first name 1 last name 1; first name 2 last name 2;
first name 3 last name 3;
Party 2; date party 2; first name 1 last name 1; first name 3 last name 3;
first name 4 last name 4;
Party 3; date party 3; first name 3 last name 3; first name 5 last name 5;
Party 4; date party 4; first name 2 last name 2; first name 6 last name 6;
first name 3 last name 3; first name 1 last name 1;
Party 5; date party 5; first name 5 last name 5; first name 4 last name 4;


Obviously the amount and the order of names is not regular. The list is
far too long to count co-appearances for each person-person combination by
hand.

What I would like to do is first of all create a network with individual
persons as nodes and the co-appearances as edges and the number of
co-appearances as strenght of interactions clustering closesly related
people.

In a second step it would be beneficial to extract information on the
durability of these interactions by including the time difference between
first and last interaction.

Do you have any ideas or hints how to approach this problem?

Thank you so much,

Hendrik

__
R-help@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]]

__
R-help@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@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.


Re: [R] Reading the non delimited file with no particular patterns in the data to R

2015-07-10 Thread Clint Bowman

Is this what your are expecting?

test - read.fwf(test.dat, width = c(10, 4, 1, 4, 9, 

12,26,1,1,1,1,1,1,3,8))

test

  V1   V2 V3 V4   V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15
1  1 2015  1  4 0.766696  1  1  0  0   0   0   0   0   0  10
2  2 2015  1  4 1.458186  1  1  0  0   0   1   0   0   0  20
3  3 2015  1  4 0.185492  1  1  0  0   0   0   0   0   0  15
4  4 2015  1  4 0.961584  1  1  0  0   0   0   0   0   0   3
5  5 2015  1  4 0.650091  2  0  0  0   1   0   0   0   0  NA
6  6 2015  1  4 0.430350  1  1  0  0   0   0   0   0   0  20
7  7 2015  1  4 3.192895  2  1  0  1   1   0   0   0   0   0
8  8 2015  1  4 0.617127  1  1  0  1   0   1   0   0   0  15
9  9 2015  1  4 0.399207  1  1  0  0   0   0   0   0   0  10

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 10 Jul 2015, jagadishpchary wrote:


I am beginner in R and I want to read a ASCII file to R environment. However,
the ASCII file is a non delimited and the data is not continuous (have some
blank spaces between the variables) so in order to read the data i have used
the below syntax i.e
test - read.fwf(D:/R_process/ASCII.txt, width = c(10, 4, 1, 4, 9, 9,
1,1,1,1,1,1,1,3,8))

Now i am able to read it but the data read is wrong. Actually my out put
should have only the applicable variables data but not the blank data.
Attached is the ASCII data. Please let me know how should i write the syntax
to read only the applicable data in the file.

Thanks for your help in advance. test.txt
http://r.789695.n4.nabble.com/file/n4709699/test.txt



--
View this message in context: 
http://r.789695.n4.nabble.com/Cross-tabulation-with-top-one-variable-and-side-as-multiple-variables-tp4708379p4709699.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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@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.


Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread Clint Bowman
Almost 20 years ago my son was in the DO-IT program at the University of 
Washington http://www.washington.edu/doit/.  They have been very 
proactive in reaching out to other institutions.


They have been solving problems such as yours and I suspect can suggest 
several workable solutions.


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 18 Jun 2015, Liz Hare wrote:


Hi Courtney and John,

The RStudio environment mentioned below will not work with speech output (I 
tried with Window-Eyes awhile ago). Some of my clients use it but I have no 
experience with it. Since the student is partially sighted, they might be able 
to customize the environment with big fonts and contrast, I’m just not sure.

Using a screen reader like Window-Eyes, the student could use the R GUI 
environment, although it’s a little frustrating because it doesn’t speak a lot 
and you need to use the mouse keys a lot.

The other option if you have to stick with Windows  is to run R at the command 
prompt, which makes interaction slightly easier but you’d have to figure out 
how to log the output.

What is being recommended for the rest of the students in the class? Ideally, 
this student’s experience should be as close as possible to the others’.

Liz

On Jun 18, 2015, at 12:17 PM, John McKown john.archie.mck...@gmail.com wrote:

On Thu, Jun 18, 2015 at 9:32 AM, Courtney Bryant cbry...@andrew.cmu.edu
wrote:


Good Morning,
I am currently working with a disabled R user who is a student here at
CMU.  The student has both sight and mobility issues.  The student has
asked for an assistant who is well versed in R to enter data for her, which
we are having a hard time finding.  I would like information from R
developers/users about how/how well R interfaces with Excel (an easier
skill set to find!)   In your opinion, could it be as easy as uploading
data from excel into R?

Also, do you know of a way to enlarge the R interface or otherwise assist
in making the program accessible to a low vision person?  My  limited
understanding leads me to believe that screen magnifiers like zoom text
don't work particularly well.  If you have information on that, I would
very much appreciate it.

Thanks for your help and for bearing with me!
Courtney



I am a bit confused (a normal condition for me). Is the student writing R
code or is the student running a application written in R? Also, since you
mentioned Excel, I am assuming that the student is using a PC running
Windows as opposed to Linux or a Mac.

If the student is writing R code, then I'd suggest that your computer
support person install Rstudio. It is cost free and can be downloaded here:
http://www.rstudio.com/ . The installer can then customize Rstudio to use a
really large font, if that would be helpful. Please forgive my lack of
knowledge about accessibility issues. If the student has trouble typing
(mobility issue?), this likely won't help. Would a speech to text / text to
speech interface help instead of a screen magnifier? I know next to nothing
about these tools, other than that they exist.

===

If the student is running an R application (which is what enter data for
her implies to me), then any accessibility issues would need to be
addressed in the application itself. But I don't understand why a data
entry assistant would need any skills in R itself in order to enter data
into it. But without knowing more, that's about all that I can say. One
thought: CMU has a college teaching electrical and computer engineering.
Depending on what that means, perhaps someone from that college (professor,
TA, or grad student) could see what your student is doing and perhaps have
some insights on how to help. Or is there a computer club on campus where
some geeky student might be found? You might look here:
http://www.club.cc.cmu.edu/ If these are true geeks (and the web site
sounds promising), then a lure of beer  pizza would likely be irresistible
grin.

===

For interfacing R with Excel, you might want to look at RExcel here:
http://rcom.univie.ac.at/download.html#RExcel . It has a free student
version. But is this more for an Excel user who wants to use R for
analysis, not an R user wanting to use Excel for data entry.



--
Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

My sister opened a computer store in Hawaii. She sells C shells down by the
seashore.
If someone tell you that nothing is impossible:
Ask him to dribble a football.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! 
John McKown

[[alternative HTML version deleted

Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Clint Bowman
Thanks, Dimitri.  Burt is the real wizard here--I'll bet he can conjure up 
an elegant solution.


For me, just reaching a desired endpoint is enoughg.

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 16 Jun 2015, Dimitri Liakhovitski wrote:


Thank you, Clint.
That's the thing: it's relatively easy to do it in base, but the
resulting code is not THAT simple.
I thought dplyr would make it easy...

On Tue, Jun 16, 2015 at 2:06 PM, Clint Bowman cl...@ecy.wa.gov wrote:

May want to add headers but the following provides the device number with
each set fo sums:

for (dev in (unique(md$device)))
{cat(colSums(subset(md,md$device==dev)==5,na.rm=T),dev,\n)}

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 16 Jun 2015, Dimitri Liakhovitski wrote:


Except, of course, Bert, that you forgot that it had to be done by
device. Your solution ignores the device.

md - data.frame(a = c(3,5,4,5,3,5), b = c(5,5,5,4,4,1), c =
c(1,3,4,3,5,5),
 device = c(1,1,2,2,3,3))
myvars = c(a, b, c)
md[2,3] - NA
md[4,1] - NA
md
vapply(md[myvars], function(x) sum(x==5,na.rm=TRUE),1L)

But the result should be by device.

On Tue, Jun 16, 2015 at 1:56 PM, Dimitri Liakhovitski
dimitri.liakhovit...@gmail.com wrote:


Thank you, Bert.
I'll be honest - I am just learning dplyr and was wondering if one
could do it in dplyr.
But of course your solution is perfect...

On Tue, Jun 16, 2015 at 1:50 PM, Bert Gunter bgunter.4...@gmail.com
wrote:


Well, dplyr seems a bit of overkill as it's so simple with plain old
vapply() in base R :



dat - data.frame (a=sample(1:5,10,rep=TRUE),


+b=sample(3:7,10,rep=TRUE),
+g = sample(7:9,10,rep=TRUE))


vapply(dat,function(x)sum(x==5,na.rm=TRUE),1L)



a b g
5 4 0



Cheers,
Bert

Bert Gunter

Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom.
   -- Clifford Stoll

On Tue, Jun 16, 2015 at 10:24 AM, Dimitri Liakhovitski
dimitri.liakhovit...@gmail.com wrote:



Hello!

I have a data frame:

md - data.frame(a = c(3,5,4,5,3,5), b = c(5,5,5,4,4,1), c =
c(1,3,4,3,5,5),
  device = c(1,1,2,2,3,3))
myvars = c(a, b, c)
md[2,3] - NA
md[4,1] - NA
md

I want to count number of 5s in each column - by device. I can do it
like
this:

library(dplyr)
group_by(md, device) %%
summarise(counts.a = sum(a==5, na.rm = T),
  counts.b = sum(b==5, na.rm = T),
  counts.c = sum(c==5, na.rm = T))

However, in real life I'll have tons of variables (the length of
'myvars' can be very large) - so that I can't specify those counts.a,
counts.b, etc. manually - dozens of times.

Does dplyr allow to run the count of 5s on all 'myvars' columns at
once?


--
Dimitri Liakhovitski

__
R-help@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.








--
Dimitri Liakhovitski





--
Dimitri Liakhovitski

__
R-help@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.







--
Dimitri Liakhovitski



__
R-help@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.


Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Clint Bowman

Any problem with

colSums(md==5, na.rm=T)

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 16 Jun 2015, Dimitri Liakhovitski wrote:


Hello!

I have a data frame:

md - data.frame(a = c(3,5,4,5,3,5), b = c(5,5,5,4,4,1), c = c(1,3,4,3,5,5),
 device = c(1,1,2,2,3,3))
myvars = c(a, b, c)
md[2,3] - NA
md[4,1] - NA
md

I want to count number of 5s in each column - by device. I can do it like this:

library(dplyr)
group_by(md, device) %%
summarise(counts.a = sum(a==5, na.rm = T),
 counts.b = sum(b==5, na.rm = T),
 counts.c = sum(c==5, na.rm = T))

However, in real life I'll have tons of variables (the length of
'myvars' can be very large) - so that I can't specify those counts.a,
counts.b, etc. manually - dozens of times.

Does dplyr allow to run the count of 5s on all 'myvars' columns at once?


--
Dimitri Liakhovitski

__
R-help@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@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.


Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Clint Bowman

It would help if I could see beyond my allergy meds.

A start could be:

colSums(subset(md,md$device==1)==5,na.rm=T)
colSums(subset(md,md$device==2)==5,na.rm=T)
colSums(subset(md,md$device==3)==5,na.rm=T)


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 16 Jun 2015, Dimitri Liakhovitski wrote:


Hello!

I have a data frame:

md - data.frame(a = c(3,5,4,5,3,5), b = c(5,5,5,4,4,1), c = c(1,3,4,3,5,5),
 device = c(1,1,2,2,3,3))
myvars = c(a, b, c)
md[2,3] - NA
md[4,1] - NA
md

I want to count number of 5s in each column - by device. I can do it like this:

library(dplyr)
group_by(md, device) %%
summarise(counts.a = sum(a==5, na.rm = T),
 counts.b = sum(b==5, na.rm = T),
 counts.c = sum(c==5, na.rm = T))

However, in real life I'll have tons of variables (the length of
'myvars' can be very large) - so that I can't specify those counts.a,
counts.b, etc. manually - dozens of times.

Does dplyr allow to run the count of 5s on all 'myvars' columns at once?


--
Dimitri Liakhovitski

__
R-help@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@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.


Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Clint Bowman
May want to add headers but the following provides the device number with 
each set fo sums:


for (dev in (unique(md$device))) 
{cat(colSums(subset(md,md$device==dev)==5,na.rm=T),dev,\n)}


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 16 Jun 2015, Dimitri Liakhovitski wrote:


Except, of course, Bert, that you forgot that it had to be done by
device. Your solution ignores the device.

md - data.frame(a = c(3,5,4,5,3,5), b = c(5,5,5,4,4,1), c = c(1,3,4,3,5,5),
 device = c(1,1,2,2,3,3))
myvars = c(a, b, c)
md[2,3] - NA
md[4,1] - NA
md
vapply(md[myvars], function(x) sum(x==5,na.rm=TRUE),1L)

But the result should be by device.

On Tue, Jun 16, 2015 at 1:56 PM, Dimitri Liakhovitski
dimitri.liakhovit...@gmail.com wrote:

Thank you, Bert.
I'll be honest - I am just learning dplyr and was wondering if one
could do it in dplyr.
But of course your solution is perfect...

On Tue, Jun 16, 2015 at 1:50 PM, Bert Gunter bgunter.4...@gmail.com wrote:

Well, dplyr seems a bit of overkill as it's so simple with plain old
vapply() in base R :



dat - data.frame (a=sample(1:5,10,rep=TRUE),

+b=sample(3:7,10,rep=TRUE),
+g = sample(7:9,10,rep=TRUE))


vapply(dat,function(x)sum(x==5,na.rm=TRUE),1L)


a b g
5 4 0



Cheers,
Bert

Bert Gunter

Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom.
   -- Clifford Stoll

On Tue, Jun 16, 2015 at 10:24 AM, Dimitri Liakhovitski
dimitri.liakhovit...@gmail.com wrote:


Hello!

I have a data frame:

md - data.frame(a = c(3,5,4,5,3,5), b = c(5,5,5,4,4,1), c =
c(1,3,4,3,5,5),
  device = c(1,1,2,2,3,3))
myvars = c(a, b, c)
md[2,3] - NA
md[4,1] - NA
md

I want to count number of 5s in each column - by device. I can do it like
this:

library(dplyr)
group_by(md, device) %%
summarise(counts.a = sum(a==5, na.rm = T),
  counts.b = sum(b==5, na.rm = T),
  counts.c = sum(c==5, na.rm = T))

However, in real life I'll have tons of variables (the length of
'myvars' can be very large) - so that I can't specify those counts.a,
counts.b, etc. manually - dozens of times.

Does dplyr allow to run the count of 5s on all 'myvars' columns at once?


--
Dimitri Liakhovitski

__
R-help@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.







--
Dimitri Liakhovitski




--
Dimitri Liakhovitski

__
R-help@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@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.


Re: [R] Calling Function With Arguments In a Script

2015-05-07 Thread Clint Bowman

?source

as in source(pairwise-plots-continuous-vars.R)

then

plotpairs(first,second,third,wise,title)

should get you going

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 7 May 2015, Rich Shepard wrote:


 I'm starting to put code in multi-use functions rather than in individual
scripts and have not learned how to invoke the function from the command
line. If this information is in Norman Matloff's 'The Art of R Programming'
or Hadley Wickham's 'Advanced R' please point me to the proper place.

 Here's an example, the script 'pairwise-plots-continuous-vars.R' consists
of this function:

plotpairs - function(x1,x2,x3,y,plotmain) {
require(compositions)
opar - par(mar=c(4,4,3,1))
NO3 - x1
SO4 - x2
pH - x3
pairwisePlot(cbind(NO3,SO4,pH),clr(y),add.line=T)
title(main=plotmain)
par(opar)
detach('package:compositions')
return()
}

 (I suppose the return statement is superfluous since there is no value
returned to a calling function.)

 What I want to do is call plotpairs() with appropriate arguments for each
plot as needed.

TIA,

Rich

__
R-help@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@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.


Re: [R] cbind question, please

2015-04-24 Thread Clint Bowman

Perhaps:


dog - 1:3
cat - 2:4
tree - 5:7
big.char - cbind(dog,cat,tree)
big.char

 dog cat tree
[1,]   1   25
[2,]   2   36
[3,]   3   47

colnames(big.char)-c(dog,cat,tree)
big.char

 dog cat tree
[1,]   1   25
[2,]   2   36
[3,]   3   47



Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 23 Apr 2015, Erin Hodgess wrote:


Hello!

I have a cbind type question, please:  Suppose I have the following:

dog - 1:3
cat - 2:4
tree - 5:7

and a character vector
big.char - c(dog,cat,tree)

I want to end up with a matrix that is a cbind of dog, cat, and tree.
This is a toy example.  There will be a bunch of variables.

I experimented with do.call, but all I got was
1
2
3

Any suggestions would be much appreciated.  I still think that do.call
might be the key, but I'm not sure.

R Version 3-1.3, Windows 7.

Thanks,
Erin


--
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

[[alternative HTML version deleted]]

__
R-help@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@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.


Re: [R] Superimposing 2 curves on the same graph with par(new=TRUE)

2015-03-24 Thread Clint Bowman
Because the range is so different between the two series, I'd suggest 
using log=y, ylim=c(500,2)



Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 23 Mar 2015, Boris Steipe wrote:


... and that gives you a double ordinate plot, a staple of misleading 
statistics.

Let me give you an analogy:

Imagine you are on a chemistry mailing list and someone asks about the proper way to mix 
aluminum powder with fertilizer. Of course, as a chemist you know how. But still - and 
the same holds for the double ordinate plot - just say no.


:-)


For reference (taken from a post on SO):
Junk charts:
 http://junkcharts.typepad.com/junk_charts/2006/06/illusion_of_suc.html
 http://junkcharts.typepad.com/junk_charts/2006/05/the_crossover_l.html
Perecptual Edge ( a more detailed analysis)
 
http://www.perceptualedge.com/articles/visual_business_intelligence/dual-scaled_axes.pdf
SMBC's tutorial on infographics (point 4).
 http://www.smbc-comics.com/?id=3167



On Mar 23, 2015, at 2:14 PM, Clint Bowman cl...@ecy.wa.gov wrote:


Agreed--I neglected to add the secondary y-axis (shouldn't hit send so fast.)

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

   USPS:   PO Box 47600, Olympia, WA 98504-7600
   Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 23 Mar 2015, Boris Steipe wrote:


... which is exactly what he shouldn't do because now it the plot falsely 
asserts that both curves are plotted to the same scale.


B.



On Mar 23, 2015, at 12:34 PM, Clint Bowman cl...@ecy.wa.gov wrote:


Try:
plot(Date,MORTSBu,lwd=2,lty=dashed,axes=F,xlab=,ylab=)



Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

  USPS:   PO Box 47600, Olympia, WA 98504-7600
  Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 23 Mar 2015, varin sacha wrote:


Dear R-Experts,

I try to superimpose/present 2 curves/plots on the same graph. I would like the 
result/graph to be readable.
For that, I use the par(new=TRUE) argument but on the Y-axis there is a 
superposition of writings and the Y-axis becomes unreadable.
How can I solve this problem ?

Here is a reproducible example :
Date-c(1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010)

MORTSFr-c(16445,17671,18113,17043,14738,14355,15028,14283,13229,13603,13672,13547,13527,13021,12737,11388,11947,10742,11497,11476,11215,10483,9900,9568,9019,8891,8541,8444,8918,8487,8079,8160,7655,6058,5593,5318,4709,4620,4275,4273,3992)

MORTSBu-c(838,889,934,946,960,1030,1021,1040,1153,1149,1199,1219,1229,1123,1119,1113,1070,1153,1153,1280,1567,1114,1299,1307,1390,1264,1014,915,1003,1047,1012,1011,959,960,943,957,1043,1006,1061,901,776)

plot(Date,MORTSFr,type=l)
par(new=TRUE)

plot(Date,MORTSBu,lwd=2,lty=dashed)

Thanks for your time.
Best,
S

__
R-help@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@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@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.


Re: [R] Superimposing 2 curves on the same graph with par(new=TRUE)

2015-03-23 Thread Clint Bowman

Try:
plot(Date,MORTSBu,lwd=2,lty=dashed,axes=F,xlab=,ylab=)



Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 23 Mar 2015, varin sacha wrote:


Dear R-Experts,

I try to superimpose/present 2 curves/plots on the same graph. I would like the 
result/graph to be readable.
For that, I use the par(new=TRUE) argument but on the Y-axis there is a 
superposition of writings and the Y-axis becomes unreadable.
How can I solve this problem ?

Here is a reproducible example :
Date-c(1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010)

MORTSFr-c(16445,17671,18113,17043,14738,14355,15028,14283,13229,13603,13672,13547,13527,13021,12737,11388,11947,10742,11497,11476,11215,10483,9900,9568,9019,8891,8541,8444,8918,8487,8079,8160,7655,6058,5593,5318,4709,4620,4275,4273,3992)

MORTSBu-c(838,889,934,946,960,1030,1021,1040,1153,1149,1199,1219,1229,1123,1119,1113,1070,1153,1153,1280,1567,1114,1299,1307,1390,1264,1014,915,1003,1047,1012,1011,959,960,943,957,1043,1006,1061,901,776)

plot(Date,MORTSFr,type=l)
par(new=TRUE)

plot(Date,MORTSBu,lwd=2,lty=dashed)

Thanks for your time.
Best,
S

__
R-help@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@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.


Re: [R] Superimposing 2 curves on the same graph with par(new=TRUE)

2015-03-23 Thread Clint Bowman
Agreed--I neglected to add the secondary y-axis (shouldn't hit send so 
fast.)


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 23 Mar 2015, Boris Steipe wrote:


... which is exactly what he shouldn't do because now it the plot falsely 
asserts that both curves are plotted to the same scale.


B.



On Mar 23, 2015, at 12:34 PM, Clint Bowman cl...@ecy.wa.gov wrote:


Try:
plot(Date,MORTSBu,lwd=2,lty=dashed,axes=F,xlab=,ylab=)



Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

   USPS:   PO Box 47600, Olympia, WA 98504-7600
   Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 23 Mar 2015, varin sacha wrote:


Dear R-Experts,

I try to superimpose/present 2 curves/plots on the same graph. I would like the 
result/graph to be readable.
For that, I use the par(new=TRUE) argument but on the Y-axis there is a 
superposition of writings and the Y-axis becomes unreadable.
How can I solve this problem ?

Here is a reproducible example :
Date-c(1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010)

MORTSFr-c(16445,17671,18113,17043,14738,14355,15028,14283,13229,13603,13672,13547,13527,13021,12737,11388,11947,10742,11497,11476,11215,10483,9900,9568,9019,8891,8541,8444,8918,8487,8079,8160,7655,6058,5593,5318,4709,4620,4275,4273,3992)

MORTSBu-c(838,889,934,946,960,1030,1021,1040,1153,1149,1199,1219,1229,1123,1119,1113,1070,1153,1153,1280,1567,1114,1299,1307,1390,1264,1014,915,1003,1047,1012,1011,959,960,943,957,1043,1006,1061,901,776)

plot(Date,MORTSFr,type=l)
par(new=TRUE)

plot(Date,MORTSBu,lwd=2,lty=dashed)

Thanks for your time.
Best,
S

__
R-help@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@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@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.


Re: [R] Help with Boxplot

2015-03-05 Thread Clint Bowman

Jim,

Have you looked at:

names: group labels which will be printed under each boxplot.  Can
  be a character vector or an expression (see plotmath).

You could use  where you want a blank.  I believe that at may work 
here also.


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 5 Mar 2015, Jim Silverton wrote:


I have the following R code for a boxplot. But I keep getting 4 1's, 4 2's
and 4 3's on the x asis for which I reall want to relace the 1's by
agegroup 1 the 2's by age group 2 etc. And I don't want to replce it 4
times just once. Can anyone help.


boxplot(data.all ~ age.group, data = data.plots,
   boxwex = 0.5, at = c(1, 4, 7, 10),
   subset = model.type == 1, col = yellow,
   main = Deviation of Predicted from Actual,
   xlab = Age Groups,
   ylab = Deviations,
   xlim = c(0.5, 12), ylim = c(-25, 35))
boxplot(data.all ~ age.group, data = data.plots, add = TRUE,
   boxwex = 0.5, at = c(1.7, 4.7, 7.7, 10.7),
   subset = model.type == 2, col = orange)
boxplot(data.all ~ age.group, data = data.plots, add = TRUE,
   boxwex = 0.5, at = c(2.4, 5.4, 8.4, 11.4),
   subset = model.type == 3, col = blue)
legend(1, 30, c(regression, glm, gam),fill = c(yellow, orange,
blue))



--
Thanks,
Jim.

[[alternative HTML version deleted]]

__
R-help@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@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.


Re: [R] Replace the value with 1 and 0

2015-02-25 Thread Clint Bowman

or:

with(yourData,table(year,month,yourData[[rain]]0))

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 26 Feb 2015, Peter Alspach wrote:


Tena koe

Something like:

set.seed(153)
# Create some (unrealistic) rainfall data
yourData - data.frame(year=rep(1950:1954, each=10), month=rep(rep(1:2, 
each=5), 5), rain=sample(0:1, 50, replace=TRUE)*round(rnorm(50, 20, 2), 1))
tapply(yourData$rain0, yourData[,c('year','month')], sum)

will give your final table, but it will need some tidying up.

HTH 

Peter Alspach


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of smart hendsome
Sent: Thursday, 26 February 2015 11:54 a.m.
To: r-help@r-project.org
Subject: [R] Replace the value with 1 and 0

Hi everyone,
I have this kind of rainfall dataset:
   Year Month Day Amount
1  1950 1   1    0.0
2  1950 1   2   35.5
3  1950 1   3   17.8
4  1950 1   4   24.5
5  1950 1   5   12.3
6  1950 1   6   11.5
7  1950 1   7    5.7
8  1950 1   8   13.2
9  1950 1   9   11.3
10 1950 1  10   14.7
11 1950 1  11   11.9
12 1950 1  12   17.5
13 1950 1  13    8.1
14 1950 1  14    0.4
15 1950 1  15    0.0
16 1950 1  16   19.5
17 1950 1  17   10.7
18 1950 1  18    0.5
19 1950 1  19   12.7
20 1950 1  20    6.3

I want to set as rain for Amount 0 and not rain for Amount = 0.  I want to 
replace the Amount0 with 1 and Amount equal to zero with 0.  Then I want to count 
how many rain in that particular month in that year. Anyone can help me?
This is what I want:
Year Month Day Amount
1  1950 1   1     0
2  1950 1   2     1
3  1950 1   3 1
4  1950 1   4 1
5  1950 1   5     1
6  1950 1   6 1
7  1950 1   7     1
8  1950 1   8 1
9  1950 1   9 1
10 1950 1  10    1
11 1950 1  11     1
12 1950 1  12    1
13 1950 1  13    1
14 1950 1  14    1
15 1950 1  15    1
16 1950 1  16    1
17 1950 1  17    1
18 1950 1  18    1
19 1950 1  19    1
20 1950 1  20    1
Then become like this:

|
| Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
| 1950 | 17 | 6 | 23 | 20 | 19 | 9 | 17 | 23 | 18 | 20 | 20 | 17 |
| 1951 | 23 | 19 | 20 | 20 | 19 | 11 | 16 | 20 | 22 | 25 | 25 | 16 |
| 1952 | 15 | 21 | 30 | 24 | 23 | 20 | 16 | 19 | 20 | 19 | 21 | 15 |


Thanks.


[[alternative HTML version deleted]]

__
R-help@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.

The contents of this e-mail are confidential and may be subject to legal 
privilege.
If you are not the intended recipient you must not use, disseminate, distribute 
or
reproduce all or any part of this e-mail or attachments.  If you have received 
this
e-mail in error, please notify the sender and delete all material pertaining to 
this
e-mail.  Any opinion or views expressed in this e-mail are those of the 
individual
sender and may not represent those of The New Zealand Institute for Plant and
Food Research Limited.
__
R-help@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@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.

Re: [R] How to unzip a .gz file

2015-02-10 Thread Clint Bowman
Alexandra,  Although you may not have control over the installation of R, 
2.15.1 is very old and should be upgraded--the current is 3.1.2


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 10 Feb 2015, Alexandra Catena wrote:


Hello,

Can someone help me with unzipping a .gz file.  I used:

readLines(gzfile('/home/file.gz'))


I also found that I could use gunzip, but after trying to install it, it
says:

package ‘gunzip’ is not available (for R version 2.15.1)


Thanks,
Alexandra

[[alternative HTML version deleted]]

__
R-help@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@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.

Re: [R] Help: The Difference Between Workspace, Script, and History

2014-12-17 Thread Clint Bowman

Ian,

ls() is your friend. To learn more about ls(), type ?ls

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 17 Dec 2014, Ian Evans wrote:


I apologize that I am very new to R and programming in general. I do not
understand the difference between the script, the workspace, and the
history, and what saving each one means.

I seem to be doing fine writing commands and going through lessons and
examples (I'm using Learn R in a Day) but when I try to save what I wrote
and load it later, it tells me that it is loaded, but none of my code is
one the screen.

[[alternative HTML version deleted]]

__
R-help@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@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.


Re: [R] Problem with

2014-12-03 Thread Clint Bowman
I'd also suggest plotting a wind rose for each month (try openair) to 
understand the statistical test results.


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 3 Dec 2014, Adams, Jean wrote:


This question is more about statistics than R.  I suggest that you post it
to Cross Validated instead, http://stats.stackexchange.com/.

Jean

On Wed, Dec 3, 2014 at 5:40 AM, Dries David dries-da...@hotmail.com wrote:


 Hey

In my data set i have two variables: month (march or april) and wind
direction (N,NE,E,SE,S,SW,W,NW). I have to know if there is a difference in
wind direction between these months. What kind of test statistic should i
use?

Kind regards

Dries David

__
R-help@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]]

__
R-help@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@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.


Re: [R] lat/log to meter

2014-10-31 Thread Clint Bowman

Eliza,

Would transforming to UTM coordinates work?

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 31 Oct 2014, eliza botto wrote:


Dear UseRs,Is there a way in R to convert latitude and longitude in 
degree.minute.second to meter? (e.g. 45'55'')Thankyou very much in Advance,Eliza
[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] Split fixed width data in R

2014-10-22 Thread Clint Bowman

?read.fortran

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 22 Oct 2014, Zilefac Elvis wrote:


Hi,
I have fixed width data that I would like to split into columns. Here is a 
sanpshot of the data (actual data is a list object):
lst1Sub-
20131124GGG1 23.00
20131125GGG1 15.00
20131128GGG1  0.00
201312 1GGG1  0.00
201312 4GGG1  0.00
201312 7GGG1 10.00
20131210GGG1  0.00
20131213GGG1  0.00
20131216GGG1  0.00
20131219GGG1  0.00
20131222GGG1  0.00
20131225GGG1  0.00
20131228GGG1  0.00

The following script will split the data into [Year Month Day Site 
Precipitation]
--
library(stringr)
dateSite - gsub((.*G.{3}).*,\\1,lst1Sub);
dat1 - data.frame(Year=as.numeric(substr(dateSite,1,4)), 
Month=as.numeric(substr(dateSite,5,6)),
  
Day=as.numeric(substr(dateSite,7,8)),Site=substr(dateSite,9,12),Rain=substr(dateSite,13,18),stringsAsFactors=FALSE);
lst3 - lapply(lst1Sub,function(x) {dateSite - gsub((.*G.{3}).*,\\1,x);
   dat1 - 
data.frame(Year=as.numeric(substr(dateSite,1,4)), 
Month=as.numeric(substr(dateSite,5,6)),Day=as.numeric(substr(dateSite,7,8)),Site=substr(dateSite,9,12),stringsAsFactors=FALSE);
   Sims - str_trim(gsub(.*G.{3}\\s?(.*),\\1,x));Sims[grep(\\d+-,Sims)] - 
gsub((.*)([-][0-9]+\\.[0-9]+),\\1 \\2,gsub(^([0-9]+\\.[0-9]+)(.*),\\1 \\2, Sims[grep(\\d+-,Sims)]));
   Sims1 - read.table(text=Sims,header=FALSE); names(Sims1) 
- c(Precipitation);dat2 - cbind(dat1,Sims1)})
--

Problem: the above script deletes the first value of my precipitation values. For 
example, after splitting, 20131124GGG1 23.00 becomes
2013 11 24 GGG1 3.00 INSTEAD of 2013 11 24 GGG1 23.00 (right answer).

Anything wrong with the string trimming? Is there another way to arrive at the 
same answer?

Thanks,
AT.

__
R-help@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.



__
R-help@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.


Re: [R] Time outside limits

2014-10-16 Thread Clint Bowman

?rle

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 16 Oct 2014, daniel wrote:


Bart,

Check if the following could help you.

library(xts)
y - c(rnorm(10,25), rnorm(10,32),rnorm(10,25), rnorm(10,20),
rnorm(10,25)); x - seq(c(ISOdate(2000,3,20)), by = hour, length.out =
length(y))
z - xts( y, order.by=as.POSIXct(x))
limit - ifelse( lag(z)  22 | z  27, 1, 0)


Daniel Merino

2014-10-16 15:12 GMT-03:00 Bart Joosen bartjoo...@hotmail.com:


Hi,
I'm currently facing the problem that I need to write a function where I
get a dataframe back which contains the time (in hours) outside the limits
of a temperature sensor, each month, and for how long exactly.
I wrote a for loop which check:- if a datapoint is outside the limit- if
the previous datapoint is outside the limt, then count + 1- if the next
datapoint isn't outside: write in dataframe.
I guess this could be with some vectorisation function, I tried with
seq_along, and match, but couldn't figure it out.
Here some sample data:
y - c(rnorm(10,25), rnorm(10,32),rnorm(10,25), rnorm(10,20),
rnorm(10,25))x - seq(c(ISOdate(2000,3,20)), by = hour, length.out =
length(y))
limits of y: c(22,27)
Thanks
Bart
[[alternative HTML version deleted]]

__
R-help@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.





--
Daniel

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] Writing .csv file

2014-09-24 Thread Clint Bowman

?write.csv 2nd line of Usage: example

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 24 Sep 2014, Steven Yen wrote:


I use the following command to write data to a .csv file:

   write.csv(yxz,file=foo.csv)

And I get the following in the file, with one column appended to the file:

,fsp,fsec,cincome,
1,0,3,2.25,...
2,0,1,2.75,...
3,1,1,0.625,...

Question: is there a way to avoid the first column? Thanks.

__
R-help@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.




__
R-help@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.


Re: [R] 8 fast or 4 very fast cores?

2014-09-15 Thread Clint Bowman
I'm in a similar situation and am looking seriously at a pair of E5-2643v3 
(6 cores each-hyperthreaded).


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 15 Sep 2014, Prof Brian Ripley wrote:


On 15/09/2014 11:21, Ben Bolker wrote:

 Leif Ruckman Leif at Ruckman.se writes:

 
  I am going to buy a new computer ( Dell workstation T5810 - Windows 8)

  to work with simulatons in R.
 
  Now I am asked what kind of processor I like and I was given two 
  choices.
 
  1. Intel Xeon E5-1620 v3 - 4 cores 3.7 GHz Turbo

  2. Intel Xeon E5-2640 v3 - 8 cores 2.6 GHz Turbo
 
  I don't know what is better in simulations studies in R, a few very fast

  cores or many cores at normal speed.


It's **very** hard to answer such general questions reliably, but I'll
 take a guess and say that if you're doing simulation studies you're likely
 to be doing tasks that are easily distributable (e.g. many random
 realizations of the same simulation and/or realizations for many
 different sets of parameter values) and so the more-cores option
 will be a good idea.

But it's possible that what you mean by simulation studies is
 different.

If you can do some benchmarking of your problems on an existing
 machine that would probably be a good idea.


Unfortunately unless it is of very similar architecture that may not help 
much.


Three issues hard to scale from are the 'Turbo', the hyperthreading of modern 
Xeons and the cache sizes.  Now, I happen to have machines with multiple 
E5-24x0 and E5-26x0 Xeons: both do hyperthreading well, so you would have 8 
or 16 virtual CPUs and they will give you say 50% increase in throughput if 
all the virtual cores are used.  But you cannot scale up from using just one 
process on one core.


I find it hard to think of tasks where option 1) would have more throughput, 
but if most of the time you are not running things in parallel then the 
higher speed on a single task is a consideration.




Ben Bolker

 __
 R-help@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.




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

__
R-help@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.




__
R-help@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.


Re: [R] Generating a polygon around points

2014-08-15 Thread Clint Bowman
Your question seems to need an answer to, How do you find a convex hull 
on a sphere?  Google has many references.


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 15 Aug 2014, Bob O'Hara wrote:


I've been struggling for half a day on what should be a simple problem...

I have a data frame of lat/long coordinates that describe a region, and I
want to draw a polygon around them so I can use that as a boundary (to be
thrown at INLA, but those details aren't important). The coordinates are
almost on a regular grid: there is some variation in latitude (because
we're on a globe).

If the coordinates were on a regular grid, I could use as.owin() to create
a mask, and go on from there (I have code that will work). But as.owin()
doesn't like unevenly spaced points.

Can anyone suggest a way to sort this out? Preferable without having to
mess around transforming the coordinates.

Bob

--
Bob O'Hara

Biodiversity and Climate Research Centre
Senckenberganlage 25
D-60325 Frankfurt am Main,
Germany

Tel: +49 69 798 40226
Mobile: +49 1515 888 5440
WWW:   http://www.bik-f.de/root/index.php?page_id=219
Blog: http://occamstypewriter.org/boboh/
Journal of Negative Results - EEB: www.jnr-eeb.org

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] data format setting

2014-06-13 Thread Clint Bowman

?sort,
?unique, and
subset come to mind.

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 13 Jun 2014, eliza botto wrote:



Dear R family,
I hope you all be doing great. I have a dataset of following format. The data 
file is of the following format.

 st year month day discharge
1  A 2004 1   1  6.752828
2  A 2004 1   2  7.602053
3  A 2004 1   3  5.583619
4  A 2004 1   4  5.019562
5  A 2004 1   5  4.804489
6  A 2004 1   6  4.363541
7  A 2004 1   7  3.801333
8  A 2004 1   8  3.455991
9  A 2004 1   9  3.402634
10 A 2004 1  10  3.250693
..
..
continue
..
..
st year month day discharge
2AY 196710   3  0.56
20001AY 196710   4  0.56
20002AY 196710   5  0.48
20003AY 196710   6  0.56
20004AY 196710   7  0.48
20005AY 196710   8  0.40
20006AY 196710   9  0.40
20007AY 196710  10  0.56
20008AY 196710  11  0.56
20009AY 196710  12  0.65
20010AY 196710  13  0.85

you can see that there are five columns.
The first column has the name of the station. I want to split the data w.r.t the names of the 
stations. Each station has data for certain years. for example A has data for years 
from 2004 to 2010 and for AY its from 1967 to 2000.similarly for other years there is 
data for different number of years.
I want to make a list of matrices each containing the data for that station in 
the following format
$A
2004200520062007200820092010
..
...
...
..
...

$AY

196719682000

each column should have 365 to 366 values depending on whether there is a leap 
year or not. obviously for non-leap years 366th row should be an NA.
kindly help me on it.
Thankyou very much in advance.
Eliza


[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] Generate Binary Matrix

2014-04-09 Thread Clint Bowman

A bit kludgey but how about:

dimMat - matrix(0, 1000, 4)
for(i in 1:1000){
while(sum(dimMat[i, ] - sample(c(0,1), 4, replace = TRUE, prob = c(.3, .7)))==0) 
dimMat[i, ] - sample(c(0,1), 4, replace = TRUE, prob = c(.3, .7))
}
table(rowSums(dimMat))


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 9 Apr 2014, ken knoblauch wrote:


Doran, Harold HDoran at air.org writes:

I am trying to generate a binary matrix where

row
in the matrix is guaranteed to have at
least one 1.

Ideally, I would like most rowSums  to be equal

2 or 3
with some 1s and some 4s. But,
rowSums cannot be equal

to 0.

I can tinker with the vector of probability weights,

but in
so (in the way I am doing it) this
causes for

more rowSums to be equal to 4 than I ideally would

, but this never helps to guarantee a
rowSum will not be

equal to 0. I could post-hoc tinker with any rows

are all
0, but seems like that may be just
inefficient.


Below is sample code, any ideas on how to best

tackle this?


Harold

dimMat - matrix(0, 1000, 4)
for(i in 1:1000){
dimMat[i, ] - sample(c(0,1), 4, replace = TRUE, prob = c(.3, .7))
}

table(rowSums(dimMat))



Wht don't you sample from the distribution of row sums
for each row and then distribute that many 1's randomly
among the columns.

Ken

__
R-help@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.



__
R-help@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.


Re: [R] Error: cannot allocate vector of size 5.2 Gb

2014-03-20 Thread Clint Bowman

5.2 won't go into 4 but there may be more problems.

32-bit or 64 bit operating system?

RAM is cheap but will your motherboard support more than 4 GB?
And don't forget there are other processes that need to run while you are 
using R.


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 20 Mar 2014, eliza botto wrote:


Dear R family,
I am trying to read a real large dataset in R (~ 2Gb). Its in binary format. 
When i tried to read it by using following command
readBin(DAT.dat.nc, numeric(), n=9e8, size=4, signed=TRUE, endian='little')
I got the following error
Error: cannot allocate vector of size 5.2 Gb
I have a Ram of 4Gb. I even tried to allocate more space to it by 
memory.limit(size=9) but to no use.
What do i do? Buy a new ram or act smart?
Thankyou very much in advance
Eliza
[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] phlyloclim help

2014-03-04 Thread Clint Bowman
I suspect the space in the filename could be the throwing the parser 
off--you may need some  around the filename or fill the space with an 
underscore.


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 3 Mar 2014, Dana Ikeda wrote:


Hello!

I'm trying to run a niche.equivalency.test and keep getting the following
error:
Error in file(fname, r) : cannot open the connection
In addition: Warning message:
In file(fname, r) :
 cannot open file 'C:/Users/Dana/Desktop/NicheIDresults/out/Populus
arizona_proj.asc': No such file or directory

Here's my code:
app-paste(C:/Users/Dana/Desktop/maxent/maxent.jar, sep=)
files-list.files(path =
G:/Research/Climate/WorldClim/Current/world/Fremont_genetics/AllPops/ascii/subset1,
pattern = '[.]asc', all.files = FALSE,
  full.names = FALSE, recursive = FALSE,
  ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)
env-stack(files)
as(env,'SpatialGridDataFrame')
p-read.csv(FremontPops_CAAZ.csv)
dir-paste(C:/Users/Dana/Desktop/NicheIDresults)
test-niche.equivalency.test(p, env, n=99, maxent.exe, dir)

Maxent runs fine, and I can see the Populus arizona_proj.asc file in the
out directory.

Any ideas on what is going on?

Thank you!
Cheers,
Dana
--
Dana Ikeda, PhD Candidate
Cottonwood Ecology Group
Department of Biological Sciences
Northern Arizona University
Flagstaff, AZ 86011

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] scatter plot to contour plot

2014-02-24 Thread Clint Bowman

Azam,

If you also have z ~ f(x,y) you can produce contours.

Otherwise, you could look at package hexbin.

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 24 Feb 2014, azam jaafari wrote:



Dear All

I want to convert a scatter plot to a continuous contour plot. I have x as a variable 
and y as another variable.
is there any package for this?
can anybody halp me?

Thanks
Azam
[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] shapiro.test

2014-02-24 Thread Clint Bowman

Greg,

For some authors the 4th page from the back should be the first page.

Not so for you, however.

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 24 Feb 2014, Greg Snow wrote:


Philippe,

replies inline

On Sat, Feb 22, 2014 at 12:29 AM, Philippe Grosjean
phgrosj...@sciviews.org wrote:

Greg,

I really like that TeachingDemos::SnowsPenultimateNormalityTest()...


If you like that function then you may appreciate
TeachingDemos::SnowsCorrectlySizedButOtherwiseUselessTestOfAnything,
which I suspect (but have been to lazy to check) may be the longest
exported function name in a CRAN package.  I justify the names of
these 2 functions using the same logic that suggests short and simple
names for functions that you would expect to be used often.


even the tortuous way to always return a p-value == 0:



It turns out (discovered by accident and then brought to my attention)
that if you run SnowsPenultimateNormalityTest on a vector of length 0
then it does return a p-value of 1.  I have not yet decided if this is
a bug or a feature.  On one hand it makes sense that a sample of size
0 is perfectly consistent with the assumption that you chose 0
observations from a normal distribution, on the other hand, if it is
an integer or double vector of length 0 that would still be
information that the numbers (or lack thereof) are rational.

[snip]


I am just curious... Are there teachers out there pointing to that test? If 
yes, what fraction of the students realise what happens? I guess, it is closer 
to zero than to one, unfortunately. Wait... I need another 
SnowsPenultimateXxxxTest() here to check the null hypothesis that all my 
students are doing what they are supposed to do when discovering a new 
statistical tool!


I don't know of any teachers pointing to the test, I would want to be
careful which class to bring it up in.  For some students it could
result in an epiphany, others may just blindly use it, and still
others may have their heads explode if they have to think to hard
about it.

I was originally considering naming the test SnowsAntepenultimeateTest
to give a little more room for follow-up tests, but at the time I
could not remember if it was Ante (before) or Anti (opposite).  I
learned the word Antepenultimate in terms of pages in a book, where
the 3rd to last page (the Antepenultimate page) is directly opposite
(Anti-) the Penultimate page.

Just in case that is not confusing enough, the ultimate page of a
cheap detective novel is the last page where the hero realizes that
since the motive for the murder was to cover up the murderer's
embezzlement of the family fortune to pay off his bookie, the hero
will not be paid after all and will still need to continue avoiding
his loan shark.  The penultimate page is the second to last page where
in response to the hero's listing of circumstantial evidence the
murderer conveniently confesses and fills in all the missing details
saving the embarrassment to the hero if he had just lawyer-ed up and
been acquitted due to lack of hard evidence.  And the antepenultimate
page is the 3rd to last where the hero utters the cliche phrase You
are probably wondering why I gathered you all here.  I don't know
what the 4th to last page would be called (could add another ante-, or
in R just use tail(book,4)).



--
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
R-help@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.



__
R-help@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.


Re: [R] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)

2014-02-04 Thread Clint Bowman

Jason,

Thanks--I've found an RSS feed from EPA very useful and will check 
Stackoverflow's.


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 4 Feb 2014, Law, Jason wrote:


Clint and Liviu,

Stackoverflow also has rss feeds available, if you prefer being pushed the 
information that way.  For the R tagged questions it's here: 
http://stackoverflow.com/feeds/tag/r.  Since some e-mail clients double as feed 
readers, you may be able to read the feed from your e-mail client.  Otherwise, 
it does mean another application.

Regards,

Jason

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Liviu Andronic
Sent: Monday, February 03, 2014 11:24 PM
To: Clint Bowman
Cc: r-help@r-project.org; Bert Gunter
Subject: Re: [R] creating an equivalent of r-help on r.stackexchange.com ? 
(was: Re: Should there be an R-beginners list?)

Dear Clint,


On Tue, Feb 4, 2014 at 1:27 AM, Clint Bowman cl...@ecy.wa.gov wrote:

Liviu,

Thanks for the excellent description of the advantages of SE.
However, there is a significant fraction of the population that
prefers that information be pushed out to them rather than having to
pull it to them. The best system is one that accommodates both equally well.


It's not exactly the same as in a mail client, but you also have a push-like 
interface on SE, sort of:
http://stackoverflow.com/questions/tagged/r
- The 'Newest' tab displays all recent questions, sorted in chronological order with 
latest on top; it gets refreshed automatically, as in a mail client (hence, 
push-like)
- The 'Active' tab displays all questions with recent activity (question asked, 
answered or commented upon)
- You also have the very useful 'Unanswered' tab, which allows to identify 
questions that haven't yet received useful advice

Another push-like element in SE is that once you ask a question or answer, any 
subsequent comments on your post will be notified to you either in the web 
interface or by email. This helps keep discussions alive.

Regards,
Liviu




Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 4 Feb 2014, Liviu Andronic wrote:


Dear Don and Bert,
Allow me to address some of your concerns below.


On Mon, Feb 3, 2014 at 9:56 PM, Bert Gunter gunter.ber...@gene.com
wrote:


I find SO's voting for posting business especially irritating. I
wish merely to post or to read the posts of others without being
subjected to some kind of online pseudo game and ratings
competition. That alone keeps me away. But Don said it better.


On SO voting is irrelevant for either posting a question or an answer.
*Anyone* (with an account) can ask a question, and *anyone* can
answer a question. Their system of privileges is explained here:
http://askubuntu.com/help/privileges . But to summarize:
- if you're interested only in giving help, then the only really
relevant threshold is 10 and 50 votes (removing some new user
restrictions and allowing you to comment on posts, respectively)
- if you're interested only in seeking  help, then all thresholds are
irrelevant really

All other thresholds are relevant only if you're interested in
contributing to the organization of information, or in moderating
this whole forum-slash-wiki thingy. And as a note, given the quality
of your answers on r-help, Bert, I have no doubt that you will clock
upwards 50 upvotes in a couple of hours or so.



I realize that I may be out of step with the masses here, and the
masses should certainly decide. Hopefully I won't be around if/when
they decide that R-help should go.


The proposal is not necessarily to close down r-help. From the myriad
lists it currently has, R Core could keep only r-help and r-devel,
and encourage new users to seek help on r.stackexchange.com. The
scope of r-help could be redefined.



On Mon, Feb 3, 2014 at 12:42 PM, MacQueen, Don macque...@llnl.gov
wrote:


- They waste copious amounts of screen space on irrelevant things
such as votes, the number of views, the elapsed time since
something or other happened, fancy web-page headers, and so on. Oh,
and advertisements. The Mathematica stackexchange example given in
a link in one of the emails below
(http://mathematica.stackexchange.com/) illustrates these
shortcomings

Re: [R] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)

2014-02-03 Thread Clint Bowman

Don,

Thanks for the brilliant summary of my thoughts.

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 3 Feb 2014, MacQueen, Don wrote:


Every browser-based interface I've ever seen has a number of features that
I find to be huge deterrents. To mention just two:

- They waste copious amounts of screen space on irrelevant things such as
votes, the number of views, the elapsed time since something or other
happened, fancy web-page headers, and so on. Oh, and advertisements. The
Mathematica stackexchange example given in a link in one of the emails
below (http://mathematica.stackexchange.com/) illustrates these
shortcomings -- and it's not the worst such example.

- In most if not all cases, one has to login before posting. I have too
many usernames and passwords as it is.

Right now, at this very moment, in my email client's window I can see and
browse the subject lines of 20 threads in r-help. And that's using only
about half of my screens vertical space. In contrast, in the Mathematica
stackexchange example, I can see at most 10, and that only by using the
entire vertical space of my screen. The From column in my email client
shows the names of several of the people contributing to the thread, which
the browser interface does not. In the email client, I can move through
messages, and between messages in a thread using my keyboard. In a
browser, I have to do lots of mousing and clicking, which is much less
efficient.

As it is now, r-help messages come to me. I don't have to start up a
browser. So it's much easier to go take a quick look at what's new at any
time.

True, I had to subscribe to the mailing list, which involves a username
and password. But once it's done, it's done. I don't have to login before
posting, which means I don't have to remember yet another username and
password.

What ...duplicated efforts of monitoring multiple mailing lists)? I have
no duplicated effort...in fact, I have almost no effort at all, since the
messages come to me. There was some initial setup, i.e., to filter
different r-* messages to different mailboxes in my email client, but now
that that's done, it's as simple as clicking on the correct mailbox.

In other words, in every way that's important to me, the mailing list
approach is superior. I do not support abandoning the mailing list system
for any alternative.

-Don

--
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 2/2/14 1:49 PM, Liviu Andronic landronim...@gmail.com wrote:


Dear Duncan,
I discovered something interesting wrt to the licensing and mirroring
of user-contributed material on StackExchange.  Please read below.


On Sun, Nov 24, 2013 at 9:00 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:

I'm not aware of a discussion on this, but I would say no.
Fragmentation is bad. Further fragmentation is worse.

TL;DR
=

Actually I'd say all mailing lists except r-devel should be moving to
StackOverlow in the future (disclaimer: I'm not affiliated with it).



I would generally agree with you, except for a few points.

1.  I avoid StackOverflow, because they claim copyright on the
compilation.
As I read their terms of service, it would be illegal for anyone to
download
and duplicate all postings about R.  So a posting there is only
available as
long as they choose to make it available. Postings to the mailing list
are
archived in several places.


It seems that StackOverflow is officially proposing user-generated
content for download/mirroring:
http://blog.stackoverflow.com/2014/01/stack-exchange-cc-data-now-hosted-by
-the-internet-archive/?cb=1

All community-contributed content on Stack Exchange is licensed under
the Creative Commons BY-SA 3.0 license.  And it is currently being
mirrored at least at the Internet Archive:
https://archive.org/details/stackexchange

So, in principle, it would be possible/desirable to:
- spin the 'r' tag from StackOverflow and propose an r.stackexchange.com
at
http://area51.stackexchange.com/categories/8/technology . Such a SE
site would be similar to http://mathematica.stackexchange.com/
- involve R Core to give blessing for using the R logo, if necessary.
This would be similar to what Ubuntu does with AskUbuntu:
http://meta.askubuntu.com/questions/5444/is-ask-ubuntu-official-ubuntu
- set a mirror on r-project.org for all the user content that is
produced by r.stackexchange.com , and thus allow R Core to keep the
info publicly available at all times. The mirroring on Internet
Archive would still hold.



2.  I think an interface like StackOverflow is better than the mailing
list

Re: [R] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)

2014-02-03 Thread Clint Bowman

Liviu,

Thanks for the excellent description of the advantages of SE.  However, 
there is a significant fraction of the population that prefers that 
information be pushed out to them rather than having to pull it to them. 
The best system is one that accommodates both equally well.


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 4 Feb 2014, Liviu Andronic wrote:


Dear Don and Bert,
Allow me to address some of your concerns below.


On Mon, Feb 3, 2014 at 9:56 PM, Bert Gunter gunter.ber...@gene.com wrote:

I find SO's voting for posting business especially irritating. I wish
merely to post or to read the posts of others without being subjected
to some kind of online pseudo game and ratings competition. That alone
keeps me away. But Don said it better.


On SO voting is irrelevant for either posting a question or an answer.
*Anyone* (with an account) can ask a question, and *anyone* can answer
a question. Their system of privileges is explained here:
http://askubuntu.com/help/privileges . But to summarize:
- if you're interested only in giving help, then the only really
relevant threshold is 10 and 50 votes (removing some new user
restrictions and allowing you to comment on posts, respectively)
- if you're interested only in seeking  help, then all thresholds are
irrelevant really

All other thresholds are relevant only if you're interested in
contributing to the organization of information, or in moderating this
whole forum-slash-wiki thingy. And as a note, given the quality of
your answers on r-help, Bert, I have no doubt that you will clock
upwards 50 upvotes in a couple of hours or so.



I realize that I may be out of step with the masses here, and the
masses should certainly decide. Hopefully I won't be around if/when
they decide that R-help should go.


The proposal is not necessarily to close down r-help. From the myriad
lists it currently has, R Core could keep only r-help and r-devel, and
encourage new users to seek help on r.stackexchange.com. The scope of
r-help could be redefined.



On Mon, Feb 3, 2014 at 12:42 PM, MacQueen, Don macque...@llnl.gov wrote:

- They waste copious amounts of screen space on irrelevant things such as
votes, the number of views, the elapsed time since something or other
happened, fancy web-page headers, and so on. Oh, and advertisements. The
Mathematica stackexchange example given in a link in one of the emails
below (http://mathematica.stackexchange.com/) illustrates these
shortcomings -- and it's not the worst such example.



Well, I've seen my fair share of advertisements on Gmail, Yahoo Mail
or what have you. I know some use dedicated clients, but not all do.
(And sofar I haven't noticed one single intrusive or distracting ad on
SE.)

As for the number of votes, this is actually the most useful bit of
this QA interface: it allows for the best questions (or most often
asked) to stand out from all the noise. And it allows for the best
answers (or those most authoritative) to stand out, too. Accepted
answers immediately indicate to others seeking similar help what has
worked for the OP. Very useful stuff.

Voting also naturally allows to differentiate between neophytes
(100), and professional helpers (1k; think of Brian, David or, as it
happens, Bert). If you remember long ago someone proposed on r-help a
reputation system for our professional helpers, only to be rebuffed
essentially because it is unfeasible in a ML interface. The SE QA web
interface---or similar---naturally handles this.




- In most if not all cases, one has to login before posting. I have too
many usernames and passwords as it is.



Fair point. However SE found a neat way around this: it keeps cookies
around and whenever you close the browser and reopen SE, it identifies
the cookie and auto-logs you in.



Right now, at this very moment, in my email client's window I can see and
browse the subject lines of 20 threads in r-help. And that's using only
about half of my screens vertical space. In contrast, in the Mathematica
stackexchange example, I can see at most 10, and that only by using the
entire vertical space of my screen. The From column in my email client
shows the names of several of the people contributing to the thread, which
the browser interface does not. In the email client, I can move through
messages, and between messages in a thread using my keyboard. In a
browser, I have to do lots of mousing and clicking, which is much less
efficient.


Again, fair point, but with SE you quickly realize that this is
irrelevant. On ML, even more so on r-help, the only sane way to sort
and filter the messages is using

Re: [R] Problems downloading and installing nlme under Linux Mint 15

2014-01-21 Thread Clint Bowman

There is the error message:

Error : package ‘lattice’ was built before R 3.0.0: please re-install it

Perhaps the problem lies there.

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 21 Jan 2014, John Sorkin wrote:


I am running R under Linux Mint 15 and trying to download and install
nlme. During the download I get an error message:
Warning message:
In install.packages(nlme) :
 installation of package ‘nlme’ had non-zero exit status

When I try to load the package, I get an error message

library(nlme)

Error: package ‘nlme’ was built before R 3.0.0: please re-install it
Why am I getting the error message, and what can I do to fix the
problem? Please see output of R session below.
Thank you,
John



version

platform   i486-pc-linux-gnu
arch   i486
os linux-gnu
system i486, linux-gnu
status
major  3
minor  0.1
year   2013
month  05
day16
svn rev62743
language   R
version.string R version 3.0.1 (2013-05-16)
nickname   Good Sport



install.packages(nlme)

Installing package into ‘/home/john/R/i486-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL
'http://watson.nci.nih.gov/cran_mirror/src/contrib/nlme_3.1-113.tar.gz'
Content type 'application/octet-stream' length 752188 bytes (734 Kb)
opened URL
==
downloaded 734 Kb

* installing *source* package ‘nlme’ ...
** package ‘nlme’ successfully unpacked and MD5 sums checked
** libs
gfortran   -fpic  -O2 -pipe -g  -c chol.f -o chol.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fvisibility=hidden
-fpic  -O2 -pipe -g  -c corStruct.c -o corStruct.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fvisibility=hidden
-fpic  -O2 -pipe -g  -c gnls.c -o gnls.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fvisibility=hidden
-fpic  -O2 -pipe -g  -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fvisibility=hidden
-fpic  -O2 -pipe -g  -c matrix.c -o matrix.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fvisibility=hidden
-fpic  -O2 -pipe -g  -c nlOptimizer.c -o nlOptimizer.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fvisibility=hidden
-fpic  -O2 -pipe -g  -c nlme.c -o nlme.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fvisibility=hidden
-fpic  -O2 -pipe -g  -c nlmefit.c -o nlmefit.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fvisibility=hidden
-fpic  -O2 -pipe -g  -c nls.c -o nls.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fvisibility=hidden
-fpic  -O2 -pipe -g  -c pdMat.c -o pdMat.o
gfortran   -fpic  -O2 -pipe -g  -c rs.f -o rs.o
gcc -std=gnu99 -shared -o nlme.so chol.o corStruct.o gnls.o init.o
matrix.o nlOptimizer.o nlme.o nlmefit.o nls.o pdMat.o rs.o -lgfortran
-lm -lquadmath -L/usr/lib/R/lib -lR
installing to /home/john/R/i486-pc-linux-gnu-library/3.0/nlme/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error : package ‘lattice’ was built before R 3.0.0: please re-install it
ERROR: lazy loading failed for package ‘nlme’
* removing ‘/home/john/R/i486-pc-linux-gnu-library/3.0/nlme’

The downloaded source packages are in
   ‘/tmp/Rtmpo7eFZf/downloaded_packages’
Warning message:
In install.packages(nlme) :
 installation of package ‘nlme’ had non-zero exit status

library(nlme)

Error: package ‘nlme’ was built before R 3.0.0: please re-install it




John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and
Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

CThis email message, including any attachments, is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.  Any unauthorized use, disclosure or distribution is
prohibited.  If you are not the intended recipient, please contact the
sender by reply email and destroy all copies of the original message.
__
R-help@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.


Re: [R] find max value in each row and return column number and column name

2013-11-01 Thread Clint Bowman

?which.max should start you down the right path

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 1 Nov 2013, Gary Dong wrote:


Dear R users,

I wonder how I can use R to identify the max value of each row, the column
number column name:

For example:

a - data.frame(x = rnorm(4), y = rnorm(4), z = rnorm(4))


a

  x  y  z
1 -0.7289964  0.2194702 -2.4674780
2  1.0889353  0.3167629 -0.9208548
3 -0.6374692 -1.7249049  0.6567313
4 -0.1348642  0.4507473 -1.7309010

In this data frame, I compare y and z only.

What I need:

   x y z
max max.col.num max.col.name
1 -0.7289964  0.2194702 -2.4674780 0.2194702   2
y
2  1.0889353  0.3167629 -0.9208548 0.3167629   2
y
3 -0.6374692 -1.7249049  0.6567313 0.6567313   3
   z
4 -0.1348642  0.4507473 -1.7309010 0.4507473   2
   y


Any suggestion will be greatly appreciated!

Thank you!

Gary

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] (no subject)

2013-10-30 Thread Clint Bowman

Just guessing, would the following help?

list1 - c(john, eric, steve, john, eric, scott, john)
list2 - c(john, john, john, eric, eric, steve, scott)
max(rle(list1)$lengths)
max(rle(list2)$lengths)

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 30 Oct 2013, Adams, Jean wrote:


You should cc r-help on all correspondence so everyone can follow the
thread.

Clearly I'm missing something.  Perhaps others are, too.  I don't  know
what you mean by a score based on the co-localization of names unless you
give an example.

Jean


On Wed, Oct 30, 2013 at 10:34 AM, Stevan Lauriault 
stevan.lauria...@gmail.com wrote:


It would depend on the algorithm.  Which is why I'm writing.  I'm asking
if anyone knows of a preexisting algorithm that would calculate a score
based on the co-localization of names.

S





On Wed, Oct 30, 2013 at 10:56 AM, Adams, Jean jvad...@usgs.gov wrote:


What would the calculated score be for the example you give?

Jean


On Wed, Oct 30, 2013 at 7:03 AM, Stevan Lauriault 
stevan.lauria...@gmail.com wrote:


Hi,

I'm looking for a function that takes a list and calculates a score
based on
how well like attracts like.
For example:

list1 - c(john, eric, steve, john, eric, scott, john)
list2 - c(john, john, john, eric, eric, steve, scott)

score(list1)  score(list2)

Both lists are composed of the same names and frequency of each
name.

Not sure how else to put it.  I am relatively new to R.  Have tried the
modularity function, but can't seem to get it to work for this purpose.


Any help is appreciated.

Steve

[[alternative HTML version deleted]]

__
R-help@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.








[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] time series has no or less than 2 periods

2013-10-04 Thread Clint Bowman

Perhaps looking at your data will suggest an appropriate number, viz.

plot(data,type=b,xlim=c(0,20),ylim=c(0,50))
par(new=T)
ind-1:19  # in this case where the data length is 19
data.ind-data.frame(ind,data)
data.lo-loess(data~ind,data.ind)
data.pre-predict(data.lo,data.frame(ind = seq(1,19,1))) 
plot(data.pre,pch=3,col=2,xlim=c(0,20),ylim=c(0,50))


If you now plot the difference between the data and the loess prediction,

data.ind-cbind(data.ind,data.pre)
data.diff-with(data.ind,data-data.pre)
data.ind-cbind(data.ind,data.diff)
with(data.ind,plot(ind,data.diff,type=b))
abline(h=0)

there is also a pretty strong two week signal--is that of any interest?

Now you should be able to decide how to proceed.

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 4 Oct 2013, Daniel Hickman wrote:


Bill,

Thanks for replying.


The data is weekly time series data.  Assume there is 52 weeks in the year.  Of 
the 52 weeks, I typically only have data for weeks 8 through 40.


4-Apr-10, 8, 27.2
11-Apr-10, 9, 32.3
18-Apr-10, 10, 31.7

DataXYZ, 40, 13.4


data - 
c(0,24.57,29.93,24.19,12.25,48.07,36.68,24.78,48.69,30.39,48.17,36.51,36.43,36.52,48.75,24.17,37.07,0,18.89)
ts - ts(data= data, start = 8, end = 40, frequency = )


There is a weekly seasonality effect.  What should I set my frequency value to?


Thanks,

Dan Hickman






From: William Dunlap
Sent: ???Thursday???, ???October??? ???3???, ???2013 ???3???:???57??? ???PM
To: David Winsemius, Daniel Hickman
Cc: r-help@r-project.org



ts - ts(data$QtyPerWeek, frequency=52)
HoltWinters(ts,0.46924,0.05,0.2)

This results in the following error. Error in decompose(ts(x[1L:wind], start = 
start(x),

frequency = f), seasonal) : time series has no or less than 2 periods


Since you have set the frequency of the time series to 52, you need
to have 104 observations to get the initial estimate of the seasonal
pattern.  How many observations are in 'ts'?  If you don't have enough
you can omit the seaonal component (HoltWinters(gamma=FALSE,...)),
change start.periods from the default 2 to 1, or supply a 52-long vector
of the initial seasonal pattern as the s.start argument.

If you do have more than 104 observations then you will have to tell
us more about the data.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf
Of David Winsemius
Sent: Thursday, October 03, 2013 12:39 PM
To: Daniel Hickman
Cc: r-help@r-project.org
Subject: Re: [R] time series has no or less than 2 periods


On Oct 3, 2013, at 8:32 AM, Daniel Hickman wrote:


Hello,



I have been tasked with taking an excel file that my colleague had implemented 
Triple

Exponential Smoothing and recreate using R.


The following image shows the before and after of smoothing out a fixed 
interval time

series data using Triple Exponential Smoothing inside of Excel.


enter image description here


The image file formats that I know are acceptable are .ps, .pdf or .png. Not 
sure about
jpeg.



I am trying to perform the same triple exponential smoothing in R.  I created a 
csv file

with the before smoothing data.  The csv file is attached and can also be found 
here.

Need to send with .txt extension.



I found the HoltWinters method but I keep getting an error when I try to apply

HoltWinters against the csv.

setwd(C:/temp)
data - read.table(TripleExpSmoothingXLS.csv, header=TRUE, sep=,)
ts - ts(data$QtyPerWeek, frequency=52)
HoltWinters(ts,0.46924,0.05,0.2)

This results in the following error. Error in decompose(ts(x[1L:wind], start = 
start(x),

frequency = f), seasonal) : time series has no or less than 2 periods

Perhaps a data entry problem. We would need to see either the file or output of
str(data).


In case it helps,  excel file with the triple exponential smoothing formulas 
and original

data can be found here.

Again there is no here here.



Any advice?

Thanks, Dan__
R-help@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.


David Winsemius
Alameda, CA, USA

__
R-help@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.

[[alternative HTML version deleted

Re: [R] Need help to find out the name of my columns and rows in a data file

2013-09-20 Thread Clint Bowman
You are close--think names, not titles, as in rownames or colnames (no 
reason to completely spell out column).  Summary already gave you the 
column names, so type ?rownames to learn more.


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 19 Sep 2013, ivanc010 wrote:


I've been assigned homework to analyze a file. The R package is car. The
specific data file is Florida.

So, I did the usual stuff:
library(car)
data(Florida)
summary(Florida)

My specific assignment is to run a t-test between GORE and BUSH. (This file
has information on the 2000 election.)

To run my t-test, my code must be something analogues to:

t.test(case0102$Salary[case0102$Sex==Female],case0102$Salary[case0102$Sex==Male])

Unfortunately, for my Florida data I can't find the analogues titles of the
rows and columns (i.e. Sex and Salary).

Please help.



--
View this message in context: 
http://r.789695.n4.nabble.com/Need-help-to-find-out-the-name-of-my-columns-and-rows-in-a-data-file-tp4676534.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] Renaming variables

2013-09-20 Thread Clint Bowman

or

with(score.plot(X1, X2))

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 20 Sep 2013, Aaron Mackey wrote:


On Fri, Sep 20, 2013 at 10:10 AM, Preetam Pal lordpree...@gmail.com wrote:


I have 25 variables in the data file (name: score), i.e. X1,X2,.,X25.

I dont want to use score$X1, score$X2 everytime I use these variables.



attach(score)

plot(X1, X2) # etc. etc.

-Aaron

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] XYZ data

2013-06-26 Thread Clint Bowman

John,

That still leaves a string of identical numbers in the vector.

Shane,

?jitter

perhaps jitter(X,1,0.0001)

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 26 Jun 2013, John Kane wrote:


mm  -  1:10
nn  - mm + .001

John Kane
Kingston ON Canada



-Original Message-
From: careys...@gmail.com
Sent: Wed, 26 Jun 2013 16:48:34 +0100
To: r-help@r-project.org
Subject: [R] XYZ data

I have x, y, z data. The x, y fields dont change but Z does. How do I add
a
very small number onto the end of each x, y data point.

For example:

Original (X)  Original (Y) Original (Z)
15   20  30
15   20  40




New (X)  New (Y) New (Z)
15.1 20.01  30
15.2 20.02  40


Thanks
--
Shane

[[alternative HTML version deleted]]

__
R-help@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.



FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@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.



__
R-help@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.


Re: [R] XYZ data

2013-06-26 Thread Clint Bowman

perhaps

x-x+0.1*seq(1,length(x))

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 26 Jun 2013, Shane Carey wrote:


Nope, neither work. :-(


On Wed, Jun 26, 2013 at 5:16 PM, Clint Bowman cl...@ecy.wa.gov wrote:
  John,

  That still leaves a string of identical numbers in the vector.

  Shane,

  ?jitter

  perhaps jitter(X,1,0.0001)

  Clint

  Clint Bowman                    INTERNET:       cl...@ecy.wa.gov
  Air Quality Modeler             INTERNET:       cl...@math.utah.edu
  Department of Ecology           VOICE:          (360) 407-6815
  PO Box 47600                    FAX:            (360) 407-7534
  Olympia, WA 98504-7600

          USPS:           PO Box 47600, Olympia, WA 98504-7600
          Parcels:        300 Desmond Drive, Lacey, WA 98503-1274

  On Wed, 26 Jun 2013, John Kane wrote:

mm  -  1:10
nn  - mm + .001

John Kane
Kingston ON Canada


  -Original Message-
  From: careys...@gmail.com
  Sent: Wed, 26 Jun 2013 16:48:34 +0100
  To: r-help@r-project.org
  Subject: [R] XYZ data

  I have x, y, z data. The x, y fields dont change but Z does. 
How do I add
  a
  very small number onto the end of each x, y data point.

  For example:

  Original (X)              Original (Y)                 
Original (Z)
  15                               20                           
   30
  15                               20                           
   40




  New (X)              New (Y)                 New (Z)
  15.1             20.01              30
  15.2             20.02              40


  Thanks
  --
  Shane

          [[alternative HTML version deleted]]

  __
  R-help@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.



FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@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.




--
Shane

__
R-help@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.


Re: [R] How to define desired numbers to a vector based on the present numbers

2013-06-21 Thread Clint Bowman

I suspect the OP may want

rep(1:length(unique(x)), rle(x[order(x)])$lengths)[order(order(x))]

to allow for variable numbers of unique values.

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 21 Jun 2013, Rui Barradas wrote:


Hello,

I'm not sure I understand. You want to attribute a color number 1:7 to each 
element of your vector? Maybe the following will do.



x - scan(text = 
43 43 43 43  0 39 13 39 50 39 39 23 23 32  0 13 32 23 32 23  0 13 13  0
)

cols - rep(1:7, rle(x[order(x)])$lengths)[order(order(x))]
plot(x, col = cols)


Hope this helps,

Rui Barradas

Em 21-06-2013 16:13, Suparna Mitra escreveu:

Hello R experts,
   I want to  define desired numbers to a vector based on the present
numbers. Can anybody please help me?
Obviously I found worst ways to do it, but I believe there must be any
better way.

I have vector as

X
  [1] 43 43 43 43  0 39 13 39 50 39 39 23 23 32  0 13 32 23 32 23  0 13 13 
0

Now I want to colour a plot with unic cols based on this vector. I want to
baseplot.
But now the problem in normal col pallet these nos has repetition. Thus I
tried to
  library(RColorBrewer)

coll-colorRampPalette(brewer.pal(9, Set1))(50)

and then use this vector as col.

But there also the colours are not enough bright.

So I am trying to set new a vector reading this present vector.
Obviously I can type out manually as
coll=c(rep(1,4),0,2 

But rather I am trying for some automation with which function or similar
But still now I am struggling with this.
Can anybody please help me.

Basic thing is some way to reads the vector and define a new col vector
from 1:7

Thanks a lot,
Mitra

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.



__
R-help@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.


Re: [R] numeric not equal its value

2013-05-21 Thread Clint Bowman

Jannis,

Not strange.  Try with numbers that can be exactly represented in binary 
(that's what computers use), e.g.,


a-seq(5,70,by=5)
b-15
a==b

or fractions,

a-seq(1/32,14/32,by=1/32)
b-3/32
a==b

Most decimal fractions cannot be represented exactly although a bit of 
magic will display them as if they are.


A little digging into the r-help archives will find further explanation.

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 20 May 2013, Jannis wrote:


Dear R users,



I ran into the strange situation where a number does not seem to equal its 
value. Try this:




a - seq(0.05,0.7,0.05)[3]

b - 0.15

a == b


Should this not be TRUE? a-b yields a very small number (and not 0) so this 
most probably is a numerical error, but why does seq create such numbers?



Thanks a lot
Jannis

__
R-help@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.



__
R-help@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.


Re: [R] Need code for Liddle Exact test?

2013-03-26 Thread Clint Bowman
Second item in Google, searching for Liddle Exact test McNemar test was 
cran.r-project.org/web/packages/exact2x2/vignettes/exactMcNemar.pdf


Guess you should have looked before asking.

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 26 Mar 2013, gokhanocakoglu wrote:


Dear friends,
I am searching a code for Liddle Exact test which is equavelent to McNemar
test...
thanx for your attention for know




--
View this message in context: 
http://r.789695.n4.nabble.com/Need-code-for-Liddle-Exact-test-tp4662549.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] NLS results different from Excel -- Tricky fortunes nomination

2013-03-14 Thread Clint Bowman
Following up on Bert's nomination, may I take one from a recent email I 
received?


The second file is air concentrations against frequencies plotted by SAS; 
however we don't have the SAS statistical package...


I thought the original name for SAS was Statistical Analysis System--am I 
missing something?


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 20 Feb 2013, Bert Gunter wrote:


Folks:

I thought the following excerpt from Bruce McCullough's post would be
a good candidate for the R fortunes package -- except that it's about
Excel, not R!  So I nominate it... but leave it to others to say
whether it's really qualified to be nominated.


The idea that the Excel solver has a good reputation for being fast
and accurate does not withstand an examination  of the Excel solver's
ability to solve the StRD nls test problems. ...
Excel solver does have the virtue that it will always produce an
answer, albeit one with zero accurate digits.
---

I also leave it to others to modify what is excerpted if appropriate.

Cheers,
Bert



On Wed, Feb 20, 2013 at 7:58 AM, Bruce McCullough
bdmccullo...@drexel.edu wrote:

The idea that the Excel solver has a good reputation for being fast and
accurate does not withstand an examination  of the Excel solver's
ability to solve the StRD nls test problems.  Solver's ability is
abysmal.  13 of 27 answers have zero accurate digits, and three more
have fewer than two accurate digits -- and this is after tuning the
solver to get a good answer.  For details see

B. D. McCullough and Berry Wilson
On the Accuracy of Statistical Procedures in Microsoft Excel 2000 and
Excel XP,
/Computational Statistics and Data Analysis/ *40*(4), 713-721, 2002

The situation is the same for Excel 2003 and Excel 2007.  The alleged
improvements for Excel 2010 have had not much practical effect.  Excel
solver does have the virture that it will always produce an answer,
albeit one with zero accurate digits.

To see an extended example of precisely how solver fails:

B. D. McCullough
Some Details of Nonlinear Estimation, Chapter Eight in
/Numerical Methods in Statistical Computing for the Social Sciences, /
Micah Altman, Jeff Gill and Michael P. McDonald, editors
New York: Wiley, 2004

I am unaware of R being applied to the StRD, but I did apply S+ to the
StRD and, with analytic derivatives, it performed flawlessly.


On 02/19/2013 08:38 PM, r-help-requ...@r-project.org wrote:

May I be allowed to say that the general comments on MS Excel may be alright,
in this special case they are not.  The Excel Solver -- which is made by an
external company, not MS -- has a good reputation for being fast and accurate.
And it indeed solves least-squares and nonlinear problems better than some of
the solvers available in R.
There is a professional version of this solver, not available from Microsoft,
that could be called excellent. We, and this includes me, should not be too
arrogant towards the outside, non-R world, the 'barbarians' as the ancient
Greeks called it.

Hans Werner



--
B. D. McCullough, Professor
Department of Decision Sciences
LeBow College of Business

So what's getting ubiquitous and cheap? Data. And what is
complementary to data? Analysis. So my recommendation is to
take lots of courses about how to manipulate and analyze
data: databases, machine learning, econometrics, statistics,
visualization, and so on. Google Chief Economist, Hal Varian,
New York Times, 25 February 2008


[[alternative HTML version deleted]]

__
R-help@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.




--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@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.



__
R-help@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.


Re: [R] Reading Wyoming radiosonde data files with RadioSonde package

2013-03-05 Thread Clint Bowman
Sure looks as if that second --... line is causing 
another attempt at parsing for varkey and unitkey which for 70.0 and 59.6 
just won't make sense to getsonde.


It's a pain but I'd experiment by removing that second ... line.

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 5 Mar 2013, Ilan Levy wrote:


Hi,
I need to do some analysis on historic daily radiosonde data I download
from the Wyoming Univ. web page (
http://weather.uwyo.edu/upperair/sounding.html).
I am trying to use the RadioSonde package (V 1.3), but the format of the
files from Wyoming don't match what RadioSonde is expecting.

Has anyone used the Radiosonde package on the Wyoming data?
Here is a sample of the Wyoming file format:


   40179 Bet Dagan Observations at 00Z 22 Feb 2013

-
  PRES   HGHT   TEMP   DWPT   RELH   MIXR   DRCT   SKNT   THTA   THTE
THTV
   hPa m  C  C  %g/kgdeg   knot K  K
K
-
  70.0  18430  -64.5 265 91  446.1
446.1
  59.6  19417  -60.9 265 83  475.1
475.1
  50.0  20500  -62.5 265 75  495.8
495.8
  46.7  20920  -64.3 501.2
501.2
  38.3  22137  -63.5 532.5
532.5
  33.3  23012  -56.3 573.2
573.2
  30.0  23670  -59.9 580.8
580.8
  28.1  24078  -60.5 590.0
590.0
  20.5  26056  -57.1 656.0
656.0


 Station information and sounding indices

Station number: 40179
  Observation time: 130222/
  Station latitude: 32.00
 Station longitude: 34.81
 Station elevation: 35.0
Mean mixed layer potential temperature: 0.00
 Mean mixed layer mixing ratio: 0.00

Here is the code I tried:

filename - 'D:\\Data\\sounding_test3.txt'
datakey  - --
varkey   -PRES
unitkey  - hPa
sample.sonde - getsonde(filename, datakey, varkey, unitkey)

Error in getsonde(filename, datakey, varkey, unitkey) :
 (getsonde): could not find a unique match for the data string

Thanks,
Ilik

Win7 OS 64-bit, R version 2.13.0.

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] Changing the order of months within a year

2013-02-12 Thread Clint Bowman
I'm sure the OP has reasons to reorder the months as shown but his data 
seems to argue that he shouldn't split the wet season (Oct - Apr) but 
should, instead, tack the 1972 months (Jan - Aug after the 1971 months 
(Sep - Dec).


Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 12 Feb 2013, David Winsemius wrote:



On Feb 11, 2013, at 10:09 PM, nick pardikes wrote:


I have data that looks like below and I would like to re-order the values within the 
date column. I would like to have each year organized like so:

Sep-71
Oct-71
Nov-71
Dec-71
Jan-71
Feb-71
Mar-71
Apr-71
May-71
Jun-71
Jul-71
Aug-71
Sep-72
Oct-72
etc...



dat1[ order(dat1$year, match(substr(dat1$date, 1,3),  month.abb[c(9:12,1:8)] ) 
) , ]


--
David.


Is there any way I can order the column in my own fashion and just move Sep-Dec 
to the beginning of each year? I am planning on doing some time series analysis 
with this data and think that the order of months is very important for the 
time series. I appreciate any suggestions and thank you in advance.



   site   date year precipitation temp_max temp_min
1  castlepeak Jan-71 197126.2903226 38.29032 18.06452
2  castlepeak Feb-71 1971 9.1071429 39.60714 17.5
3  castlepeak Mar-71 197136.3548387 38.87097 17.77419
4  castlepeak Apr-71 197114.833 44.06667 22.56667
5  castlepeak May-71 197111.0967742 47.87097 29.22581
6  castlepeak Jun-71 1971 7.900 62.2 34.16667
7  castlepeak Jul-71 1971 0.4516129 75.45161 44.93548
8  castlepeak Aug-71 1971 1.1612903 76.54839 45.96774
9  castlepeak Sep-71 1971 0.933 68.3 36.86667
10 castlepeak Oct-71 197110.1612903 56.22581 31.74194
11 castlepeak Nov-71 197158.100 43.1 28.4
12 castlepeak Dec-71 197156.0645161 30.87097 16.29032
13 castlepeak Jan-72 197216.7741935 33.90323 15.41935
14 castlepeak Feb-72 197230.4137931 37.62069 19.82759
15 castlepeak Mar-72 197212.5161290 46.45161 24.06452
16 castlepeak Apr-72 197220.933 41.2 22.1
17 castlepeak May-72 1972 3.3870968 53.06452 28.77419
18 castlepeak Jun-72 1972 3.767 65.6 37.9
19 castlepeak Jul-72 1972 0.000 74.25806 43.45161
20 castlepeak Aug-72 1972 0.2258065 73.35484 43.03226
21 castlepeak Sep-72 1972 5.400 65.7 37.9
22 castlepeak Oct-72 1972 5.1612903 51.0 27.38710
23 castlepeak Nov-72 197223.067 40.1 23.4
24 castlepeak Dec-72 197250.7096774 27.0 10.16129

Nick Pardikes
PhD Student
Program in Ecology, Evolution and Conservation Biology
University of Nevada, Reno
303-550-1072
http://wolfweb.unr.edu/homepage/npardikes/MySite/Welcome.html

[[alternative HTML version deleted]]

__
R-help@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.


David Winsemius
Alameda, CA, USA

__
R-help@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.



__
R-help@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.


Re: [R] R for Windows 32-bit mode versus 64-bit mode

2013-02-06 Thread Clint Bowman

Most Windows computers in my neighborhood have been upgraded to 64 bit.

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 6 Feb 2013, Roy Mendelssohn - NOAA Federal wrote:


Hi All:

We are developing  (actually updating) a piece of code that runs in R.  Due to 
some limitations of some the libraries we use, at the present time we would be 
limited to the 32-bit version of R on Windows.  Does anyone have a feel (or 
even real knowledge) if most people  these days run R on Windows in 32-bit or 
64-bit mode?  This would affect some development decisions.

Thanks

-Roy M.



**
The contents of this message do not reflect any position of the U.S. Government or 
NOAA.
**
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: roy.mendelss...@noaa.gov (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/

Old age and treachery will overcome youth and skill.
From those who have been given much, much will be expected
the arc of the moral universe is long, but it bends toward justice -MLK Jr.

__
R-help@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.



__
R-help@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.


Re: [R] Removing duplicates without a for loop

2012-09-26 Thread Clint Bowman

?duplicated

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 26 Sep 2012, Rui Barradas wrote:

Sorry, but in my previous post I've confused the columns. It's by REQ.NR, not 
by date


REQ.NR - 1:4
REQ.NR - c(REQ.NR, sample(REQ.NR, 2))
dat - data.frame(date = Sys.Date() + 1:6, REQ.NR = REQ.NR, value = rnorm(6))

aggregate(dat, by = list(dat$REQ.NR), FUN = tail, 1)

Rui Barradas
Em 26-09-2012 16:19, wwreith escreveu:

  I have several thousand rows of shipment data imported into R as a data
frame, with two columns of particular interest, col 1 is the entry date, 
and
col 2 is the tracking number (colname is REQ.NR). Tracking numbers should 
be
unique but on occassion aren't because they get entered more than once. 
This

creates two or more rows of with the same tracking number but different
dates. I wrote a for loop that will keep the row with the oldest date but 
it

is extremely slow.

Any suggestions of how I should write this so that it is faster?

# Creates a vector of on the unique tracking numbers #
u-na.omit(unique(Para.5C$REQ.NR))

# Create Data Frame to rbind unique rows to #
Para.5C.final-data.frame()

# For each value in u subset Para.5C find the min date and rbind it to
Para.5C.final #
for(i in 1:length(u))
{
   x-subset(Para.5C,Para.5C$REQ.NR==u[i])
   Para.5C.final-rbind(Para.5C.final,x[which(x[,1]==min(x[,1])),])
}



--
View this message in context: 
http://r.789695.n4.nabble.com/Removing-duplicates-without-a-for-loop-tp4644255.html

Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


__
R-help@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.



__
R-help@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.


Re: [R] extracting column at regular intervals starting from different columns

2012-09-18 Thread Clint Bowman

Try:

x - 1:444
start-2

x[c(rep(FALSE,start-1),TRUE, rep(FALSE, 36-start+1))]

# [1]   2  39  76 113 150 187 224 261 298 335 372 409
start-30
x[c(rep(FALSE,start-1),TRUE, rep(FALSE, 36-start+1))]
# [1]  30  67 104 141 178 215 252 289 326 363 400 437
start-37
x[c(rep(FALSE,start-1),TRUE, rep(FALSE, 36-start+1))]
# [1]  37  74 111 148 185 222 259 296 333 370 407 444



Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 18 Sep 2012, eliza botto wrote:



Dear useRs,
i had a matrix with 31 rows and 444 columns and i wanted to extract every 37th 
column of that matrix starting from 1. more precisely i wanted to select 
columns 1, 38,75, 112 and so on. then doing the same by starting from column 
number 2(2,39,76,113...).
i was advised to use

x[c(TRUE, rep(FALSE, 36)),]

i works if it is start from first column but as i am very new to R i wanted to 
know what to do to make it work if i want to start column selection from column 
2 and then from column 3 and so on.
sorry for bothering you once again..
regards
eliza



From: eliza_bo...@hotmail.com
To: michael.weyla...@gmail.com
Date: Tue, 18 Sep 2012 15:06:18 +
CC: r-help@r-project.org
Subject: Re: [R] extracting column and regular interval in R


thnkyou very much micheal.
i worked!!!
regards
eliza



From: michael.weyla...@gmail.com
Date: Tue, 18 Sep 2012 15:58:31 +0100
Subject: Re: [R] extracting column and regular interval in R
To: eliza_bo...@hotmail.com
CC: r-help@r-project.org

x[c(TRUE, rep(FALSE, 36)),]

and let recycling work its magic!

To concretize:

x - 1:100

x[c(TRUE, rep(FALSE, 4))]

Cheers,
Michael

On Tue, Sep 18, 2012 at 3:55 PM, eliza botto eliza_bo...@hotmail.com wrote:


Dear R users,
i have a matrix with 31 rows and 444 columns and i want to extract every 37th 
column of that matrix starting from 1. more precisely i want to select columns 
1, 38,75, 112 and so on. then doing the same by starting from column number 
2(2,39,76,113...).
i know that there is a manual way of doing it but i wanted to make it more 
quickly as i have fairly large data to dealth with.

thanks in advance
eliza
[[alternative HTML version deleted]]

__
R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] Tendonitis and R users

2012-09-04 Thread Clint Bowman
I think I've avoided tendonitis by carefully stretching the affected area 
when I begin to feel discomfort and, as John suggests, Carefully watch 
posture and arm/hand actions to reduce strain.


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Tue, 4 Sep 2012, John Kane wrote:


I've come close a couple of times. Solutions: don't use computer-not
always practical. Carefully watch posture and arm/hand actions to reduce 
strain.


If do a lot of keyboarding not just R type look into using a Dvoark keyboard.

Something I have not done but which is likely to help is consult your 
institutions health and safety people about solutions such as ergonomic 
keyboards etc.

John Kane
Kingston ON Canada



-Original Message-
From: resea...@namibia.pharmaccess.org
Sent: Tue, 4 Sep 2012 12:55:36 +
To: r-help@r-project.org
Subject: [R] Tendonitis and R users


Hello
This request asks something beyond the technicalities of the R language,
I would like to ask you wonderful people if you have ever suffered as
programmers ( or de facto programmers like myself though I am a 'research
assistant') from tendonitis and how you coped with it, i have golfer's
elbow on both sides. Any resources?

Pancho Mulongeni
Namibia
__
R-help@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.



FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@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.



__
R-help@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.


Re: [R] Remove several numbers from a sequence

2012-08-17 Thread Clint Bowman

yy[!yy%in%xx]

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 17 Aug 2012, penguins wrote:


Can anyone tell me how to remove several numbers for a sequence. For example:

xx- c(1,5,7,10)
yy-seq(1,10,1)

how do I get take xx away from yy to get the new sequence

2,3,4,6,8,9

Many thanks in advance



--
View this message in context: 
http://r.789695.n4.nabble.com/Remove-several-numbers-from-a-sequence-tp4640630.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] Quadrat counting with spatstat

2012-05-31 Thread Clint Bowman

1.  Erect a solid, impremeable wall around the perimeter.
2.  Put a very flexible, membrane around each circle.
3.  Add a drop of low viscosity, low surface tension liquid to each
circle.
4.  At some point, all circles will have expanded to completely fill the
space.
5.  The membranes will define your optimum solution.

Soap bubbles with micropipets to inflate them may work equally well.

Clint

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 31 May 2012, David Winsemius wrote:



On May 31, 2012, at 2:26 PM, R. Michael Weylandt wrote:


On Thu, May 31, 2012 at 11:23 AM, AMFTom the.quiet.r...@gmail.com wrote:

I have photographs of plots that look like so:

http://r.789695.n4.nabble.com/file/n4631960/Untitled.jpg

I need to divide it up so each circle has an equal area surrounding it. So
into 20 equal segments, each of which contains a circle. Quadratcount is 
not

sufficient because if I divide it up into 36 equal quadrats, some quadrats
do not contain one of the circles.


I must admit I found this a little confusing -- are you trying to
divide into twenty segments or 36? Also, what package does
quadratcount come from?

I'm guessing this might work better in an image processing/computer
vision program than in R.



The solution[1] requires a higher level of intelligence than is typical in 
ordinary clustering mechanisms. Maybe some sort of symbolic geometry 
program exists somewhere? There are really two levels of symmetry that need 
to be processed to come up with an approach that satisfies both constraints 
(equi-area-partition and all-area-included) . Agree it's not a statistical 
problem  ... not was it offered in a manner that lent itself to testing an 
algorithmic solution.


--
David.

[1] Which is too large to fit into the margins of this posting.


Best,
Michael



I'm not even sure how to do it mathematically, let alone using R.

Can anyone help?

--
View this message in context: 
http://r.789695.n4.nabble.com/Quadrat-counting-with-spatstat-tp4631960.html

Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


__
R-help@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.


David Winsemius, MD
West Hartford, CT

__
R-help@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.


__
R-help@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.


Re: [R] SmoothTrend in OpenAir

2012-04-19 Thread Clint Bowman
I was able to get the plot by converting the dates in the date column to 
dates, e.g.,


mytable-read.csv(MCNP-pH.csv)
newdate-with(mytable,strptime(date,%m/%d/%Y))
mytable$date-newdate
smoothTrend(mytable, pollutant = pH)

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Thu, 19 Apr 2012, David Doyle wrote:


I'm trying to plot smooth trend using smoothTrend in OpenAir but I'm having
problems.

I used the following code.
-
#Set my working dir to the dir with my files
setwd(c:/R)

#Load the openair library
library(openair)

#Load the data
mydata - read.table(MCNP-pH.csv, header=TRUE, sep=,,)

#Plot the data
smoothTrend(mydata, pollutant = pH)
-


I get the following error:
Error in seq.int(0, to0 - from, by) : 'to' must be finite
In addition: Warning messages:
1: In min.default(c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,  :
 no non-missing arguments to min; returning Inf
2: In max.default(c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,  :
 no non-missing arguments to max; returning -Inf




A copy of the data can be found at
www.doylesdartden.com/e/MCNP-pH.csv

Any suggestions??

Thank you
David

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] How to use ggplot to do the binned quantile plots(one type of scatter plot)?

2012-03-14 Thread Clint Bowman
?quantile on the individual bins, make your deciles, then plot the ten 
series as usual with your x values at the midpoint of the bins.


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 14 Mar 2012, David Winsemius wrote:



On Mar 14, 2012, at 11:33 AM, Michael wrote:

How to use ggplot to do the binned quantile plots(one type of scatter 
plot)?


More like a quantile regression plot.



Hi all,

I have done scatter plot: plot(x, y).

Now I wanted to do binned quantile plots... can ggplot2 help me?

For example, we bin x data into 10 bins.

For each bin, we draw the 10 deciles of the corresponding y data in that
bin as points/dots.

And then accross all bins, we would like to connect the corresponding
decile points/dots together(something like equi-quantile or equi-decile
curves)...

How do I do that in R or ggplot2? Is there an existing function/command
that can do this?


I'm not aware of it if there is. But I agree that it can be a very 
informative display of data.  I do such plots on data structures generated 
using tapply with age, sex categories and quantile() to generate a value. It 
gets kind of hairy with the list structure that results but if you have a 
more simple data situation it will probably be more straightforward, and you 
should post it.



[[alternative HTML version deleted]]


And you should learn to post in plain text

PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html


And you should read the Posting Guide.


and provide commented, minimal, self-contained, reproducible code.



And I already said that.

--

David Winsemius, MD
West Hartford, CT

__
R-help@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.


__
R-help@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.


Re: [R] importing NPDB

2011-12-28 Thread Clint Bowman

Alison,

library(foreign)
ndpb-read.spss(NPDB1107.por)

generates:

Warning message:
In `levels-`(`*tmp*`, value = c(Self Query Processing, Non-Fed. 
Malp. Payor,  :

  duplicated levels will not be allowed in factors anymore

and summary(ndpb) does generate quite a list.

Perhaps you can take it from there.

Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Tue, 27 Dec 2011, alison korte wrote:


Does anyone have information about using the National Practitioner Data Bank 
(NPDB) in R? It's public use data available from the U.S. Department of Health 
and Human Services that can be downloaded as a .dat or .por file.?I can't even 
figure out how to open the file in R.
[[alternative HTML version deleted]]




__
R-help@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.


Re: [R] Gps fraction of degrees function

2011-12-21 Thread Clint Bowman

The following (untested) should get you close:

deg-as.integer(strsplit(coords, ?)[[1]][1])
min-as.integer(strsplit(strsplit(coords, ?)[[1]][2], 
')[[1]][1])
sec-as.numeric(strsplit(strsplit(strsplit(coords, ?)[[1]][2], 
')[[1]][2], \)[[1]][1])
nswe-strsplit(strsplit(strsplit(coords, ?)[[1]][2], 
')[[1]][2], \)[[1]][2]


deg.frac-((sec/60+min)/60+deg
deg.frac-ifelse(nswe==S|nswe==E,-deg.frac,deg.frac)

Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Wed, 21 Dec 2011, Alaios wrote:


Dear all,?? I have the following written example


coords - 51?30'48.58\N

as.integer(strsplit(coords, ?)[[1]][1])

[1] 51

as.integer(strsplit(strsplit(coords, ?)[[1]][2], ')[[1]][1])

[1] 30

as.numeric(strsplit(strsplit(strsplit(coords, ?)[[1]][2], ')[[1]][2], 
\)[[1]][1])

[1] 48.58

strsplit(strsplit(strsplit(coords, ?)[[1]][2], ')[[1]][2], \)[[1]][2]

[1] N


My code gets from the coords degrees , minutes, seconds and finally the N/S/W/E

Could you please tell me if there is any function in R that can convert all the 
above into fractions of degrees (single numerical value).

B.R
Alex

[[alternative HTML version deleted]]




__
R-help@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.


Re: [R] Gps fraction of degrees function

2011-12-21 Thread Clint Bowman
I see my pre-coffee fingering hit an incorrect key in the final 
line--E is positive, W is negative.


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Wed, 21 Dec 2011, Clint Bowman wrote:


The following (untested) should get you close:

deg-as.integer(strsplit(coords, ?)[[1]][1])
min-as.integer(strsplit(strsplit(coords, ?)[[1]][2], ')[[1]][1])
sec-as.numeric(strsplit(strsplit(strsplit(coords, ?)[[1]][2], 
')[[1]][2], \)[[1]][1])
nswe-strsplit(strsplit(strsplit(coords, ?)[[1]][2], ')[[1]][2], 
\)[[1]][2]


deg.frac-((sec/60+min)/60+deg
deg.frac-ifelse(nswe==S|nswe==E,-deg.frac,deg.frac)

Clint




__
R-help@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.


Re: [R] windrose color ramp issue

2011-12-14 Thread Clint Bowman

library(openair)
?windRose

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Wed, 14 Dec 2011, MacQueen, Don wrote:


There is also a windrose (though not with that name) function in the
openair package.
-Don




__
R-help@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.


Re: [R] Web based R-help not a list

2011-11-09 Thread Clint Bowman

Cem,

Thanks for your comments.

1.  http://cran.r-project.org/ and select Search in the left-hand 
panel.


2.  Use a filter to funnel r-help into it's own area and review as 
desired.


3.  I find that there are many posts that have been quite 
educational and have helped me with analyses.


4.  Although HTML produces pretty posts many of us don't find that 
the information content is increased.


5.  Yes, a picture is often worth 1K words and I'll agree there are 
times when they are needed.  However, mailbox size (a picture is 
often 10K words or more) may be more important than number of 
messages.  Reproducible code usually is sufficient to demonstrate 
the problem.


Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Wed, 9 Nov 2011, Cem Girit wrote:


Hello,



   Is there a web version of this R-Help user group (such as
the ones under Google Groups) such that



1.   I can do a search on any topic over thousands of posts on R easily
and effectively

2.   My mailbox do not overflow with emails so that I do not need to
edit it every day

3.   I can arrange to receive only the responses to my posts
automatically

4.   The content of the post might be better formatted for more
information other than just the text (we now have HTML!)

5.   I can attach pictures to my posts for questions related to plots,
results etc. be quick and effective rather than just links to other sites



Sincerely,



Cem Girit




[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] representing wind date using windrose

2011-11-04 Thread Clint Bowman
I'm also very impressed with openair 
http://www.openair-project.org/,

also
cran.r-project.org/package=openair

Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Fri, 4 Nov 2011, R. Michael Weylandt wrote:


Try this: http://rss.acs.unt.edu/Rdoc/library/climatol/html/rosavent.html

Michael

On Fri, Nov 4, 2011 at 6:06 PM, Norman Khine nor...@khine.net wrote:

hello,
i am new to R and want to use it for a small project to draw a wind
data from a microclimate datasource, can someone give me an example of
how i can represent this in a neat way?

for example, i have:
speed, direction
0.3,NNE
0.45,NNE
0.32,NE
0.28,N
0.30,NE

how do i put this data to get a windrose graph?

many thanks

norman

--

% .join( [ {'*':'@','^':'.'}.get(c,None) or
chr(97+(ord(c)-83)%26) for c in ,adym,*)uzq^zqf ] )

__
R-help@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.



__
R-help@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.



__
R-help@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.


Re: [R] round up a number to 10^4

2011-11-01 Thread Clint Bowman
Or does the middle number have two digits switched? 76131.17 would 
round up to 8 very nicely.


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Tue, 1 Nov 2011, David Winsemius wrote:



On Nov 1, 2011, at 1:07 PM, Wendy wrote:


Hi all,

I have a list of numbers, e.g., X = c(60593.23, 71631.17, 75320.1), and 
want

to round them  so the output is Y = c(6, 8, 8).


Under what notion of rounding would that be the result?


I tried
Y-round(X,-4), but it gives me Y = c(6, 7, 8). Do anybody know
how to round up a number to 10^4?

Thank you in advance.






__
R-help@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.


Re: [R] Bug or feature? sum(c(a, b, c)) != (a + b + c)

2011-08-23 Thread Clint Bowman

?all.equal

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Tue, 23 Aug 2011, Daniel Lai wrote:


Greetings all,

I'm porting an algorithm from MATLAB to R, and noticed some minor 
discrepancies in small decimal values using rowSums and colSums which are 
exacerbated after heavy iteration and log space transformation. This was 
rather perplexing as both programs claimed and appeared to use the IEEE 754 
standard for floating point arithmetic (confirmed with manual basic 
operations).  After some tracing and testing, I've managed to isolated a 
minimal working example as follows:


a = 0.812672
b = 0.916541
c = 0.797810
sum(c(a, b, c)) == (a + b + c)
[1] FALSE

Should I attribute this to the woes of working with floating point numbers 
and accept it? i.e.


sprintf(%.30f, sum(c(a, b, c)))
[1] 2.5270229797182681504637
sprintf(%.30f, (a + b + c))
[1] 2.5270230241271891354700

Change the OS or version I'm using?

MAC OSX 10.5.8:
sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

Linux 2.6.34:
R version 2.12.0 (2010-10-15)
Platform: x86_64-unknown-linux-gnu (64-bit)
attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

Or report this as a bug?

Thanks,
Daniel

__
R-help@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.



__
R-help@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.


Re: [R] How to use as.Date (or something else) with 31-Jul-2010 23:59:00

2011-07-26 Thread Clint Bowman

?strptime

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Tue, 26 Jul 2011, Eduardo M. A. M.Mendes wrote:


Hello

I have a huge file (not an R-file) in which the first column is a string
with date, hour, minutes and seconds (For instance, 31-Jul-2010 23:59:00).

I tried as.Date but the error msg was Error in charToDate(x) :
 character string is not in a standard unambiguous format.

I have checked the help for the function as well as date but to no avail.

How can that sort of string be transformed to something useful in R?

Many thanks

Ed

__
R-help@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.



__
R-help@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.


Re: [R] timeDate with month designated by three letters.

2011-07-19 Thread Clint Bowman

strptime(04-MAY-11 1428,format=%d-%b-%y %H%M)

[1] 2011-05-04 14:28:00


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Tue, 19 Jul 2011, mdkz...@aol.com wrote:


Dear R Experts:


  I am trying to convert a date and time character field to timeDate where the month is 
presented as three letters, such as JUN for June, etc.


This is an example of the full character field:


04-MAY-11 1428
What is the proper format syntax?


I've tried

timeDate(04-MAY-11 1428,format=%d-%m-%y %H%M)
but only get

GMT
[1] [NA]
If I change the month to a number as below, then it works, but that would 
require recoding of the data field.



timeDate(04-05-11 1428,format=%d-%m-%y %H%M)

gives

GMT
[1] [2011-05-04 14:28:00]
which is correct.  How do I get R to recognize the month as a 3 letter 
designator.


Any recommendations you can provide would be greatly appreciated.


Michael


[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] need to delete by time, not date

2011-05-10 Thread Clint Bowman

You may be happy using:

strptime(paste(Date,Time,sep= ),%m/%d/%y %H:%M)$hour

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Tue, 10 May 2011, Schatzi wrote:


I have a matrix where one column has a date and another column has a time. I
need to delete all times before 6am. I had combined the Date and Time column
into DateTime.

Mat1:
Weight Date  Time
7.6 04/28/11 09:03
8.4 04/29/11 03:11
8.6 04/29/11 05:32
8.6 04/29/11 09:53
1.4 05/01/11 19:52

I tried just picking up the time:

as.POSIXct(Mat1$Time, format = %H:%M)

but this assigns the time value today's date.

The final matrix should look like:
Weight Date  Time
7.6 04/28/11 09:03
8.6 04/29/11 09:53
1.4 05/01/11 19:52


-
In theory, practice and theory are the same. In practice, they are not - Albert 
Einstein
--
View this message in context: 
http://r.789695.n4.nabble.com/need-to-delete-by-time-not-date-tp3512162p3512162.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] Compiling a FORTRAN program under Windows 7

2011-05-05 Thread Clint Bowman
You are compiling a subroutine not a program and you compile line 
should read:


gfortran testit.f -c testit.o

You then reference that object code testit.o in your final loading 
stage after compiling other routiens and the main program.


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Thu, 5 May 2011, Mikael Anderson wrote:


Hi,

I am trying to compile a FORTRAN program to call from R under Windows 7 but
I am having problem in the compiling step. To demonstrate this is the
program testit.f:

--
 subroutine TESTIT(x,n,m)
 dimension x(n)
 do 10 i=1,n
10  x(i)=x(i)**m
 end


When I compile it with gfortran I get the following error:

--
c:\MinGW\programsgfortran testit.f -o testit.o
c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libmingw32.a(main.o):main.c:(.tex
t+0xd2): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status.


I should add that a program like the following hello.f compiles with no
problem.

--
READ (*, *) YOURNAME
WRITE (*, 200) YOURNAME
200 FORMAT(//,' Hello ',A/)
STOP
END
--

I realize that this is not directly a question about R but I guess there are
some people here who have compiled FORTRAN programs under Windows 7 to call
from R. I appreciate any help to fix the problem.

/Mikael

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] Null

2011-05-05 Thread Clint Bowman

with(fcv,shapiro.test(case))


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Thu, 5 May 2011, Thomas Levine wrote:


Maybe you were doing something like

fcv - read.csv('fcv.csv')

instead of

fcv - read.csv('fcv.csv')[1]

(I haven't tested this.)

Tom

On Thu, May 5, 2011 at 8:48 AM, pcc polly...@hotmail.com wrote:


This is probably a very simple question but I am completely stumped!I am
trying to do shapiro.wilk(x) test on a relatively small dataset(75) and each
time my variable and keeps coming out as 'NULL', and


shapiro.test(fcv)

Error in complete.cases(x) : no input has determined the number of cases

my text file looks like this:

case
1.600972896
1.534026106
1.633468456
1.69019608
1.686636269
1.713490543
1.460897843
1.604226053
1.547774705
1.575187845
1.50242712
1.489958479
1.555094449
1.56937391
1.46686762
1.583198774
1.59439255
1.627365857
1.596597096
1.598790507
1.596597096
1.613841822
1.607455023
1.586587305
1.72427587
1.668385917
1.743509765
1.5774918
1.709269961
1.507855872
1.650307523
1.670245853
1.721810615
1.613841822
1.586587305
1.658011397
1.595496222
1.662757832
1.521138084
1.564666064
1.515873844
1.596597096
1.617000341
1.621176282
1.598790507
1.73479983
1.498310554
1.571708832
1.426511261
1.698970004
1.534026106
1.5774918
1.682145076
1.689308859
1.654176542
1.526339277
1.545307116
1.658964843
1.638489257
1.557507202
1.604226053
1.627365857
1.651278014
1.627365857
1.559906625
1.720159303
1.64738297
1.62324929
1.698970004
1.704150517
1.57863921
1.558708571
1.681241237
1.539076099
1.5132176

Any ideas?

--
View this message in context: 
http://r.789695.n4.nabble.com/Null-tp3498261p3498261.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


__
R-help@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.



__
R-help@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.


Re: [R] Averaging uneven measurements by time with uneven numbers of measurements

2011-05-05 Thread Clint Bowman
I'd be tempted to do a robust fit (loess?) to the data with a 
relatively small span (I'm assuming that there are errors in the 
measurements and some degree of smoothing is acceptable) then 
predict the fit at a regular interval (e.g., every 30 minutes).


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Thu, 5 May 2011, Schatzi wrote:


I have a new device that takes measurements anywhere from every second, to
every 15 minutes (depending on changes). The matrix has a date, time and Y
column (Y is the measurement). For three days it is 25,000 rows. How do I
average the measurements by every 30 minutes so my matrix is 48 rows per
day? I have been working on this and cannot figure out a simple method. Any
ideas? Thank you.

-
In theory, practice and theory are the same. In practice, they are not - Albert 
Einstein
--
View this message in context: 
http://r.789695.n4.nabble.com/Averaging-uneven-measurements-by-time-with-uneven-numbers-of-measurements-tp3499337p3499337.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] Averaging uneven measurements by time with uneven numbers of measurements

2011-05-05 Thread Clint Bowman
In your first request for help you said, How do I average the 
measurements by every 30 minutes?  With 25000 readings over three 
days, it looks as if you are getting readings just about every 
second.


Okay, why don't you use the first reading as your initial weight, 
w0.  Then subtract each succeeding reading from that to obtain the 
amount of feed dispensed.  Now plot that value every 30 minutes.


If you are interested in the variation of feed dispensed over a 
half hour interval, that can be easily obtained by accummulating 
those half-hour readings.


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Thu, 5 May 2011, Schatzi wrote:


I do not want smoothing as the data should have jumps (it is weight left in
feeding bunker). I was thinking of maybe using a histogram-like function and
then averaging that. Not sure if this is possible.

-
In theory, practice and theory are the same. In practice, they are not - Albert 
Einstein
--
View this message in context: 
http://r.789695.n4.nabble.com/Averaging-uneven-measurements-by-time-with-uneven-numbers-of-measurements-tp3499337p3499386.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] filled contour plot with contour lines

2011-04-01 Thread Clint Bowman

Steve,

I use filled.contour but have a semicolon, ;, between the two 
axis calls.  Do you need one after


axis(1, seq(45 , 58, by = 1))

?

Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Fri, 1 Apr 2011, steve_fried...@nps.gov wrote:


Hi Peter,

Thanks for taking the time to consider the problem. I realize the procedure
is not reproducible. I use a 4 dimensional netCDF file (4.2 GB) in size to
pull data into this process. Nobody in their right mind should work with
such things. It's a spatial temporal database with 10 years of daily data
in a irregular area spanning 405 x 287 cells.

Anyway, I tried your suggestion adding a { in front of the for loop and a
closing } following the last line.

It did not work.


Steve Friedman Ph. D.
Ecologist  / Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147



Peter Ehlers
ehlers@ucalgary.
caTo
  steve_fried...@nps.gov
04/01/2011 05:08  steve_fried...@nps.gov
PM cc
  r-help@r-project.org
  r-help@r-project.org
  Subject
  Re: [R] filled contour plot with
  contour lines










Aren't you missing a set of parentheses?
I can't run your code since it's not reproducible, but to
my aging eyes it seems that you need a set of '{}' around
the contents of your loop:

 for(j in 1:(varsize[4]-1)) { loop stuff }

Peter Ehlers

On 2011-04-01 11:48, steve_fried...@nps.gov wrote:


I'm stumped,  can anyone find my error in this sequence.

  for(j in 1:(varsize[4]-1))
   temp- get.var.ncdf(nc=input,
varid=p_foraging,c(1,1,j),c(varsize[1],varsize[2],1))
  filled.contour(x, y, temp, color = terrain.colors,
  plot.title = title(main = paste(Everglades Wood Stork
Foraging Potential \nYear, (2000+j)),
  xlab = UTM East, ylab = UTM North) ,
  plot.axes = { contour(temp, add=T)
 axis(1, seq(45 , 58, by = 1))
 axis(2, seq(280,400, by = 1)) },
  key.title = title(main=Probability) ,
  key.axes = axis(4, seq(0 , 1 , by = 0.1))


The routine will work in a modified form without adding the coordinates
(the axis lines) but when I include these the routine produces various
errors, such as dimension mismatch, or unexpected end encountered.

I tried to follow the example on filled.contour help page.

Thanks in advance
Steve

Steve Friedman Ph. D.
Ecologist  / Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

__
R-help@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.


__
R-help@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.



__
R-help@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.


Re: [R] Quick recode of -999 to NA in R

2011-03-30 Thread Clint Bowman
Amen.  Ditto for -999.000, -999.00 and all of the other ones 
that various (usually Fortran) programmers have used.  Has the most 
recent Fortran standard come around to understanding NA?


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Wed, 30 Mar 2011, peter dalgaard wrote:



On Mar 30, 2011, at 16:05 , Christopher Desjardins wrote:



dat0 - read.table('tim1.dat', na = -999)



Ah ... yes. I knew that but clearly didn't at the time of my question or
script writing.
Thanks,
Chris


Depending on where your data came from, you could get caught by the fact that the above 
is really ...na.strings=-999... and that is not going to work if the actual 
code is (say) -999.00.

Another straightforward option is dat0[dat0 == -999] - NA





__
R-help@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.


Re: [R] mean of runoff for several years

2011-03-23 Thread Clint Bowman

Dominique,

Let's call your dataframe, df.

Then try:

with(df, boxplot(runoff ~ month))

which will plot the daily runoff distribution by month.

Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Wed, 23 Mar 2011, dominique wrote:


Hello everyone
I have a dataframe with 4 colums (year, month, day, runoff) for 1993-2009.
Now I like to calculate the average runoff for each day. Finally I like to
plot the median runoff for all this years.
I tried with some loops, but it didn't work. Do you have any Tips for my
problem?
Any help is greatly appreciated! Thank you very much.
Dominique



--
View this message in context: 
http://r.789695.n4.nabble.com/mean-of-runoff-for-several-years-tp3400541p3400541.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.



__
R-help@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.


Re: [R] Finding length of unique numbers in a vector

2011-02-10 Thread Clint Bowman

?rle

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Fri, 11 Feb 2011, Nipesh Bajaj wrote:


Hello there, would you please look into my codes? Here I have following:


set.seed(100)
samp - sample(c(1,-1,0), 20, replace=T); samp

[1]  1  1 -1  1 -1 -1  0 -1 -1  1 -1  0  1 -1  0  0  1 -1 -1  0

Here I want to calculate the length of each unique number for above vector.
How can I do that?

Thanks in advance

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] spacing of color key in filled.contour

2011-01-20 Thread Clint Bowman
I've gotten good results using the sine function to map colors. 
For example, when plotting x, map the range(x) to (-pi/2,pi/2) 
which the sine will transform to (-1,1), then add 1 and multiply by 
half the desired number of colors.  Now the integer values will 
pick the colors and give a pleasing display.


If the squeeze is taking place only over one of the tails (which 
sounds like your case) map the range from (0,pi/2) or (-pi/2,0) and 
make the necessary scaling adjustments to cover the number of 
colors desired.


Essentially, you are transforming the color mapping instead of 
transforming your data.


Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Thu, 20 Jan 2011, Jim Lemon wrote:


On 01/20/2011 09:19 AM, claudia tebaldi wrote:

 Hi all


 I'm plotting colored contour maps using filled.contour. My levels
 are very unevenly spaced, with, say, high resolution in the small
 numbers but ranges that can be an order of magnitude or two larger in
 absolute value compared to where the action takes place. Aside from
 transforming the data, is there a way to control the color spacing in
 the key to the right of the map? Right now I get most of the key
 length taken up by a couple of colors and the rest all squeezed into
 thin slices, which also creates a problem with the fourth axis labels
 getting drawn on top of one another.


Hi Claudia,
You can roll your own color key with the color.legend function in plotrix. 
Just specify the colors you want in rect.col and the labels in legend.


Jim

__
R-help@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.




__
R-help@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.


Re: [R] Remove 100 years from a date object

2010-12-10 Thread Clint Bowman
There still may be a problem if the dates go back far enough, e.g., 
1909.  Is '09' 1909 or 2009?  No matter what, you have to decide 
which values need 1900 added and which need 2000.  I'd split the 
date on the delimiter '.', decide whether to add 1900 or 2000, and 
then paste them together and then as.Date().


Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600


USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274


On Fri, 10 Dec 2010, Barry Rowlingson wrote:


On Fri, Dec 10, 2010 at 3:27 PM, Daniel Brewer daniel.bre...@icr.ac.uk wrote:

Hello,

I have some data that has dates in the form 27.02.37.  I convert them to
a date object as follows:
as.Date(data$date,format=%d.%m.%y)

But this gives me years such as 2037 when I would like them to be 1937.
 I thought of trying to take off some time i.e.
as.Date(camCD$DoB,format=%d.%m.%y) - 100*365
But that doesn't seem to work out correctly.  Any ideas how to do this?


Normally to adjust dates you can use as.difftime() and do arithmetic,
but a year is a variable thing (can be 365 or 366 days) so you cant
make a difftime of years. Days are variable things if you worry about
leap seconds...

Also, you could end up with an invalid date if you have 29-Feb-2000
and 29-Feb-1900. One wasn't a leap year...

A solution minus those caveats is to convert to POSIXlt and adjust the
$year element:

 dob=27.02.37
 as.Date(dob,format=%d.%m.%y)
[1] 2037-02-27
 dobp = as.POSIXlt(as.Date(dob,format=%d.%m.%y))
 dobp$year = dobp$year - 100

 dobp
[1] 1937-02-27 UTC
 as.Date(dobp)
[1] 1937-02-27

although it might be easier to paste a '19' into your character variable

 paste(substr(dob,1,6),19,substr(dob,7,9),sep=)
[1] 27.02.1937

and then do it the way you started. Assumes you have leading zeroes on
all fields though.

Barry

__
R-help@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.
__
R-help@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.


Re: [R] previous business day

2010-10-21 Thread Clint Bowman

May also wish to or in a check for holidays.

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Thu, 21 Oct 2010, Henrique Dallazuanna wrote:


Try this:

f - function(d)if(format(d - 1, '%w') %in% c(0, 6)) Recall(d - 1) else d -
1
d - Sys.Date()
f(d)

On Thu, Oct 21, 2010 at 5:38 PM, Li, Jing Yi jingyi...@credit-suisse.comwrote:


How to get the previous business day in R? I saw some post about using
functions in timeSeries package before but can not find it anymore.
Thanks!




===
Please access the attached hyperlink for an important el...{{dropped:8}}

__
R-help@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.








__
R-help@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.


Re: [R] rounding up (always)

2010-10-20 Thread Clint Bowman

x-runif(10,1,10)  # generate 10 numbers
as.integer(log(x,10)+1)


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Wed, 20 Oct 2010, Duncan Murdoch wrote:


On 20/10/2010 5:16 PM, Dimitri Liakhovitski wrote:

 Hello!

 I am trying to round the number always up - i.e., whatever the
 positive number is, I would like it to round it to the closest 10 that
 is higher than this number, the closest 100 that is higher than this
 number, etc.

 For example:
 x-3241.388

 signif(x,1) rounds to the closest thousand, i.e., to 3,000, but I'd
 like to get 4,000 instead.
 signif(x,2) rounds to the closest hundred, i.e., to 3,200, but I'd
 like to get 3,300 instead.
 signif(x,3) rounds to the closest ten, i.e., to 3,240, but I'd like to
 get 3,250 instead.

 Of course, I could do:
 floor(signif(x,1)+1000)
 floor(signif(x,2)+100)
 floor(signif(x,3)+10)

 But it's very manual - because in the problem I am facing the numbers
 sometimes have to be rounded to a 1000, sometimes to a 100, etc.


Write a function.  You have very particular needs, so it's unlikely there's 
already one out there that matches them.


Duncan Murdoch

__
R-help@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.




__
R-help@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.


[R] Dealing with Non-Standard Hours

2010-10-15 Thread Clint Bowman
A data set I obtained has the hours running from 01 through 24 
rather than the conventional 00 through 23.  My favorite, strptime, 
balks at hour 24.


I thought it would be easy to correct but it must be too late on 
Friday for my brain and caffeine isn't helping.


TIA for a hint,

Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

__
R-help@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.


Re: [R] labeling outliers with subject numberss

2010-09-15 Thread Clint Bowman

SubNo[identify(rep(1,8),mydata$score)]

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Wed, 15 Sep 2010, Kevin Burnham wrote:


How can I get the outlier in this boxplot of Score to be represented by
the corresponding value in SubNo?

score=c(6,6,7,14,5,7,6,8)
SubNo=1:8
mydata=data.frame(SubNo, score)
boxplot(mydata$score)


Thanks!
Kevin

[[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.


Re: [R] Peak Over Threshold values

2010-05-26 Thread Clint Bowman

How about?

hi.rle-rle(walevel5.79)
lo.rle-rle(walevel5.36)
plot(walevel)
abline(h=5.8,col=2,lty=3)
abline(h=5.35,col=3,lty=3)
hi.lo.rle-sort(c(cumsum(hi.rle$lengths),cumsum(lo.rle$lengths)))
abline(v=hi.lo.rle)

You can use the $values from the rle to sort things out.  Probably 
want to ignore the end point at length(walevel).


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Wed, 26 May 2010, Vito Muggeo (UniPa) wrote:


dear Tonja,
By plotting your data

plot(df)

it seems to me that you are looking for a piecewise linear relationships. If 
this is the case, have a look to the package segmented. You have to specify 
or not the number and the starting values for the breakpoints


library(segmented)
olm-lm(walevel~day)

#specify number and starting values for the breakpoints..
oseg-segmented(olm, seg.Z=~day, psi=c(20,50,80))
plot(oseg,add=TRUE,col=2)
oseg$psi

#or you can avoid to specify starting values for psi
oseg-segmented(olm, seg.Z=~day, 
psi=NA,control=seg.control(stop.if.error=FALSE,K=30))


plot(oseg,add=TRUE,col=2)
oseg$psi


best,
vito


Tonja Krueger ha scritto:

Dear List

I hope you can help me: I’ve got a dataframe (df) within which I am
looking
for Peak Over Threshold values as well as the length of the events. An
event
starts when walevel equals 5.8 and it should end when walevel equals
the
lower threshold value (5.35).

I tried “clusters (…)” from “evd package”, and varied r (see example)
but it
did not work for all events (again see example).

walevel - c(5.75, 5.75, 5.75, 5.76, 5.80, 5.82, 5.85, 5.86, 5.91,
5.91,
5.88, 5.92, 5.99, 6.02, 6.00, 6.08, 6.11, 6.10, 6.10, 6.11, 6.14, 6.12,
6.15, 6.17, 6.15, 6.08, 6.01, 5.95, 5.89, 5.83, 5.77, 5.72, 5.70, 5.65,
5.59, 5.51, 5.43, 5.33, 5.30, 5.25, 5.22, 5.21, 5.19, 5.19, 5.19, 5.13,
5.15, 5.07, 5.04, 5.02, 4.99, 5.05, 5.07, 5.12, 5.17, 5.22, 5.32, 5.29,
5.33, 5.33, 5.36, 5.37, 5.42, 5.43, 5.48, 5.55, 5.57, 5.66, 5.68, 5.72,
5.77, 5.79, 5.81, 5.80, 5.80, 5.77, 5.72, 5.70, 5.66, 5.62, 5.62, 5.61,
5.59, 5.57, 5.51, 5.47, 5.41, 5.39, 5.40, 5.40, 5.42, 5.45, 5.47, 5.50,
5.50, 5.49, 5.43, 5.39, 5.33, 5.26)

day - c(1:100)

df - data.frame(day,walevel)

library(evd)
clusters(df$walevel, u = 5.80, r = 1, ulow = 5.35, cmax = T, plot = T)
clusters(df$walevel, u = 5.80, r = 50, ulow = 5.35, cmax = T, plot = T)

What have I done wrong?

Tonja
 __
 R-help@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.



__
R-help@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.


Re: [R] Identifying breakpoints/inflection points?

2010-04-27 Thread Clint Bowman

Charlotte,

Try:

library(msProcess)  # you may have to install msProcess
year[peaks(birds.pr$fit)]

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Mon, 26 Apr 2010, Charlotte Chang wrote:


Hi Clint,

Thank you for your help with the code. The span recommendation really
improved the fit of my LOESS curve. I appreciate your thoughtful
assistance!

My remaining question is how could I go about identifying the
inflection points for the LOESS curve? I was thinking about trying to
find the 2nd derivative and then using the uniroot function.

My code is here (but it's buggy and doesn't work):

birds.lo-loess.smooth(x,y,span=0.45)
d2 - function(x) {
predict(birds.lo, x, deriv=2)$y
}
x-year
y-piproute


d2(x)

Error in predict(birds.lo, x, deriv = 2)$y :
 $ operator is invalid for atomic vectors

#Desired next step:
uniroot(d2,c(7,10))

Any ideas about this would be profoundly appreciated! I'm hitting a dead end.

Yours,

Charlotte

On Mon, Apr 26, 2010 at 3:32 PM, Clint Bowman cl...@ecy.wa.gov wrote:

Charlotte,

Try:

birds.lo - loess(piproute~year,span=.25)
# play with span to see your desired pattern
birds.pr-predict(birds.lo, data.frame(year = seq(1967, 2009, 1)), se =
FALSE)
#
plot($year,birds.pr$fit,ylim=c(0,5))
par(new=T)
plot(year,birds.pr$fit,pch=+,col=2,ylim=c(0,5))


--
Clint Bowman                    INTERNET:       cl...@ecy.wa.gov
Air Quality Modeler             INTERNET:       cl...@math.utah.edu
Department of Ecology           VOICE:          (360) 407-6815
PO Box 47600                    FAX:            (360) 407-7534
Olympia, WA 98504-7600

On Mon, 26 Apr 2010, Charlotte Chang wrote:


Hello!
I have a dataset with the following two vectors:


year-c(1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009)


piproute-c(0.7,0.945945946,1.886363636,1.607843137,4.245614035,3.175675676,2.169014085,2,2.136363636,2.65625,2.080645161,2.114754098,2.090909091,3.012195122,2.935897436,2.592105263,1.075757576,1.210526316,1,1.1875,1.903614458,1.385542169,1.788990826,1.163793103,1.558558559,1.595238095,1.75833,1.858267717,2.169117647,1.403225806,2.859375,3.236220472,2.054263566,3.85417,1.812080537,2.708029197,2.75862069,2.625954198,4.540740741,3.686567164,2.8,2.968253968,3.517730496)

Pipits is the response variable (it is the number of birds counted at
each survey site in each year) and year is the independent variable.
If you plot it in R (plot(year,piproute,pch=19)), you'll see that the
relationship looks like a quintic polynomial.

Initially I was trying to fit this curve using an iterative equation,
but it's not working. I suspect that the curve-fitting equation itself
is inappropriate (it's a modified version of the logistic growth
equation). Now what I'd like to do is identify the 3 break/inflection
points in the population trend. That way, I can make an argument that
the break points corresponded to shifts in government policy with
respect to land use management. I've been looking at the segmented
package, and initially I looked at change.pt test in the circ.stats
package (which is inappropriate b/c my data is not amenable to
circular statistical analysis). Any ideas on what I could do would be
appreciated!

Thank you!

-Charlotte

__
R-help@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.



__
R-help@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.


Re: [R] Identifying breakpoints/inflection points?

2010-04-26 Thread Clint Bowman

Charlotte,

Try:

birds.lo - loess(piproute~year,span=.25)
# play with span to see your desired pattern
birds.pr-predict(birds.lo, data.frame(year = seq(1967, 2009, 1)), 
se = FALSE)

#
plot($year,birds.pr$fit,ylim=c(0,5))
par(new=T)
plot(year,birds.pr$fit,pch=+,col=2,ylim=c(0,5))


--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Mon, 26 Apr 2010, Charlotte Chang wrote:


Hello!
I have a dataset with the following two vectors:

year-c(1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009)

piproute-c(0.7,0.945945946,1.886363636,1.607843137,4.245614035,3.175675676,2.169014085,2,2.136363636,2.65625,2.080645161,2.114754098,2.090909091,3.012195122,2.935897436,2.592105263,1.075757576,1.210526316,1,1.1875,1.903614458,1.385542169,1.788990826,1.163793103,1.558558559,1.595238095,1.75833,1.858267717,2.169117647,1.403225806,2.859375,3.236220472,2.054263566,3.85417,1.812080537,2.708029197,2.75862069,2.625954198,4.540740741,3.686567164,2.8,2.968253968,3.517730496)

Pipits is the response variable (it is the number of birds counted at
each survey site in each year) and year is the independent variable.
If you plot it in R (plot(year,piproute,pch=19)), you'll see that the
relationship looks like a quintic polynomial.

Initially I was trying to fit this curve using an iterative equation,
but it's not working. I suspect that the curve-fitting equation itself
is inappropriate (it's a modified version of the logistic growth
equation). Now what I'd like to do is identify the 3 break/inflection
points in the population trend. That way, I can make an argument that
the break points corresponded to shifts in government policy with
respect to land use management. I've been looking at the segmented
package, and initially I looked at change.pt test in the circ.stats
package (which is inappropriate b/c my data is not amenable to
circular statistical analysis). Any ideas on what I could do would be
appreciated!

Thank you!

-Charlotte

__
R-help@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.



__
R-help@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.


Re: [R] two questions for R beginners

2010-02-25 Thread Clint Bowman
I started using statistical software with the commercial product S+ 
when I obtained a new HP735 workstation.  We kept the S+ license 
going for a number of years until I heard about R.  It was an easy 
transition and because I have been proficient in fortran and perl, 
the scripting came naturally--except for some syntax 
similarities/differences between perl and R interacting with a 
natural tendency towards dyslexia.


I especially like that I can slice and dice the data to ferret out 
relationships e.g., concentration by hour of day, by month, by wind 
speed, by wind direction--love those boxplots.


I also find that even the default settings produce some pretty 
attractive plots that are useable in many settings--I've also 
produced some pretty awful ones.


And the price always reminds me that I need to find every way 
possible to contribute to the overall good--I've forgotten too much 
of my fortran and C programming skills to contribute directly to 
the R Project.


Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Thu, 25 Feb 2010, Ralf B wrote:


My biggest blocker was my misconception that R is extremely difficult
to start with. It is powerful and one can do very complicated things (
that consequently turn things  complicated) but it comes with very
nice defaults and one can produce great results with standard tasks in
very little time - especially if one has done programming and/or
scripting before.

I pushed it away for too long that way. I wish I would have used it
years ago and avoided SPSS altogether - must have wasted 100s of hours
doing repetitive tasks by click and partial scripts in SPSS. Not to
mention a horrible license policy and a visualization unit that is
simply embarrassing for a product that is in its 18th or 19th version.

Ralf

On Thu, Feb 25, 2010 at 1:11 PM, Tal Galili tal.gal...@gmail.com wrote:

My biggest stumbling blocks to getting up and running with R was whenever I
was lazy and impatient.

The more you love R, the more it loves you back.

Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Thu, Feb 25, 2010 at 7:31 PM, Patrick Burns pbu...@pburns.seanet.comwrote:


* What were your biggest misconceptions or
stumbling blocks to getting up and running
with R?

* What documents helped you the most in this
initial phase?

I especially want to hear from people who are
lazy and impatient.

Feel free to write to me off-list.  Definitely
write off-list if you are just confirming what
has been said on-list.

--
Patrick Burns
pbu...@pburns.seanet.com
http://www.burns-stat.com
(home of 'The R Inferno' and 'A Guide for the Unwilling S User')

__
R-help@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.



       [[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.
__
R-help@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.


Re: [R] how to draw image of a data distribution? Thanks

2009-11-20 Thread Clint Bowman

with(p,plot(x,y,pch=20,col=1+as.integer(value)))

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Fri, 20 Nov 2009, Senlin Liang wrote:


I have a file with 3 cols as:
xyvalue
110.5000
121.8333
134.
210.7500
220.7500
234
310.7500
321.4167
335.1667

I read them in using
p - read.table(data.txt, header=TRUE)

My questoin: how to draw a image to show the values at different positions
(x, y)? I would like to see different colors for different values.

Sorry if it is a naive question, but it is my first week of R and I have
been trying for several hours trying to make it.

Thank you,



__
R-help@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.


Re: [R] Temperature Prediction Model

2009-10-26 Thread Clint Bowman

Aneeta,

My gorilla and mouse analogies were referring to the magnitude of 
the disturbance and also to its time signature.  Are you only 
interested in the large disturbance which is abrupt (the gorilla)? 
Or do you also want to be able to detect the more surreptitious 
attack which may be quite gradual (the mouse)?


You will want to define the magnitude (and perhaps the associated 
duration) of the smallest disturbance that would be important.  I 
would look at the entire data set to see what would be the 
likelihood of detecting such a change given the noise in the 
temperature data.  Or alternatively, use the global analysis to 
help define the minimum disturbance that could be detected.


Then see what can be done with just the first 7 days of data (or 
for matter the past 7 days regardless of when they occur).


I applaude your goal of looking at each sensor without referring to 
other nodes but I think I would develop the analysis by looking for 
anomalies in one sensor's data when compared with other sensors and 
then focusing on those periods to determine an approach for 
detecting a disturbance.


Because you are looking at 7 days, should we assume that you expect 
a day-of-week dependence?  If so, I'd be more comfortable if you 
used more than one week to develop it.


I fear that you've gotten me quite interested in this analysis, 
good luck.


Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Sun, 25 Oct 2009, Aneeta wrote:



Thank you everyone for all the responses.

Clint you are correct in assuming that the problem deals with sensors in a
lab setup which can be assumed to be isolated from outside temperature
changes. And, I am only dealing with temperature so the other parameters are
not important.

There will be no gorillas or mouses in the picture but rather some malicious
attacker who would try to cause disturbances in the normal readings. That is
why it is important to have an equation that defines 'normal behaviour'.

The data-sets contain readings for multiple days. I want to take the first 7
days for each node and establish a relationship between time(column 2) and
temperature(column 4).

My objective is not to model temperature variation throughout the year and
take into consideration climatic changes. Rather, it is to define a model
for the given data which happens to be temperature recorded by nodes. In a
simple way we may look at it as a set of X(time) and Y(temperature) values
where I am trying to define Y in terms of X.

How should I approach this problem?

Many Thanks,
Aneeta


Clint Bowman wrote:


Aneeta,

If I understand the figure at
http://db.csail.mit.edu/labdata/labdata.html this problem deals
with sensors in a lab that is probably isolated from outdoor
temperature changes.

I assume the predictive model must detect when a rampaging 800
pound gorilla messes with a sensor.  Do we also have to detect the
pawing of a micro-mouse as well?

The collected data also seem to have other parameters which would
be valuable--are you limited to just temperature?

Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Thu, 22 Oct 2009, Thomas Adams wrote:


Aneeta,

You will have to have a seasonal component built into your model, because
the
seasonal variation does matter, particularly -where- you are
geographically
(San Diego, Chicago, Denver, Miami are very different). Generally, there
is a
sinusoidal daily temperature variation, but frontal passages and
thunderstorms, etc., can and will disrupt this nice pattern. You may have
to
tie this into temperature predictions from a mesoscale numerical weather
prediction model. Otherwise, you will end up with lots of misses and
false
alarms…

Regards,
Tom

Aneeta wrote:

 The data that I use has been collected by a sensor network deployed by
 Intel.
 You may take a look at the network at the following website
 http://db.csail.mit.edu/labdata/labdata.html

 The main goal of my project is to simulate a physical layer attack on a
 sensor network and to detect such an attack. In order to detect an
attack
 I
 need to have a model that would define the normal behaviour. So the
actual
 variation of temperature throughout the year is not very important out
 here.
 I have a set of data for a period of 7 days which is assumed to be the
 correct behaviour and I need to build a model upon that data. I may
refine
 the model later on to take into account temperature variations
throughout
 the year.

 Yes I am trying to build a model that will predict the temperature just

Re: [R] Temperature Prediction Model

2009-10-22 Thread Clint Bowman

Aneeta,

If I understand the figure at
http://db.csail.mit.edu/labdata/labdata.html this problem deals 
with sensors in a lab that is probably isolated from outdoor 
temperature changes.


I assume the predictive model must detect when a rampaging 800 
pound gorilla messes with a sensor.  Do we also have to detect the 
pawing of a micro-mouse as well?


The collected data also seem to have other parameters which would 
be valuable--are you limited to just temperature?


Clint

--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

On Thu, 22 Oct 2009, Thomas Adams wrote:


Aneeta,

You will have to have a seasonal component built into your model, because the 
seasonal variation does matter, particularly -where- you are geographically 
(San Diego, Chicago, Denver, Miami are very different). Generally, there is a 
sinusoidal daily temperature variation, but frontal passages and 
thunderstorms, etc., can and will disrupt this nice pattern. You may have to 
tie this into temperature predictions from a mesoscale numerical weather 
prediction model. Otherwise, you will end up with lots of misses and false 
alarms…


Regards,
Tom

Aneeta wrote:

 The data that I use has been collected by a sensor network deployed by
 Intel.
 You may take a look at the network at the following website
 http://db.csail.mit.edu/labdata/labdata.html

 The main goal of my project is to simulate a physical layer attack on a
 sensor network and to detect such an attack. In order to detect an attack
 I
 need to have a model that would define the normal behaviour. So the actual
 variation of temperature throughout the year is not very important out
 here.
 I have a set of data for a period of 7 days which is assumed to be the
 correct behaviour and I need to build a model upon that data. I may refine
 the model later on to take into account temperature variations throughout
 the year.

 Yes I am trying to build a model that will predict the temperature just on
 the given time of the day so that I am able to compare it with the
 observed
 temperature and determine if there is any abnormality. Each node should
 have
 its own expectation model (i.e. there will be no correlation between the
 readings of the different nodes).


 Steve Lianoglou-6 wrote:

  Hi,
 
  On Oct 21, 2009, at 12:31 PM, Aneeta wrote:
 
 
   Greetings!
  
   As part of my research project I am using R to study temperature data
   collected by a network. Each node (observation point) records 
   temperature of

   its surroundings throughout the day and generates a dataset. Using the
   recorded datasets for the past 7 days I need to build a prediction 
   model for

   each node that would enable it to check the observed data against the
   predicted data. How can I derive an equation for temperature using the
   datasets?
   The following is a subset of one of the datasets:-
  
Time  Temperature
  
   07:00:17.369668   17.509

   07:03:17.465725   17.509
   07:04:17.597071   17.509
   07:05:17.330544   17.509
   07:10:47.838123   17.5482
   07:14:16.680696   17.5874
   07:16:46.67457 17.5972
   07:29:16.887654   17.7442
   07:29:46.705759   17.754
   07:32:17.131713   17.7932
   07:35:47.113953   17.8324
   07:36:17.194981   17.8324
   07:37:17.227013   17.852
   07:38:17.809174   17.8618
   07:38:48.00011 17.852
   07:39:17.124362   17.8618
   07:41:17.130624   17.8912
   07:41:46.966421   17.901
   07:43:47.524823   17.95
   07:44:47.430977   17.95
   07:45:16.813396   17.95
  
  I think you/we need much more information.
 
  Are you really trying to build a model that predicts the temperature 
  just given the time of day?
 
  Given that you're in NY, I'd say 12pm in August sure feels much 
  different than 12pm in February, no?
 
  Or are you trying to predict what one sensor readout would be at a 
  particular time given readings from other sensors at the same time?
 
  Or ... ?
 
  -steve
 
  --

  Steve Lianoglou
  Graduate Student: Computational Systems Biology
 |   Memorial Sloan-Kettering Cancer Center
 |   Weill Medical College of Cornell University
  Contact Info: http://cbio.mskcc.org/~lianos/contact
 
  __

  R-help@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.
 
 
 






__
R-help@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.


Re: [R] Best R text editors?

2009-09-11 Thread Clint Bowman

On Fri, 11 Sep 2009, Duncan Murdoch wrote:


On 11/09/2009 6:53 AM, (Ted Harding) wrote:

 On 11-Sep-09 10:41:21, Jim Lemon wrote:
  On 09/11/2009 05:15 PM, Patrick Connolly wrote:
   ...
  |and in previous versions, you could always do M-x cua-mode for
  |the same effect. Talk about a well-hidden function mostly 
  |directed

  |at beginners ...
  
   Perhaps the thinking was that by the time they find it, they'll

   already have noticed that they can cut/copy and paste using only the
   mouse buttons and won't be bothered with such inefficient methods.
  
   Though this be madness, yet there is a method in't. :-)
  
  Well, okay, let's look at it from the viewpoint of learning theory. We 
  expect that if someone has learned a skill, they will prefer to engage 
  in other behaviors where they can successfully use that skill. Upon
  this easily understood foundation rest the fortunes of many. Thus two of 
  those entities, let us call them A and M for the purposes of
  discussion, spend a great deal of time and effort attempting to 
  differentiate their
  interfaces from each other so that having trained their users, those 
  users will be reluctant to switch to the competitor. However, they must
  remain similar enough so that the switch from the competitor is not 
  impossible. Such is the dispiriting triumph of form over substance in 
  interface design. Both have yet to abandon such atavists as myself who 
  prefer to type rather than fiddle with a pointing device, though they 
  try hard to convert us. A somewhat smaller organization that I will 
  label G seems to have decided that it can build a user base by sticking
  to the arcane typoglyphics of the VT-100 era and enticing the largely 
  amoral digirati with moral suasion. Now that's madness.
 
  Jim


 Once again, I cannot resist citing the immortal quote (from Charles
 Curran, of the UK Unix Users Group):

   I can touch-type, but I can't touch-mouse


That's a strange disability.  It took me several months to learn to 
touch-type (and years later I'm still not very good at the top-row numbers or 
the special symbols on them), but I memorized the location of the two buttons 
on my mouse in no time at all.


Duncan Murdoch


Ahh, just Ted's point--mice have three buttons (unless they are 
connected to Apples).


Clint





 Originally posted on Wed Nov 17 13:48:14 2004, in the context of an
 extended discussion (still relevant to the present thread):

   http://finzi.psych.upenn.edu/R/Rhelp02/archive/41560.html

 Best wishes to all,
 Ted.

 
 E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
 Fax-to-email: +44 (0)870 094 0861
 Date: 11-Sep-09   Time: 11:53:09
 -- XFMail --

 __
 R-help@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.


__
R-help@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.



--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

__
R-help@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.


Re: [R] Joining Characters in R {issue with paste}

2009-09-09 Thread Clint Bowman

?paste and look at sep.

On Wed, 9 Sep 2009, Abhishek Pratap wrote:


Hi Guys
I am want to join to strings in R. I am using paste but not getting
desirable result.

For the sake of clarity, a quick example:


a=Bio
b=iology
paste(a,b)

[1] Bio iology


*There is a SPACE in the word biology which is what I dont want *


Thanks,
-Abhi

[[alternative HTML version deleted]]

__
R-help@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.



--
Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

__
R-help@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.


Re: [R] How do I plot a line followed by two forecast points?

2009-08-07 Thread Clint Bowman
Because you know a priori the dates associated with your forecast points
you could use the col= in the plot function to change colors for the last
two points (may require some mathmatical gymnastics to specify the colors
desired--I've set up a vector and created an index from either the x or y
values to obtain the desired effect).

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Dispersion Modeler  INTERNET:   cl...@math.utah.edu
Air Quality Program VOICE:  (360) 407-6815
Department of Ecology   FAX:(360) 407-7534

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 7 Aug 2009, Jorgy Porgee wrote:

 Hi Jean,
 Thank you for the reply. I do have the forecast points before I plot,
 the example below was just for illustration purposes..If I am to add
 the forecast points to one y-series data plot however, is there a way
 of highlighting them? This is essentially what I'm trying to do below
 by plotting 3 separate series on the same graph...
 Any help would be much appreciated..

 Regards,

 George.
 In addition, I can't add the forecasts to the original series because I need

 On Fri, Aug 7, 2009 at 8:36 PM, Jean V Adamsjvad...@usgs.gov wrote:
 
  Just wait until after you have the forecasts before you create the plot.
 
  # Sample dates
  xValues - seq.Date(as.Date(1990-01-31), to=as.Date(1992-12-31),
  by=month)
 
  # Sample y value
  yValues - seq(0.1, length=length(xValues))
 
  # Sample forecast one year from xValue's end point
  fcastDate - seq.Date(from=as.Date(xValues[length(xValues)]), length=2,
  by=year)[2]
  fcast - 20
 
  # The second forecast
  fcastDate2 - seq.Date(from=as.Date(fcastDate), length=2, by=year)[2]
  fcast2 - 15
 
  plot(xValues, yValues, type=n, xlim=range(c(xValues, fcastDate,
  fcastDate2)), ylim=range(c(yValues, fcast, fcast2)))
  lines(xValues, yValues)
  points(fcastDate, fcast, col=red)
  points(fcastDate2, fcast2, col=blue)
 
  Jean
 
 
  -
 
 
  From: Jorgy Porgee jorgy.porgee at gmail.com
  Subject: How do I plot a line followed by two forecast points?
  Newsgroups: gmane.comp.lang.r.general
  Date: 2009-08-07 15:17:52 GMT (2 hours and 55 minutes ago)
 
  Good day all,
 
  I'm trying to plot a continuous line plot, which is followed by two forecast
  points eg. one forecast point is 12 months out, and another 24 months out
  from the last date of the line plot.
 
  In my attempts so far, the second plot (the forecast points) is scaled
  against a new axis scale, thus the two plots are not directly comparable (I
  need the forecast points to be scaled according to the existing y axis).
 
  An example is pasted below. Any ideas on how to achieve this would be much
  appreciated.
 
  Thanking you in advance,
 
  George.
 
  # Sample dates
 xValues =
  seq.Date(as.Date(1990-01-31),to=as.Date(1992-12-31),by=month);
 
  # Sample y value
  yValues-NULL;
  yValues[1:length(xValues)]=seq(0.1,length=length(xValues))
 
  # Plot the series as a line
  plot(xValues,yValues,type=l);
 
  # Sample forecast dates that start from xValue's data point
 
  fcastDates=seq.Date(from=as.Date(xValues[length(xValues)]),length=12,by=month);
  fcastDates
   [1] 1992-12-31 1993-01-31 1993-03-03 1993-03-31 1993-05-01
  1993-05-31
   [7] 1993-07-01 1993-07-31 1993-08-31 1993-10-01 1993-10-31
  1993-12-01
 
  # Sample forecast (we only want the forecast point to be displayed)
 
  fcast-NULL; fcast[1:length(fcastDates)]=NA; fcast[length(fcast)]-20;
  fcast
   [1] NA NA NA NA NA NA NA NA NA NA NA 20
 
  # Add the forecast plot to the original plot
  par(new=TRUE)
  plot(fcastDates,fcast,yaxt=n,xaxt=n,col=red)
  Warning message:
  In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
 
  # The second forecast
 
 
  fcastDates2=seq.Date(from=as.Date(fcastDates[length(fcastDates)]),length=12,by=month);
  fcastDates2
   [1] 1993-12-01 1994-01-01 1994-02-01 1994-03-01 1994-04-01
  1994-05-01
   [7] 1994-06-01 1994-07-01 1994-08-01 1994-09-01 1994-10-01
  1994-11-01
  fcast2-NULL; fcast2[1:length(fcastDates2)]=NA;
  fcast2[length(fcast2)]-15;
  par(new=TRUE);plot(fcastDates2,fcast2,yaxt=n,xaxt=n,col=blue)
  Warning message:
  In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion

 __
 R-help@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.
__
R-help@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.


Re: [R] handle graph size in eps

2009-03-02 Thread Clint Bowman
Try adding paper = special to your postscript arguments.

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Dispersion Modeler  INTERNET:   cl...@math.utah.edu
Air Quality Program VOICE:  (360) 407-6815
Department of Ecology   FAX:(360) 407-7534

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Mon, 2 Mar 2009, Benoit Boulinguiez wrote:

 Sorry for the lack of information.

 I'm indeed under Windows. I indeed used the menu save as in the graph
 window.

 The matter with the eps obtained was the width of the graph which is lower
 than what I had on the screen or what I got when I saved it as a JPEG file.

 I tried the postscript command

 postscript(test.eps,width=14,height=6)
 print.it=TRUE
 {
 #windows(width=6,height=6)
 par   (
   fin=c(6,6)
   ,mai=c(1,1,0.5,0.5)
   ,mfrow=c(1,2)
   ,cex.axis=1.5
   ,cex.lab=1.5)

 dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian)

 xlimit-range(dens$x)
 ylimit-range(dens$y)

 hist(
   DATA1.y[2,]-mean(DATA1.y[2,])
   ,xlim=1.1*xlimit
   ,xlab=expression(q[e])
   ,ylim=1.1*ylimit
   ,probability=T
   ,main=Random distribution around y)
 lines(dens,col=2,lwd=2)
 qqnorm(DATA1.x[1,])
 }
 dev.off()
 rm(dens,xlimit,ylimit)


 I barely managed to get the ratio I want for the graph
 http://www.4shared.com/file/90339223/5a3239fc/test.html
 But still when I change the width in the poscript command from 12 to 20
 for instance, it doesn't change anything... why?

 BTW how do I stop the pipe between a poscript file and R without closing R?


 Regards/Cordialement


 Benoit Boulinguiez


 -Message d'origine-
 De : Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk]
 Envoyé : lundi 2 mars 2009 11:25
 À : Benoit Boulinguiez
 Cc : r-help@r-project.org
 Objet : Re: [R] handle graph size in eps

 On Mon, 2 Mar 2009, Benoit Boulinguiez wrote:

  Hi all,
 
  I've got a density graph made with the following commands:
 
  win.graph(width=13,height=6)

 The preferred name is windows().

  par (
  fin=c(13,3)
  ,mai=c(1,1,0.5,0.5)
  ,mfrow=c(1,2)
  ,cex.axis=1.5
  ,cex.lab=1.5)
 
  dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian)
 
  xlimit-range(dens$x)
  ylimit-range(dens$y)
  hist(
  DATA1.y[2,]-mean(DATA1.y[2,])
  ,xlim=1.1*xlimit
  ,xlab=expression(q[e])
  ,ylim=1.1*ylimit
  ,probability=T
  ,main=Random distribution around y)
  lines(dens,col=2,)
  rm(dens,xlimit,ylimit)
 
  qqnorm(DATA1.x[1,])
 
  that's what I've on the screen and I'm OK with that.
  http://www.4shared.com/file/90283562/9f27d83b/screen.html
 
  When I save the graph in eps format

 How exactly?  I know at least three ways to do that.  I am guessing that as
 you didn't tell us you were on Windows, you also didn't tell us that you
 used the menu on the windows() device, but these details do matter.

  I've got that
  http://www.4shared.com/file/90283115/490b7383/density_v_1.html
 
  what am I doing wrong?

 Not telling us what you don't like about this plot.

 I think you should consider using dev.copy2eps(), which will give you more
 control.  Or even better, calling postscript() directly.

 --
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595

 __
 R-help@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.
__
R-help@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.


Re: [R] 3D trajectory plot?

2008-11-14 Thread Clint Bowman
In reading this thread the thought popped into my head.  A smooth
representation of the trajectory defined by the data in Chris's message
from Wednesday is very similar to the guidance problem of a rocket.  I
believe that guidance engineers use Kalman filters to smooth out noisy
data to generate the control signals to keep the missile on course.  Would
an such an approach work here to produce a smooth estimate to the
trajectory described by the data?

Clint

Clint BowmanINTERNET:   [EMAIL PROTECTED]
Air Dispersion Modeler  INTERNET:   [EMAIL PROTECTED]
Air Quality Program VOICE:  (360) 407-6815
Department of Ecology   FAX:(360) 407-7534

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 14 Nov 2008, Duncan Murdoch wrote:

 On 14/11/2008 3:10 AM, Yihui Xie wrote:
  But it's not _smooth_ (as Chris asked for)... I also thought about the
  plot3d(), but I don't know how to smooth the 3D points. AFAIK spline
  functions only work for 2D cases in R? (Sorry I'm not familiar with
  splines)

 There are lots of definitions of smooth.  One easy one is to use splines in
 each coordinate, with the independent variable being an implied time
 coordinate 1, 2, 3, etc.  That is (with only the first 4 points, I'm lazy):

 x - splinefun(1:4, c(25,12,2,2))
 y - splinefun(1:4, c(32,25,12,2))
 z - splinefun(1:4, c(40,32,25,12))

 times - seq(1, 4, len=200)
 plot3d(x(times), y(times), z(times), type=l)

 Duncan Murdoch

 
  Regards,
  Yihui
  --
  Yihui Xie [EMAIL PROTECTED]
  Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
  Mobile: +86-15810805877
  Homepage: http://www.yihui.name
  School of Statistics, Room 1037, Mingde Main Building,
  Renmin University of China, Beijing, 100872, China
 
 
 
  On Wed, Nov 12, 2008 at 7:22 PM, Duncan Murdoch [EMAIL PROTECTED]
  wrote:
   Chris Jarman wrote:
Hello,
I'm attempting to create a smooth, 3D plot of a trajectory (rather
than the cloud or wireframe functions).  I would rather the individual
data points not be visible.  I've had no luck finding this on the
graphics or help pages.  Thank you in advance.  Chris
Some example data, just in case:
   
25  32  40
12  25  32
2   12  25
2   2   12
20  2   2
1   20  2
6   1   20
5   6   1
5   5   6
   
   
   plot3d(x,y,z, type='l') from rgl.
  
   Duncan Murdoch
  
 
  __
  R-help@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.

 __
 R-help@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.


__
R-help@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.


Re: [R] Mail server problem?

2008-10-24 Thread Clint Bowman
Rolf,

It must have been a Northern Hemisphere patch that conflicted with the
Coriolis effect--just put a different spin on your email and that should
correct it.

Clint

Clint BowmanINTERNET:   [EMAIL PROTECTED]
Air Dispersion Modeler  INTERNET:   [EMAIL PROTECTED]
Air Quality Program VOICE:  (360) 407-6815
Department of Ecology   FAX:(360) 407-7534

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Fri, 24 Oct 2008, Rolf Turner wrote:


 I keep getting repeated copies of ``R-help post acknowledgements'' in respect
 of a couple of postings that I made to the list this morning (my time).
 I only posted each posting *once*.  I hope that others are not getting
 repeated copies of my postings  I mean I *know* my postings are so
 wonderful they merit re-reading, but one does not need another copy in order
 to re-read! :-)

 Has anyone else experienced this phenomenon of multiple acknowledgements for
 a single post?  Are people getting multiple copies of my postings?  (If so,
 sorry 'bout that, but I don't think it's my fault.)

   cheers,

   Rolf Turner

 ##
 Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

 __
 R-help@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.

__
R-help@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.


  1   2   >