Re: [R] plot.hclust point to older version

2014-11-25 Thread Michael Mason
Thanks! That worked

From: William Dunlap mailto:wdun...@tibco.com>>
Date: Tuesday, November 25, 2014 12:53 PM
To: Rolf Turner mailto:r.tur...@auckland.ac.nz>>
Cc: Michael Mason 
mailto:mma...@benaroyaresearch.org>>, R help 
mailto:R-help@r-project.org>>
Subject: Re: [R] plot.hclust point to older version

You probably have a local copy of an old version of plot.hclust or 
plot.dendrogram in your global environmenet or another package that masks the 
one in package:stats.  E.g., I fired up R-2.14.2 and copied those 2 plot 
methods to .GlobalEnv and then saved by workspace when quitting R.  I then 
fired up R-3.1.1, which loads the workspace saved by the older version of R.  I 
get:

> objects()
[1] "plot.dendrogram" "plot.hclust"
> plot(hclust(dist(c(2,3,5,7,11,13,17,19
Error in .Internal(dend.window(n, merge, height, hang, labels, ...)) :
  there is no .Internal function 'dend.window'
> traceback()
2: plot.hclust(hclust(dist(c(2, 3, 5, 7, 11, 13, 17, 19
1: plot(hclust(dist(c(2, 3, 5, 7, 11, 13, 17, 19

Note how calling traceback() after an error gives more information about the 
source of the error.

To fix this, get rid of the .RData file that is being loaded when R starts.


Bill Dunlap
TIBCO Software
wdunlap tibco.com<http://tibco.com>

On Tue, Nov 25, 2014 at 12:18 PM, Rolf Turner 
mailto:r.tur...@auckland.ac.nz>> wrote:
On 26/11/14 08:53, Michael Mason wrote:
Here you are. I expect most folks won't get the error.

N   = 100; M = 1000
mat = matrix(1:(N*M) + rnorm(N*M,0,.5),N,M)
h   = hclust(as.dist(1-cor(mat)))
plot(h)

Error in .Internal(dend.window(n, merge, height2, hang, labels, ...)) :
   there is no .Internal function 'dend.window'



Thanks again


On 11/25/14 11:29 AM, "Rolf Turner" 
mailto:r.tur...@auckland.ac.nz>> wrote:



Reproducible example???

(I know from noddink about hclust, but I tried the example from the help
page and it plotted without any problem.)

cheers,

Rolf Turner

On 26/11/14 06:13, Michael Mason wrote:
Hello fellow R users,

I have recently updated to R 3.1.2. When trying to plot an hclust
object to generate the dendrogram I get the following error:

Error in .Internal(dend.window(n, merge, height2, hang, labels, ...)) :
there is no .Internal function 'dend.window'


I am indeed using R3.1.2 but my understanding is that the .Internal API
to the C code is no longer used. I have tried detaching the stats
package and restarting R to no avail.
I would love any help from any wiser guRus.

Please keep communications on-list; there are others on the list far more 
likely to be able to help you than I.  I am cc-ing this reply to the list.

For what it's worth, I can run your example without error.

As to how to track down what is going wrong on your system, I'm afraid I have 
no idea.  Someone on the list may have some thoughts.

cheers,

Rolf Turner

--
Rolf Turner
Technical Editor ANZJS

__
R-help@r-project.org<mailto: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.


--CONFIDENTIALITY NOTICE--: The information contained in this email is intended 
for the exclusive use of the addressee and may contain confidential 
information. If you are not the intended recipient, you are hereby notified 
that any form of dissemination of this communication is strictly prohibited. 
www.benaroyaresearch.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] plot.hclust point to older version

2014-11-25 Thread Michael Mason
Hello fellow R users,

I have recently updated to R 3.1.2. When trying to plot an hclust object to 
generate the dendrogram I get the following error:

Error in .Internal(dend.window(n, merge, height2, hang, labels, ...)) :
  there is no .Internal function 'dend.window'


I am indeed using R3.1.2 but my understanding is that the .Internal API to the 
C code is no longer used. I have tried detaching the stats package and 
restarting R to no avail.
I would love any help from any wiser guRus.
Thanks in advance,
Mike

--CONFIDENTIALITY NOTICE--: The information contained in this email is intended 
for the exclusive use of the addressee and may contain confidential 
information. If you are not the intended recipient, you are hereby notified 
that any form of dissemination of this communication is strictly prohibited. 
www.benaroyaresearch.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.


Re: [R] Archieve of mails from R forum

2013-03-27 Thread Mason
http://r-help.markmail.org/ has a nice interface for searching the
archives, too.

On Wed, Mar 27, 2013 at 12:18 PM, Marc Schwartz wrote:

>
> On Mar 27, 2013, at 1:58 PM, Katherine Gobin 
> wrote:
>
> > Dear R helpers,
> >
> > Everyday I do receive many many mails from R forum and after some period
> of times, INBOX is filled with numerous mails. At times if for some period
> of time, I haven't accessed mails, it becomes difficult to keep track of
> mails and many times simply due to the volume (and owing to the lack of
> time due to office constraints), I have to simply delete the mails without
> opening them and I understand this is a huge loss.
> >
> > If in case I wish to refer to all the old emails that have been appeared
> in the R forum, where do I get these? Is there any list where I will get
> subject-wise of thread-wise archive of old emails? I understand that will
> be an ocean of quality information and one can learn a lot from these old
> mails and I don't need to keep track of my emails all the time.
> >
> >
> > Kindly guide.
> >
> > Regards
> >
> > Katherine
> >
>
> The official archives for R-Help are here:
>
>   https://stat.ethz.ch/pipermail/r-help/
>
> and these are mirrored in various locations, such as:
>
>   http://www.mail-archive.com/r-help@stat.math.ethz.ch/
>   http://dir.gmane.org/gmane.comp.lang.r.general
>
> You can also search the archives for all R lists at:
>
>   http://rseek.org/
>   http://finzi.psych.upenn.edu/search.html
>   http://tolstoy.newcastle.edu.au/R/
>
>
> My recommendation would be to set up a mail filter or rule (using
> r-help@r-project.org in the the sender and cc: address fields) so that
> the list e-mails are automatically moved from your main inbox to a folder
> just for these e-mails and you can then browse them as your schedule
> permits, rather than having them interspersed with other e-mails in the
> same location. I do this with a number of the R related lists and have a
> folder for each one to keep them separated. Most e-mail clients and/or
> online services have some type of filtering or rule configuration available
> to do this.
>
> Regards,
>
> Marc Schwartz
>
> __
> 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.


Re: [R] Double condition

2013-03-22 Thread Mason
It sounds like, although your "noon" and "midnight" data are separate rows,
they are not fully independent. If I understand correctly, the operation
you want to perform would be simple if you had (at least temporarily) a
single row with columns ddawn.midnight, ddusk.midnight, ddawn.noon,
ddusk.noon, rather than two separate rows.

I recommend you check out the reshape package http://had.co.nz/reshape/,
and read the paper Hadley wrote about it for a conceptual understanding of
wide vs. long data.

On Fri, Mar 22, 2013 at 11:18 AM, zuzana zajkova  wrote:

> Hi,
>
> I would appreciate if somebody could help me with this small issue...
> I have a dataframe like this (originaly has more than 100 000 rows):
>
> > subz
>  jultimedtime  fixddawnddusk day
> 101608 15006 2011-02-01 19:14:49 19.24694 noon 7.916667 19.88333   1
> 101609 15006 2011-02-01 19:24:49 19.41361 midnight 7.916667 19.56667   1
> 101610 15006 2011-02-01 19:24:49 19.41361 noon 7.916667 19.88333   1
> 101611 15006 2011-02-01 19:34:49 19.58028 midnight 7.916667 19.56667   0
> 101612 15006 2011-02-01 19:34:49 19.58028 noon 7.916667 19.88333   1
> 101613 15006 2011-02-01 19:44:49 19.74694 midnight 7.916667 19.56667   0
> 101614 15006 2011-02-01 19:44:49 19.74694 noon 7.916667 19.88333   1
> 101615 15006 2011-02-01 19:54:49 19.91361 midnight 7.916667 19.56667   0
> 101616 15006 2011-02-01 19:54:49 19.91361 noon 7.916667 19.88333   0
> 101617 15006 2011-02-01 20:04:49 20.08028 midnight 7.916667 19.56667   0
> 101618 15006 2011-02-01 20:04:49 20.08028 noon 7.916667 19.88333   0
>
> > dput(subz)
> structure(list(jul = c(15006, 15006, 15006, 15006, 15006, 15006,
> 15006, 15006, 15006, 15006, 15006), time = structure(c(1296587689,
> 1296588289, 1296588289, 129659, 129659, 1296589489, 1296589489,
> 1296590089, 1296590089, 1296590689, 1296590689), class = c("POSIXct",
> "POSIXt"), tzone = "GMT"), dtime = c(19.24694, 19.41361,
> 19.41361, 19.58028, 19.58028, 19.74694,
> 19.74694, 19.91361, 19.91361, 20.08028,
> 20.08028), fix = structure(c(2L, 1L, 2L, 1L, 2L, 1L,
> 2L, 1L, 2L, 1L, 2L), .Label = c("midnight", "noon"), class = "factor"),
> ddawn = c(7.916667, 7.916667, 7.916667,
> 7.916667, 7.916667, 7.916667, 7.916667,
> 7.916667, 7.916667, 7.916667, 7.916667
> ), ddusk = c(19.88333, 19.56667, 19.88333,
> 19.56667, 19.88333, 19.56667, 19.88333,
> 19.56667, 19.88333, 19.56667, 19.88333
> ), day = c(1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0)), .Names = c("jul",
> "time", "dtime", "fix", "ddawn", "ddusk", "day"), row.names =
> 101608:101618, class = "data.frame")
>
> where "day" is calculated as
>
> subz$day <- ifelse( subz$dtime > subz$ddusk | subz$dtime < subz$ddawn, 0, 1
> )
>
> The way I would like to calculate "day" is this
> - for the same "time",  the "day" is calculated for "noon" as mentioned
> above but  for "midnight" is just copying the same value as for "noon".
> So for the same "time" the "day" value should be the same for "noon" and
> "midnight".
> Something like this:
>
>   jultimedtime  fixddawnddusk day
> 101608 15006 2011-02-01 19:14:49 19.24694 noon 7.916667 19.88333   1
> 101609 15006 2011-02-01 19:24:49 19.41361 midnight 7.916667 19.56667   1
> 101610 15006 2011-02-01 19:24:49 19.41361 noon 7.916667 19.88333   1
> 101611 15006 2011-02-01 19:34:49 19.58028 midnight 7.916667 19.56667   1
> 101612 15006 2011-02-01 19:34:49 19.58028 noon 7.916667 19.88333   1
> 101613 15006 2011-02-01 19:44:49 19.74694 midnight 7.916667 19.56667   1
> 101614 15006 2011-02-01 19:44:49 19.74694 noon 7.916667 19.88333   1
> 101615 15006 2011-02-01 19:54:49 19.91361 midnight 7.916667 19.56667   0
> 101616 15006 2011-02-01 19:54:49 19.91361 noon 7.916667 19.88333   0
> 101617 15006 2011-02-01 20:04:49 20.08028 midnight 7.916667 19.56667   0
> 101618 15006 2011-02-01 20:04:49 20.08028 noon 7.916667 19.88333   0
>
> Where I get stuck, is I don't know how to get the value for "midnight".
>
> Any suggestion is welcome. Thanks
>
> Zuzana
>
> [[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, reproducib

[R] Calculating home ranges using mcp in adehabitat

2009-06-25 Thread Tom Mason

Hello,

I've been trying to calculate home range sizes (for Icelandic geese!) using
minimum convex polygons with the adehabitat package. I've tried to use the R
code shown by demo(homerange) in adehabitat and when that didn't work I've
fiddled around with it but to no avail...Below is the output of the demo
that I've attempted to follow, followed by a subset of my data (for one
individual) and the code I've been trying. Can anyone tell me where I may be
going wrong???


#Demo output...

> data(puechabon)

> xy<-puechabon$locs[,c("X","Y")]

> id<-puechabon$locs$Name

> ## The data are:
> xy[1:4,] ## relocations coordinates
   X   Y
1 699889 3161559
2 700046 3161541
3 698840 3161033
4 699809 3161496

> id[1:4]  ## ID
[1] Brock Brock Brock Brock
Levels: Brock Calou Chou Jean

> ###
> ###
> ###
> ### Home ranges
> 
> ## MCP
> hr<-mcp(xy, id) ## home range estimation



# My attempts...

> mydata
   Name XY
1  XDRY -21.98389 64.06457
2  XDRY -21.99759 64.08291
3  XDRY -21.98784 64.06467
4  XDRY -21.98333 64.06058
5  XDRY -21.97889 64.06257
6  XDRY -21.98284 64.06044
7  XDRY -21.97886 64.06358
8  XDRY -21.99741 64.08124
9  XDRY -21.99715 64.08330
10 XDRY -22.00397 64.09331
11 XDRY -21.99811 64.08239
12 XDRY -22.00453 64.09337
13 XDRY -21.99713 64.08299
14 XDRY -21.99608 64.08307
15 XDRY -21.99646 64.08352
16 XDRY -21.99326 64.08361
17 XDRY -22.00770 64.09090
18 XDRY -21.98160 64.06400
19 XDRY -21.97966 64.06367

> xy<-mydata$locs[,c("X","Y")]
> id<-mydata$locs$Name

> xy[1:19,]
NULL
> id[1:19,]
NULL

> mcp(xy,id,percent=95)
Error in if (length(id) != nrow(xy)) stop("xy and id should be of the same
length") : 
  argument is of length zero


#I've also tried things like the code below. But didn't know how to
incorporate 'locs' into this...

> xy<-cbind(X,Y)
> id<-Name[1:19]

> xy[1:19,]
  XY
 [1,] -21.98389 64.06457
 [2,] -21.99759 64.08291
 [3,] -21.98784 64.06467
 [4,] -21.98333 64.06058
 [5,] -21.97889 64.06257
 [6,] -21.98284 64.06044
 [7,] -21.97886 64.06358
 [8,] -21.99741 64.08124
 [9,] -21.99715 64.08330
[10,] -22.00397 64.09331
[11,] -21.99811 64.08239
[12,] -22.00453 64.09337
[13,] -21.99713 64.08299
[14,] -21.99608 64.08307
[15,] -21.99646 64.08352
[16,] -21.99326 64.08361
[17,] -22.00770 64.09090
[18,] -21.98160 64.06400
[19,] -21.97966 64.06367

> id<-Name[1:19]
> id[1:19]
 [1] XDRY XDRY XDRY XDRY XDRY XDRY XDRY XDRY XDRY XDRY XDRY
[12] XDRY XDRY XDRY XDRY XDRY XDRY XDRY XDRY
Levels: XDRY

> mcp(xy,id,percent=95)
Error in apply(xy, 2, mean) : dim(X) must have a positive length

> xy1<-xy[1:19,]
> id1<-id[1:19]
> mcp(xy1,id1,percent=95)
Error in apply(xy, 2, mean) : dim(X) must have a positive length


Would be most grateful for any suggestions to where I'm going wrong!


Tom Mason,
University of Exeter,
UK.








-- 
View this message in context: 
http://www.nabble.com/Calculating-home-ranges-using-mcp-in-adehabitat-tp24207532p24207532.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.


Re: [R] type conversion

2007-10-19 Thread Roger Mason
Hello Moshe,

Moshe Olshansky <[EMAIL PROTECTED]> writes:

> Try 
> x <- as.integer(Membersind06$actual06)
> and then
> x/10

I think I tried that without success (but I tried so many things, that
one may have escaped me).  In the meantime I changed the database
relation to a numeric type [numeric(10,2)] because I discovered that
the "money" type will be (or has already been) dropped from
forthcoming versions of postgresql.

Thanks for you help,
Roger

__
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] type conversion

2007-10-17 Thread Roger Mason
Hello,

I am trying to do arithmetic on numbers extracted from a PostgreSQL
database, wherein the numbers are stored as type "money".  The
transcript below illustrates the problem.

> Membersind06 <- sqlQuery(channel,"select * from income where rowname like 
> '%Membersind%'") 
> names(Membersind06)
[1] "rowname"  "item" "budget07" "budget08" "actual06"
> Membersind06$actual06
[1] $149,625.00
Levels: $149,625.00
> typeof(Membersind06$actual06)
[1] "integer"
> Membersind06$actual06/10
[1] NA
Warning message:
/ not meaningful for factors in: Ops.factor(Membersind06$actual06, 10)

Can someone show me how to convert the quantity stored in
Membersind06$actual06 to a numeric type such that I can perfor
arithmetic operations on it?

__
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] apply

2007-09-19 Thread Roger Mason
Hello,

I have a list of filenames extracted from a data-frame thus:

files <- main$file

e.g. file[[1]] returns 

[1] Ca00Mn48_0.gout
4702 Levels: Ca00Mn48_0.gout Ca01Mn47_0.gout Ca01Mn47_1.gout
... Ca48Mn00_0.gout

I want to extract the substring that contains the two digits after
"Ca".  This works on individual entries, e.g. substr(files[[1]],3,4)
returns "00".

I wish to apply substr() to all the entries in files.  All my efforts
fail.  Could some kind soul explain how to do what I want?

Thanks,

Roger Mason

__
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.