Re: [R] R Data

2019-02-14 Thread Fowler, Mark
I am not sure I would use the word ‘accounted’, more like discounted (tossed 
out).

From: Spencer Brackett 
Sent: February 14, 2019 9:21 AM
To: Fowler, Mark 
Cc: R-help ; Sarah Goslee ; 
Caitlin Gibbons ; Jeff Newmiller 

Subject: Re: R Data

Mr. Fowler,

Thank you! This information is most helpful. So from my understanding, I can 
use the regression coefficients shown (via the coding I originally sent, to 
generate a continuous distribution with what is essentially a line of best fit? 
The data added here had some 30,000 variables (it is genomic data from TCGA), 
does this mean that any none NA data is being accounted for in said 
distribution?

Best,

Spencer Brackett



On Thursday, February 14, 2019, Fowler, Mark 
mailto:mark.fow...@dfo-mpo.gc.ca>> wrote:
Hi Spencer,

The an1 syntax is adding regression coefficients (or NAs where a regression 
could not be done) to the downloaded and processed data, which ends up a 
matrix. The cbind function adds the regression coefficients to the last column 
of the matrix (i.e. bind the columns of the inputs in the order given). Simple 
example below. Not actually any need for the separate cbind commands, could 
have just used an1=cbind(an,p,t). The cbind function expects all the columns to 
be of the same length, hence the use of the tryCatch function to capture NA's 
for failed regression attempts, ensuring that p and t correspond row by row 
with the matrix.

 x=seq(1,5)
 y=seq(6,10)
 z=seq(1,5)
xyz=cbind(x,y,z)
xyz
   x  y z
[1,] 1  6 1
[2,] 2  7 2
[3,] 3  8 3
[4,] 4  9 4
[5,] 5 10 5
dangs=rep(NA,5)
xyzd=cbind(xyz,dangs)
xyzd
 x  y z dangs
[1,] 1  6 1NA
[2,] 2  7 2NA
[3,] 3  8 3NA
[4,] 4  9 4NA
[5,] 5 10 5NA

-Original Message-
From: R-help 
mailto:r-help-boun...@r-project.org>> On Behalf 
Of Spencer Brackett
Sent: February 14, 2019 12:32 AM
To: R-help mailto:r-help@r-project.org>>; Sarah Goslee 
mailto:sarah.gos...@gmail.com>>; Caitlin Gibbons 
mailto:bioprogram...@gmail.com>>; Jeff Newmiller 
mailto:jdnew...@dcn.davis.ca.us>>
Subject: [R] R Data

Hello everyone,

The following is a portion of coding that a colleague sent. Given my lack of 
experience in R, I am not quite sure what the significance of the following 
arguments. Could anyone help me translate? For context, I am aware of the 
downloading portion of the script... library(data.table) etc., but am not 
familiar with the portion pertaining to an1 .

library(data.table)
anno = as.data.frame(fread(file =
"/rsrch1/bcb/kchen_group/v_mohanty/data/TCGA/450K/mapper.txt", sep ="\t", 
header = T)) meth = read.table(file = 
"/rsrch1/bcb/kchen_group/v_mohanty/data/TCGA/27K/GBM.txt", sep  ="\t", header = 
T, row.names = 1) meth = as.matrix(meth) """ the loop just formats the 
methylation column names to match format"""
colnames(meth) = sapply(colnames(meth), function(i){
  c1 = strsplit(i,split = '.', fixed = T)[[1]]
  c1[4] = paste(strsplit(c1[4],split = "",fixed = T)[[1]][1:2],collapse =
"")
  paste(c1,collapse = ".")
})
exp = read.table(file =
"/rsrch1/bcb/kchen_group/v_mohanty/data/TCGA/RNAseq/GBM.txt", sep = "\t", 
header = T, row.names = 1) exp = as.matrix(exp) c = 
intersect(colnames(exp),colnames(meth))
exp = exp[,c]
meth = meth[,c]
m = apply(meth, 1, function(i){
  log2(i/(1-i))
})
m = t(as.matrix(m))
an = anno[anno$probe %in% rownames(m),]
an = an[an$gene %in% rownames(exp),]
an = an[an$location %in% c("TSS200","TSS1500"),]

p = apply(an,1,function(i){
  tryCatch(summary(lm(exp[as.character(i[2]),] ~ 
m[as.character(i[1]),]))$coefficient[2,4], error= function(e)NA)
})
t = apply(an,1,function(i){
  tryCatch(summary(lm(exp[as.character(i[2]),] ~ 
m[as.character(i[1]),]))$coefficient[2,3], error= function(e)NA)
})
an1 =cbind(an,p)
an1 = cbind(an1,t)
an1$q = p.adjust(as.numeric(an1$p))
summary(lm(exp["MAOB",] ~ m["cg00121904",]$coefficient[2,c(3:4)]
###

[[alternative HTML version deleted]]

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


Re: [R] R Data

2019-02-14 Thread Fowler, Mark
Hi Spencer,

The an1 syntax is adding regression coefficients (or NAs where a regression 
could not be done) to the downloaded and processed data, which ends up a 
matrix. The cbind function adds the regression coefficients to the last column 
of the matrix (i.e. bind the columns of the inputs in the order given). Simple 
example below. Not actually any need for the separate cbind commands, could 
have just used an1=cbind(an,p,t). The cbind function expects all the columns to 
be of the same length, hence the use of the tryCatch function to capture NA's 
for failed regression attempts, ensuring that p and t correspond row by row 
with the matrix.

 x=seq(1,5)
 y=seq(6,10)
 z=seq(1,5)
xyz=cbind(x,y,z)
xyz
   x  y z
[1,] 1  6 1
[2,] 2  7 2
[3,] 3  8 3
[4,] 4  9 4
[5,] 5 10 5
dangs=rep(NA,5)
xyzd=cbind(xyz,dangs)
xyzd
 x  y z dangs
[1,] 1  6 1NA
[2,] 2  7 2NA
[3,] 3  8 3NA
[4,] 4  9 4NA
[5,] 5 10 5NA

-Original Message-
From: R-help  On Behalf Of Spencer Brackett
Sent: February 14, 2019 12:32 AM
To: R-help ; Sarah Goslee ; 
Caitlin Gibbons ; Jeff Newmiller 

Subject: [R] R Data

Hello everyone,

The following is a portion of coding that a colleague sent. Given my lack of 
experience in R, I am not quite sure what the significance of the following 
arguments. Could anyone help me translate? For context, I am aware of the 
downloading portion of the script... library(data.table) etc., but am not 
familiar with the portion pertaining to an1 .

library(data.table)
anno = as.data.frame(fread(file =
"/rsrch1/bcb/kchen_group/v_mohanty/data/TCGA/450K/mapper.txt", sep ="\t", 
header = T)) meth = read.table(file = 
"/rsrch1/bcb/kchen_group/v_mohanty/data/TCGA/27K/GBM.txt", sep  ="\t", header = 
T, row.names = 1) meth = as.matrix(meth) """ the loop just formats the 
methylation column names to match format"""
colnames(meth) = sapply(colnames(meth), function(i){
  c1 = strsplit(i,split = '.', fixed = T)[[1]]
  c1[4] = paste(strsplit(c1[4],split = "",fixed = T)[[1]][1:2],collapse =
"")
  paste(c1,collapse = ".")
})
exp = read.table(file =
"/rsrch1/bcb/kchen_group/v_mohanty/data/TCGA/RNAseq/GBM.txt", sep = "\t", 
header = T, row.names = 1) exp = as.matrix(exp) c = 
intersect(colnames(exp),colnames(meth))
exp = exp[,c]
meth = meth[,c]
m = apply(meth, 1, function(i){
  log2(i/(1-i))
})
m = t(as.matrix(m))
an = anno[anno$probe %in% rownames(m),]
an = an[an$gene %in% rownames(exp),]
an = an[an$location %in% c("TSS200","TSS1500"),]

p = apply(an,1,function(i){
  tryCatch(summary(lm(exp[as.character(i[2]),] ~ 
m[as.character(i[1]),]))$coefficient[2,4], error= function(e)NA)
})
t = apply(an,1,function(i){
  tryCatch(summary(lm(exp[as.character(i[2]),] ~ 
m[as.character(i[1]),]))$coefficient[2,3], error= function(e)NA)
})
an1 =cbind(an,p)
an1 = cbind(an1,t)
an1$q = p.adjust(as.numeric(an1$p))
summary(lm(exp["MAOB",] ~ m["cg00121904",]$coefficient[2,c(3:4)]
###

[[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] Hacked

2018-04-18 Thread Fowler, Mark
Seems it must be the R-list. A horde of ‘solicitation’ emails began arriving 
about 27 minutes after I posted about not seeing any! Had left work by that 
time, so did not encounter them until now.

From: Mark Leeds [mailto:marklee...@gmail.com]
Sent: April 18, 2018 12:33 AM
To: Rui Barradas
Cc: Ding, Yuan Chun; Fowler, Mark; Luis Puerto; Peter Langfelder; R-Help ML 
R-Project; Neotropical bat risk assessments
Subject: Re: [R] Hacked

Hi All: I lately get a lot more spam-porn type emails lately also but I don't 
know if they are due to me being on
the R-list.


On Tue, Apr 17, 2018 at 5:09 PM, Rui Barradas 
<ruipbarra...@sapo.pt<mailto:ruipbarra...@sapo.pt>> wrote:
Hello,

Nor do I, no gmail, also got spam.

Rui Barradas

On 4/17/2018 8:34 PM, Ding, Yuan Chun wrote:
No, I do not use gmail, still got dirty spam email twice.

-Original Message-
From: R-help 
[mailto:r-help-boun...@r-project.org<mailto:r-help-boun...@r-project.org>] On 
Behalf Of Fowler, Mark
Sent: Tuesday, April 17, 2018 12:32 PM
To: Luis Puerto; Peter Langfelder
Cc: R-Help ML R-Project; Neotropical bat risk assessments
Subject: Re: [R] Hacked

[Attention: This email came from an external source. Do not open attachments or 
click on links from unknown senders or unexpected emails.]





Just an observation. I have not seen the spam you are discussing. Possibly it 
is specific to gmail addresses?

-Original Message-
From: R-help 
[mailto:r-help-boun...@r-project.org<mailto:r-help-boun...@r-project.org>] On 
Behalf Of Luis Puerto
Sent: April 17, 2018 4:11 PM
To: Peter Langfelder
Cc: R-Help ML R-Project; Neotropical bat risk assessments
Subject: Re: [R] Hacked

Hi!

This happened to me also! I just got a spam email just after posting and then 
in following days I got obnoxious spam emails in my spam filter. As the others, 
I think that there is some kind of bot subscribed to the list, but also perhaps 
a spider or crawler monitoring the R-Help archive and getting email addresses 
there. Nabble is a possibility too.
On 17 Apr 2018, at 21:50, Peter Langfelder 
<peter.langfel...@gmail.com<mailto:peter.langfel...@gmail.com>> wrote:

I got some spam emails after my last post to the list, and the emails
did not seem to go through r-help. The spammers may be subscribed to
the r-help, or they get the poster emails from some of the web copies
of this list (nabble or similar).

Peter

On Tue, Apr 17, 2018 at 11:37 AM, Ulrik Stervbo 
<ulrik.ster...@gmail.com<mailto:ulrik.ster...@gmail.com>> wrote:
I asked the moderators about it. This is the reply

"Other moderators have looked into this a bit and may be able to shed
more light on it. This is a "new" tactic where the spammers appear to
reply to the r-help post. They are not, however, going through the r-help 
server.

It also seems that this does not happen to everyone.

I am not sure how you can automatically block the spammers.

Sorry I cannot be of more help."

--Ulrik

Jeff Newmiller <jdnew...@dcn.davis.ca.us<mailto:jdnew...@dcn.davis.ca.us>> 
schrieb am Di., 17. Apr.
2018,
14:59:
Likely a spammer has joined the mailing list and is auto-replying to
posts made to the list. Unlikely that the list itself has been
"hacked". Agree that it is obnoxious.

On April 17, 2018 5:01:10 AM PDT, Neotropical bat risk assessments <
neotropical.b...@gmail.com<mailto:neotropical.b...@gmail.com>> wrote:
Hi all,

Site has been hacked?
Bad SPAM arriving

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

--
Sent from my phone. Please excuse my brevity.

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

2018-04-17 Thread Fowler, Mark
Just an observation. I have not seen the spam you are discussing. Possibly it 
is specific to gmail addresses?

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Luis Puerto
Sent: April 17, 2018 4:11 PM
To: Peter Langfelder
Cc: R-Help ML R-Project; Neotropical bat risk assessments
Subject: Re: [R] Hacked

Hi! 

This happened to me also! I just got a spam email just after posting and then 
in following days I got obnoxious spam emails in my spam filter. As the others, 
I think that there is some kind of bot subscribed to the list, but also perhaps 
a spider or crawler monitoring the R-Help archive and getting email addresses 
there. Nabble is a possibility too. 

> On 17 Apr 2018, at 21:50, Peter Langfelder  wrote:
> 
> I got some spam emails after my last post to the list, and the emails 
> did not seem to go through r-help. The spammers may be subscribed to 
> the r-help, or they get the poster emails from some of the web copies 
> of this list (nabble or similar).
> 
> Peter
> 
> On Tue, Apr 17, 2018 at 11:37 AM, Ulrik Stervbo  
> wrote:
>> I asked the moderators about it. This is the reply
>> 
>> "Other moderators have looked into this a bit and may be able to shed 
>> more light on it. This is a "new" tactic where the spammers appear to 
>> reply to the r-help post. They are not, however, going through the r-help 
>> server.
>> 
>> It also seems that this does not happen to everyone.
>> 
>> I am not sure how you can automatically block the spammers.
>> 
>> Sorry I cannot be of more help."
>> 
>> --Ulrik
>> 
>> Jeff Newmiller  schrieb am Di., 17. Apr. 
>> 2018,
>> 14:59:
>> 
>>> Likely a spammer has joined the mailing list and is auto-replying to 
>>> posts made to the list. Unlikely that the list itself has been 
>>> "hacked". Agree that it is obnoxious.
>>> 
>>> On April 17, 2018 5:01:10 AM PDT, Neotropical bat risk assessments < 
>>> neotropical.b...@gmail.com> wrote:
 Hi all,
 
 Site has been hacked?
 Bad SPAM arriving
 
 __
 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.
>>> 
>>> --
>>> Sent from my phone. Please excuse my brevity.
>>> 
>>> __
>>> 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.

__
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] When customizing last line, the code stops working

2016-11-03 Thread Fowler, Mark
Hi Frank,

Maybe just the quotes?

paste0("dt_sp_", 1:length(sp))
[1] "dt_sp_1" "dt_sp_2" "dt_sp_3" "dt_sp_4"
noquote(paste0("dt_sp_", 1:length(sp)))
 [1] dt_sp_1 dt_sp_2 dt_sp_3 dt_sp_4


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Frank S.
Sent: November 3, 2016 9:30 AM
To: r-help@r-project.org
Subject: [R] When customizing last line, the code stops working

Dear all,


The function I present works perfectly when I run it as written (that is, 
leaving NEW LINE as commented). However, when

I try to run the same function via this mentioned line (and therefore 
commenting LAST LINE) R gives an error message:
Error in FUN(X[[i]], ...) : object 'dt_sp_1' not found. I do not understand why 
I don't get the same result.


Thanks in advance for any help!


Frank S.


all.sp <- function(age.u, open, close) {

require(data.table)
dt <- data.table( id = c(rep(1, 2), 2:4, rep(5, 2)),
   sex = as.factor(rep(c(0, 1), c(3, 4))),
   fborn =  as.Date(c("1935-07-25", "1935-07-25", "1939-07-23", "1943-10-05",
  "1944-01-01", "1944-09-07", "1944-09-07")) )

sp <- seq(open, close, by = "year")
dt_sp <- list()
for (i in 1:length(sp)) {
  vp <- as.POSIXlt(c(as.Date("1000-01-01"), sp))
  vp$year <- vp$year - age.u
  dt.cut <- as.numeric(cut(x = as.POSIXlt(dt$fborn), breaks = vp, right = TRUE, 
include.lowest = TRUE))
  dt_sp[i] <- split(dt, factor(dt.cut, i))
  dt_sp[[i]] <- data.table(dt_sp[[i]])[, entry_sp := sp[i]]
  assign(paste0("dt_sp_", 1:length(sp))[i], dt_sp[[i]])
  }

  union <- rbind(dt_sp_1, dt_sp_2, dt_sp_3, dt_sp_4) # LAST LINE: IT WORKS


  # I TRY TO CUSTOMIZE LAST LINE, BUT THEN CODE STOPS WORKING
  # union <- do.call(rbind, lapply(paste0("dt_sp_", 1:length(sp)), get)) # 
NEW LINE
}

# Example:
result <- all.sp(age.u = 65, open = as.Date("2007-01-01"), close = 
as.Date("2010-05-01"))

[[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] email threads chronology

2016-05-30 Thread Fowler, Mark
Hi all,

I'm seeing the natural sequencing of email threads getting corrupted. For 
example, a May 26 thread on subject 'Shaded areas in R' would have been 
initiated by an email at 6:58am. However I did not get that email until 1:48pm, 
preceded by 3 replies to the post. Trivial but irritating. The preceding 
replies suggest this is something going on at my end, perhaps related to 
network security. I'm curious what might be causing it, and if there is 
something I can do about it - short of contacting IT staff, which is more 
irritating than the corrupted threads.

Mark Fowler
Population Ecology Division
Bedford Inst of Oceanography
Dept Fisheries & Oceans
Dartmouth NS Canada
B2Y 4A2
Tel. (902) 426-3529
Fax (902) 426-9710
Email mark.fow...@dfo-mpo.gc.ca



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


Re: [R] R-help mailing list activity / R-not-help?

2016-01-25 Thread Fowler, Mark
Two concerns with implementing this philosophy.


1.   Determining whether a question is indeed seeking an answer to a 
homework exercise. Certainly if I think a question is short-cutting a basic 
homework task I ignore it. But I don't waste an email berating the alleged 
student.

2.   The validity of the barrier. At what point (maybe graduate levels? Nth 
year?) do we regard questions inspired by an educational system to be 
appropriate? Academia was still using mainframes when I graduated so I don't 
have much notion of expectations today.


I'm just musing that we might be farther ahead simply opting for no response 
than adding another email to the queue. It also gets around needing to feel I 
know the answers to 1 and 2.

From: John Sorkin [mailto:jsor...@grecc.umaryland.edu]
Sent: January 25, 2016 1:36 PM
To: ted.hard...@wlandres.net
Cc: Fowler, Mark; dupo...@nancy.inra.fr; r-help@r-project.org; frien...@yorku.ca
Subject: Re: [R] R-help mailing list activity / R-not-help?

When we read acerbic replies we should remind the poster to reply in a more 
moderate tone. On the other hand  noting that the list is not intended to be a 
source of answers to home work questions is 100% appropriate. This philosophy 
is intended both to keep the list from being flooded with questions and to make 
sure that no student has an unfair advantage.
John


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)

On Jan 25, 2016, at 12:17 PM, Ted Harding 
<ted.hard...@wlandres.net<mailto:ted.hard...@wlandres.net>> wrote:
My feelings exactly! (And since quite some time ago).
Ted.

On 25-Jan-2016 12:23:16 Fowler, Mark wrote:

I'm glad to see the issue of negative feedback addressed. I can especially
relate to the 'cringe' feeling when reading some authoritarian backhand to a
new user. We do see a number of obviously inappropriate or overly lazy
postings, but I encounter far more postings where I don't feel competent to
judge their merit. It might be better to simply disregard a posting one does
not like for some reason. It might also be worthwhile to actively counter
negative feedback when we experience that 'cringing' moment. I'm not thinking
to foster contention, but simply to provide some tangible reassurance to new
users, and not just the ones invoking the negative feedback, that a
particular respondent may not represent the perspective of the list.

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael
Friendly
Sent: January 24, 2016 5:43 PM
To: Jean-Luc Dupouey; r-help@r-project.org<mailto:r-help@r-project.org>
Subject: Re: [R] R-help mailing list activity / R-not-help?


On 1/23/2016 7:28 AM, Jean-Luc Dupouey wrote:
Dear members,

Not a technical question:
But one worth raising...

The number of threads in this mailing list, following a long period of
increase, has been regularly and strongly decreasing since 2010,
passing from more than 40K threads to less than 11K threads last year.
The trend is similar for most of the "ancient" mailing lists of the
R-project.
[snip ...]

I hope it is the wright place to ask this question. Thanks in advance,


In addition to the other replies, there is another trend I've seen that has
actively worked to suppress discussion on R-help and move it elsewhere. The
general things:
- R-help was too unwieldy and so it was a good idea to hive-off specialized
topics to various sub lists, R-SIG-Mac, R-SIG-Geo, etc.
- Many people posted badly-formed questions to R-help, and so it was a good
idea to develop and refer to the posting guide to mitigate the number of
purely junk postings.


Yet, the trend I've seen is one of increasing **R-not-help**, in that there
are many posts, often by new R users who get replies that not infrequently
range from just mildly off-putting to actively hostile:

- Is this homework? We don't do homework (sometimes false alarms, where the
OP has to reply to say it is not)
- Didn't you bother to do your homework, RTFM, or Google?
- This is off-topic because XXX (e.g., it is not strictly an R programming
question).
- You asked about doing XXX, but this is a stupid thing to want to do.
- Don't ask here; you need to talk to a statistical consultant.

I find this sad in a public mailing list sent to all R-help subscribers and I
sometimes cringe when I read replies to people who were actually trying to
get help with some R-related problem, but expressed it badly, didn't know
exactly what to ask for, or how to format it, or somehow motivated a
frequent-replier to publicly dis the OP.

On the other hand, I still see a spirit of great generosity among some people
who frequently reply 

Re: [R] R-help mailing list activity / R-not-help?

2016-01-25 Thread Fowler, Mark
I'm glad to see the issue of negative feedback addressed. I can especially 
relate to the 'cringe' feeling when reading some authoritarian backhand to a 
new user. We do see a number of obviously inappropriate or overly lazy 
postings, but I encounter far more postings where I don't feel competent to 
judge their merit. It might be better to simply disregard a posting one does 
not like for some reason. It might also be worthwhile to actively counter 
negative feedback when we experience that 'cringing' moment. I'm not thinking 
to foster contention, but simply to provide some tangible reassurance to new 
users, and not just the ones invoking the negative feedback, that a particular 
respondent may not represent the perspective of the list.

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael Friendly
Sent: January 24, 2016 5:43 PM
To: Jean-Luc Dupouey; r-help@r-project.org
Subject: Re: [R] R-help mailing list activity / R-not-help?


On 1/23/2016 7:28 AM, Jean-Luc Dupouey wrote:
> Dear members,
>
> Not a technical question:
But one worth raising...
>
> The number of threads in this mailing list, following a long period of 
> increase, has been regularly and strongly decreasing since 2010, 
> passing from more than 40K threads to less than 11K threads last year. 
> The trend is similar for most of the "ancient" mailing lists of the R-project.
[snip ...]
>
> I hope it is the wright place to ask this question. Thanks in advance,
>

In addition to the other replies, there is another trend I've seen that has 
actively worked to suppress discussion on R-help and move it elsewhere. The 
general things:
- R-help was too unwieldy and so it was a good idea to hive-off specialized 
topics to various sub lists, R-SIG-Mac, R-SIG-Geo, etc.
- Many people posted badly-formed questions to R-help, and so it was a good 
idea to develop and refer to the posting guide to mitigate the number of purely 
junk postings.


Yet, the trend I've seen is one of increasing **R-not-help**, in that there are 
many posts, often by new R users who get replies that not infrequently range 
from just mildly off-putting to actively hostile:

- Is this homework? We don't do homework (sometimes false alarms, where the OP 
has to reply to say it is not)
- Didn't you bother to do your homework, RTFM, or Google?
- This is off-topic because XXX (e.g., it is not strictly an R programming 
question).
- You asked about doing XXX, but this is a stupid thing to want to do.
- Don't ask here; you need to talk to a statistical consultant.

I find this sad in a public mailing list sent to all R-help subscribers and I 
sometimes cringe when I read replies to people who were actually trying to get 
help with some R-related problem, but expressed it badly, didn't know exactly 
what to ask for, or how to format it, or somehow motivated a frequent-replier 
to publicly dis the OP.

On the other hand, I still see a spirit of great generosity among some people 
who frequently reply to R-help, taking a possibly badly posed or ill-formatted 
question, and going to some lengths to provide a a helpful answer of some sort. 
 I applaud those who take the time and effort to do this.

I use R in a number of my courses, and used to advise students to post to 
R-help for general programming questions (not just homework) they couldn't 
solve. I don't do this any more, because several of them reported a negative 
experience.

In contrast, in the Stackexchange model, there are numerous sublists 
cross-classified by their tags.  If I have a specific knitr, ggplot2, LaTeX, or 
statistical modeling question, I'm now more likely to post it there, and the 
worst that can happen is that no one "upvotes" it or someone (helpfully) marks 
it as a duplicate of a similar question.
But comments there are not propagated to all subscribers, and those who reply 
helpfully, can see their solutions accepted or not, or commented on in that 
specific topic.

Perhaps one solution would be to create a new "R-not-help" list where, as in a 
Monty Python skit, people could be directed there to be insulted and all these 
unhelpful replies could be sent.

A milder alternative is to encourage some R-help subscribers to click the 
"Don't send" or "Save" button and think better of their replies.


-- 
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University  Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

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

Re: [R] two questions - function help and 32vs64 bit sessions

2014-07-21 Thread Fowler, Mark
Hi Duncan,
I tried your suggestion, but no luck. The first error is no surprise, it
just confirms the address is lost. The second line suggests it worked,
but it didn't. The session is still remembering the original address.

 tools::startDynamicHelp(FALSE) # shut it down
Warning message:
In file(out, wt) :
  cannot open file
'C:\Users\fowlerm\AppData\Local\Temp\1\RtmpK09I4B\Rhttpd26c04742884': No
such file or directory
 tools::startDynamicHelp(TRUE)  # start it up
starting httpd help server ... done

-Original Message-
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] 
Sent: July 16, 2014 10:47 AM
To: Fowler, Mark; r-h...@stat.math.ethz.ch
Subject: Re: [R] two questions - function help and 32vs64 bit sessions

On 14/07/2014, 11:42 AM, Fowler, Mark wrote:
 Hello,
 
  
 
 Two unrelated questions, and neither urgent.
 
  
 
 Windows 7, R 3.0.1. Using R Console, no fancy interface.
 
  
 
 The function help ultimately becomes lost to a session kept running 
 for extended periods (days). I.e. with a new session if you invoke the

 Help menu 'R functions (txt)...' it activates the html help and goes 
 to the named function page. This will work fine for at least a day, 
 but typically the next day invoking the help menu in this fashion will

 fail, as R looks for a temporary address it creates on your computer. 
 This gets lost, possibly due to network administration activity. So 
 then I save and start another session with same Rdata. Trivial enough 
 but irritating. Anybody know how to restore the 'link' without ending 
 and restarting the session?

I never have sessions that last that long, so I haven't tried this, but
I'd expect you could restart the help system in this way:

tools::startDynamicHelp(FALSE) # shut it down
tools::startDynamicHelp(TRUE)  # start it up

Duncan Murdoch

 
  
 
 I have a mix of 32-bit and 64-bit requirements, with 64 the default. I

 became used to starting R sessions directly from the appropriate Rdata

 workspaces. With the latest version I need to start from the generic 
 icon and then load the workspace if I want 32-bit. Anybody know a way 
 to make the Rdata files keep track of which bit version they work 
 with, or some trick that accomplishes the same objective? The 32-bit 
 requirement is usually just RODBC, and the need for it is scattered 
 over lots of workspaces. Again, trivial but a nuisance. A more 
 pragmatic motive is to not oblige users of applications to think about

 it. Any way to make a session switch 'bits' with a source file?
 
  
 
 Mark Fowler
 Population Ecology Division
 Bedford Inst of Oceanography
 Dept Fisheries  Oceans
 Dartmouth NS Canada
 B2Y 4A2
 Tel. (902) 426-3529
 Fax (902) 426-9710
 Email mark.fow...@dfo-mpo.gc.ca mailto:mark.fow...@dfo-mpo.gc.ca
 
 
 
  
 
 
   [[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] FW: two questions - function help and 32vs64 bit sessions

2014-07-21 Thread Fowler, Mark


-Original Message-
From: Fowler, Mark 
Sent: July 21, 2014 1:56 PM
To: 'Duncan Murdoch'
Subject: RE: [R] two questions - function help and 32vs64 bit sessions

The server doesn't shut down, it just kind of shuts everybody else down.
But your mention of TEMPDIR jostled some old memory cells awake, and
essentially answered the question. I do [did] a similar thing with
temporary directories as you discuss, just another directory location.
But that location (R_USER) disappeared when I upgraded (one or all of R
to 2 to 3, OS XP to 7, machine 34 to 62 bit). So R has to create a temp
dir by default. I think that default directory gets derailed during
network-wide system scans, thus Tuesdays and weekends for me.

Sys.getenv('R_USER')
[1] C:\\Users\\fowlerm\\Documents
 tempdir()
[1] C:\\Users\\fowlerm\\AppData\\Local\\Temp\\1\\RtmpeqbLeR

-Original Message-
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com]
Sent: July 21, 2014 11:55 AM
To: Fowler, Mark; r-h...@stat.math.ethz.ch
Subject: Re: [R] two questions - function help and 32vs64 bit sessions

On 21/07/2014 9:40 AM, Fowler, Mark wrote:
 Hi Duncan,
 I tried your suggestion, but no luck. The first error is no surprise, 
 it just confirms the address is lost. The second line suggests it 
 worked, but it didn't. The session is still remembering the original
address.

  tools::startDynamicHelp(FALSE) # shut it down
 Warning message:
 In file(out, wt) :
cannot open file
 'C:\Users\fowlerm\AppData\Local\Temp\1\RtmpK09I4B\Rhttpd26c04742884': 
 No such file or directory
  tools::startDynamicHelp(TRUE)  # start it up
 starting httpd help server ... done

This is a different error than I thought you described.  I thought
something had shut down the server, but it looks like something has 
deleted your temporary directory.   You might be able to tell your OS 
not to do that (if it was the OS that did), or you can put your
temporary directory in a location that is less likely to get deleted,
e.g. by setting the TMPDIR environment variable to somewhere else before
you start R.  For example, I typically run with TMPDIR set to C:/temp
when I'm debugging things.

Duncan Murdoch


 -Original Message-
 From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com]
 Sent: July 16, 2014 10:47 AM
 To: Fowler, Mark; r-h...@stat.math.ethz.ch
 Subject: Re: [R] two questions - function help and 32vs64 bit sessions

 On 14/07/2014, 11:42 AM, Fowler, Mark wrote:
  Hello,
 
 
 
  Two unrelated questions, and neither urgent.
 
 
 
  Windows 7, R 3.0.1. Using R Console, no fancy interface.
 
 
 
  The function help ultimately becomes lost to a session kept running 
  for extended periods (days). I.e. with a new session if you invoke 
  the

  Help menu 'R functions (txt)...' it activates the html help and goes

  to the named function page. This will work fine for at least a day, 
  but typically the next day invoking the help menu in this fashion 
  will

  fail, as R looks for a temporary address it creates on your
computer.
  This gets lost, possibly due to network administration activity. So 
  then I save and start another session with same Rdata. Trivial 
  enough but irritating. Anybody know how to restore the 'link'
  without ending and restarting the session?

 I never have sessions that last that long, so I haven't tried this, 
 but I'd expect you could restart the help system in this way:

 tools::startDynamicHelp(FALSE) # shut it down
 tools::startDynamicHelp(TRUE)  # start it up

 Duncan Murdoch

 
 
 
  I have a mix of 32-bit and 64-bit requirements, with 64 the default.

  I

  became used to starting R sessions directly from the appropriate 
  Rdata

  workspaces. With the latest version I need to start from the generic

  icon and then load the workspace if I want 32-bit. Anybody know a 
  way to make the Rdata files keep track of which bit version they 
  work with, or some trick that accomplishes the same objective? The 
  32-bit requirement is usually just RODBC, and the need for it is 
  scattered over lots of workspaces. Again, trivial but a nuisance. A 
  more pragmatic motive is to not oblige users of applications to 
  think about

  it. Any way to make a session switch 'bits' with a source file?
 
 
 
  Mark Fowler
  Population Ecology Division
  Bedford Inst of Oceanography
  Dept Fisheries  Oceans
  Dartmouth NS Canada
  B2Y 4A2
  Tel. (902) 426-3529
  Fax (902) 426-9710
  Email mark.fow...@dfo-mpo.gc.ca mailto:mark.fow...@dfo-mpo.gc.ca
 
 
 
 
 
 
  [[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

Re: [R] two questions - function help and 32vs64 bit sessions

2014-07-16 Thread Fowler, Mark
Hi Jim,
Lost the address (Tuesday night is a major system scan for DFO, messes
everybody up). Tried your suggestion, no luck. Also tried shutting down
all Explorer browsers, still no luck. Maybe something related to
configuration or environment differs between our systems.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Jim Lemon
Sent: July 15, 2014 12:17 AM
To: r-help@r-project.org
Subject: Re: [R] two questions - function help and 32vs64 bit sessions

On Mon, 14 Jul 2014 01:42:54 PM Fowler, Mark wrote:
 Hello,
 
 
 
 Two unrelated questions, and neither urgent.
 
 
 
 Windows 7, R 3.0.1. Using R Console, no fancy interface.
 
 
 
 The function help ultimately becomes lost to a session kept running
for
 extended periods (days). I.e. with a new session if you invoke the 
 Help menu 'R functions (txt)...' it activates the html help and goes 
 to the named function page. This will work fine for at least a day, 
 but typically the next day invoking the help menu in this fashion will

 fail, as R looks for a temporary address it creates on your computer. 
 This gets lost, possibly due to network administration activity. So 
 then I save and start another session with same Rdata. Trivial enough 
 but irritating. Anybody know how to restore the 'link' without ending 
 and restarting the session?

Hi Mark,
I simply shut down the help browser. It will restart with a new IP
address.

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.


[R] long tk2listbox display offset

2014-07-16 Thread Fowler, Mark
Hello

 

I have a dialog (pasted below) that includes a couple of long listboxes
(require scrollbars). I want the display of the list to start at the
top, but by default the displayed portion of the list starts at the
selected position + 1 (or the first selected position +1 if extended
selection). This appears to be because the underlying tcl/tk indexing
begins at 0 while the tk2listbox indexing for selection starts (more
intuitively) at 1. However the tk2listbox function sets the selection
pointer using tksee with an unadjusted selection value, hence the
offset. This never matters for listboxes that are fully displayed, so
maybe slipped through the cracks. But for scrolled listboxes it means
the displayed list items do not include the selected (or first selected)
value, which is irksome. The dialog below resolves the problem with two
tksee commands, currently commented out to illustrate the problem with
the default behavior. The bit of code in the tk2listbox function...

 

for (item in values) tkinsert(w, end, item)

if (!is.null(selection)) {

for (sel in selection) tkselection.set(w, sel - 1)

tksee(w, selection[1])

}

 

...should perhaps be...

 

for (item in values) tkinsert(w, end, item)

if (!is.null(selection)) {

for (sel in selection) tkselection.set(w, sel - 1)

tksee(w, selection[1]-1)

}

 

I checked this revision with the SSGUI function below and it worked fine
without adding the tksee lines. Staying with the original tk2listbox
function with tksee fixes as below regardless, too much potential for
confusion down the road.

 

SSGUI=function() {

DiagnosticsR=tktoplevel()

tktitle(DiagnosticsR) - Survey Data Analysis with R

tkgrid(tklabel(DiagnosticsR,text=DATA SELECTION 
DEFINITION),stick=we)

tkgrid(tklabel(DiagnosticsR,text=))

tkgrid(tklabel(DiagnosticsR,text=Survey),tklabel(DiagnosticsR,text=St
ock),tklabel(DiagnosticsR,text=Subset
Strata),tklabel(DiagnosticsR,text=Sex),sticky=n)

Surveys - c(SUMMER , GEORGES,4VWCOD ,SPRING ,FALL   ,GULF
)

Surveylist=tk2listbox(DiagnosticsR, values=Surveys, selection=1,
selectmode = single, height = 6, scroll = none, autoscroll = x,
enabled = TRUE)

Stocks -
c(CAPELIN,COD,COD4VN,COD4VSW,COD4X,CUSK,DOGFISH,HADDOCK,
HADDOCK4VW,HADDOCK4X,HALIBUT,HERRING,LITTLESKATE,LONGHORNSCUL
PIN,

MONKFISH,PLAICE,PLAICE4VW,PLAICE4X,POLLOCK,POUT,REDFISH,R
EDFISHUNIT2,REDFISHUNIT3,ROSEFISH,

SANDLANCE,SHANNY,SILVERHAKE,SMOOTHSKATE,SHORTFINSQUID,THORNYS
KATE,TURBOT,

WHITEHAKE,WHITEHAKE4VN,WHITEHAKE4VSW,WHITEHAKE4X,WINTERFLOUNDER
,WINTERFLOUNDER4X,WINTERSKATE,WITCH,WITCH4VW,WITCH4X,WOLFFIS
H,

YELLOWTAIL,YELLOWTAIL4VW,YELLOWTAIL4X,

COD4T,HADDOCK4T,WHITEHAKE4T,SILVERHAKE4T,POLLOCK4T,REDFISH4T
,HALIBUT4T,PLAICE4T,WITCH4T,YELLOWTAIL4T,WINTERFLOUNDER4T,WOL
FFISH4T,

THORNYSKATE4T,SMOOTHSKATE4T,LITTLESKATE4T,WINTERSKATE4T,DOGFISH
4T,MONKFISH4T,POUT4T)

Stocklist=tk2listbox(DiagnosticsR, values=Stocks, selection=2,
selectmode = single, height = 20, scroll = y, autoscroll = none,
enabled = TRUE)

#tksee(Stocklist,0)

Strata -
as.character(c(seq(401,411),seq(415,429),seq(431,466),seq(470,478),seq(4
80,485),seq(490,495),seq(501,508)))

Stratalist=tk2listbox(DiagnosticsR, values=Strata, selection=seq(1,91),
selectmode = extended, height = 20, scroll = y, autoscroll = none,
enabled = TRUE)

#tksee(Stratalist,0)

Sex - c(Combined, Males,Females)

Sexlist=tk2listbox(DiagnosticsR, values=Sex, selection=1, selectmode =
single, height = 3, scroll = none, autoscroll = y, enabled = TRUE)

tkgrid(Surveylist,Stocklist,Stratalist,Sexlist,sticky=n)

DoWB - tk2checkbutton(DiagnosticsR, text = Do Weights and Biomass)

tkgrid(DoWB,sticky=w)

keepDoWB=tclVar(1)

tkconfigure(DoWB,variable=keepDoWB)

DoNA - tk2checkbutton(DiagnosticsR, text = Do Numbers and Abundance)

tkgrid(DoNA,sticky=w)

keepDoNA=tclVar(1)

tkconfigure(DoNA,variable=keepDoNA)

DoGroups - tk2checkbutton(DiagnosticsR, text = Do Length Groups
(Numbers Only))

tkgrid(DoGroups,sticky=w)

keepDoGroups=tclVar(0)

tkconfigure(DoGroups,variable=keepDoGroups)

G1small - tclVar(1)

G1smallEntry=tk2entry(DiagnosticsR, textvariable=G1small)

tkgrid(tklabel(DiagnosticsR,text=Smallest (cm)),G1smallEntry)

G1large - tclVar(30)

G1largeEntry=tk2entry(DiagnosticsR, textvariable=G1large)

tkgrid(tklabel(DiagnosticsR,text=Largest (cm)),G1largeEntry)

G2small - tclVar(31)

G2smallEntry=tk2entry(DiagnosticsR, textvariable=G2small)

tkgrid(tklabel(DiagnosticsR,text=Smallest (cm)),G2smallEntry)

G2large - tclVar(150)

G2largeEntry=tk2entry(DiagnosticsR, textvariable=G2large)

tkgrid(tklabel(DiagnosticsR,text=Largest (cm)),G2largeEntry)

DoCatchability - tk2checkbutton(DiagnosticsR, text = Use Documented
Transformations for Vessel Catchability Coefficients)

tkgrid(DoCatchability,sticky=w)

keepDoCatchability=tclVar(0)

tkconfigure(DoCatchability,variable=keepDoCatchability)

AppApply - tk2button(DiagnosticsR, text = Apply, width = 7, command =
function()

Re: [R] two questions - function help and 32vs64 bit sessions

2014-07-15 Thread Fowler, Mark
Hi Jim,
Thought I tried that. Just have one session running currently, started
yesterday, help still linked. I'll wait for the link to expire and
confirm.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Jim Lemon
Sent: July 15, 2014 12:17 AM
To: r-help@r-project.org
Subject: Re: [R] two questions - function help and 32vs64 bit sessions

On Mon, 14 Jul 2014 01:42:54 PM Fowler, Mark wrote:
 Hello,
 
 
 
 Two unrelated questions, and neither urgent.
 
 
 
 Windows 7, R 3.0.1. Using R Console, no fancy interface.
 
 
 
 The function help ultimately becomes lost to a session kept running
for
 extended periods (days). I.e. with a new session if you invoke the 
 Help menu 'R functions (txt)...' it activates the html help and goes 
 to the named function page. This will work fine for at least a day, 
 but typically the next day invoking the help menu in this fashion will

 fail, as R looks for a temporary address it creates on your computer. 
 This gets lost, possibly due to network administration activity. So 
 then I save and start another session with same Rdata. Trivial enough 
 but irritating. Anybody know how to restore the 'link' without ending 
 and restarting the session?

Hi Mark,
I simply shut down the help browser. It will restart with a new IP
address.

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.


[R] two questions - function help and 32vs64 bit sessions

2014-07-14 Thread Fowler, Mark
Hello,

 

Two unrelated questions, and neither urgent.

 

Windows 7, R 3.0.1. Using R Console, no fancy interface.

 

The function help ultimately becomes lost to a session kept running for
extended periods (days). I.e. with a new session if you invoke the Help
menu 'R functions (txt)...' it activates the html help and goes to the
named function page. This will work fine for at least a day, but
typically the next day invoking the help menu in this fashion will fail,
as R looks for a temporary address it creates on your computer. This
gets lost, possibly due to network administration activity. So then I
save and start another session with same Rdata. Trivial enough but
irritating. Anybody know how to restore the 'link' without ending and
restarting the session?

 

I have a mix of 32-bit and 64-bit requirements, with 64 the default. I
became used to starting R sessions directly from the appropriate Rdata
workspaces. With the latest version I need to start from the generic
icon and then load the workspace if I want 32-bit. Anybody know a way to
make the Rdata files keep track of which bit version they work with, or
some trick that accomplishes the same objective? The 32-bit requirement
is usually just RODBC, and the need for it is scattered over lots of
workspaces. Again, trivial but a nuisance. A more pragmatic motive is to
not oblige users of applications to think about it. Any way to make a
session switch 'bits' with a source file?

 

Mark Fowler 
Population Ecology Division 
Bedford Inst of Oceanography 
Dept Fisheries  Oceans 
Dartmouth NS Canada 
B2Y 4A2 
Tel. (902) 426-3529 
Fax (902) 426-9710 
Email mark.fow...@dfo-mpo.gc.ca mailto:mark.fow...@dfo-mpo.gc.ca  



 


[[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] tkbind (callback)

2014-06-04 Thread Fowler, Mark
Thanks for responding, Greg. That works. Plus I wasn't aware of a ListboxSelect 
option, which is much more convenient. Trivial question if you know off the top 
of your head - why  ListboxSelect rather than  ListboxSelect? I never saw 
any examples of that type of enclosure.

I cced the list. Ran into a lot of dead end threads related to my question, and 
callbacks in general, using tcltk or tcltk2. Might spare others some headaches.



-Original Message-
From: Greg Snow [mailto:538...@gmail.com] 
Sent: June 3, 2014 1:41 PM
To: Fowler, Mark
Cc: R help
Subject: Re: [R] tkbind (callback)

I think the problem is that the tkbind function is expecting the 3rd argument 
to be a function and the arguments of functions passed to tkbind need to have 
specific names.  In your call when you do the binding the OtoFanCallback 
function is called at that time (hence the initial print) and its return value 
(which is the return value of the final cat call) is used as the binding 
function, which ends up doing nothing as you see.

I changed your bind command to:

tkbind(detlist,ListboxSelect, OtofanCallback)

and I changed the OtofanCallback function to have no arguments and ran the 
script and everything looks much more like it is working, at least when I 
changed the selection in the list box I saw the new value 'cat'ed to the screen.

hope this helps


On Tue, Jun 3, 2014 at 6:32 AM, Fowler, Mark mark.fow...@dfo-mpo.gc.ca wrote:
 Hello,



 I've migrated an ADMB application with a user dialog from S to R. The 
 script below will produce a dialog in R, and don't need data to 
 address this issue. It works in terms of capturing user inputs to pass 
 along, no problem running the ADMB program. However some of the 
 options have dependencies. E.g. if we fix a parameter it should not 
 have an estimation phase, but we want the full suite of phases 
 available to the user when the parameter is active. Thus the selection 
 of one listbox is constrained by the selection of another listbox. I 
 had callback functionality in S for this, and am now trying to 
 implement callbacks in
 tcltk2 using tkbind. At the bottom of the dialog function below I 
 include an attempt at a callback function. Just for one 
 parameter-phase pair and scenario to illustrate. It includes a 
 troubleshooting cat to tell if it works. When I run this it 
 immediately cats the correct value, although this is premature, as I haven't 
 interacted with the dialog yet.
 More importantly, it subsequently ignores interactions. If I change 
 the parameter definition in one listbox, the callback should verify 
 that the estimation phase is appropriate in the other listbox and 
 change it if not. But beyond running the callback function when the 
 dialog is created, it does not appear to be active after that. Anybody 
 know what I'm doing wrong?



 require(tcltk2)

 OtofanGUI=function() {

 OtofanR=tktoplevel()

 tktitle(OtofanR) - Age-Related Data Analysis with OTOFAN

 tkgrid(tklabel(OtofanR,text=DATA SELECTION  DEFINITION),stick=we)

 tkgrid(tklabel(OtofanR,text=If you already have files of 
 ADMB-formatted data, and/or optional PIN, click button(s) to retrieve 
 them))

 ADMBdata - tk2button(OtofanR, text = ADMB Data, width = 10, command 
 =
 function() tkgetOpenFile())

 ADMBfile - tk2button(OtofanR, text = ADMB Pin, width = 10, command 
 =
 function() tkgetOpenFile())

 tkgrid(ADMBdata)

 tkgrid(ADMBfile)

 tkgrid(tklabel(OtofanR,text=))

 tkgrid(tklabel(OtofanR,text=If you have a dataframe in R, 
 confirm/identify it, and the variables to build the ADMB inputs))

 CustomFile - tclVar(AgeData)

 tkgrid(tklabel(OtofanR,text=Dataframe name),tk2entry(OtofanR, 
 textvariable=CustomFile, width=20))

 Ages - tclVar(AgeYears)

 tkgrid(tklabel(OtofanR,text=Age variable),tk2entry(OtofanR, 
 textvariable=Ages, width=20))

 FishLens - tclVar(FishLength)

 tkgrid(tklabel(OtofanR,text=Fish Length variable),tk2entry(OtofanR, 
 textvariable=FishLens, width=20))

 OtoWts - tclVar(NA)

 tkgrid(tklabel(OtofanR,text=Otolith Weight 
 variable),tk2entry(OtofanR, textvariable=OtoWts, width=20))

 OtoLens - tclVar(NA)

 tkgrid(tklabel(OtofanR,text=Otolith Length 
 variable),tk2entry(OtofanR, textvariable=OtoLens, width=20))

 FishWts - tclVar(NA)

 tkgrid(tklabel(OtofanR,text=Fish Weight variable),tk2entry(OtofanR, 
 textvariable=FishWts, width=20))

 GroupID - tclVar(NA)

 tkgrid(tklabel(OtofanR,text=Group ID variable),tk2entry(OtofanR, 
 textvariable=GroupID, width=20))

 YearID - tclVar(NA)

 tkgrid(tklabel(OtofanR,text=Year ID variable),tk2entry(OtofanR, 
 textvariable=YearID, width=20))

 Sex - tclVar(NA)

 tkgrid(tklabel(OtofanR,text=Sex variable),tk2entry(OtofanR, 
 textvariable=Sex, width=20))

 LFdata - tclVar(NA)

 tkgrid(tklabel(OtofanR,text=Separate Length-Frequency Dataframe 
 name),tk2entry(OtofanR, textvariable=LFdata, width=20))

 FreqVar - tclVar(NA)

 tkgrid(tklabel(OtofanR,text=Frequency variable),tk2entry(OtofanR, 
 textvariable=FreqVar, width=20

Re: [R] tkbind (callback)

2014-06-04 Thread Fowler, Mark
And the path may vary a bit between installations within Windows, but
'somewhere in the R folder' is close enough to find it.

-Original Message-
From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] 
Sent: June 4, 2014 2:53 PM
To: Greg Snow; Fowler, Mark
Cc: R help
Subject: Re: [R] tkbind (callback)

On 04/06/2014 18:30, Greg Snow wrote:
 Installed with R is the documentation for tcl/tk (the original 
 language), on my computer it is in the Doc folder/dir of the TCL 
 folder/dir under the R folder.  In that documentation on listbox, near

That will only be the case on Windows.  On other OSes you need to invoke
one of

man listbox
man Tk::Listbox

or perhaps something similar.



 the bottom in the Default Bindings section it mentions the virtual 
 event ListboxSelect, so I tried that and it worked.  It looks 
 like the double angle brackets are because it is a virtual event 
 rather than a regular (real, non-virtual, ...?) event.  Virtual events

 are not tied to a direct interaction like keypress or mouse click, but

 rather a given widget can generate a virtual event at a time when it 
 makes sense to do so, e.g. ListboxSelect.

 On Wed, Jun 4, 2014 at 10:42 AM, Fowler, Mark
mark.fow...@dfo-mpo.gc.ca wrote:
 Thanks for responding, Greg. That works. Plus I wasn't aware of a
ListboxSelect option, which is much more convenient. Trivial question if
you know off the top of your head - why  ListboxSelect rather than 
ListboxSelect? I never saw any examples of that type of enclosure.

 I cced the list. Ran into a lot of dead end threads related to my
question, and callbacks in general, using tcltk or tcltk2. Might spare
others some headaches.



 -Original Message-
 From: Greg Snow [mailto:538...@gmail.com]
 Sent: June 3, 2014 1:41 PM
 To: Fowler, Mark
 Cc: R help
 Subject: Re: [R] tkbind (callback)

 I think the problem is that the tkbind function is expecting the 3rd
argument to be a function and the arguments of functions passed to
tkbind need to have specific names.  In your call when you do the
binding the OtoFanCallback function is called at that time (hence the
initial print) and its return value (which is the return value of the
final cat call) is used as the binding function, which ends up doing
nothing as you see.

 I changed your bind command to:

 tkbind(detlist,ListboxSelect, OtofanCallback)

 and I changed the OtofanCallback function to have no arguments and
ran the script and everything looks much more like it is working, at
least when I changed the selection in the list box I saw the new value
'cat'ed to the screen.

 hope this helps


 On Tue, Jun 3, 2014 at 6:32 AM, Fowler, Mark
mark.fow...@dfo-mpo.gc.ca wrote:
 Hello,



 I've migrated an ADMB application with a user dialog from S to R. 
 The script below will produce a dialog in R, and don't need data to 
 address this issue. It works in terms of capturing user inputs to 
 pass along, no problem running the ADMB program. However some of the

 options have dependencies. E.g. if we fix a parameter it should not 
 have an estimation phase, but we want the full suite of phases 
 available to the user when the parameter is active. Thus the 
 selection of one listbox is constrained by the selection of another 
 listbox. I had callback functionality in S for this, and am now 
 trying to implement callbacks in
 tcltk2 using tkbind. At the bottom of the dialog function below I 
 include an attempt at a callback function. Just for one 
 parameter-phase pair and scenario to illustrate. It includes a 
 troubleshooting cat to tell if it works. When I run this it 
 immediately cats the correct value, although this is premature, as I
haven't interacted with the dialog yet.
 More importantly, it subsequently ignores interactions. If I change 
 the parameter definition in one listbox, the callback should verify 
 that the estimation phase is appropriate in the other listbox and 
 change it if not. But beyond running the callback function when the 
 dialog is created, it does not appear to be active after that. 
 Anybody know what I'm doing wrong?



 require(tcltk2)

 OtofanGUI=function() {

 OtofanR=tktoplevel()

 tktitle(OtofanR) - Age-Related Data Analysis with OTOFAN

 tkgrid(tklabel(OtofanR,text=DATA SELECTION  
 DEFINITION),stick=we)

 tkgrid(tklabel(OtofanR,text=If you already have files of 
 ADMB-formatted data, and/or optional PIN, click button(s) to 
 retrieve
 them))

 ADMBdata - tk2button(OtofanR, text = ADMB Data, width = 10, 
 command =
 function() tkgetOpenFile())

 ADMBfile - tk2button(OtofanR, text = ADMB Pin, width = 10, 
 command =
 function() tkgetOpenFile())

 tkgrid(ADMBdata)

 tkgrid(ADMBfile)

 tkgrid(tklabel(OtofanR,text=))

 tkgrid(tklabel(OtofanR,text=If you have a dataframe in R, 
 confirm/identify it, and the variables to build the ADMB inputs))

 CustomFile - tclVar(AgeData)

 tkgrid(tklabel(OtofanR,text=Dataframe name),tk2entry(OtofanR, 
 textvariable=CustomFile, width=20))

 Ages - tclVar(AgeYears)

 tkgrid

[R] tkbind (callback)

2014-06-03 Thread Fowler, Mark
Hello,

 

I've migrated an ADMB application with a user dialog from S to R. The
script below will produce a dialog in R, and don't need data to address
this issue. It works in terms of capturing user inputs to pass along, no
problem running the ADMB program. However some of the options have
dependencies. E.g. if we fix a parameter it should not have an
estimation phase, but we want the full suite of phases available to the
user when the parameter is active. Thus the selection of one listbox is
constrained by the selection of another listbox. I had callback
functionality in S for this, and am now trying to implement callbacks in
tcltk2 using tkbind. At the bottom of the dialog function below I
include an attempt at a callback function. Just for one parameter-phase
pair and scenario to illustrate. It includes a troubleshooting cat to
tell if it works. When I run this it immediately cats the correct value,
although this is premature, as I haven't interacted with the dialog yet.
More importantly, it subsequently ignores interactions. If I change the
parameter definition in one listbox, the callback should verify that the
estimation phase is appropriate in the other listbox and change it if
not. But beyond running the callback function when the dialog is
created, it does not appear to be active after that. Anybody know what
I'm doing wrong?

 

require(tcltk2)

OtofanGUI=function() {

OtofanR=tktoplevel()

tktitle(OtofanR) - Age-Related Data Analysis with OTOFAN

tkgrid(tklabel(OtofanR,text=DATA SELECTION  DEFINITION),stick=we)

tkgrid(tklabel(OtofanR,text=If you already have files of ADMB-formatted
data, and/or optional PIN, click button(s) to retrieve them))

ADMBdata - tk2button(OtofanR, text = ADMB Data, width = 10, command =
function() tkgetOpenFile())

ADMBfile - tk2button(OtofanR, text = ADMB Pin, width = 10, command =
function() tkgetOpenFile())

tkgrid(ADMBdata)

tkgrid(ADMBfile)

tkgrid(tklabel(OtofanR,text=))

tkgrid(tklabel(OtofanR,text=If you have a dataframe in R,
confirm/identify it, and the variables to build the ADMB inputs))

CustomFile - tclVar(AgeData)

tkgrid(tklabel(OtofanR,text=Dataframe name),tk2entry(OtofanR,
textvariable=CustomFile, width=20))

Ages - tclVar(AgeYears)

tkgrid(tklabel(OtofanR,text=Age variable),tk2entry(OtofanR,
textvariable=Ages, width=20))

FishLens - tclVar(FishLength)

tkgrid(tklabel(OtofanR,text=Fish Length variable),tk2entry(OtofanR,
textvariable=FishLens, width=20))

OtoWts - tclVar(NA)

tkgrid(tklabel(OtofanR,text=Otolith Weight variable),tk2entry(OtofanR,
textvariable=OtoWts, width=20))

OtoLens - tclVar(NA)

tkgrid(tklabel(OtofanR,text=Otolith Length variable),tk2entry(OtofanR,
textvariable=OtoLens, width=20))

FishWts - tclVar(NA)

tkgrid(tklabel(OtofanR,text=Fish Weight variable),tk2entry(OtofanR,
textvariable=FishWts, width=20))

GroupID - tclVar(NA)

tkgrid(tklabel(OtofanR,text=Group ID variable),tk2entry(OtofanR,
textvariable=GroupID, width=20))

YearID - tclVar(NA)

tkgrid(tklabel(OtofanR,text=Year ID variable),tk2entry(OtofanR,
textvariable=YearID, width=20))

Sex - tclVar(NA)

tkgrid(tklabel(OtofanR,text=Sex variable),tk2entry(OtofanR,
textvariable=Sex, width=20))

LFdata - tclVar(NA)

tkgrid(tklabel(OtofanR,text=Separate Length-Frequency Dataframe
name),tk2entry(OtofanR, textvariable=LFdata, width=20))

FreqVar - tclVar(NA)

tkgrid(tklabel(OtofanR,text=Frequency variable),tk2entry(OtofanR,
textvariable=FreqVar, width=20))

OSTypes - c(Random at Length, Simple Random)

OSlist=tk2listbox(OtofanR, values=OSTypes, selection=1, selectmode =
single, height = 2, scroll = none, autoscroll = x, enabled = TRUE)

tkgrid(tklabel(OtofanR,text=Otolith Sample Type),OSlist)

ASTypes - c(Random at Length, Simple Random)

ASlist=tk2listbox(OtofanR, values=ASTypes, selection=1, selectmode =
single, height = 2, scroll = none, autoscroll = x, enabled = TRUE)

tkgrid(tklabel(OtofanR,text=Age Sample Type),ASlist)

AppApply - tk2button(OtofanR, text = Apply, width = 7, command =
function()
OtofanDT(tclvalue(ADMBdata),tclvalue(ADMBFile),tclvalue(ADMBPin),ADMBF=
NA,ADMBP=NA,tclvalue(GS),

 
Regdata=NA,tclvalue(CustomFile),tclvalue(Ages),tclvalue(FishLens),tclv
alue(OtoWts),tclvalue(OtoLens),tclvalue(FishWts),tclvalue(GroupID),tclva
lue(YearID),

tclvalue(Sex),tclvalue(LFdata),tclvalue(FreqVar),

 
tclvalue(tclVar(OSTypes[as.numeric(tkcurselection(OSlist))+1])),tclvalue
(tclVar(ASTypes[as.numeric(tkcurselection(ASlist))+1])),

 
tclvalue(tclVar(LAAdet[as.numeric(tkcurselection(detlist))+1])),tclvalue
(tclVar(LPhase[as.numeric(tkcurselection(LPlist))+1])),

 
tclvalue(tclVar(Ldist[as.numeric(tkcurselection(Ldlist))+1])),tclvalue(t
clVar(LAAstdev[as.numeric(tkcurselection(LAASDlist))+1])),

 
tclvalue(tclVar(LSDPhase[as.numeric(tkcurselection(LSDlist))+1])),tclval
ue(tclVar(LSDdist[as.numeric(tkcurselection(LSDdlist))+1])),

 
tclvalue(tclVar(LSDcov[as.numeric(tkcurselection(LSDcovlist))+1])),OAA=

[R] tk2listbox

2014-05-28 Thread Fowler, Mark
Hello,

 

I'm migrating an old S application to R, and having trouble passing
tk2listbox selections to a function. Could not find a listbox example
with tcltk2, just tcltk. The snippet below shows a few of the lines
creating the gui, including a tk2entry box that works fine for passing
content, and a tk2listbox that doesn't, and the button calling the
function. Right now I'm just passing the default values for any listbox
(OSType in the example below). I can't figure out how to pass a user
selection. Have tried variations with
tkcurselection(OSlist),tclGetValue(OSlist). How do I obtain the value
from OSlist if Simple Random was selected by the user? 

 

OtofanR=tktoplevel()

tktitle(OtofanR) - Age-Related Data Analysis with OTOFAN

tkgrid(tklabel(OtofanR,text=DATA SELECTION  DEFINITION),stick=we)

.

.

.

FreqVar - tclVar(NA)

tkgrid(tklabel(OtofanR,text=Frequency variable),tk2entry(OtofanR,
textvariable=FreqVar, width=20))

OSType - tclVar(Random at Length)

OSlist=tk2listbox(OtofanR, values=c(Random at Length, Simple
Random), value=OSType, selection=1, selectmode = single, height = 2,
scroll = none, autoscroll = x, enabled = TRUE)

tkgrid(tklabel(OtofanR,text=Otolith Sample Type),OSlist)

.

.

.

AppApply - tk2button(OtofanR, text = Apply, width = 7, command =
function()
OtofanDT(tclvalue(ADMBdata),tclvalue(ADMBFile),tclvalue(ADMBPin),ADMBF=
NA,ADMBP=NA,tclvalue(GS),tclvalue(Regdata),tclvalue(CustomFile),

 
tclvalue(Ages),tclvalue(FishLens),tclvalue(OtoWts),tclvalue(OtoLens),tcl
value(FishWts),tclvalue(GroupID),tclvalue(YearID),tclvalue(Sex),tclvalue
(LFdata),tclvalue(FreqVar),tclvalue(OSType),tclvalue(ASType),

 
tclvalue(LAAdet),tclvalue(LPhase),tclvalue(Ldist),tclvalue(LAAstdev),tcl
value(LSDPhase),tclvalue(LSDdist),tclvalue(LSDcov),tclvalue(OAA),tclvalu
e(OAAdet),tclvalue(OPhase),tclvalue(Odist),tclvalue(OAAstdev),tclvalue(O
SDPhase),tclvalue(OSDdist),

 
tclvalue(CORR),tclvalue(CORest),tclvalue(CPhase),tclvalue(GS2),tclvalue(
PAAPhase)))

 

Mark Fowler 
Population Ecology Division 
Bedford Inst of Oceanography 
Dept Fisheries  Oceans 
Dartmouth NS Canada 
B2Y 4A2 
Tel. (902) 426-3529 
Fax (902) 426-9710 
Email mark.fow...@dfo-mpo.gc.ca mailto:mark.fow...@dfo-mpo.gc.ca  



 


[[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] calcMin

2013-02-19 Thread Fowler, Mark
I tried to use calcMin with a function that uses a number of ...
arguments (all args from resid on) besides the vector of parameters
being fit. Same idea as optim, nlm, nlminb for which this form of ...
syntax works. But with calcMin I get an error regarding unused
arguments. No partial matches to previous arguments that I can see.
Anybody know the reason or fix for this?

calcMin(pvec=data.frame(val=par,min=rep(.01,length(par)),max=rep(100
,length(par)),active=rep(TRUE,length(par))),func=optimwrap2,
resid=resid,caa=caa,na=na,vcode=vcode,maa=maa,ny=ny,nind=nind,qage=qage,
selmod=selmod,oldagei=oldagei,vpaflag=vpaflag)
Error in f(x, ...) : 
  unused argument(s) (resid = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), caa = c(0.344919912565012,
1.36925481463155, 4.94519930946541, 5.12996667120799, 11.0171415280463,
9.4432641668968, 4.7216320834484, 3.14775472229893, 1.57387736114947,
3.14775472229893, 


And an example using optim to address concerns about the user function
itself. [I'm trying to concoct a solver that handles far-off initial
parameter values without getting stuck in local minima. I'm searching
for something faster and more intelligent than this example.]

 for(i in 1:9) {
+
fitpars=optim(par=parset1,fn=optimwrap,control=list(maxit=100),resid=res
id,caa=caa,na=na,vcode=vcode,maa=maa,ny=ny,nind=nind,qage=qage,selmod=se
lmod,oldagei=oldagei,vpaflag=vpaflag)
+ parset2=fitpars$par
+ parval2=fitpars$value
+ print(parval2)
+ print(parset2)
+ if((parval1-parval2)1.0) {
+ parval1=parval2
+ parset1=parset2
+ }
+ if((parval1-parval2)1.0  parval20.1) {
+ parset1=par*pardown[i]
+ }
+ }
[1] 193.1500
[1] 43.84105 43.47576 42.91166 41.81009 42.57930
[1] 15.69411
[1] 13.35845 12.52650 12.28231 11.78171 11.29699
[1] 15.65625
[1] 11.91989 11.10244 10.84155 10.34886  9.85170
[1] 15.45980
[1] 10.374731  9.569294  9.302000  8.779963  8.325952
[1] 14.85332
[1] 9.105026 8.293079 8.004561 7.521170 7.080387
[1] 8.18217
[1] 6.209737 5.876993 5.229392 4.887182 4.102208
[1] 6.720143
[1] 6.180562 5.276061 5.057946 4.561191 4.317552
[1] 0.04003793
[1] 3.754422 2.871289 2.876904 2.091451 1.806243
[1] 0.04003793
[1] 3.754422 2.871289 2.876904 2.091451 1.806243

Mark Fowler
Population Ecology Division
Bedford Inst of Oceanography
Dept Fisheries  Oceans
Dartmouth NS Canada
B2Y 4A2
Tel. (902) 426-3529
Fax (902) 426-9710
Email mark.fow...@dfo-mpo.gc.ca
Home Tel. (902) 461-0708
Home Email mark.fow...@ns.sympatico.ca



[[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] Attached file following download failure

2009-08-12 Thread Fowler, Mark

Hello,

I'm working with a package that uses download.file in functions to
extract information from remote databases. My current environment is
Windows XP Pro SP3, R 2.7. A full extraction can be a great deal of
data, so the download is accomplished in generally manageable packets,
such that a single download will result in many files, which are written
to a directory. It is not uncommon for a progressing download to fail
unexpectedly midstream (firewall issues, server crashes/reboots, etc).
When this occurs the last file remains attached (and empty), at least as
far is Windows is concerned. I need to delete it to properly resume
downloading. Windows won't let me do that unless I exit R, as it regards
the file as in use. And unlink won't do it, although it doesn't report
an error either. And if I try to unlink the folder containing the
problem file, it deletes all files in the folder except the attached
one, does not delete the folder, and again no message to indicate any
problem. Any way to release the file without exiting and restarting R?


 showConnections(all=TRUE)
  description class  mode text   isopen   can read can write
0 stdin terminal r  text opened yesno 
1 stdoutterminal w  text opened no yes
2 stderrterminal w  text opened no yes

 unlink(D:\\sharks\\KalmanFilter\\F34520\\AG2008072_2008074_sst.xyz)

#does nothing, no message (status 0)

 unlink(D:\\sharks\\KalmanFilter\\F34520,recursive=TRUE)

#does not delete the folder, deletes any files in the folder EXCEPT the
attached one, no message (status 0)

   Mark Fowler
Population Ecology Division
   Bedford Inst of Oceanography
   Dept Fisheries  Oceans
   Dartmouth NS Canada
B2Y 4A2
Tel. (902) 426-3529
Fax (902) 426-9710
Email fowl...@mar.dfo-mpo.gc.ca
Home Tel. (902) 461-0708
Home Email mark.fow...@ns.sympatico.ca



[[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] Passing a list object to lapply

2009-08-11 Thread Fowler, Mark
Hello,

I'm having difficulty passing an object name to a lapply function. Can
somebody tell me the trick to make this work?


#Works
T13702 - TRACKDATA[[13702.xls]][[data]]
min(unlist(lapply(list(T13702), function(x) mdy.date(x[1, 2], x[1, 1],
x[1, 3]
16553

#Works
d-2
assign(paste(T,substr(names(TRACKDATA)[d],1,(nchar(names(TRACKDATA)[d]
)-4)),sep=),TRACKDATA[[d]][[data]],pos=1)
min(unlist(lapply(list(T13702), function(x) mdy.date(x[1, 2], x[1, 1],
x[1, 3]
16553

#Fails.
d-2
assign(paste(T,substr(names(TRACKDATA)[d],1,(nchar(names(TRACKDATA)[d]
)-4)),sep=),TRACKDATA[[d]][[data]],pos=1)
min(unlist(lapply(list(paste(T,substr(names(TRACKDATA)[d],1,(nchar(nam
es(TRACKDATA)[d])-4)),sep=)), function(x) mdy.date(x[1, 2], x[1, 1],
x[1, 3]
Error in x[1, 2] : incorrect number of dimensions
 traceback()
4: mdy.date(x[1, 2], x[1, 1], x[1, 3])
3: FUN(X[[1L]], ...)
2: lapply(list(paste(T, substr(names(TRACKDATA)[d], 1,
(nchar(names(TRACKDATA)[d]) - 
   4)), sep = )), function(x) mdy.date(x[1, 2], x[1, 1], x[1, 
   3]))
1: unlist(lapply(list(paste(T, substr(names(TRACKDATA)[d], 1, 
   (nchar(names(TRACKDATA)[d]) - 4)), sep = )), function(x)
mdy.date(x[1, 
   2], x[1, 1], x[1, 3])))

#Fails (trying noquote).
min(unlist(lapply(list(noquote(paste(T,substr(names(TRACKDATA)[d],1,(n
char(names(TRACKDATA)[d])-4)),sep=))), function(x) mdy.date(x[1, 2],
x[1, 1], x[1, 3]
Error in unclass(x)[...] : incorrect number of dimensions
 traceback()
6: `[.noquote`(x, 1, 2)
5: x[1, 2]
4: mdy.date(x[1, 2], x[1, 1], x[1, 3])
3: FUN(X[[1L]], ...)
2: lapply(list(noquote(paste(T, substr(names(TRACKDATA)[d], 1, 
   (nchar(names(TRACKDATA)[d]) - 4)), sep = ))), function(x)
mdy.date(x[1, 
   2], x[1, 1], x[1, 3]))
1: unlist(lapply(list(noquote(paste(T, substr(names(TRACKDATA)[d], 
   1, (nchar(names(TRACKDATA)[d]) - 4)), sep = ))), function(x)
mdy.date(x[1, 
   2], x[1, 1], x[1, 3])))

   Mark Fowler
Population Ecology Division
   Bedford Inst of Oceanography
   Dept Fisheries  Oceans
   Dartmouth NS Canada
B2Y 4A2
Tel. (902) 426-3529
Fax (902) 426-9710
Email fowl...@mar.dfo-mpo.gc.ca
Home Tel. (902) 461-0708
Home Email mark.fow...@ns.sympatico.ca



[[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] Questions on the results from glmmPQL(MASS)

2008-12-08 Thread Fowler, Mark
Ben Bolker's response to a glmmPQL question below raises a question. 

Does the issue of bias with binomial data reported by Breslow (2003)
remain valid with respect specifically to Ripley's treatment of PQL in
glmmPQL? Breslow makes no reference to this particular implementation.
He does discuss that of SAS GLIMMIX, but it does not work exactly as
glmmPQL. I've compared results between binomial models between these two
approaches, and they usually give compatible results. But they can
diverge markedly in enough cases that I wish I understood just how they
differ, so wonder if relative vulnerability to bias could be involved.

BTW Ben refers Zhijie to a separate user group that focuses on mixed
models. I knew nothing of this group. Following through on the link I
found their archive, which included a fairly extensive thread on a
question I posed to the regular R group in October. My question was
forwarded, by Ben Bolker in fact (Wald F tests thread), for which I'm
grateful. But I'm embarassed to say I only learned of the thread, even
though I initiated it, because of this email. I just assumed no
responses, other than R-News, and that was mostly questions to me about
glmmPQL, rather than attempts to answer my own question. I'm clearly not
the only one unaware of the mixed-models group, and a very sad choice
for asking questions about glmmPQL.


   Mark Fowler
Population Ecology Division
   Bedford Inst of Oceanography
   Dept Fisheries  Oceans
   Dartmouth NS Canada
B2Y 4A2
Tel. (902) 426-3529
Fax (902) 426-9710
Email [EMAIL PROTECTED]
Home Tel. (902) 461-0708
Home Email [EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Ben Bolker
Sent: December 6, 2008 4:10 PM
To: r-help@r-project.org
Subject: Re: [R] Questions on the results from glmmPQL(MASS)




zhijie zhang wrote:
 
 Dear Rusers,
I have used R,S-PLUS and SAS to analyze the sample data bacteria 
 in MASS package. Their results are listed below.
 I have three questions, anybody can give me possible answers?
 Q1:From the results, we see that R get 'NAs'for AIC,BIC and logLik, 
 while S-PLUS8.0 gave the exact values for them. Why?
 

This is a philosophical difference between S-PLUS and R.
Since glmmPQL uses quasi-likelihood, technically there is no
log-likelihood (hence no AIC nor BIC, which are based on the
log-likelihood) for this model -- the argument is that one is limited to
looking at Wald tests (testing the Z- or t-statistics, i.e. parameter
estimates divided by estimated standard errors) for inference in this
case.


zhijie zhang wrote:
 
 Q2: The model to analyse the data is logity=b0+u+b1*trt+b2*I(week2), 
 but the results for Random effects in R/SPLUS confused me. SAS may be
clearer.
 Random effects:
  Formula: ~1 | ID
(Intercept)  Residual
 StdDev:1.410637 0.7800511
   Which is the random effect 'sigma'? I think it is 1.410637, but 
 what does 0.7800511 mean? That is, i want ot know how to explain/use

 the above two data for Random effects.
 

The (Intercept) random effect is the variance in intercept across
grouping factors .
The residual (0.78) is (I believe) the individual-level error estimated
for the underlying linear mixed model -- you can probably ignore this.



zhijie zhang wrote:
 
 Q3:In SAS and other softwares, we can get *p*-values for the random 
 effect 'sigma', but i donot see the *p*-values in the results of 
 R/SPLUS. I have used attributes() to look for them, but no *p* values.

 Anybody knows how to get *p*-values for the random effect 'sigma',.
   Any suggestions or help are greatly appreciated.
 #R Results:MASS' version 7.2-44; R version 2.7.2
 library(MASS)
 summary(glmmPQL(y ~ trt + I(week  2), random = ~ 1 | ID,family = 
 binomial, data = bacteria))
 
 Linear mixed-effects model fit by maximum likelihood
  Data: bacteria
   AIC BIC logLik
NA  NA NA
 
 Random effects:
  Formula: ~1 | ID
 (Intercept)  Residual
 StdDev:1.410637 0.7800511
 
 Variance function:
  Structure: fixed weights
  Formula: ~invwt
 Fixed effects: y ~ trt + I(week  2)
 Value  Std.Error  DF   t-value
 p-value
 (Intercept)  3.4120140.5185033   169   6.580506  0.
 trtdrug -1.247355 0.6440635 47  -1.936696  0.0588
 trtdrug+-0.7543270.6453978 47  -1.168779  0.2484
 I(week  2)TRUE -1.607257 0.3583379 169 -4.485311  0.
  Correlation:
 (Intr) trtdrg trtdr+
 trtdrug -0.598
 trtdrug+-0.571  0.460
 I(week  2)TRUE -0.537  0.047 -0.001
 
 #S-PLUS8.0: The results are the same as R except the followings:
 AIC  BIClogLik
 1113.622 1133.984 -550.8111
 
 #SAS9.1.3
 proc nlmixed data=b;
  parms b0=-1 b1=1 b2=1 sigma=0.4;
  yy=b0+u+b1*trt+b2*week;
  p=1/(1+exp(-yy));
  Model 

[R] glmmPQL Wald-type F-tests

2008-10-03 Thread Fowler, Mark
Hello,
Might anyone know how to conduct Wald-type F-tests of the fixed
effects estimated by glmmPQL? I see this implemented in SAS (GLIMMIX),
and have seen it recommended in user group discussions, but haven't come
across any code to accomplish it. I understand the anova function treats
a glmmPQL fit as an lme fit, with the test assumptions based on maximum
likelihood, which is inappropriate for PQL. I'm using S-Plus 7. I also
have R 2.7 and S-Plus 8 if necessary.

   Mark Fowler
Population Ecology Division
   Bedford Inst of Oceanography
   Dept Fisheries  Oceans
   Dartmouth NS Canada
B2Y 4A2
Tel. (902) 426-3529
Fax (902) 426-9710
Email [EMAIL PROTECTED]
Home Tel. (902) 461-0708
Home Email [EMAIL PROTECTED]



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