Re: [R] modifying factors in a data frame

2010-08-19 Thread Abhishek Pratap
Kiaora Koe Peter

It worked. I hope I am getting my Maori right.

-Abhi

On Thu, Aug 19, 2010 at 1:50 AM, Peter Alspach
peter.alsp...@plantandfood.co.nz wrote:

 Tena koe Abhi

 The easiest way is probably

 data1$sample - as.numeric(data1$sample)

 If you want it to remain as a factor then

 data1$sample - as.factor(as.numeric(data1$sample))

 HTH 

 Peter Alspach

  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
  project.org] On Behalf Of Abhishek Pratap
  Sent: Thursday, 19 August 2010 5:41 p.m.
  To: r-help@r-project.org
  Subject: [R] modifying factors in a data frame
 
  Hi All
 
  I have a data frame in which on the columns is a factor with following
  levels
 
  Levels: M006 M0114 M0379 M0432 M0823 M1012 M1096 M1107 SW393 SW708
 
  I want to change all the M006 to 1, M0114 to 2 and so on.  What I
  am
  trying is not working.
 
  data1$sample[data1$sample =='M006'] - 1
  Warning message:
  In `[-.factor`(`*tmp*`, data1$sample == M006, value = 1) :
    invalid factor level, NAs generated
 
 
  Any slick way to do this ?
 
  Thanks!
  -Abhi
 
        [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-
  guide.html
  and provide commented, minimal, self-contained, reproducible code.

__
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] R reports

2010-08-19 Thread Donald Paul Winston

I don't see much in the way of an ability to write reports in R the way you
can with SAS. You basically have to write a program with R in a 3G way
unlike SAS with it's 4G proc print and proc report. 

Are there similar R functions and packages? 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-reports-tp2330733p2330733.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] Help with Vectors and conditional functions

2010-08-19 Thread Ferreira, Thiago Alves
Good morning,

I have something like this: names(coint_tests) - apply(b,2,paste, 
collapse=_) which prints 15 names like: A_B, C_D, E_F, ...
AA,B,C,D.. Are time series. Then there is a vector called coint_tests of length 
15 which yields yes or no.

I need to add a function to plot the time series Ai_Bi if the coint_tests 
vectors gives me a YES.


I tried:for (i in 1:(length(coint_tests))
if (coint_tests[[i]]=YES) {plot(coint_tests[i])}

But it does not work. I would most appreciate if someone could give me some 
insight as to how to sort this out. Thank you

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Rolling window linear regression

2010-08-19 Thread Achim Zeileis
The function rollapply() in package zoo can be used to run rolling 
regressions. See the examples in the manual page for a worked example.


On Thu, 19 Aug 2010, siddharth.gar...@gmail.com wrote:


Thanks, I will try it.

Regards
Sid
Sent on my BlackBerry? from Vodafone

-Original Message-
From: Dennis Murphy djmu...@gmail.com
Date: Wed, 18 Aug 2010 08:46:49
To: siddharth.gar...@gmail.com
Subject: Re: [R] Rolling window linear regression

This is called kernel-based regression; the most popular version is loess.
Try

library(sos)
findFn('loess')

to see some of the various implementations available, including graphics
functions. The basic function is loess(); the window width is related to the
span = parameter of that function.

HTH,
Dennis

On Wed, Aug 18, 2010 at 2:08 AM, siddharth.gar...@gmail.com wrote:


Hi

Does there exists an efficient way of performing linear regression on
rolling windows in R.

The exact problem is:

We have a dataset of length l. The window size is w.

Now, I perform linear regression on window i to (i+w) . Using this model
can I perform linear regression over window (i+1) to (i+w+1).

Thanks
Sid
Sent on my BlackBerry? from Vodafone
__
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] Help with Vectors and conditional functions

2010-08-19 Thread Ivan Calandra
  Hi,

I haven't spent too much time on it, but that might help:
if (coint_tests[[i]]==YES)...
Note the double = which is the operator for equality. The single = 
is the assignment operator, especially with arguments.

HTH, Ivan

Le 8/19/2010 09:03, Ferreira, Thiago Alves a écrit :
 Good morning,

 I have something like this: names(coint_tests)- apply(b,2,paste, 
 collapse=_) which prints 15 names like: A_B, C_D, E_F, ...
 AA,B,C,D.. Are time series. Then there is a vector called coint_tests of 
 length 15 which yields yes or no.

 I need to add a function to plot the time series Ai_Bi if the coint_tests 
 vectors gives me a YES.


 I tried:for (i in 1:(length(coint_tests))
  if (coint_tests[[i]]=YES) {plot(coint_tests[i])}

 But it does not work. I would most appreciate if someone could give me some 
 insight as to how to sort this out. Thank you

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php


[[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] Rolling window linear regression

2010-08-19 Thread Achim Zeileis

On Thu, 19 Aug 2010, siddharth.gar...@gmail.com wrote:


Hi

That's right, but that isn't what I am trying to achieve. When we have a 
rolling window, the only difference between two neighboring windows is 
first and the last point.


Yes, this is what the example does. Consider the following artificial 
example:


## artificial bivariate series of length 5
set.seed(1)
z - zoo(matrix(rnorm(10), ncol = 2))
colnames(z) - c(y, x)

## rolling regression of width 4
rollapply(z, width = 4,
  function(x) coef(lm(y ~ x, data = as.data.frame(x))),
  by.column = FALSE, align = right)

## result is identical to
coef(lm(y ~ x, data = z[1:4,]))
coef(lm(y ~ x, data = z[2:5,]))

First window indexes from i to i+w and second 
window from (i+1) to (i+w+1). Is there a efficient way to run regression 
on second window if I am given the results of regression on the first 
window.


Yes, the above computations are not efficient but use a brute-force 
approach. I'm not sure whether there is a rolling regression 
implementation that uses an updating algorithm.

Z

Regards 
Sid

--Original Message--
From: Achim Zeileis
To: siddharth.gar...@gmail.com
Cc: Dennis Murphy
Cc: R-help@r-project.org
Subject: Re: [R] Rolling window linear regression
Sent: Aug 19, 2010 12:42 PM

The function rollapply() in package zoo can be used to run rolling 
regressions. See the examples in the manual page for a worked example.


On Thu, 19 Aug 2010, siddharth.gar...@gmail.com wrote:


Thanks, I will try it.

Regards
Sid
Sent on my BlackBerry? from Vodafone

-Original Message-
From: Dennis Murphy djmu...@gmail.com
Date: Wed, 18 Aug 2010 08:46:49
To: siddharth.gar...@gmail.com
Subject: Re: [R] Rolling window linear regression

This is called kernel-based regression; the most popular version is loess.
Try

library(sos)
findFn('loess')

to see some of the various implementations available, including graphics
functions. The basic function is loess(); the window width is related to the
span = parameter of that function.

HTH,
Dennis

On Wed, Aug 18, 2010 at 2:08 AM, siddharth.gar...@gmail.com wrote:


Hi

Does there exists an efficient way of performing linear regression on
rolling windows in R.

The exact problem is:

We have a dataset of length l. The window size is w.

Now, I perform linear regression on window i to (i+w) . Using this model
can I perform linear regression over window (i+1) to (i+w+1).

Thanks
Sid
Sent on my BlackBerry? from Vodafone
__
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]]

Sent on my BlackBerry® from Vodafone__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading lmer table

2010-08-19 Thread Mark Difford

Hi Nicola,

 In few word: does this row indicate a global effect of the predictor
 'cat' 
 or a more specific passage?

It indicates a more specific passage.  Use anova(m7) for global/omnibus.
Check this for yourself by fitting the model with different contrasts. The
default contrasts in R are treatment contrasts.

##
m7 - lmer(log.second ~ Cond + cat + (1|subjID) + (1|Code), data = march.f, 
contrasts=list(Cond=contr.treatment,
cat=contr.treatment))
m7s - lmer(log.second ~ Cond + cat + (1|subjID) + (1|Code), data = march.f, 
contrasts=list(Cond=contr.sum, cat=contr.sum))
summary(m7)
summary(m7s)
anova(m7)
anova(m7s)

Regards, Mark.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/reading-lmer-table-tp2329521p2330809.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] AIC in MuMIn

2010-08-19 Thread Gavin Simpson
On Thu, 2010-08-19 at 04:42 +0800, elaine kuo wrote:
 Yes, I tried the example in the ?dredge and agreed that something else
 caused the mistake.
 
 
 Aside from the cause which takes time to clarify (16 explanatory
 variables in the model), 
 I would like to ask another question.
 
 
 Please kindly advise if it is possible to show the singular model with
 only one certain variable using the command subset. (or maybe others)
 I tried the command subset=X3 but it returned multiple models
 including X3.
 
 
 The above demand might look unnecessary when visual inspection offers
 the solution with few exp. variables. 
 However, it is of great importance for recognizing AIC for each
 variable in the model selection with more than 10 variables.

No, there isn't. The object returned by dredge is a data frame so you
can subset it to your hearts content, but you'll need to select rows
where you specify that all your variables (except the one you are
interested in) are missing (NA). Without writing this all out, I don't
know of a quick way of doing this sort of subsetting.

In effect, you want

data(Cement)
lm1 - lm(y ~ ., data = Cement)
dd - dredge(lm1, subset = X1)

want - with(dd, is.na(X)  is.na(X2)  is.na(X3)  is.na(X4))
want
## how many models selected?
sum(want)
## OK selected just 1, show it
dd[want, , drop = FALSE]

Oh, actually, I suppose you could automate this, so it will return all
models with single variable:

dd - dredge(lm1)
parms - !is.na(dd[, -c(1, (ncol(dd) - c(0:7)))])
want - which(rowSums(parms) == 1)
dd[want, ]

Having said all this, I don't think this is a good way to do model
selection.

G

 
 
 Please kindly help and thank you in advance.
 
 
 Elaine
 
 
 code
 library(MuMIn)
 
 
 data(Cement)
 lm1  -  lm(y  ~  .,  data  =  Cement)
 dd  -  dredge(lm1,  beta  = FALSE,  eval  =  TRUE,  rank  =  AIC)
 X3-dredge(lm1,  rank  =  AIC, subset=X3)
 
 On Wed, Aug 18, 2010 at 9:18 PM, Gavin Simpson
 gavin.simp...@ucl.ac.uk wrote:
 On Wed, 2010-08-18 at 21:11 +0800, elaine kuo wrote:
  A cause other than data based on standardized regression
  was identified.
  It is that the manual command added with target - at the
 left hand
  side.
 
  C1 did not work but C2 did.
  C1 target-dredge(mig.stds,  subset  =  temp_max)
 
 
  C2 dredge(mig.stds,  subset  =  temp_max)
 
 
 Glad you have this working, but that can't possibly be the
 reason for
 the error. There must be something else going on. The only
 difference
 between the two calls is that you are storing the result
 somewhere, yet
 the error was coming from within the running of the dredge
 function.
 
 If everything works from within a new, clean R session then
 great.
 
 
 G
 
 
 
  Elaine
 
  On Wed, Aug 18, 2010 at 5:37 PM, elaine kuo
 elaine.kuo...@gmail.com
  wrote:
 
 
  
  Please suggest how to define subset in my
 case
 
 
  How would I know? I still haven't seen your
 data. You
  seem to be
  mistaken on what is and is not included in
 your model
  and you fitted it.
  What hope do we have...? However, given the
 model
  'mig.stds' from above
  in this email:
 
   mig.stds -lm(SummerM_ratio ~ temp_max +
 evi_mean +
  topo_var +
topo_mean + coast +
 Iso_index_0808,
## now tell R were to find
 the
  variables in formula
data = datum.std)
   ## If you are fitting a Gaussian GLM it is
 better
  fitted with lm()
 
 
  If you want to consider dredged models
 containing
  temp_max, then you
  would do
 
  dredge(mig.stds, subset = temp_max)
 
  If you want models that contain temp_max and
 coast,
  then you'd do
 
  dredge(mig.stds, subset = temp_max  coast)
 
  or
 
  dredge(mig.stds, fixed = ~ temp_max + coast)
 
  The bits you include in subset or fixed are
 the names
  of your variables
  that you want in or out of the models. In
 your 

Re: [R] Yet another memory limit problem

2010-08-19 Thread Tim Clark
Thanks for everyones help - mydat was not what I thought it was.  str(mydat) 
showed:
 $ Date   : Factor w/ 1504 levels ,2002-11-22,..: 295 295 295 295 295 
295 295 295 295 295 ...
 $ Time   : Factor w/ 72447 levels ,00:00:00,..: 15423 15470 15509 
17112 
17136 17159 17209 17239 17266 21527 ...
 
I didn't properly convert date and time using chron.  Not sure how R plots 
factor levels, but obviously it has problems with it!

Aloha,

Tim


 Tim Clark
Department of Zoology 
University of Hawaii 



- Original Message 
From: Peter Dalgaard pda...@gmail.com
To: Tim Clark mudiver1...@yahoo.com
Cc: r-help@r-project.org
Sent: Wed, August 18, 2010 8:34:56 AM
Subject: Re: [R] Yet another memory limit problem

On 08/18/2010 11:19 AM, Tim Clark wrote:
 Dear List,
...
 I would appreciate some help.  I think I set the target field correctly, both 
 memory.size and memory.limit indicate I have over 2G of memory, yet I can't 
 allocate 831.3Mb?  It just doesn't make sense to me.

That shouldn't by itself cause concern. It is always the _last_
allocation that triggers the message, so it could happen due to
allocation of 3 vectors of size 800M. Straw, camel, back...

Another matter is that memory.size is the amount _used_, not amount
_available_, so you would seem to have more like 1500M left.

However, it does look odd that mydat with dimensions 245x9 should
generate an 800M memory request. As others have suggested, perhaps mydat
is not what you think it should be...

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com



  
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Why does Bootstrap work for one of similar models but not for the other?

2010-08-19 Thread Reiko Akiyama

Dear all,

Could anyone help me figure out why bootstrap works for one of similar  
models but not for the other and how I can solve it?


I am using R 2.11.1 in Windows and would like to get confidence  
intervals for my models A and B by bootstrapping. However, bootstrap  
gives expected output for the model A but not for B, which I found was  
puzzling because the structure of the models is similar as I describe  
below. I had another person running the models in another computer and  
the same thing happens so this does not seem to be computer-specific.  
I could not find a clue for a solution in the R archive or in the R  
book (at least to the extent I understood).


Here are the properties of the models A and B and what happens when I  
run bootstrap.


modelA: rA~stA1+ stA2+stA3
model B: rB~stB1+stB2+stB3
The variables for the models A and B are in the same dataset called  
?data?. The sample size is 32 for both models and the value range and  
distribution of the variables in the two models are similar.  
(Variables from both models are at the end of this enquiry.)


[bootstrap of the model A]
A.fun-function(data,indices)coefficients(lm(rA~stA1+  
stA2+stA3,data=data[indices,]))

bootA-boot(data,A.fun,1000);bootA

ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = data, statistic = A.fun, R = 1000)
Bootstrap Statistics :
   original   biasstd. error
t1*  1.00016501 -0.004350842  0.05309877
t2*  0.02343475  0.008501989  0.07638795
t3* -0.01602954 -0.004980400  0.07806805
t4*  0.03601194 -0.005417404  0.08510128

[bootstrap of the model B]

B.fun-function(data,indices)coefficients(lm(rB~stB1+stB2+stB3),data=data[indices,])
bootB-boot(data,B.fun,1000);bootB

ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = data, statistic = B.fun, R = 1000)
Bootstrap Statistics :
   original  biasstd. error
t1*  0.99975370   0   0
t2* -0.06091574   0   0
t3*  0.27506203   0   0
t4* -0.03040424   0   0

What am I missing here?
I highly appreciate any comments and suggestions.

Best Wishes,
Reiko Akiyama
Uppsala University
Sweden

[Variables from the model A]

rA

 [1] 0.7100881 1.0406464 1.1100229 0.6182664 0.7345739 1.0577865 0.6856024
 [8] 0.5264447 1.5793340 1.1793993 0.6488737 1.0214076 1.3589618 1.0528893
[15] 1.5242409 1.3761019 0.9427032 0.6794809 1.4752693 0.7737512 1.0120797
[22] 0.8692458 1.2079660 1.0610513 0.8570029 0.9794319 1.0957395 0.8243552
[29] 0.4162586 1.4079334 1.0692132 1.1059419

stA1

 [1] -0.9126354 -0.8331680 -1.0239203 -0.3721959 -0.5311308  0.7564474
 [7] -1.1828933 -1.2146727 -0.8172593 -0.9921410 -0.5152602 -0.9285442
[13] -0.4198840 -0.9444529 -0.4198840 -0.8331680  1.2810163  1.4081718
[19]  1.7102091  2.3460247  1.3806653  1.3127957  1.2333282  1.4240806
[25] -0.1337555 -0.1973142  0.2954372 -0.1337555 -0.4039753 -0.3880665
[31]  0.2795666 -0.2291317

stA2

 [1] -0.2292617 -0.4917962 -0.6437899 -1.2241293 -0.3398026 -2.0946384
 [7] -1.0721356 -1.2655821 -1.3484877 -1.8873744 -0.7543307 -0.9615948
[13] -0.3674378  0.4483537  0.8761467 -0.8786892  0.5312593  1.1524988
[19]  0.3234425 -0.4088906  0.5102565  1.1945044  1.7748438  0.6827002
[25]  0.6418001  1.1801340  0.4207184  0.8076114  0.9181522  0.6827002
[31]  0.9037819  0.9181522

stA3

 [1]  0.86459627 -0.23416149 -2.00372671  0.04161491  0.78881988 -2.50869565
 [7] -0.02608696 -0.84161491 -0.95465839 -0.28012422  0.47080745  0.07577640
[13]  0.84223602  0.24472050  2.83975155  0.43043478 -0.75652174 -0.92795031
[19]  0.29192547 -0.78633540 -0.78385093 -0.51242236  0.59627329  0.19068323
[25]  0.02919255  1.17018634 -0.19440994  0.68385093  1.08881988 -0.28385093
[31] -0.71118012  1.06583851

[Variables from the model B]

rB

 [1] 1.5385568 1.5885100 1.3587255 0.8991566 1.4086787 0.3097095 0.9191378
 [8] 0.3996252 0.7393065 0.6993440 1.2488286 1.4186693 1.4586318 1.8282851
[15] 0.8991566 0.9790816 1.0889785 1.0090535 0.7792690 0.8991566 0.8791753
[22] 0.7892597 0.6294096 0.9690910 1.0689973 0.5994377 0.6793628 0.7293159
[29] 0.9690910 0.7393065 0.7193253 1.7583507

stB1

 [1] -0.67898627 -0.94275552 -1.32045796  0.03417996 -1.18276552  2.01872951
 [7] -1.75937865 -1.85016395 -0.70319013 -0.89159673 -0.35055299 -0.38890124
[13] -0.81445562 -0.98941255 -0.95548269 -0.63066192  0.52759406  1.27063302
[19]  1.19746568  1.34424498  0.62679931  1.15103096  1.24195520  0.94395043
[25]  0.20232868  0.71085978  0.53654199  0.67470683  0.41377202  0.38428833
[31]  0.58178180 -0.40626910

stB2

 [1]  2.18599646  1.64030436  0.29913150 -0.30874645  2.29052340 -2.13238029
 [7] -0.78386750 -0.53233418 -0.96552917 -1.00046883 -0.02227346 -0.71399585
[13]  0.42490201  1.27034048  0.09650296 -0.32970563 -0.23188840 -0.24586119
[19]  0.04061179 -0.07118592 -0.49040812 -0.04323265 -0.06419952 -0.18297594
[25]  0.40393513 -0.73495504 -0.53233418 -0.23188840  0.13144263 -0.21092921
[31] -1.24501576  2.29052340

stB3

 [1] -0.368  0.3416667 -1.788 -1.813 -0.617  

[R] Slow response from Windows Rgui - caused by Word?

2010-08-19 Thread Jon Olav Skoien

Dear list,

I quite often experience a delayed response when I type in the console 
of the RGui of my computer. When typing a command, the text only appears 
letter-by-letter on the console if I type rather slow (maximum 1-2 
letters per second), otherwise it appears some time after I finished 
writing the complete command. Moving back and forth in a command with 
arrows keys are similarly slow if I need to correct something (which I 
often have to do, given that I cannot read while writing).


Although this might sound like a minor problem (thinking takes more time 
than writing when programming, and writing should anyway take place in a 
proper text editor), it is quite annoying, especially when I just want 
to rerun a long command after changing something at the start of the line.


Strangely, it seems that this problem starts when I open a 
Word-document, and it stops when I close all open Word-documents. I do 
not have any problems with other programs (including other programs from 
the office package), and computation seems to run as quick as normal.


Some info about my system:

 sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252  
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C 
[5] LC_TIME=English_United States.1252   


attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base
 objects()

character(0)

And as Word seems to be connected to the problem - I am running Windows 
7 Pro with Office 2007, the only Add-In to Word is Endnote (version 9). 
I have turned off the instant formatting option, as it also caused some 
other problems.


Does anyone have a clue how I can have a Word document open and at the 
same time work with R without having this delayed response?


Best wishes,
Jon

__
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] texi2dvi: option clean also deletes the generated pdf file

2010-08-19 Thread Marius Hofert
Dear expeRts,

below are two examples of using texi2dvi. The problem becomes clear from the 
second example: on cleaning, texi2dvi also deletes the generated .pdf file.
Is there a solution?

Cheers,

Marius

## Example 1: texi2dvi cleans fine, without deleting the generated .pdf
require(tools)
sink(file=myLaTeXFile1.tex)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
sink()
texi2dvi(myLaTeXFile1.tex,pdf=TRUE,clean=TRUE,quiet=TRUE) 

## Example 2: texi2dvi also deletes the generated .pdf
require(tools)
filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
sink(file=filepath)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
sink()
texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE)

__
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] ROCR predictions

2010-08-19 Thread Assa Yeroslaviz
Hello everybody,

yes I'm sorry. I can see it is not so easy to understand.
I'l try to explain a bit more. The experiment was used to compare two
(protein domain) data bases and find out whether or not the results founded
in one are comparable to the second DB.
the first column shows the list of the various inputs in the DB, the second
lists the various domains for each gene. the p-value column calculates the
probability that the found in column four (Expected) to be found by chance.
in column five the expected values was listed.
The calculation of the TP,TN,FP,FN was made many times, each time with a
different p-value (from p=1,...,p=10E-12) as a threshold to calculate the
various values of TP,TN, etc.

The goal of this calculation was to find the optimal p-value wit ha maximum
of TP and a minimum of FP.

To do so I thought about making the column of p-values my predictions and
the values in the column Is.Expected (TRUE,FALSE) to my labels.
This how I calculated my first ROC curve:
 pValue - read.delim(file = p=1.txt, as.is= TRUE)
 desc1 - pValue[[p.value]]
 label1 - pValue[[Is.Expected]] # after changing the values of TRUE = 0,
FALSE = 1

 pred - prediction(desc1, label1)
 perf - performance(pred, tpr, fpr)
 plot(perf, colorsize = TRUE)

my question are as follow:
1. Am I right in my way of thinkning, that the p-values here are
predictions?
I know you said I need to decided it for myself, but I'm not sure. If they
are, than I will have the same predictions for each and every calculation of
ROCR. Will it make any difference at the prediction?
2. how can i calculate the other p-values thresholds? Do I need to do each
separately, or is there a way of combining them?

I hope you can still help we with some hints or further advieces.

Thanks

Assa

On Wed, Aug 18, 2010 at 07:55, Claudia Beleites cbelei...@units.it wrote:

 Dear Assa,

 you need to call prediction with continuous predictions and a _binary_ true
 class label.

 You are the only one who can tell whether the p-values are actually
 predictions  and what the class labels are. For the list readers p is just
 the name of whatever variable, and you didn't even vaguely say what you try
 to classify, nor did you offer any explanation of what the columns are.

 The only information we get from your table is that p-value has small and
 continuous values. From what I see the p-values could also be fitting errors
 of the predictions (e.g. expressed as a probability that the similarity to
 the predicted class is random).

 Claudia

 Assa Yeroslaviz wrote:

 Dear Claudia,

 thank you for your fast answer.
 I add again the table of the data as an example.

 Protein ID  Pfam Domain p-value ExpectedIs
 Expected True Postive False Negative False Positive  True Negative
 NP_11.2 APH 1.15E-05APH TRUE1   0   0
   0
 NP_11.2 MutS_V  0.0173  APH FALSE   0   0   1   0
 NP_62.1 CBS 9.40E-08CBS TRUE1   0   0
   0
 NP_66.1 APH 3.83E-06APH TRUE1   0   0
   0
 NP_66.1 CobU0.009   APH FALSE   0   0   1   0
 NP_66.1 FeoA0.3975  APH FALSE   0   0   1   0
 NP_66.1 Phage_integr_N  0.0219  APH FALSE   0   0   1
   0
 NP_000161.2 Beta_elim_lyase 6.25E-12Beta_elim_lyase
   TRUE1   0   0   0
 NP_000161.2 Glyco_hydro_6   0.002   Beta_elim_lyase FALSE   0
   0   1   0
 NP_000161.2 SurE0.0059  Beta_elim_lyase FALSE   0   0
   1   0
 NP_000161.2 SapB_2  0.0547  Beta_elim_lyase FALSE   0   0
   1   0
 NP_000161.2 Runt0.1034  Beta_elim_lyase FALSE   0   0
   1   0
 NP_000204.3 EGF 0.004666118 EGF TRUE1   0   0
   0
 NP_000229.1 PAS 3.13E-06PAS TRUE1   0   0
   0
 NP_000229.1 zf-CCCH 0.2067  PAS FALSE   0   1   1
   0
 NP_000229.1 E_raikovi_mat   0.0206  PAS FALSE   0   0   0
   0
 NP_000388.2 NAD_binding_1   8.21E-24NAD_binding_1   TRUE1
   0   0   0
 NP_000388.2 ABM 1.40E-08NAD_binding_1   FALSE   0   0
   1   0
 NP_000483.3 MMR_HSR11.98E-05MMR_HSR1TRUE1
   0   0   0
 NP_000483.3 DEAD2.30E-05MMR_HSR1FALSE   0   0
   1   0
 NP_000483.3 APS_kinase  1.80E-09MMR_HSR1FALSE   0
   0   1   0
 NP_000483.3 CbiA0.0003  MMR_HSR1FALSE   0   0   1
   0
 NP_000483.3 CoaE1.28E-07MMR_HSR1FALSE   0   0
   1   0
 NP_000483.3 FMN_red 4.61E-08MMR_HSR1FALSE   0
   0   1   0
 NP_000483.3 Fn_bind 0.3855  MMR_HSR1

Re: [R] R reports

2010-08-19 Thread ONKELINX, Thierry
Dear Donald,

I'm not sure what the meaning of '3G' and '4G' is. You should take a
look at Sweave() which is a very powerfull tool for generating reports
in R.

HTH,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie  Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics  Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
  

 -Oorspronkelijk bericht-
 Van: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] Namens Donald Paul Winston
 Verzonden: donderdag 19 augustus 2010 8:53
 Aan: r-help@r-project.org
 Onderwerp: [R] R reports
 
 
 I don't see much in the way of an ability to write reports in 
 R the way you can with SAS. You basically have to write a 
 program with R in a 3G way unlike SAS with it's 4G proc print 
 and proc report. 
 
 Are there similar R functions and packages? 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/R-reports-tp2330733p2330733.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.
 

Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading lmer table

2010-08-19 Thread Nicola Spotorno

Thank you very much Mark, I'll try.

Regards,

Nicola

Mark Difford ha scritto:

Hi Nicola,

  

In few word: does this row indicate a global effect of the predictor
'cat' 
or a more specific passage?
  


It indicates a more specific passage.  Use anova(m7) for global/omnibus.
Check this for yourself by fitting the model with different contrasts. The
default contrasts in R are treatment contrasts.

##
m7 - lmer(log.second ~ Cond + cat + (1|subjID) + (1|Code), data = march.f, 
contrasts=list(Cond=contr.treatment,

cat=contr.treatment))
m7s - lmer(log.second ~ Cond + cat + (1|subjID) + (1|Code), data = march.f, 
contrasts=list(Cond=contr.sum, cat=contr.sum))

summary(m7)
summary(m7s)
anova(m7)
anova(m7s)

Regards, Mark.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R reports

2010-08-19 Thread David Hajage
and:
 - brew
 - HTMLUtils
 - ascii
 - odfWeave
 - R2HTML
 - hwriter
 - ...

2010/8/19 ONKELINX, Thierry thierry.onkel...@inbo.be

 Dear Donald,

 I'm not sure what the meaning of '3G' and '4G' is. You should take a
 look at Sweave() which is a very powerfull tool for generating reports
 in R.

 HTH,

 Thierry

 
 
 ir. Thierry Onkelinx
 Instituut voor natuur- en bosonderzoek
 team Biometrie  Kwaliteitszorg
 Gaverstraat 4
 9500 Geraardsbergen
 Belgium

 Research Institute for Nature and Forest
 team Biometrics  Quality Assurance
 Gaverstraat 4
 9500 Geraardsbergen
 Belgium

 tel. + 32 54/436 185
 thierry.onkel...@inbo.be
 www.inbo.be

 To call in the statistician after the experiment is done may be no more
 than asking him to perform a post-mortem examination: he may be able to
 say what the experiment died of.
 ~ Sir Ronald Aylmer Fisher

 The plural of anecdote is not data.
 ~ Roger Brinner

 The combination of some data and an aching desire for an answer does not
 ensure that a reasonable answer can be extracted from a given body of
 data.
 ~ John Tukey


  -Oorspronkelijk bericht-
  Van: r-help-boun...@r-project.org
  [mailto:r-help-boun...@r-project.org] Namens Donald Paul Winston
  Verzonden: donderdag 19 augustus 2010 8:53
  Aan: r-help@r-project.org
  Onderwerp: [R] R reports
 
 
  I don't see much in the way of an ability to write reports in
  R the way you can with SAS. You basically have to write a
  program with R in a 3G way unlike SAS with it's 4G proc print
  and proc report.
 
  Are there similar R functions and packages?
  --
  View this message in context:
  http://r.789695.n4.nabble.com/R-reports-tp2330733p2330733.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.
 

 Druk dit bericht a.u.b. niet onnodig af.
 Please do not print this message unnecessarily.

 Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver
 weer
 en binden het INBO onder geen enkel beding, zolang dit bericht niet
 bevestigd is
 door een geldig ondertekend document. The views expressed in  this message
 and any annex are purely those of the writer and may not be regarded as
 stating
 an official position of INBO, as long as the message is not confirmed by a
 duly
 signed document.

 __
 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] How to read ANOVA output

2010-08-19 Thread Stephen Liu
- Original Message 

From: ted.hard...@manchester.ac.uk ted.hard...@manchester.ac.uk
To: r-help@r-project.org
Cc: Stephen Liu sati...@yahoo.com
Sent: Wed, August 18, 2010 4:41:11 PM
Subject: RE: [R] How to read ANOVA output


Hi Ted,

Thanks for your advice.

- snip -

You need to understand how that works (basic
statistical theory) before even thinking of looking at the
Tukey thing (omitted in this reply).

I have been googling a while.  There were many documents discovered.  I wonder 
where shall I start?  Which direction shall I choose?  Could you please shed me 
some hints.  TIA


I found follows;

Basic Inferential Statistics: Theory and Application
http://owl.english.purdue.edu/owl/resource/672/05/

Basic Statistics-I
http://works.bepress.com/durgesh_chandra_pathak/10/
file download
basic_Statistics-I-fulltext.pdf


The following is an explanation of your 1-way ANOVA written
entirely in R (preceded by a duplicate of your ANOVA output):

Performed following steps:-

## anova(lm(values ~ ind, data = tablets))
## Analysis of Variance Table
## Response: values
##  DfSum Sq   Mean Sq   F value  Pr(F)
## ind   2   2.05787   1.0289345.239   2.015e-05 ***
## Residuals 9   0.20470   0.02274
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

tabA = c(5.67, 5.67, 5.55, 5.57)
tabB = c(5.75, 5.47, 5.43, 5.45)
tabC = c(4.74, 4.45, 4.65, 4.94)

nA - length(tabA) ; nB - length(tabB) ; nC - length(tabC)
nG - nA + nB + nC
 nG
[1] 12


mG - mean(c(tabA,tabB,tabC))
mA - mean(tabA) ; mB - mean(tabB) ; mC - mean(tabC)
SSres - sum((tabA-mA)^2) + sum((tabB-mB)^2) + sum((tabC-mC)^2)
SSres # = 0.2047
[1] 0.2047


( I suppose - ^2 here means a raised to the power of 2) ??
( SSres is the sum of squares residual (or sum of squares error it is sometimes 
called), which is the variation in the dependent variable that is not predicted 
by the model. Adding the SSreg to the SSres gives the SStotal, which represents 
how much variation there is in the data overall) ??


SSeff - nA*(mA-mG)^2 + nB*(mB-mG)^2 + nC*(mC-mG)^2
SSeff # = 2.057867
[1] 2.057867


(What does SSeff refer to here)??


## Number of groups = 3 hence df.groups = (3-1) = 2

(?df
Description:

 Density, distribution function, quantile function and random
 generation for the F distribution with ‘df1’ and ‘df2’ degrees of
 freedom (and optional non-centrality parameter ‘ncp’).

What does df refer here?  
) ??


df.groups - 2
meanSSeff - SSeff/df.groups
meanSSeff # = 1.028933
[1] 0.0227


## df for residuals in each group = (n.group - 1):
df.res - (nA-1) + (nB-1) + (nC-1)  ## = 3 + 3 + 3 = 9
meanSSres - SSres/df.res
meanSSres # = 0.0227
[1] 0.0227


## Fisher's F-ratio statistic = meanSSeff/meanSSres:
F - meanSSeff/meanSSres
F # = 45.23889
[1] 45.23889


(Fisher's F-ratio
F-test ???
http://en.wikipedia.org/wiki/F-test
)


## P-value for F as test of difference between group means
## relative to within-group residuals (upper tail):
Pval - pf(F, df.groups, df.res, lower.tail=FALSE)
Pval  # = 2.015227e-05
[1] 2.015227e-05


(The P-values for the Popular Distributions
http://home.ubalt.edu/ntsbarsh/Business-stat/otherapplets/pvalues.htm
) ??


If I'm wrong please correct me.  TIA


B.R.
Stephen



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to read ANOVA output

2010-08-19 Thread Stephen Liu
- Original Message 

From: Gavin Simpson gavin.simp...@ucl.ac.uk
To: Stephen Liu sati...@yahoo.com
Cc: r-help@r-project.org
Sent: Wed, August 18, 2010 4:13:03 PM
Subject: Re: [R] How to read ANOVA output

Hi Gavin,


Thanks for your advice.


  tabA = c(5.67, 5.67, 5.55, 5.57)
  tabB = c(5.75, 5.47, 5.43, 5.45)
  tabC = c(4.74, 4.45, 4.65, 4.94)
  tabs = data.frame(tabA, tabB, tabC)
 
  tablets = stack(tabs)
 
 
  anova(lm(values ~ ind, data = tablets))
 Analysis of Variance Table
 Response: values
   Df  Sum Sq   Mean Sq  F value  Pr(F)
 ind  2   2.05787  1.02893  45.239   2.015e-05 ***
 Residuals 9   0.20470  0.02274
 ---
 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


That output is designed to look like ANOVA tables from classical text
books, so any introductory textbook designed for your particular
background or area of knowledge would probably help you understand it.

- snip -

Could you pls shed me some hints where can I find the relevant online document 
for my use?  Google search brought me tons of output.  To go through all it 
would take lengthy time.  Also it may lead me to the wrong direction.

TIA


B.R.
Stephen



__
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] Slow response from Windows Rgui - caused by Word?

2010-08-19 Thread jim holtman
Start up perfmon on your system (or the task manager) and then look at
who is consuming the CPU and memory.  This will provide insight to the
problem.  You need to determine if it is a CPU problem or possibly
memory due to paging.  The tools are there for you to trouble shoot
the problem since it is probably not being caused by R unless you have
some very large objects.  The task manager will tell you how much
memory a process is consuming.

On Thu, Aug 19, 2010 at 4:35 AM, Jon Olav Skoien
jon.sko...@jrc.ec.europa.eu wrote:
 Dear list,

 I quite often experience a delayed response when I type in the console of
 the RGui of my computer. When typing a command, the text only appears
 letter-by-letter on the console if I type rather slow (maximum 1-2 letters
 per second), otherwise it appears some time after I finished writing the
 complete command. Moving back and forth in a command with arrows keys are
 similarly slow if I need to correct something (which I often have to do,
 given that I cannot read while writing).

 Although this might sound like a minor problem (thinking takes more time
 than writing when programming, and writing should anyway take place in a
 proper text editor), it is quite annoying, especially when I just want to
 rerun a long command after changing something at the start of the line.

 Strangely, it seems that this problem starts when I open a Word-document,
 and it stops when I close all open Word-documents. I do not have any
 problems with other programs (including other programs from the office
 package), and computation seems to run as quick as normal.

 Some info about my system:

 sessionInfo()
 R version 2.11.1 (2010-05-31)
 x86_64-pc-mingw32

 locale:
 [1] LC_COLLATE=English_United States.1252
 [2] LC_CTYPE=English_United States.1252  [3] LC_MONETARY=English_United
 States.1252
 [4] LC_NUMERIC=C                         [5] LC_TIME=English_United
 States.1252
 attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base    
 objects()
 character(0)

 And as Word seems to be connected to the problem - I am running Windows 7
 Pro with Office 2007, the only Add-In to Word is Endnote (version 9). I have
 turned off the instant formatting option, as it also caused some other
 problems.

 Does anyone have a clue how I can have a Word document open and at the same
 time work with R without having this delayed response?

 Best wishes,
 Jon

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading a text file, one line at a time

2010-08-19 Thread jim holtman
Here is how I would do it to just do character substitution on the data:

 inFile - textConnection(   V1 V2 V3 V4 V5
+ 1   1  b  b  a -0.4990719
+ 2   2  b  a  a  1.5134101
+ 3   3  a  b  b  1.9375467
+ 4   4  a  a  b  0.3310612
+ 5   5  a  b  a  0.2807520
+ 6   6  a  a  b  0.9646351
+ 7   7  b  a  b  0.6243979
+ 8   8  a  b  a -0.8076008
+ 9   9  a  b  b -1.7645273
+ 10 10  b  b  a  0.5460802
+ 11 11  c  c  b 12.300)
 output - NULL  # initialize output file (just a vector in this case
 while(length(input - readLines(inFile, n=3))  0){
+ # replace 'b' with 'z'
+ for (i in seq_along(input)){
+ input[i] - gsub('b', 'z', input[i])
+ }
+ output - c(output, input)  # collect the output
+ }
 close(inFile)
 print(cbind(output))  # show converted data
  output
 [1,]V1 V2 V3 V4 V5
 [2,] 1   1  z  z  a -0.4990719
 [3,] 2   2  z  a  a  1.5134101
 [4,] 3   3  a  z  z  1.9375467
 [5,] 4   4  a  a  z  0.3310612
 [6,] 5   5  a  z  a  0.2807520
 [7,] 6   6  a  a  z  0.9646351
 [8,] 7   7  z  a  z  0.6243979
 [9,] 8   8  a  z  a -0.8076008
[10,] 9   9  a  z  z -1.7645273
[11,] 10 10  z  z  a  0.5460802
[12,] 11 11  c  c  z 12.300



On Wed, Aug 18, 2010 at 10:51 PM, Juliet Hannah juliet.han...@gmail.com wrote:
 Hi Jim,

 I was trying to use your template without success. With the toy data
 below, could
 you explain how to use this template to change all bs to zs --
 just as an exercise, reading
 in 3 lines at a time. I need to use this strategy for a larger
 problem, but I haven't
 been able to get the basics working.

 Thanks,

 Juliet

 myData - structure(list(V1 = 1:11, V2 = structure(c(2L, 2L, 1L, 1L, 1L,
 1L, 2L, 1L, 1L, 2L, 3L), .Label = c(a, b, c), class = factor),
    V3 = structure(c(2L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 2L,
    3L), .Label = c(a, b, c), class = factor), V4 = structure(c(1L,
    1L, 2L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 2L), .Label = c(a,
    b), class = factor), V5 = c(-0.499071939558026, 1.51341011554134,
    1.93754671209923, 0.331061227463955, 0.280752001959284, 0.964635079229074,
    0.624397908891502, -0.807600774484419, -1.76452730888732,
    0.546080229326458, 12.3)), .Names = c(V1, V2, V3, V4,
 V5), class = data.frame, row.names = c(NA, -11L))

 On Sun, Aug 15, 2010 at 1:06 PM, jim holtman jholt...@gmail.com wrote:
 For efficiency of processing, look at reading in several
 hundred/thousand lines at a time.  One line read/write will probably
 spend most of the time in the system calls to do the I/O and will take
 a long time.  So do something like this:

 con - file('yourInputFile', 'r')
 outfile - file('yourOutputFile', 'w')
 while (length(input - readLines(con, n=1000)  0){
    for (i in 1:length(input)){
        ..your one line at a time processing
    }
    writeLines(output, con=outfile)
 }

 On Sun, Aug 15, 2010 at 7:58 AM, Data Analytics Corp.
 w...@dataanalyticscorp.com wrote:
 Hi,

 I have an upcoming project that will involve a large text file.  I want to

  1. read the file into R one line at a time
  2. do some string manipulations on the line
  3. write the line to another text file.

 I can handle the last two parts.  Scan and read.table seem to read the whole
 file in at once.  Since this is a very large file (several hundred thousand
 lines), this is not practical.  Hence the idea of reading one line at at
 time.  The question is, can R read one line at a time?  If so, how?  Any
 suggestions are appreciated.

 Thanks,

 Walt

 

 Walter R. Paczkowski, Ph.D.
 Data Analytics Corp.
 44 Hamilton Lane
 Plainsboro, NJ 08536
 
 (V) 609-936-8999
 (F) 609-936-3733
 w...@dataanalyticscorp.com
 www.dataanalyticscorp.com

 _


 --
 

 Walter R. Paczkowski, Ph.D.
 Data Analytics Corp.
 44 Hamilton Lane
 Plainsboro, NJ 08536
 
 (V) 609-936-8999
 (F) 609-936-3733
 w...@dataanalyticscorp.com
 www.dataanalyticscorp.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.




 --
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390

 What is the problem that you are trying to solve?

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





-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

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

Re: [R] Adding column to dataframe

2010-08-19 Thread jim holtman
I think you are probably paging on your system.  Turn on your
performance metrics and look at it.  If the object you are processing
is all numeric, it would seem to require about 3.5GB of space (50% of
available memory).  Provide and 'str' and 'object.size' of the object
so that we can see what you are working with.  My rule of thumb is
that no single object should take more than 25-30% of memory since
copies may be made.  So the reasons things are taking 20 minutes is
you might be paging.  It is always good to break the problem into
pieces to see what is happening.  Read in only 25% of the data and
time it; then 50% and so on.  In any performance related problems you
need to determine where the knee of the curve it.  Never undertake
processing the large data file at once; start with some pieces and
work up so that you know what to expect.

On Wed, Aug 18, 2010 at 9:46 PM, Matt Cooper mattcst...@gmail.com wrote:
 Two questions:
 1) Are there any good R guides/sites with information/techniques for dealing
 with large datasets in R? (Large being ~2 mil rows and ~200 columns)

 2) My specific problem with this dataset.

 I am essentially trying to convert a date and add it to a data frame. I
 imagine any 'data manipulation on a column within dataframe into a new
 column' will present the same issue, be it as.Date or anything else.

 I have a dataset, size

 dim(morbidity)
 [1] 1775683     264

 This was read in from a STATA .dta file. The dates have come in as the
 number of ms from 1960 so I have the following to convert these to usable
 dates.

 as.Date(morbidity$adm_date / (100*10*60*60*24), origin=1960-01-01)

 when I store this as a vector it is near instant, 5 seconds
 test - as.Date(etc)
 when I place it over itself it takes ~20 minutes
 morbidity$adm_date - as.Date(etc)
 when I place the vector over it (so no computation involved), or place it as
 a new column it still takes ~20 minutes
 morbidity$adm_date - test
 morbidity$new_col - test
 when I tried a cbind to add it that way it took 20 minutes
 new_morb - cbind(morbidity,test)

 Has anyone done something similar or know of a different command that should
 work faster? I can't get my head around what R is doing, if it can create
 the vector instantly then the computation is quite simple, I don't
 understand why then adding it as a column to a dataframe can take that long.

 R64 bit on mac os x, 2.4 GHz dual core, 8gb ram so more than enough
 resources.

 Thanks
 Matt

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
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] texi2dvi: option clean also deletes the generated pdf file

2010-08-19 Thread Tim Gruene
Dear Marius,

from reading the texi2dvi man-page and R-help on texi2dvi I suggest to set
'clean=F' and use 'texi2dvi = getOption(texi2dvi --mostly-clean)' instead.

Tim

On Thu, Aug 19, 2010 at 10:36:30AM +0200, Marius Hofert wrote:
 Dear expeRts,
 
 below are two examples of using texi2dvi. The problem becomes clear from the 
 second example: on cleaning, texi2dvi also deletes the generated .pdf file.
 Is there a solution?
 
 Cheers,
 
 Marius
 
 ## Example 1: texi2dvi cleans fine, without deleting the generated .pdf
 require(tools)
 sink(file=myLaTeXFile1.tex)
   cat(\\documentclass{article}\n)
   cat(\\usepackage[T1]{fontenc}\n)
   cat(\\usepackage[english]{babel}\n)
   cat(\\usepackage{blindtext}\n)
   cat(\\begin{document}\n)
   cat(\\blindtext[10]\n)
   cat(\\end{document}\n)
 sink()
 texi2dvi(myLaTeXFile1.tex,pdf=TRUE,clean=TRUE,quiet=TRUE) 
 
 ## Example 2: texi2dvi also deletes the generated .pdf
 require(tools)
 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
   cat(\\documentclass{article}\n)
   cat(\\usepackage[T1]{fontenc}\n)
   cat(\\usepackage[english]{babel}\n)
   cat(\\usepackage{blindtext}\n)
   cat(\\begin{document}\n)
   cat(\\blindtext[10]\n)
   cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE)
 
 __
 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.

-- 
--
Tim Gruene
Institut fuer anorganische Chemie
Tammannstr. 4
D-37077 Goettingen

GPG Key ID = A46BEE1A



signature.asc
Description: Digital signature
__
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] memory problem

2010-08-19 Thread Duncan Murdoch

avsha38 wrote:

Hi,
when i run the following code i get this massege:

The instruction at 0x reference memory at 

0x###, the memory cannot be read. 
and then i have to close R.


what is the problem and how can i solve it?
  


The problem is a bug in the underlying C (or other) code.  To solve it, 
put together a minimal example that produces it reliably.  If it 
requires the frailtypack package to work, then send your example to the 
maintainer of that package.  If the minimal example uses only standard R 
packages, then submit an R bug report about it.


There's no point reporting it unless someone can reproduce it, and 
people might not follow up if the example is too complicated, so you 
should make an effort to simplify as much as you can before reporting.


Duncan Murdoch

thanks in advance
Avi

my code

# frailtypack
library(frailtypack)
cgd.ag - read.csv(C:/rfiles/RE/cgd.csv)
cgd.nfm -frailtyPenal(Surv(TStart, TStop,
Status)~cluster(Center)+subcluster(ID) 
 Treatment,data=cgd.ag,Frailty=TRUE,n.knots=8,kappa1=5, 
   cross.validation=TRUE,recurrentAG=TRUE)


  



__
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] texi2dvi: option clean also deletes the generated pdf file

2010-08-19 Thread Marius Hofert
Dear Tim,

you mean

require(tools)
filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
sink(file=filepath)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
sink()
texi2dvi(filepath,pdf=TRUE,quiet=TRUE,texi2dvi=getOption(texi2dvi 
--mostly-clean))

?
The problem is that this does not work. It produces the same output as my 
Example 2 without the clean-option. So it leaves all files in the working 
directory. 

The reason why I am looking for a clean-up is that I have to compile several 
hundred LaTeX files in different directories...

Cheers,

Marius


On 2010-08-19, at 12:33 , Tim Gruene wrote:

 Dear Marius,
 
 from reading the texi2dvi man-page and R-help on texi2dvi I suggest to set
 'clean=F' and use 'texi2dvi = getOption(texi2dvi --mostly-clean)' instead.
 
 Tim
 
 On Thu, Aug 19, 2010 at 10:36:30AM +0200, Marius Hofert wrote:
 Dear expeRts,
 
 below are two examples of using texi2dvi. The problem becomes clear from the 
 second example: on cleaning, texi2dvi also deletes the generated .pdf file.
 Is there a solution?
 
 Cheers,
 
 Marius
 
 ## Example 1: texi2dvi cleans fine, without deleting the generated .pdf
 require(tools)
 sink(file=myLaTeXFile1.tex)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
 sink()
 texi2dvi(myLaTeXFile1.tex,pdf=TRUE,clean=TRUE,quiet=TRUE) 
 
 ## Example 2: texi2dvi also deletes the generated .pdf
 require(tools)
 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE)
 
 __
 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.
 
 -- 
 --
 Tim Gruene
 Institut fuer anorganische Chemie
 Tammannstr. 4
 D-37077 Goettingen
 
 GPG Key ID = A46BEE1A
 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to read ANOVA output

2010-08-19 Thread Siri Bjoner

He's already sent you some good advice.

Go to amazon.com and search for basic statistics + your area in  
Books. Giving you specific recommendations will also take a lot of  
time, both for us and you, especially seeing as we don't really know  
what area or subject you're looking for.


Any basic book should give you enough knowledge to understand the  
basics of ANOVA and statistics in general. You should also find a book  
with basic problems and answers, so you can try them out yourself.


Siri.

Siterer Stephen Liu sati...@yahoo.com:


- Original Message 

From: Gavin Simpson gavin.simp...@ucl.ac.uk
To: Stephen Liu sati...@yahoo.com
Cc: r-help@r-project.org
Sent: Wed, August 18, 2010 4:13:03 PM
Subject: Re: [R] How to read ANOVA output

Hi Gavin,


Thanks for your advice.



 tabA = c(5.67, 5.67, 5.55, 5.57)
 tabB = c(5.75, 5.47, 5.43, 5.45)
 tabC = c(4.74, 4.45, 4.65, 4.94)
 tabs = data.frame(tabA, tabB, tabC)

 tablets = stack(tabs)


 anova(lm(values ~ ind, data = tablets))

Analysis of Variance Table
Response: values
  Df  Sum Sq   Mean Sq  F value  Pr(F)
ind  2   2.05787  1.02893  45.239   2.015e-05 ***
Residuals 9   0.20470  0.02274
---

Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1




That output is designed to look like ANOVA tables from classical text
books, so any introductory textbook designed for your particular
background or area of knowledge would probably help you understand it.


- snip -

Could you pls shed me some hints where can I find the relevant  
online document

for my use?  Google search brought me tons of output.  To go through all it
would take lengthy time.  Also it may lead me to the wrong direction.

TIA


B.R.
Stephen



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R reports

2010-08-19 Thread Prof Brian Ripley

On Thu, 19 Aug 2010, ONKELINX, Thierry wrote:


Dear Donald,

I'm not sure what the meaning of '3G' and '4G' is. You should take a


I think he means 3GL, as in

http://en.wikipedia.org/wiki/Third-generation_programming_language

(and I've not heard the term used for 20 years now).


look at Sweave() which is a very powerfull tool for generating reports
in R.

HTH,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie  Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics  Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey



-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] Namens Donald Paul Winston
Verzonden: donderdag 19 augustus 2010 8:53
Aan: r-help@r-project.org
Onderwerp: [R] R reports


I don't see much in the way of an ability to write reports in
R the way you can with SAS. You basically have to write a
program with R in a 3G way unlike SAS with it's 4G proc print
and proc report.

Are there similar R functions and packages?
--
View this message in context:
http://r.789695.n4.nabble.com/R-reports-tp2330733p2330733.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.



Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message
and any annex are purely those of the writer and may not be regarded as stating
an official position of INBO, as long as the message is not confirmed by a duly
signed document.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Math symbols in ylab with vis.gam() or plot.gam()

2010-08-19 Thread Vijaya Parthiban
Hi all,

Has anyone tried to plot math symbols with vis.gam() - a function that uses
(I think) plot.gam() internally? This is from the package mgcv - I am new to
gam().

For example, with the normal plot(), the expression() works fine for Math
symbols:

plot(xx, ylab=expression(paste(Delta,H,sep=))) # works fine

But, with vis.gam(), the same ylab=expression(paste(Delta,H,sep=)) does
not plot the symbols - in stead it is 'paste(Delta,H,sep=)'.

Do I have an alternative way of specifying the expression() to vis.gam()? Am
I not doing this correctly?

Thanks,
Parthiban.

[[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] Help with Vectors and conditional functions

2010-08-19 Thread Nikhil Kaza
In additiion to Ivan's  comment, in this case, you are just plotting  
Yes or No. I think thats not what you want.


Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina

nikhil.l...@gmail.com

On Aug 19, 2010, at 3:42 AM, Ivan Calandra wrote:


 Hi,

I haven't spent too much time on it, but that might help:
if (coint_tests[[i]]==YES)...
Note the double = which is the operator for equality. The single =
is the assignment operator, especially with arguments.

HTH, Ivan

Le 8/19/2010 09:03, Ferreira, Thiago Alves a écrit :

Good morning,

I have something like this: names(coint_tests)- apply(b,2,paste,  
collapse=_) which prints 15 names like: A_B, C_D, E_F, ...
AA,B,C,D.. Are time series. Then there is a vector called  
coint_tests of length 15 which yields yes or no.


I need to add a function to plot the time series Ai_Bi if the  
coint_tests vectors gives me a YES.



I tried:for (i in 1:(length(coint_tests))
if (coint_tests[[i]]=YES)  
{plot(coint_tests[i])}


But it does not work. I would most appreciate if someone could give  
me some insight as to how to sort this out. Thank you


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php


[[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] 2d kriging with anisotropy on an irregular network (RandomFields Package)

2010-08-19 Thread Jean-Marie Lepioufle
Dear List

I am using the RandomFields package, and I have a problem when 2d-kriging, with 
an anisotropy, some values from an irregular network.
It works well when :
- 2d-kriging, without any anisotropy, some data from an irregular network
- 2d-kriging, with and without anisotropy, some data from a regular network
- 3d-kriging, with and without anisotropy, some data from a regular network

Here is my script highly inspired by some examples from the package.

rm(list=ls())
library(RandomFields)
###
# PARAMETERS
###
Mean-1
Variance-4.5
Range-1
nbRainG-20
rPoint - 1:nbRainG
points1 - rPoint
xMax-5
yMax-10

##
#CREATION OF AN IRREGULAR RAINGAUGE NETWORK, DATA SIMULATION
##
model=exponential
param1 - c(mean=Mean,variance=Variance,nugget=0,scale=Range)
RFparameters(PracticalRange=FALSE)
data - GaussRF(points1, grid=FALSE, model=model,param=param1)
data[which(data0)]-0

xPoint - runif(nbRainG,0,xMax)
yPoint - runif(nbRainG,0,yMax)
MatCoord-matrix(0,nr=nbRainG,nc=2)
MatCoord[,1]-t(xPoint)
MatCoord[,2]-t(yPoint)
points2-MatCoord

dim(data)-NULL

###
# PARAMETERS FOR KRIGING
###
stepSpace - 0.25
xkrig -  seq(0,xMax,stepSpace)
ykrig -  seq(0,yMax,stepSpace)

valuesLim - c(0,3)
colour - rainbow(100)

###
#2D KRIGING
###
#NO ANISOTROPY-It works
krige.method - O
values -  Kriging(krige.method=krige.method,
   x=xkrig,y=ykrig,grid=TRUE,
   model=list(
list(m=exp, v=Variance,s=Range)
),
   given=points2,data=data)


#ANISOTROPY -doesnt work
anisoMatrix-matrix(0,2,2)
AnisoS-1 #whatever this value, it doesn't work
anisoMatrix[1,1]-1
anisoMatrix[2,2]-AnisoS

krige.method - O
values -  Kriging(krige.method=krige.method,
  x=xkrig,y=ykrig,grid=TRUE,
  model=list(
list(m=exp, v=Variance,s=Range,a=anisoMatrix)
),
  given=points2,data=data)
##
#END#
##

As an error message, R writes : Error: (in PrepareModel) do not mix isotropic 
definitions with anisotropic ones
I don't know why.
- The problem comes from adding the anisotropy parameter (a=anisoMatrix, in the 
function Kriging). When putting the anisotropy coefficient to one (ie 
isotropy), it doesn't work as well.
- I have tested the script for several theoritical model of structure 
(sph,...), but it doesn't work as well
- Even if the dimension of the data set is a vector in the case of irregular 
network (instead of a matrix in the case of a regular network), the anisotropy 
matrix has to stay with the dimension 2x2 (for a spatial network), and not a 
scalar.

Does someone has any idea about this error?

Some information about my system :
 sessionInfo()
R version 2.11.1 (2010-05-31)
i386-pc-mingw32

locale:
[1] LC_COLLATE=Norwegian (Bokmål)_Norway.1252  LC_CTYPE=Norwegian 
(Bokmål)_Norway.1252
[3] LC_MONETARY=Norwegian (Bokmål)_Norway.1252 LC_NUMERIC=C
[5] LC_TIME=Norwegian (Bokmål)_Norway.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] RandomFields_1.3.41

Thanks a lot

Jean-Marie

[[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] texi2dvi: option clean also deletes the generated pdf file

2010-08-19 Thread Tim Gruene
Dear Marius,

yes, that's what I had meant.

I am sorry I had not actually tested my suggestion nor your problem (bad
practice). Now I have and actually in case 2 you describe I only end up
with test/myLaTeXFile2.tex and myLaTeXFile2.pdf.

If, however, I run texi2dvi at least once with option 'clean=F', the auxiliary 
files
are generated and left in the path. Also upon a subsequent run with the option
'clean=T', they are not being deleted. 

Could this also be the case for you, i.e., that you once used the option
'clean=F' (or not set at all) and now are made believe 'clean=T' does not work
because they are still there but actually left-overs from the old run?

I run R version 2.7.1 (2008-06-23) on Debian stable.

Kind regards, Tim

On Thu, Aug 19, 2010 at 12:41:57PM +0200, Marius Hofert wrote:
 Dear Tim,
 
 you mean
 
 require(tools)
 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
   cat(\\documentclass{article}\n)
   cat(\\usepackage[T1]{fontenc}\n)
   cat(\\usepackage[english]{babel}\n)
   cat(\\usepackage{blindtext}\n)
   cat(\\begin{document}\n)
   cat(\\blindtext[10]\n)
   cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,quiet=TRUE,texi2dvi=getOption(texi2dvi 
 --mostly-clean))
 
 ?
 The problem is that this does not work. It produces the same output as my 
 Example 2 without the clean-option. So it leaves all files in the working 
 directory. 
 
 The reason why I am looking for a clean-up is that I have to compile 
 several hundred LaTeX files in different directories...
 
 Cheers,
 
 Marius
 
 
 On 2010-08-19, at 12:33 , Tim Gruene wrote:
 
  Dear Marius,
  
  from reading the texi2dvi man-page and R-help on texi2dvi I suggest to set
  'clean=F' and use 'texi2dvi = getOption(texi2dvi --mostly-clean)' instead.
  
  Tim
  
  On Thu, Aug 19, 2010 at 10:36:30AM +0200, Marius Hofert wrote:
  Dear expeRts,
  
  below are two examples of using texi2dvi. The problem becomes clear from 
  the 
  second example: on cleaning, texi2dvi also deletes the generated .pdf file.
  Is there a solution?
  
  Cheers,
  
  Marius
  
  ## Example 1: texi2dvi cleans fine, without deleting the generated .pdf
  require(tools)
  sink(file=myLaTeXFile1.tex)
   cat(\\documentclass{article}\n)
   cat(\\usepackage[T1]{fontenc}\n)
   cat(\\usepackage[english]{babel}\n)
   cat(\\usepackage{blindtext}\n)
   cat(\\begin{document}\n)
   cat(\\blindtext[10]\n)
   cat(\\end{document}\n)
  sink()
  texi2dvi(myLaTeXFile1.tex,pdf=TRUE,clean=TRUE,quiet=TRUE) 
  
  ## Example 2: texi2dvi also deletes the generated .pdf
  require(tools)
  filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
  sink(file=filepath)
   cat(\\documentclass{article}\n)
   cat(\\usepackage[T1]{fontenc}\n)
   cat(\\usepackage[english]{babel}\n)
   cat(\\usepackage{blindtext}\n)
   cat(\\begin{document}\n)
   cat(\\blindtext[10]\n)
   cat(\\end{document}\n)
  sink()
  texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE)
  
  __
  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.
  
  -- 
  --
  Tim Gruene
  Institut fuer anorganische Chemie
  Tammannstr. 4
  D-37077 Goettingen
  
  GPG Key ID = A46BEE1A
  

-- 
--
Tim Gruene
Institut fuer anorganische Chemie
Tammannstr. 4
D-37077 Goettingen

GPG Key ID = A46BEE1A



signature.asc
Description: Digital signature
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R reports

2010-08-19 Thread Donald Paul Winston

Oops, I meant 4GL. Part of SAS involves more or less declarative coding
where SAS figures out how to process the information and you don't have to.
Sweave and html generators in R are not what I'm looking for. I'm looking
for a function whose arguments are data, column names, grouping variables,
summary stats, titles, footnotes, etc. Sort of like what plot does except
the function will generate a report. I suppose you could specify an output
format or printer device as plain text, rich text, pdf, or html.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-reports-tp2330733p2331037.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] Slow response from Windows Rgui - caused by Word?

2010-08-19 Thread Jon Olav Skoien

Hi,

It is certainly not a memory or CPU problem, I should have mentioned in 
the first email that I already tried to check for that.


However, I now tried to disable EndNote 9 from the Add-Ins, and it seems 
that was the problem. I still dont understand why this happens though. 
There seems to be some issues with using older versions of EndNote on a 
64-bit computer:

http://www.endnote.com/support/Faqs/Install/faq28.asp
This caused me some trouble in the past, slowing down Windows Explorer, 
but this got solved by turning off the instant formatting. It is very 
strange that it apparently only affects R now, and I would prefer if I 
could use the two programs at the same time...


Thanks for the suggestion though,
Jon

jim holtman wrote:

Start up perfmon on your system (or the task manager) and then look at
who is consuming the CPU and memory.  This will provide insight to the
problem.  You need to determine if it is a CPU problem or possibly
memory due to paging.  The tools are there for you to trouble shoot
the problem since it is probably not being caused by R unless you have
some very large objects.  The task manager will tell you how much
memory a process is consuming.

On Thu, Aug 19, 2010 at 4:35 AM, Jon Olav Skoien
jon.sko...@jrc.ec.europa.eu wrote:
  

Dear list,

I quite often experience a delayed response when I type in the console of
the RGui of my computer. When typing a command, the text only appears
letter-by-letter on the console if I type rather slow (maximum 1-2 letters
per second), otherwise it appears some time after I finished writing the
complete command. Moving back and forth in a command with arrows keys are
similarly slow if I need to correct something (which I often have to do,
given that I cannot read while writing).

Although this might sound like a minor problem (thinking takes more time
than writing when programming, and writing should anyway take place in a
proper text editor), it is quite annoying, especially when I just want to
rerun a long command after changing something at the start of the line.

Strangely, it seems that this problem starts when I open a Word-document,
and it stops when I close all open Word-documents. I do not have any
problems with other programs (including other programs from the office
package), and computation seems to run as quick as normal.

Some info about my system:



sessionInfo()
  

R version 2.11.1 (2010-05-31)
x86_64-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252  [3] LC_MONETARY=English_United
States.1252
[4] LC_NUMERIC=C [5] LC_TIME=English_United
States.1252
attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base
objects()
character(0)

And as Word seems to be connected to the problem - I am running Windows 7
Pro with Office 2007, the only Add-In to Word is Endnote (version 9). I have
turned off the instant formatting option, as it also caused some other
problems.

Does anyone have a clue how I can have a Word document open and at the same
time work with R without having this delayed response?

Best wishes,
Jon

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.









__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Different way of aggregating

2010-08-19 Thread skan


Phil Spector wrote:
 
 
 For chron objects:
 
   aggregate(thedata$value,list(hour=hours(thedata$date)),mean)
 
 


Ok, thanks, that's what I need. Now it seems so easy...

Could you tell me why we write... ?
 aggregate(thedata$value,list(hour=hours(thedata$date)),mean)
instead of just
 aggregate(thedata$value,hours(thedata$date),mean)

thanks

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Different-way-of-aggregating-tp2330497p2331072.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] texi2dvi: option clean also deletes the generated pdf file

2010-08-19 Thread Marius Hofert
Dear Tim,

if I run ...

## Example 2: texi2dvi also deletes the generated .pdf
require(tools)
filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
sink(file=filepath)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
sink()
texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE) 

... on a fresh-and-clean working directory (and also no files in the 
subdirectory ./test), I only get the file myLaTeXFile2.tex in ./test, so 
*everything* (including the .pdf) is deleted :-(

I work with R version 2.11.1 (2010-05-31) on a MacBook Pro running 10.6.4.

Cheers,

Marius

On 2010-08-19, at 13:38 , Tim Gruene wrote:

 Dear Marius,
 
 yes, that's what I had meant.
 
 I am sorry I had not actually tested my suggestion nor your problem (bad
 practice). Now I have and actually in case 2 you describe I only end up
 with test/myLaTeXFile2.tex and myLaTeXFile2.pdf.
 
 If, however, I run texi2dvi at least once with option 'clean=F', the 
 auxiliary files
 are generated and left in the path. Also upon a subsequent run with the option
 'clean=T', they are not being deleted. 
 
 Could this also be the case for you, i.e., that you once used the option
 'clean=F' (or not set at all) and now are made believe 'clean=T' does not work
 because they are still there but actually left-overs from the old run?
 
 I run R version 2.7.1 (2008-06-23) on Debian stable.
 
 Kind regards, Tim
 
 On Thu, Aug 19, 2010 at 12:41:57PM +0200, Marius Hofert wrote:
 Dear Tim,
 
 you mean
 
 require(tools)
 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,quiet=TRUE,texi2dvi=getOption(texi2dvi 
 --mostly-clean))
 
 ?
 The problem is that this does not work. It produces the same output as my 
 Example 2 without the clean-option. So it leaves all files in the 
 working directory. 
 
 The reason why I am looking for a clean-up is that I have to compile 
 several hundred LaTeX files in different directories...
 
 Cheers,
 
 Marius
 
 
 On 2010-08-19, at 12:33 , Tim Gruene wrote:
 
 Dear Marius,
 
 from reading the texi2dvi man-page and R-help on texi2dvi I suggest to set
 'clean=F' and use 'texi2dvi = getOption(texi2dvi --mostly-clean)' instead.
 
 Tim
 
 On Thu, Aug 19, 2010 at 10:36:30AM +0200, Marius Hofert wrote:
 Dear expeRts,
 
 below are two examples of using texi2dvi. The problem becomes clear from 
 the 
 second example: on cleaning, texi2dvi also deletes the generated .pdf file.
 Is there a solution?
 
 Cheers,
 
 Marius
 
 ## Example 1: texi2dvi cleans fine, without deleting the generated .pdf
 require(tools)
 sink(file=myLaTeXFile1.tex)
 cat(\\documentclass{article}\n)
 cat(\\usepackage[T1]{fontenc}\n)
 cat(\\usepackage[english]{babel}\n)
 cat(\\usepackage{blindtext}\n)
 cat(\\begin{document}\n)
 cat(\\blindtext[10]\n)
 cat(\\end{document}\n)
 sink()
 texi2dvi(myLaTeXFile1.tex,pdf=TRUE,clean=TRUE,quiet=TRUE) 
 
 ## Example 2: texi2dvi also deletes the generated .pdf
 require(tools)
 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
 cat(\\documentclass{article}\n)
 cat(\\usepackage[T1]{fontenc}\n)
 cat(\\usepackage[english]{babel}\n)
 cat(\\usepackage{blindtext}\n)
 cat(\\begin{document}\n)
 cat(\\blindtext[10]\n)
 cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE)
 
 __
 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.
 
 -- 
 --
 Tim Gruene
 Institut fuer anorganische Chemie
 Tammannstr. 4
 D-37077 Goettingen
 
 GPG Key ID = A46BEE1A
 
 
 -- 
 --
 Tim Gruene
 Institut fuer anorganische Chemie
 Tammannstr. 4
 D-37077 Goettingen
 
 GPG Key ID = A46BEE1A
 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R reports

2010-08-19 Thread David Hajage
I'm not sure I understand what is 3GL or 4GL, but R is on the list of
fourth-generation
languages : Data manipulation, analysis, and reporting
languageshttp://en.wikipedia.org/wiki/Fourth-generation_programming_language#Some_fourth-generation_languages
on
wikipedia.

I don't know a function like that (nervertheless, I know nothing about proc
report, and I don't understand how it works). But if you don't want a
Sweave-like process, hwriter can automatically generate (html) reports:

# from http://www.ebi.ac.uk/~gpau/hwriter/
library(hwriter)
hwrite(iris[1:2,1:2], 'test.html', row.bgcolor='#ffdc98')
browseURL(paste(file://, getwd(), /test.html, sep = ))

In all case, to generate the report, you must first create the results, and
then display it into a report.

Or perhaps you're looking for something like rreport package (in
development): http://biostat.mc.vanderbilt.edu/wiki/Main/Rreport (never
tried)

david

2010/8/19 Donald Paul Winston satchwins...@yahoo.com


 Oops, I meant 4GL. Part of SAS involves more or less declarative coding
 where SAS figures out how to process the information and you don't have to.
 Sweave and html generators in R are not what I'm looking for. I'm looking
 for a function whose arguments are data, column names, grouping variables,
 summary stats, titles, footnotes, etc. Sort of like what plot does except
 the function will generate a report. I suppose you could specify an output
 format or printer device as plain text, rich text, pdf, or html.
 --
 View this message in context:
 http://r.789695.n4.nabble.com/R-reports-tp2330733p2331037.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.


[[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] texi2dvi: option clean also deletes the generated pdf file

2010-08-19 Thread Duncan Murdoch

On 19/08/2010 7:55 AM, Marius Hofert wrote:

Dear Tim,

if I run ...

## Example 2: texi2dvi also deletes the generated .pdf
require(tools)
filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
sink(file=filepath)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
sink()
texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE) 


... on a fresh-and-clean working directory (and also no files in the 
subdirectory ./test), I only get the file myLaTeXFile2.tex in ./test, so *everything* 
(including the .pdf) is deleted :-(
  


The texi2dvi function has two possible execution paths:  in one, it 
basically constructs a call to the system texi2dvi command and calls 
that, and in the other it emulates the behaviour of texi2dvi.  I haven't 
checked recently, but I think the second method doesn't do anything with 
clean=TRUE, so it looks as though this is a problem with the texi2dvi 
command you have installed on your system.


To confirm this, run debug(tools:::.shell_with_capture), and run 
texi2dvi.  When R breaks in that .shell_with_capture, it will show you 
what it is trying to execute.  If it is using your system texi2dvi 
command, it will call it once with option --help to find out what 
options are supported, and then a second call will show you the main 
command line.  You can use this to report a bug to Apple or whoever 
supplied your texi2dvi.


Duncan Murdoch



I work with R version 2.11.1 (2010-05-31) on a MacBook Pro running 10.6.4.

Cheers,

Marius

On 2010-08-19, at 13:38 , Tim Gruene wrote:

 Dear Marius,
 
 yes, that's what I had meant.
 
 I am sorry I had not actually tested my suggestion nor your problem (bad

 practice). Now I have and actually in case 2 you describe I only end up
 with test/myLaTeXFile2.tex and myLaTeXFile2.pdf.
 
 If, however, I run texi2dvi at least once with option 'clean=F', the auxiliary files

 are generated and left in the path. Also upon a subsequent run with the option
 'clean=T', they are not being deleted. 
 
 Could this also be the case for you, i.e., that you once used the option

 'clean=F' (or not set at all) and now are made believe 'clean=T' does not work
 because they are still there but actually left-overs from the old run?
 
 I run R version 2.7.1 (2008-06-23) on Debian stable.
 
 Kind regards, Tim
 
 On Thu, Aug 19, 2010 at 12:41:57PM +0200, Marius Hofert wrote:

 Dear Tim,
 
 you mean
 
 require(tools)

 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,quiet=TRUE,texi2dvi=getOption(texi2dvi 
--mostly-clean))
 
 ?
 The problem is that this does not work. It produces the same output as my Example 2 without the clean-option. So it leaves all files in the working directory. 
 
 The reason why I am looking for a clean-up is that I have to compile several hundred LaTeX files in different directories...
 
 Cheers,
 
 Marius
 
 
 On 2010-08-19, at 12:33 , Tim Gruene wrote:
 
 Dear Marius,
 
 from reading the texi2dvi man-page and R-help on texi2dvi I suggest to set

 'clean=F' and use 'texi2dvi = getOption(texi2dvi --mostly-clean)' instead.
 
 Tim
 
 On Thu, Aug 19, 2010 at 10:36:30AM +0200, Marius Hofert wrote:

 Dear expeRts,
 
 below are two examples of using texi2dvi. The problem becomes clear from the 
 second example: on cleaning, texi2dvi also deletes the generated .pdf file.

 Is there a solution?
 
 Cheers,
 
 Marius
 
 ## Example 1: texi2dvi cleans fine, without deleting the generated .pdf

 require(tools)
 sink(file=myLaTeXFile1.tex)
 cat(\\documentclass{article}\n)
 cat(\\usepackage[T1]{fontenc}\n)
 cat(\\usepackage[english]{babel}\n)
 cat(\\usepackage{blindtext}\n)
 cat(\\begin{document}\n)
 cat(\\blindtext[10]\n)
 cat(\\end{document}\n)
 sink()
 texi2dvi(myLaTeXFile1.tex,pdf=TRUE,clean=TRUE,quiet=TRUE) 
 
 ## Example 2: texi2dvi also deletes the generated .pdf

 require(tools)
 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
 cat(\\documentclass{article}\n)
 cat(\\usepackage[T1]{fontenc}\n)
 cat(\\usepackage[english]{babel}\n)
 cat(\\usepackage{blindtext}\n)
 cat(\\begin{document}\n)
 cat(\\blindtext[10]\n)
 cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE)
 
 __

 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 

Re: [R] Finding a scalar value...

2010-08-19 Thread Adaikalavan Ramasamy

Your best option is to read the relevant help files.

A simple (untested) example to find R when P, T and scal.fn=Z is given, 
is to do this:


 my.fun - function(P, R, T, Z) scal.fn(P, R, T) - Z
 uniroot( fn, R=rr, T=tt, Z=zz, lower=-100, upper=100 )$root

You have to make an intelligent guess on the upper and lower ranges for 
the parameter R. I have used +/- 1 million as a silly example.


HOWEVER, I do not think this works when P,R,T,Z are scalars. Try it to 
be sure. If not, then you may have to write a for or apply loop.


Regards, Adai




On 16/08/2010 13:19, Petar Milin wrote:

Thanks for the answer!
However, if I would have scal.fn() like below, how would I apply
uniroot() or optimize() or the like?

Best,
PM

On 16/08/10 13:24, Adaikalavan Ramasamy wrote:

You probably need to look up on how to write functions.

Try

  scal.fn- function(P, R, T){
   out- ( 1/R - T ) / ( P - T )
   return(out)
  }

Here is a fake example:

  df- cbind.data.frame( P=rnorm(10), R=rnorm(10), T=rnorm(10) )
  scal.fn( df$P, df$R, df$T )

Or are you trying to solve other parameters given scal values? If so,
try having a look at functions like uniroot().

Regards, Adai


On 16/08/2010 11:48, Petar Milin wrote:

Hello!
I need to find a simple scalar value:
Scal = ((1/R) - T) / (P - T),
where R, T, and P are vectors in a data.frame.

Please, can anyone tell me how to solve that in R?

Best,
PM

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] texi2dvi: option clean also deletes the generated pdf file

2010-08-19 Thread Tim Gruene
Dear Marius,

I see. I suppose it's a matter of your version of texi2dvi then - when I do the
same in a freshly created directory (including the test directory), cutting
and pasting your very code into R leaves me only with myLaTeXFile2.pdf and
test/myLaTeXFile2.tex

This is texi2dvi --version
texi2dvi (GNU Texinfo 4.11) 1.104

Tim

On Thu, Aug 19, 2010 at 01:55:06PM +0200, Marius Hofert wrote:
 Dear Tim,
 
 if I run ...
 
 ## Example 2: texi2dvi also deletes the generated .pdf
 require(tools)
 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
   cat(\\documentclass{article}\n)
   cat(\\usepackage[T1]{fontenc}\n)
   cat(\\usepackage[english]{babel}\n)
   cat(\\usepackage{blindtext}\n)
   cat(\\begin{document}\n)
   cat(\\blindtext[10]\n)
   cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE) 
 
 ... on a fresh-and-clean working directory (and also no files in the 
 subdirectory ./test), I only get the file myLaTeXFile2.tex in ./test, so 
 *everything* (including the .pdf) is deleted :-(
 
 I work with R version 2.11.1 (2010-05-31) on a MacBook Pro running 10.6.4.
 
 Cheers,
 
 Marius
 
 On 2010-08-19, at 13:38 , Tim Gruene wrote:
 
  Dear Marius,
  
  yes, that's what I had meant.
  
  I am sorry I had not actually tested my suggestion nor your problem (bad
  practice). Now I have and actually in case 2 you describe I only end up
  with test/myLaTeXFile2.tex and myLaTeXFile2.pdf.
  
  If, however, I run texi2dvi at least once with option 'clean=F', the 
  auxiliary files
  are generated and left in the path. Also upon a subsequent run with the 
  option
  'clean=T', they are not being deleted. 
  
  Could this also be the case for you, i.e., that you once used the option
  'clean=F' (or not set at all) and now are made believe 'clean=T' does not 
  work
  because they are still there but actually left-overs from the old run?
  
  I run R version 2.7.1 (2008-06-23) on Debian stable.
  
  Kind regards, Tim
  
  On Thu, Aug 19, 2010 at 12:41:57PM +0200, Marius Hofert wrote:
  Dear Tim,
  
  you mean
  
  require(tools)
  filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
  sink(file=filepath)
   cat(\\documentclass{article}\n)
   cat(\\usepackage[T1]{fontenc}\n)
   cat(\\usepackage[english]{babel}\n)
   cat(\\usepackage{blindtext}\n)
   cat(\\begin{document}\n)
   cat(\\blindtext[10]\n)
   cat(\\end{document}\n)
  sink()
  texi2dvi(filepath,pdf=TRUE,quiet=TRUE,texi2dvi=getOption(texi2dvi 
  --mostly-clean))
  
  ?
  The problem is that this does not work. It produces the same output as my 
  Example 2 without the clean-option. So it leaves all files in the 
  working directory. 
  
  The reason why I am looking for a clean-up is that I have to compile 
  several hundred LaTeX files in different directories...
  
  Cheers,
  
  Marius
  
  
  On 2010-08-19, at 12:33 , Tim Gruene wrote:
  
  Dear Marius,
  
  from reading the texi2dvi man-page and R-help on texi2dvi I suggest to set
  'clean=F' and use 'texi2dvi = getOption(texi2dvi --mostly-clean)' 
  instead.
  
  Tim
  
  On Thu, Aug 19, 2010 at 10:36:30AM +0200, Marius Hofert wrote:
  Dear expeRts,
  
  below are two examples of using texi2dvi. The problem becomes clear from 
  the 
  second example: on cleaning, texi2dvi also deletes the generated .pdf 
  file.
  Is there a solution?
  
  Cheers,
  
  Marius
  
  ## Example 1: texi2dvi cleans fine, without deleting the generated .pdf
  require(tools)
  sink(file=myLaTeXFile1.tex)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
  sink()
  texi2dvi(myLaTeXFile1.tex,pdf=TRUE,clean=TRUE,quiet=TRUE) 
  
  ## Example 2: texi2dvi also deletes the generated .pdf
  require(tools)
  filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
  sink(file=filepath)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
  sink()
  texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE)
  
  __
  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.
  
  -- 
  --
  Tim Gruene
  Institut fuer anorganische Chemie
  Tammannstr. 4
  D-37077 Goettingen
  
  GPG Key ID = A46BEE1A
  
  
  -- 
  --
  Tim Gruene
  Institut fuer anorganische Chemie
  Tammannstr. 4
  D-37077 Goettingen
  
  GPG Key ID = A46BEE1A
  

-- 
--

Re: [R] texi2dvi: option clean also deletes the generated pdf file

2010-08-19 Thread Marius Hofert
Dear all,

many thanks for your help. I totally missed that texi2dvi is also a system 
command (I don't use that explicitly to compile my .tex docs). So I checked my 
system-texi2dvi. It's quite interesting, if I use the option 
--mostly-clean, everthing is removed. However, if I use just --clean, then 
the generated pdf file is not removed. So the solution is to call (in the 
shell):
texi2dvi --clean --pdf ./test/myLaTeXFile2.tex
I can call this from within system() [or even use pdflatex directly from within 
system()]. I guess I don't need R's texi2dvi anymore.

Many thanks

Marius

Ps: Here is the output of what Duncan suggested:

 debug(tools:::.shell_with_capture)
 require(tools)
 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
   cat(\\documentclass{article}\n)
   cat(\\usepackage[T1]{fontenc}\n)
   cat(\\usepackage[english]{babel}\n)
   cat(\\usepackage{blindtext}\n)
   cat(\\begin{document}\n)
   cat(\\blindtext[10]\n)
   cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE)
debugging in: .shell_with_capture(paste(shQuote(texi2dvi), --help))
debug: {
outfile - tempfile(xshell)
errfile - tempfile(xshell)
on.exit(unlink(c(outfile, errfile)))
status - if (.Platform$OS.type == windows) 
shell(sprintf(%s  %s 2 %s, command, outfile, errfile), 
input = input, shell = cmd.exe)
else system(sprintf(%s  %s 2 %s, command, outfile, errfile), 
input = input)
list(status = status, stdout = readLines(outfile, warn = FALSE), 
stderr = readLines(errfile, warn = FALSE))
}
Browse[2] 
debug: outfile - tempfile(xshell)
Browse[2] 
debug: errfile - tempfile(xshell)
Browse[2] 
debug: on.exit(unlink(c(outfile, errfile)))
Browse[2] 
debug: status - if (.Platform$OS.type == windows) shell(sprintf(%s  %s 2 
%s, 
command, outfile, errfile), input = input, shell = cmd.exe) else 
system(sprintf(%s  %s 2 %s, 
command, outfile, errfile), input = input)
Browse[2] 
debug: system(sprintf(%s  %s 2 %s, command, outfile, errfile), input = 
input)
Browse[2] 
debug: list(status = status, stdout = readLines(outfile, warn = FALSE), 
stderr = readLines(errfile, warn = FALSE))
Browse[2] 
exiting from: .shell_with_capture(paste(shQuote(texi2dvi), --help))
debugging in: .shell_with_capture(paste(shQuote(texi2dvi), opt_pdf, opt_quiet, 
opt_extra, shQuote(file)))
debug: {
outfile - tempfile(xshell)
errfile - tempfile(xshell)
on.exit(unlink(c(outfile, errfile)))
status - if (.Platform$OS.type == windows) 
shell(sprintf(%s  %s 2 %s, command, outfile, errfile), 
input = input, shell = cmd.exe)
else system(sprintf(%s  %s 2 %s, command, outfile, errfile), 
input = input)
list(status = status, stdout = readLines(outfile, warn = FALSE), 
stderr = readLines(errfile, warn = FALSE))
}
Browse[2] 
debug: outfile - tempfile(xshell)
Browse[2] 
debug: errfile - tempfile(xshell)
Browse[2] 
debug: on.exit(unlink(c(outfile, errfile)))
Browse[2] 
debug: status - if (.Platform$OS.type == windows) shell(sprintf(%s  %s 2 
%s, 
command, outfile, errfile), input = input, shell = cmd.exe) else 
system(sprintf(%s  %s 2 %s, 
command, outfile, errfile), input = input)
Browse[2] 
debug: system(sprintf(%s  %s 2 %s, command, outfile, errfile), input = 
input)
Browse[2] 
debug: list(status = status, stdout = readLines(outfile, warn = FALSE), 
stderr = readLines(errfile, warn = FALSE))
Browse[2] 
exiting from: .shell_with_capture(paste(shQuote(texi2dvi), opt_pdf, opt_quiet, 
opt_extra, shQuote(file)))


On 2010-08-19, at 15:02 , Tim Gruene wrote:

 Dear Marius,
 
 I see. I suppose it's a matter of your version of texi2dvi then - when I do 
 the
 same in a freshly created directory (including the test directory), cutting
 and pasting your very code into R leaves me only with myLaTeXFile2.pdf and
 test/myLaTeXFile2.tex
 
 This is texi2dvi --version
 texi2dvi (GNU Texinfo 4.11) 1.104
 
 Tim
 
 On Thu, Aug 19, 2010 at 01:55:06PM +0200, Marius Hofert wrote:
 Dear Tim,
 
 if I run ...
 
 ## Example 2: texi2dvi also deletes the generated .pdf
 require(tools)
 filepath - paste(getwd(),/test/myLaTeXFile2.tex,sep=)
 sink(file=filepath)
  cat(\\documentclass{article}\n)
  cat(\\usepackage[T1]{fontenc}\n)
  cat(\\usepackage[english]{babel}\n)
  cat(\\usepackage{blindtext}\n)
  cat(\\begin{document}\n)
  cat(\\blindtext[10]\n)
  cat(\\end{document}\n)
 sink()
 texi2dvi(filepath,pdf=TRUE,clean=TRUE,quiet=TRUE) 
 
 ... on a fresh-and-clean working directory (and also no files in the 
 subdirectory ./test), I only get the file myLaTeXFile2.tex in ./test, so 
 *everything* (including the .pdf) is deleted :-(
 
 I work with R version 2.11.1 (2010-05-31) on a MacBook Pro running 10.6.4.
 
 Cheers,
 
 Marius
 
 On 2010-08-19, at 13:38 , Tim Gruene wrote:
 
 Dear Marius,
 
 yes, that's 

Re: [R] GLMM random effects

2010-08-19 Thread Ben Bolker
 Natasha natasha.lloyd at gmail.com writes:

  For future reference, you may have better luck *either* on
the r-sig-mixed-models help list (for advice about GLMMs) *or*
on r-sig-ecology (for advice about ecological studies) [it's not
considered polite to cross-post: try looking at the archives of
both lists to decide which is more appropriate].

 Background information:
 Our study design:   We used mark-recapture trapping to obtain density
 estimates and demography of prairie dogs. The location of our study sites
 are nested, we have 6 trapping plots within 3 colonies of prairie dogs.
 Within each colony 3 plots are treatment (given supplemental food) and 3 are
 control sites. Therefore, in total we have 18 study plots (9 control and 9
 treatment).
 Our study spans over two years and within each year we trapped prairie dogs
 twice (Spring 2008, Summer 2008, Spring 2009, Summer 2009) for a total of
 four trapping sessions. Therefore we also have temporal repeated measures in
 our sampling design. From the mark-recapture data we estimated density using
 Program DENSITY for each study plot and for each session (a total of 4
 density estimates for each 18 plots over time). We also did vegetation
 sampling to obtain estimates of the natural food available in each plot,
 which gave us total biomass and % edible vegetation as covariates.
 
 We are using the lme4 package in program R (2.11.1) for analysis:
 We fitted a GLMM with Laplace restricted maximum likelihood estimation.
 Since our response variable density is a count with overdispersion we used a
 corrected poisson distribution with a log link function. 

  (I'm not sure corrected is a technically meaningful term:
do Zuur et al use this?)

 And in order to
 account for the nested and repeated measures in our design we want to
 include Plot nested in Colony as random effects. The explanatory variables
 include Treatment, Session, Total biomass, and/or %Edible food for the fixed
 effects. (Colony, Plot, Treatment, and Session are all factor variables).
 
 And an example of the R code that we started with is:
 
 PDmodel_1 - lmer(Density~1+Treatment+Session+Biomass+(1|Colony/Plot),
 family=quasipoisson, data=DensityPD)
  
  (You don't need the 1 in this formula: the intercept is implicitly
included.)
 
 My main question is: 
 Does this accurately take into account our nested and repeated measures
 design? Have we accounted for any possible pseudoreplication with this type
 of analysis?  Do I need to also look at type AR-1 error structures (or can I
 do that in a glmm?) Or is there a simpler way you might suggest?  I can also
 look at the change in density between time intervals instead density at time
 intervals if that makes anything easier to analyze?  I can also split
 Session into season and year if that is helpful too.

  This looks reasonable.  You're likely to have trouble estimating
the among-colony variance, because there are only 3 colonies (try
estimating a variance from 3 samples sometime) -- I wouldn't be
surprised if the estimate of the among-colony variance is zero, unless
the colonies are very different.  You might alternatively try 
Colony as a fixed effect and Colony:Plot as the random effect
(or equivalently make sure your plots have 18 distinct labels rather
than being numbered 1..6 in each plot).

   It's a bit tricky to incorporate autoregressive structures in a GLMM --
if your densities are high (means  5) you can try this in MASS::glmmPQL.
However, I suspect you're unlikely to be able to resolve AR structure
in this data set -- if you're worried, take the residuals and examine
the correlation between r(t) and r(t+1) [you'll have 54 points -- one for
each plot/session combination, not counting the final session]. If that
correlation is small/non-significant, you're off the hook.

   Quasipoisson fits are a little bit problematic in lme4 -- two alternatives
are (1) fitting a lognormal-Poisson model by adding a random effect with
a distinct level for each observation (2) fitting a negative binomial
model with glmm.admb (glmm.admb only allows a single random effect,
but you could do that if you make Colony fixed as suggested above).

  Also keep in mind the rule of thumb that you need at least 10-20 observations
per parameter you want to estimate -- with 72 observations, you're pushing
it a little (intercept (1) + treatment (1) + session (3) + biomass (1) +
random effects (2)) (it's hard to know exactly how to count random effects,
but this is a crude rule of thumb).  I certainly wouldn't try to make
your model any *more* complicated ...

  good luck

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R reports

2010-08-19 Thread Frank Harrell


What do low level proc print and proc report have on Sweave or
http://biostat.mc.vanderbilt.edu/wiki/pub/Main/StatReport/summary.pdf?
If proc print and proc report are 4G, let's move back a generation.

Frank E Harrell Jr   Professor and ChairmanSchool of Medicine
 Department of Biostatistics   Vanderbilt University

On Thu, 19 Aug 2010, Donald Paul Winston wrote:



I don't see much in the way of an ability to write reports in R the way you
can with SAS. You basically have to write a program with R in a 3G way
unlike SAS with it's 4G proc print and proc report.

Are there similar R functions and packages?
--
View this message in context: 
http://r.789695.n4.nabble.com/R-reports-tp2330733p2330733.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ifelse command

2010-08-19 Thread David Winsemius


On Aug 18, 2010, at 10:46 PM, Philip Wong wrote:



well to be honest, it is a assignment for the Bayesian statistic  
paper I wish
to take later in the academic year.  But I'm a slow learner, so I'm  
going to
try out some of the assignments posted in the university forum  
hoping to get

some practice in advance.

Could you please elaborate more on the set.seed() function, I  
understood
from the ?set.seed the general idea of set.seed (if I didn't  
misunderstood
it).  I could stimulate a six side dice by set.seed(1:6) with n  
number of
runs using runif(), does that meant if I use set.seed() I don't need  
to use

the prob=c(1,1,2,3,2,1)/10) to create my bias dice?


No. set.seed()'s only purpose is to fix the RNG in a predictiable  
starting state so that the reuslts of one or more simulation runs can  
be recreated exactly.




--
View this message in context: 
http://r.789695.n4.nabble.com/ifelse-command-tp2329538p2330591.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.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Correlograms and linear regression

2010-08-19 Thread ashz

Dear all,

I generated a Correlograms and used the panel.ellipse (confidence ellipse
and smoothed line) option. Is there a way to get instead of the smoothed
line the linear regression?

Thanks,
As hz



-- 
View this message in context: 
http://r.789695.n4.nabble.com/Correlograms-and-linear-regression-tp2331071p2331071.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] Linear regression equation and coefficient matrix

2010-08-19 Thread ashz

Dear Greg,

Thanks for the tip. As I am new in R can you please provide me a script how
do to so. It will help my learning process.

Thanks,
Asher
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Linear-regression-equation-and-coefficient-matrix-tp2329804p2330867.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Combining means

2010-08-19 Thread Holger Danner

Hi volunteer statisticians,
I want to combine the stdev of 6 populations of means for two different 
treatments and there seem to be many methods for doing so.
It is QPCR data consisting of 3 technical replicates building one mean 
and 6 biological samples in two treatment groups. Now as an overview I 
just assumed each value to be a replicate it self within each of the two 
treatments and calculated an overall mean with overall stdev. But this 
seems to be a bit of a mistake. Is it?
First - I think I need a more robust mean. So I applied the geometric 
mean. Next I combined the deviations by calculating with the formula for 
error propagation (wiki german Fehlerfortpflanzung). Isn't this a too 
complicated way?


So:

3 technical replicates build one mean with stdev
6 of these build the population of one treatment
2 treatments

Any suggestions which method I should use and how I perform the 
calculations?


Thanks for your help
Best Holger

__
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] Little's MCAR test

2010-08-19 Thread Sander

L.S.,

Does anyone know if there is an R library which implements Little's MCAR
test for completely at random missing values? It is implemented in SPSS and
SAS, and widely mentioned in the literature.

Thanks in advance!

Sander van Kuijk
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Little-s-MCAR-test-tp2331137p2331137.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] creation package

2010-08-19 Thread anderson nuel
Dear r-help,

I don't use namespace.

How can I make asia available?

I think my problem in creating the package in this: I have a singleglobal
function (RT) in my package, but inside RT I need to call several other
function( comb l,earn_comb, nchoo). When I used package.sekeleton, Iput in
lists all the functions(comb l,earn_comb, nchoo,RT),but in the 'man' I left
only namepackage-package.Rd and RT.Rd. When I did do this, is it true??


Best Regards


2010/8/18, Michael Dewey i...@aghmed.fsnet.co.uk:

 At 10:27 18/08/2010, anderson nuel wrote:

 Dear r-help,

 No, I find errors in the file C:/Rp/namepackage.Rcheck/00check.txt :

 * using log directory 'C:/Rpackage/namepackage.Rcheck'
 * using R version 2.10.1 (2009-12-14)
 * using session charset: ISO8859-1
 * checking for file 'namepackage/DESCRIPTION' ... OK
 * checking extension type ... Package
 * this is package 'namepackage' version '1.0'
 * checking package dependencies ... OK
 * checking if this is a source package ... OK
 * checking for executable files ... OK
 * checking whether package 'namepackage' can be installed ... OK
 * checking package directory ... OK
 * checking for portable file names ... OK
 * checking DESCRIPTION meta-information ... OK
 * checking top-level files ... OK
 * checking index information ... OK
 * checking package subdirectories ... OK
 * checking R files for non-ASCII characters ... OK
 * checking R files for syntax errors ... OK
 * checking whether the package can be loaded ... OK
 * checking whether the package can be loaded with stated dependencies ...
 OK
 * checking for unstated dependencies in R code ... OK
 * checking S3 generic/method consistency ... OK
 * checking replacement functions ... OK
 * checking foreign function calls ... OK
 * checking R code for possible problems ... NOTE
 comb: no visible global function definition for 'copy_bloc'
 comb: no visible global function definition for 'copy_interl'
 * checking Rd files ... OK
 * checking Rd metadata ... OK
 * checking Rd cross-references ... OK
 * checking for missing documentation entries ... WARNING
 Undocumented code objects:
  comb learn_comb nchoo
 All user-level objects in a package should have documentation entries.
 See the chapter 'Writing R documentation files' in manual 'Writing R
 Extensions'.
 * checking for code/documentation mismatches ... OK
 * checking Rd \usage sections ... OK
 * checking examples ... ERROR
 Running examples in 'namepackage-Ex.R' failed.
 The error most likely occurred in:
  ### * RT
 
  flush(stderr()); flush(stdout())
 
  ### Name: RT
  ### Title: RT
  ### Aliases: RT
 
  ### ** Examples
 
  data(asia)
 Warning in data(asia) : data set 'asia' not found
  RT(asia, c(2,2,2), c(1,2,3),c(a,b,c ))
 Error in nrow(data) : object 'x' not found
 Calls: RT - array - nrow
 Execution halted


 I think my problem in creating the package in this: I have a singleglobal
 function (RT) in my package, but inside RT I need to call several other
 function( comb l,earn_comb, nchoo). When I used package.sekeleton, Iput in
 lists all the functions(comb l,earn_comb, nchoo,RT),but in the 'man' I
 left
 only namepackage-package.Rd and RT.Rd. When I did do this, is it true??


 Are you using a namespace?
 If not I think it may help you with the warnings about documentation.

 The other warning tells you R cannot find asia. You need to make it
 available.


  Best Regards,











 2010/8/16, Uwe Ligges lig...@statistik.tu-dortmund.de:
 
 
 
  On 16.08.2010 18:52, anderson nuel wrote:
 
  Dear r-help,
 
  the file C:/Rp/namepackage.Rcheck/00install.out :
 
  * install options are ' --no-html'
  * installing *source* package 'namepackage' ...
  ** R
  ** preparing package for lazy loading
  ** help
  *** installing help indices
  ** building package indices ...
  ** MD5 sums
  * DONE (namepackage)
 
 
 
  So it was successful.
 
  Uwe
 
 
 
  Best Regards,
 
 
 
 
 
  2010/8/14, Uwe Liggeslig...@statistik.tu-dortmund.de:
 
 
 
 
  On 14.08.2010 11:21, anderson nuel wrote:
 
  Dear r-help,
 
  I run R CMD INSTALL :
 
  c:\RpR CMD INSTALL namepackage
 
  *installing to library'c:/PROGRA~1/R/R-210~1-1/library'
  *installing *source* 'namepackage'...
  **R
  **preparing package for lazy loading
  **help
  Avis:./man/namepackage-package.Rd:25:'' inatttendue
  **installing help indices
  **building package indices
  **MD5sums
  *DONEnamepackage
 
  best
 
 
 
  OK, but strange that checking the package fails now in its
 installation
  checks. Can you send us the file
  C:/Rp/namepackage.Rcheck/00install.out
  please.
 
  Uwe Ligges
 
 
 
 
 
  2010/8/13, Uwe Liggeslig...@statistik.tu-dortmund.de:
 
 
  In my previous maiul I asked you to run R CMD INSTALL at first
 (rather
  than
  R CMD check).
 
  You could also look into the mentioned file
  C:/Rp/namepackage.Rcheck/00install.out
 
  But we really need that file to understand what is going on.
 
  Uwe Ligges
 
 
 
 
 
 
  On 13.08.2010 15:12, anderson nuel wrote:
 
  Dear r-help,
 
  I try this 

[R] zoo. window

2010-08-19 Thread wyd923
Hi, 
I have a dataset including monthly date from 1971-01-01 to 2009-01-01. The 
dates are character variables.

I want to select the subsample from my original data, so I use
mydata3-window(mydata,start=1972-02-01,end=2005-02-01),
or mydata3-window(mydata, 
start=as.date(1972-02-01),end=as.date(2005-02-01))
or mydata3-window(mydata, start=c(1972-02-01),end=c(2005-02-01))

but I constantly receive 
Error in attr(x, tsp) - c(1, NROW(x), 1) : 
  invalid time series parameters specified

I don't know how to fix it in this case.

Many thanks 
YD



[[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] error with bitmap, please help

2010-08-19 Thread kayj

Hi All 


I still have a problem with “bitmap” function in R, I have downloaded
ghostscript 8.71 and added the path to the executable to the path
environment variable, by going to the control panel , system, advanced
system settings, added C:\Program Files(x86)\gs\gs8.71\bin to the path
variable. I have also added the R executable path to the path variable. I
have a 64 bit computer with windows 7 as an operating system. When running
the following script, I get an error in the system 

df=read.table(sample.txt,sep=\t) 
bitmap(file=sample.JPG,type=jpeg,width=5,height=5,res=300,pointsize=10) 
Error in system(paste(gsexe, -help), intern = TRUE, invisible = TRUE) : 
  gswin32c.exe not found 
plot(df$V1,df$V2,pch=20,col=blue) 

is there anything that I am missing?? 

Thanks for your input 




-- 
View this message in context: 
http://r.789695.n4.nabble.com/error-with-bitmap-please-help-tp2331196p2331196.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] R reports

2010-08-19 Thread peter dalgaard

On Aug 19, 2010, at 3:49 PM, Frank Harrell wrote:

 What do low level proc print and proc report have on Sweave or
 http://biostat.mc.vanderbilt.edu/wiki/pub/Main/StatReport/summary.pdf?
 If proc print and proc report are 4G, let's move back a generation.

Er, no...

AFAIK, 4GL just means that the end user writes (short) programs to control a 
(complex) application. 

(3GL is systems programming languages: fortran, C, Pascal, Algol, 2GL is 
assembler, 1GL is binary code).

So a SAS programming is quite typical 4GL, as is S and R. However, SAS may be 
more contemporary with the buzzword, which roughly corresponds to the perceived 
state of the art in computer science anno 1945, 1955, 1965, and 1975. If you 
try continuing into 1985, 1995, 2005, 2015, you'll realize that languages fell 
off the avant-garde, and instead we got (say) word processors, internet, 
handheld devices, ...
 
-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Does R always insist on sending plot output to a file?

2010-08-19 Thread Matt Shotwell
Donald, 

I was able to 'trick' R into writing plot data to a GNU Linux fifo. I
had forgotten that the fifo will block until there is a process at
either end (a writer and a reader):

At one terminal, create a fifo and set a program to catch output

$ mkfifo Rfifo
$ cat Rfifo

At a second terminal

$ R
 postscript(file=Rfifo)
 plot(0)
 dev.off()

-Matt


On Wed, 2010-08-18 at 23:21 -0400, Matt Shotwell wrote:
 Donald,
 
 At least for the PDF device (I know you asked about png, but I believe
 they are similar), the answer no. Ultimately, this device calls the
 standard C function fopen, and writes its data to the resulting file
 stream.
 
 If you're using GNU Linux, you might trick R into writing to a fifo (a
 named pipe, see 'man fifo'), or some other in-memory device, and read
 from it with another program. My initial experiments with this, however,
 were not successful.
 
 A better solution here, would be to have the various graphics devices
 write to an R connection, as do most other R functions that input and
 output data. In this way, we could write graphics data to a RAW
 connection (rawConnection()), which is essentially a memory buffer. 
 
 There are two obvious barriers to this:
 1. C level I/O routines (e.g. fprintf) are heavily integrated into the
 graphics device code. Hence, accommodating R connections would require
 significant changes.
 2. The graphics devices are mostly implemented in C, and there is (at
 present) no interface to R connections at the C level.
 
 -Matt
 
 On Wed, 2010-08-18 at 21:49 -0400, Donald Paul Winston wrote:
  I need to write the output of a R plot to a Java OutputStream. It looks like
  R insists on sending it's output to a file. Is there anyway to get bytes
  directly from the output of a plot so I can write it with Java? Writing it
  to a file is too slow.
  
  Is there a parameter in the graphics device function png(..) that directs
  output to a variable in memory? 
  
  x - plot(.)  would make sense.
 

-- 
Matthew S. Shotwell
Graduate Student 
Division of Biostatistics and Epidemiology
Medical University of South Carolina

__
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] probabilities from predict.svm

2010-08-19 Thread Steve Lianoglou
Hi James,

I'd like to help you out, but I'm not sure I understand what the problem is.

Does the problem lie with building a predictive SVM, or getting the
right values (class probabilities) to land in the right place on your
map/plot?

-steve

On Wed, Aug 18, 2010 at 3:09 PM, Watling,James I watli...@ufl.edu wrote:
 Dear R Community-

 I am a new user of support vector machines for species distribution modeling 
 and am using package e1071 to run svm() and predict.svm().  Briefly, I want 
 to create an svm model for classification of a factor response (species 
 presence or absence) based on climate predictor variables.  I have used a 
 training dataset to train the model, and tested it against a validation data 
 set with good results: AUC is high, and the confusion matrix indicates low 
 commission and omission errors.  The code for the best-fit model is:

 svm.model 
 -svm(as.factor(acutus)~p_feb+p_jan+p_mar+p_sep+t_feb+t_july+t_june+t_mar,cost=1,
  gamma=1, probability=T)

 Because ultimately I want to create prediction maps of probabilities of 
 species occurrence under future climate change, I want to use the results of 
 the validated model to predict probability of presence using data describing 
 future conditions.  I have created a data frame (predict.data) with new 
 values for the same predictor variables used in the original model; each 
 value corresponds to an observation from a raster grid of the study area.  I 
 enabled the probability option when creating the original model, and acquire 
 the probabilities using the predict function:
 pred.map -predict(svm.model, predict.data, probability=T).  However, when I 
 use probs-attr(pred.map, probabilities) to acquire the probabilities for 
 each grid cell, the spatial signature of the probabilities does make sense.  
 I have extracted the column of probabilities for class = 1 (probability of 
 presence), and the resulting map of the study area is spatially accurate (it 
 has the right shape), but the probability values are incorrect, or at least 
 in the wrong place.  I am attaching a pdf (SVM prediction maps) of the 
 resulting map using probabilities obtained using the code described above 
 (page 1) and a map of what the prediction map should look like given spatial 
 autocorrelation in climate predictors (page 2, map generated using 
 openmodeller).  Note that the openmodeller map was created with the same 
 input data and same svm algorithm (also using code from libsvm) as the model 
 in R, just run using different software.  I don't know why the prediction map 
 of probabilities based on the model is  so different from what I would 
 expect, and would appreciate any thoughts from the group.

 All the best

 James

 ***
 James I Watling, PhD
 Postdoctoral Research Associate
 University of Florida
 Ft. Lauderdale Research  Education Center
 3205 College Avenue
 Ft Lauderdale, FL 33314 USA
 954.577.6316 (phone)
 954.475.4125 (fax)


 ***
 James I Watling, PhD
 Postdoctoral Research Associate
 University of Florida
 Ft. Lauderdale Research  Education Center
 3205 College Avenue
 Ft Lauderdale, FL 33314 USA
 954.577.6316 (phone)
 954.475.4125 (fax)


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





-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R reports

2010-08-19 Thread Spencer Graves
 The sos package is designed to search the help pages of all 
contributed packages and return the results in a data.frame sorted to 
put first the package with the most matches.  It also has a vignette, 
which appeared in last December's issue of The R Journal.  This can be 
used to search in a variety of ways for whatever you want.  It has union 
capabilities to support combining the results of different searches.



Spencer Graves, lead author of sos


On 8/19/2010 6:49 AM, Frank Harrell wrote:


What do low level proc print and proc report have on Sweave or
http://biostat.mc.vanderbilt.edu/wiki/pub/Main/StatReport/summary.pdf?
If proc print and proc report are 4G, let's move back a generation.

Frank E Harrell Jr   Professor and ChairmanSchool of Medicine
 Department of Biostatistics   Vanderbilt University

On Thu, 19 Aug 2010, Donald Paul Winston wrote:



I don't see much in the way of an ability to write reports in R the 
way you

can with SAS. You basically have to write a program with R in a 3G way
unlike SAS with it's 4G proc print and proc report.

Are there similar R functions and packages?
--
View this message in context: 
http://r.789695.n4.nabble.com/R-reports-tp2330733p2330733.html

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.




--
Spencer Graves, PE, PhD
President and Chief Operating Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567

__
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] Adding lines to xyplot with abline

2010-08-19 Thread Jeffrey.Morris
Is it kosher to add, say, horizontal lines to a lattice xyplot using
abline(h=xxx)?  The lines don't appear at the right value, that is, if
h=150, the line might appear at h=140?

Jeff



This communication, including any attachments, is intended solely for the use 
of the addressee and may contain information which is privileged, confidential, 
exempt from disclosure under applicable law or subject to copyright. If you are 
not an intended recipient, any use, disclosure, distribution, reproduction, 
review or copying is unauthorized and may be unlawful. If you have received 
this transmission in error, please notify the sender immediately. Thank you.

Cette communication,y compris les pieces jointes, est reservee a l'usage 
exclusif du destinataire et peut contenir des informations privilegiees, 
confidentielles, exemptees de divulgation selon la loi ou protegees par les 
droits de publication. Si vous n'etes pas un destinataire, toute utilisation, 
divulgation, distribution, reproduction, examen ou copie est non-autorisee et 
peut etre illegale. Si vous avez recu cette communication par erreur, veuillez 
aviser l'expediteur immediatement. Merci.


[[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] error with bitmap, please help

2010-08-19 Thread Prof Brian Ripley

On Thu, 19 Aug 2010, kayj wrote:



Hi All


I still have a problem with “bitmap” function in R, I have downloaded
ghostscript 8.71 and added the path to the executable to the path
environment variable, by going to the control panel , system, advanced
system settings, added C:\Program Files(x86)\gs\gs8.71\bin to the path
variable. I have also added the R executable path to the path variable. I
have a 64 bit computer with windows 7 as an operating system. When running
the following script, I get an error in the system

df=read.table(sample.txt,sep=\t)
bitmap(file=sample.JPG,type=jpeg,width=5,height=5,res=300,pointsize=10)
Error in system(paste(gsexe, -help), intern = TRUE, invisible = TRUE) :
 gswin32c.exe not found
plot(df$V1,df$V2,pch=20,col=blue)

is there anything that I am missing??


As it says it is not found, so you need to check your paths: do 
Sys.getenv(PATH) inside R.


Note that the help page mentions two environment variables you can 
set to the path to the gswin32c.exe, which is designed to make this 
easier for you to set.


Please note that it is getting increasingly important to supply 'at a 
minimum' information asked for in the posting guide.  This is the 
second time that you have not done so, and would-be helpers are put 
off by the lack of basic information.  For example, here we don't know 
the version or build of R (your OS may be 64-bit, is your R)?




Thanks for your input




--
View this message in context: 
http://r.789695.n4.nabble.com/error-with-bitmap-please-help-tp2331196p2331196.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.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] solution

2010-08-19 Thread Alex Levitchi
Hello 
I am not sure about your general aim, but from my previous experience on 
combination of treatments, it can be more useful to create a matrix or 
data.frame, which you can fulfill either with 1s and 0s, or with the values of 
treatment, especially if you will need this data later for the analysis. 

I can propose a small function, but only for the case of pair selection 

treat=function(x,y){ 
data.frame(Treatment=x[-which(x==y)], Comparator=rep(y,times=length(x)-1)) 
} 

 treat(c(t1,t2,t3,t4),t2) 
Treatment Comparator 
1 t1 t2 
2 t3 t2 
3 t4 t2 

In this case you can define the list of names of treatments ant the comparator 
each time you need, and you will get the result as a data frame in the way you 
asked. 

Good luck 

Alex Levitchi 
PhD in Genetics, 
Bioinformatician at Laboratory of Bioinformatics 
CBM, Area Science Park, Trieste, Italy 
http://www.cbm.fvg.it/laboratories/bioinformatics_research 

scientific researcher, 
Center of Molecular Biology, 
University of Academy of Sciences of Moldova 
www.edu.asm.md 

[[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] zoo. window

2010-08-19 Thread Achim Zeileis

On Thu, 19 Aug 2010, wyd...@msn.com wrote:

Hi, I have a dataset including monthly date from 1971-01-01 to 
2009-01-01. The dates are character variables.


I would suggest to use a more suitable class for the index, such as 
yearmon (if you only want to indicate the month anyway) or Date (if 
you want to use a particular day within the month). From your description, 
I would recommend yearmon.


Also look at the examples on the manual pages and in the vignettes of the 
package that provide various illustrations of both approaches.



I want to select the subsample from my original data, so I use
mydata3-window(mydata,start=1972-02-01,end=2005-02-01),
or mydata3-window(mydata, 
start=as.date(1972-02-01),end=as.date(2005-02-01))
or mydata3-window(mydata, start=c(1972-02-01),end=c(2005-02-01))

but I constantly receive
Error in attr(x, tsp) - c(1, NROW(x), 1) :
 invalid time series parameters specified

I don't know how to fix it in this case.

Many thanks
YD



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Adding lines to xyplot with abline

2010-08-19 Thread David Winsemius


On Aug 19, 2010, at 10:31 AM, jeffrey.mor...@sanofipasteur.com wrote:


Is it kosher to add, say, horizontal lines to a lattice xyplot using
abline(h=xxx)?  The lines don't appear at the right value, that is, if
h=150, the line might appear at h=140?


Correct. The coordinate systems are not shared between lattice and  
base graphics.


?panel.abline

If you have an existing plot on your screen device, you can try what  
the help pages describe as an experimental method:


trellis.focus(panel, 1, 1)
   panel.abline(h=140)
 trellis.unfocus()

As far as I can tell, it doesn't actually change the lattice object  
but the plot can be saved as whatever options for Save as your GUI  
may offer.

--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Correlograms and linear regression

2010-08-19 Thread Kevin Wright
Just define your own panel function.  Here I modified the panel.ellipse
function and called it panel.lm

library(corrgram)
data(baseball)
vars2 - c(Assists,Atbat,Errors,Hits,Homer,logSal,
Putouts,RBI,Runs,Walks,Years)
panel.lm - function(x, y, ...){
  dfn - 2
  dfd - length(x) - 1
  shape - var(cbind(x, y), na.rm = TRUE)
  keep - (!is.na(x)  !is.na(y))
  center - c(mean(x[keep]), mean(y[keep]))
  radius - sqrt(dfn * qf(0.68, dfn, dfd))
  segments - 75
  angles - seq(0, 2 * pi, length = segments)
  unit.circle - cbind(cos(angles), sin(angles))
  ellipse.pts - t(center + radius * t(unit.circle %*% chol(shape)))
  ellx - ellipse.pts[, 1]
  elly - ellipse.pts[, 2]
  usr - par()$usr
  minx - usr[1]
  maxx - usr[2]
  miny - usr[3]
  maxy - usr[4]
  ellx - ifelse(ellx  minx, minx, ellx)
  ellx - ifelse(ellx  maxx, maxx, ellx)
  elly - ifelse(elly  miny, miny, elly)
  elly - ifelse(elly  maxy, maxy, elly)
  lines(ellx, elly, col = gray30, ...)
  #ok - is.finite(x)  is.finite(y)
  #if (any(ok))
  #  lines(stats::lowess(x[ok], y[ok], f = 2/3, iter = 3),
  #col = red, ...)
  abline(coef(lm(y~x)), col=red)
}
corrgram(baseball[,vars2], order=TRUE,
 main=Baseball correlation ellipses,
 panel=panel.lm, text.panel=panel.txt, diag.panel=panel.minmax)

Kevin Wright


On Thu, Aug 19, 2010 at 7:07 AM, ashz a...@walla.co.il wrote:


 Dear all,

 I generated a Correlograms and used the panel.ellipse (confidence ellipse
 and smoothed line) option. Is there a way to get instead of the smoothed
 line the linear regression?

 Thanks,
 As hz



 --
 View this message in context:
 http://r.789695.n4.nabble.com/Correlograms-and-linear-regression-tp2331071p2331071.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.




-- 
Kevin Wright

[[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] How to measure correlations in terms of distance and draw them on a 2-dimmentional plot?

2010-08-19 Thread weijian21cn

Thank you all a lot for all the suggestion!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/How-to-measure-correlations-in-terms-of-distance-and-draw-them-on-a-2-dimmentional-plot-tp2330413p2331408.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] probabilities from predict.svm

2010-08-19 Thread Steve Lianoglou
On Thu, Aug 19, 2010 at 10:56 AM, Watling,James I watli...@ufl.edu wrote:
 Hi Steve--

 Thanks for your interest in helping me figure this out.  I think the problem 
 has to do with the values of the probabilities returned from the use of the 
 model to predict occurrence in a new dataframe.

Ok, so if you're sure this is the problem, and not, say, getting the
correct values for the predictor variables at a given point, then I'd
be a bit more thorough when building your model.

Originally you said:

 I have used a training dataset to train the model, and tested it against a 
 validation data set with good results: AUC is high, and the confusion matrix 
 indicates low commission and omission errors.

Maybe your originally good AUC's was just a function of your train/test split?

Why not use all of your data and do something like 10 fold cross
validation to find:

(1) Your average accuracy over your folds
(2) The best value for your cost parameter; (how did you pick cost=1)?
(3) or even the best kernel to use.

Doing 2 and 3 will likely be time consuming. To help with (2) you
might try looking at the svmpath package:

http://cran.r-project.org/web/packages/svmpath/index.html

It only works on 2-class classification problems, and (I think) using
a linear kernel (sorry, don't remember off hand, but it's written in
the package help and linked pubs).

You don't need to use svmpath, but then you'll need to define a grid
of C values (or maybe a 2d grid, if your svm + kernel combo has more
params) and train over these values ... takes lots of cpu time, but
not too much human time.

Does that make sense?

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to measure correlations in terms of distance and draw them on a 2-dimmentional plot?

2010-08-19 Thread Kjetil Halvorsen
You could also try
RSiteSearch(correlation circle)

Kjetil

On Thu, Aug 19, 2010 at 11:31 AM, weijian21cn wli...@stern.nyu.edu wrote:

 Thank you all a lot for all the suggestion!
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/How-to-measure-correlations-in-terms-of-distance-and-draw-them-on-a-2-dimmentional-plot-tp2330413p2331408.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Quick q. on lists

2010-08-19 Thread Jonathan
Hi All,
Anyone know how to quickly query some summary information on the
components of a list?

For example, I have a list that contains dataframes (originally
generated by using split() on one large data frame).


I simply want to know the number of rows in the longest dataframe from the list.

Example, if my list has 3 data frames, and the first has 2 rows, the
second 8 rows, and the third 3 rows, I want to ask something like:


max(nrow(myList))
which would ideally return 8.


but this is obviously wrong syntax.

Currently, I'm looping through each of the data frames in the list,
searching for the max rows, but I'm sure there must be a faster way.

Thanks,
Jonatahn

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] (no subject)

2010-08-19 Thread Ben Bolker
Kalaivani Mani manikalaivani at yahoo.co.in writes:

 To
  
 R group
 Help Desk


  (We're not the help desk (!!)  You can buy support from various
companies if you want ...)
 
 I am a user of R software.  I am facing a problem while using 
 frailtyPenal command in R.2.11.1. When I use
 these command, R closes completely without any prior alert message. 
 Can I know what would be the reason? My
 data size is 7050 records with atleast 25 variables.

  R stopping, if you have not been writing your own low-level
(C/FORTRAN) code, constitutes a bug by definition -- but the bug
is in the contributed 'frailtypack' package, rather than in base
R.  Try contacting the maintainer of the package [maintainer(frailtypack)].
You will want to provide them with at least the results of
sessionInfo() , which will let them know what operating system you
are using (which may well be important in dealing with this sort of bug),
as well as the versions of R and frailtypack.

  good luck
Ben Bolker

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ROCR predictions

2010-08-19 Thread Frank Harrell


At the heart of this you have a problem in incomplete conditioning. 
You are computing things like Prob(X  x) when you know X=x.  Working 
with a statistician who is well versed in probability models will 
undoubtedly help.


Frank

Frank E Harrell Jr   Professor and ChairmanSchool of Medicine
 Department of Biostatistics   Vanderbilt University

On Thu, 19 Aug 2010, Assa Yeroslaviz wrote:


Hello everybody,

yes I'm sorry. I can see it is not so easy to understand.
I'l try to explain a bit more. The experiment was used to compare two
(protein domain) data bases and find out whether or not the results founded
in one are comparable to the second DB.
the first column shows the list of the various inputs in the DB, the second
lists the various domains for each gene. the p-value column calculates the
probability that the found in column four (Expected) to be found by chance.
in column five the expected values was listed.
The calculation of the TP,TN,FP,FN was made many times, each time with a
different p-value (from p=1,...,p=10E-12) as a threshold to calculate the
various values of TP,TN, etc.

The goal of this calculation was to find the optimal p-value wit ha maximum
of TP and a minimum of FP.

To do so I thought about making the column of p-values my predictions and
the values in the column Is.Expected (TRUE,FALSE) to my labels.
This how I calculated my first ROC curve:

pValue - read.delim(file = p=1.txt, as.is= TRUE)
desc1 - pValue[[p.value]]
label1 - pValue[[Is.Expected]] # after changing the values of TRUE = 0,

FALSE = 1


pred - prediction(desc1, label1)
perf - performance(pred, tpr, fpr)
plot(perf, colorsize = TRUE)


my question are as follow:
1. Am I right in my way of thinkning, that the p-values here are
predictions?
I know you said I need to decided it for myself, but I'm not sure. If they
are, than I will have the same predictions for each and every calculation of
ROCR. Will it make any difference at the prediction?
2. how can i calculate the other p-values thresholds? Do I need to do each
separately, or is there a way of combining them?

I hope you can still help we with some hints or further advieces.

Thanks

Assa

On Wed, Aug 18, 2010 at 07:55, Claudia Beleites cbelei...@units.it wrote:


Dear Assa,

you need to call prediction with continuous predictions and a _binary_ true
class label.

You are the only one who can tell whether the p-values are actually
predictions  and what the class labels are. For the list readers p is just
the name of whatever variable, and you didn't even vaguely say what you try
to classify, nor did you offer any explanation of what the columns are.

The only information we get from your table is that p-value has small and
continuous values. From what I see the p-values could also be fitting errors
of the predictions (e.g. expressed as a probability that the similarity to
the predicted class is random).

Claudia

Assa Yeroslaviz wrote:


Dear Claudia,

thank you for your fast answer.
I add again the table of the data as an example.

Protein ID  Pfam Domain p-value ExpectedIs
Expected True Postive False Negative False Positive  True Negative
NP_11.2 APH 1.15E-05APH TRUE1   0   0
  0
NP_11.2 MutS_V  0.0173  APH FALSE   0   0   1   0
NP_62.1 CBS 9.40E-08CBS TRUE1   0   0
  0
NP_66.1 APH 3.83E-06APH TRUE1   0   0
  0
NP_66.1 CobU0.009   APH FALSE   0   0   1   0
NP_66.1 FeoA0.3975  APH FALSE   0   0   1   0
NP_66.1 Phage_integr_N  0.0219  APH FALSE   0   0   1
  0
NP_000161.2 Beta_elim_lyase 6.25E-12Beta_elim_lyase
  TRUE1   0   0   0
NP_000161.2 Glyco_hydro_6   0.002   Beta_elim_lyase FALSE   0
  0   1   0
NP_000161.2 SurE0.0059  Beta_elim_lyase FALSE   0   0
  1   0
NP_000161.2 SapB_2  0.0547  Beta_elim_lyase FALSE   0   0
  1   0
NP_000161.2 Runt0.1034  Beta_elim_lyase FALSE   0   0
  1   0
NP_000204.3 EGF 0.004666118 EGF TRUE1   0   0
  0
NP_000229.1 PAS 3.13E-06PAS TRUE1   0   0
  0
NP_000229.1 zf-CCCH 0.2067  PAS FALSE   0   1   1
  0
NP_000229.1 E_raikovi_mat   0.0206  PAS FALSE   0   0   0
  0
NP_000388.2 NAD_binding_1   8.21E-24NAD_binding_1   TRUE1
  0   0   0
NP_000388.2 ABM 1.40E-08NAD_binding_1   FALSE   0   0
  1   0
NP_000483.3 MMR_HSR11.98E-05MMR_HSR1TRUE1
  0   0   0
NP_000483.3 DEAD2.30E-05MMR_HSR1FALSE   0   0
  1   0
NP_000483.3 APS_kinase  1.80E-09MMR_HSR1

Re: [R] Quick q. on lists

2010-08-19 Thread Erik Iverson



Jonathan wrote:

Hi All,
Anyone know how to quickly query some summary information on the
components of a list?

For example, I have a list that contains dataframes (originally
generated by using split() on one large data frame).


I simply want to know the number of rows in the longest dataframe from the list.

Example, if my list has 3 data frames, and the first has 2 rows, the
second 8 rows, and the third 3 rows, I want to ask something like:


max(nrow(myList))
which would ideally return 8.



max(sapply(myList, nrow))



but this is obviously wrong syntax.

Currently, I'm looping through each of the data frames in the list,
searching for the max rows, but I'm sure there must be a faster way.

Thanks,
Jonatahn

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Quick q. on lists

2010-08-19 Thread ONKELINX, Thierry
You need sapply

max(sapply(myList, nrow))

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie  Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics  Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
  

 -Oorspronkelijk bericht-
 Van: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] Namens Jonathan
 Verzonden: donderdag 19 augustus 2010 17:42
 Aan: r-help
 Onderwerp: [R] Quick q. on lists
 
 Hi All,
 Anyone know how to quickly query some summary information 
 on the components of a list?
 
 For example, I have a list that contains dataframes
 (originally generated by using split() on one large data frame).
 
 
 I simply want to know the number of rows in the longest 
 dataframe from the list.
 
 Example, if my list has 3 data frames, and the first has 2 
 rows, the second 8 rows, and the third 3 rows, I want to ask 
 something like:
 
 
 max(nrow(myList))
 which would ideally return 8.
 
 
 but this is obviously wrong syntax.
 
 Currently, I'm looping through each of the data frames in the 
 list, searching for the max rows, but I'm sure there must be 
 a faster way.
 
 Thanks,
 Jonatahn
 
 __
 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.
 

Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Quick q. on lists

2010-08-19 Thread Jorge Ivan Velez
Hi Jonathan,

Try this:

 # list of data frames

mylist - list(d1 = matrix(rnorm(100), ncol = 10),

   d2 = matrix(rnorm(100), ncol = 5),

   d3 = matrix(rnorm(100), ncol = 20))


# max number of rows

max(do.call(c, lapply(mylist, nrow)))

# [1] 20


HTH,
Jorge


On Thu, Aug 19, 2010 at 11:42 AM, Jonathan  wrote:

 Hi All,
Anyone know how to quickly query some summary information on the
 components of a list?

 For example, I have a list that contains dataframes (originally
 generated by using split() on one large data frame).


 I simply want to know the number of rows in the longest dataframe from the
 list.

 Example, if my list has 3 data frames, and the first has 2 rows, the
 second 8 rows, and the third 3 rows, I want to ask something like:


 max(nrow(myList))
 which would ideally return 8.


 but this is obviously wrong syntax.

 Currently, I'm looping through each of the data frames in the list,
 searching for the max rows, but I'm sure there must be a faster way.

 Thanks,
 Jonatahn

 __
 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] functions and multiple levels

2010-08-19 Thread chris20


Thanks for the replies, it wasn't quite what I wanted but it has given me
some more code for working out averages.

I have managed to construct something that nearly works

level.1  level.2  observation 
1 1 0.5 
1 1 0.2 
1 2 0.6 
1 2 0.4 
2 3 0.8 
2 3 0.7 
2 4 0.6 
2 4 0.4 

# read data (copy above to clipboard) 
 dat - read.table(clipboard,head=T) 

mean.lev- function(a, b, c) {
lev.1-rep(tapply(c, a, mean),each=2)
lev.2-tapply(c, b, mean)
ss.lev-(lev.1-lev.2)^2
ss.lev.n-ss.lev*(length(c)/max(b))
return(as.matrix(ss.lev,ss.lev.n,nrow=max(b)))

}
mean.lev(level.1, level.2, observation)

The only problem is that it won't print both ss.lev and ss.lev.n, does
anyone know to to get it to print both?

I want it in a function as above because I have lots of data sets to apply
it to.

Thanks Chris 

-- 
View this message in context: 
http://r.789695.n4.nabble.com/functions-and-multiple-levels-tp2329935p2331403.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] probabilities from predict.svm

2010-08-19 Thread Watling,James I
Hi Steve--

Thanks for your interest in helping me figure this out.  I think the problem 
has to do with the values of the probabilities returned from the use of the 
model to predict occurrence in a new dataframe.  The svm model I referenced in 
the original message (svm.model) does a good job classifying species presence 
and absence in the test data set I used.  So I don't think the problem is with 
building the predictive svm per se.  The problem comes when I take that model 
and use it to calculate probabilities based on the climate predictors--the 
resulting probabilities range from 0-1, but the probability of presence 
associated with specific cells just does not make sense.  If you take a look at 
the maps I attached in the original message I think the problem becomes very 
clear; the maps model the probability of occurrence for the American 
Crocodile--a species with an entirely tropical distribution.  The second map 
looks exactly like the prediction map for the species should--the warmer colors 
essentially delineate the geographic range of the species.  The first map, with 
probabilities extracted from the use of svm.model to predict occurrence as a 
function of climate variables in the same area (the predict.data dataframe) 
does not make any sense.  I don't think the problem is with getting the 
probabilities in the right place, because the relative position of predicted 
values and NA's used to define the map make sense--the map looks like a map of 
southern North America and northern South America, just as it should. So the 
probabilities are in the right place on the map.  The problem is that the 
probabilities associated with each individual cell are, in a word, wrong.  The 
original model (svm.model) was parameterized with 10,000 pseudoabsences drawn 
from throughout the entire region, so the range of climate values used to 
create the original model is the same as that reflected in the data I am using 
to build the prediction map.  I can't think of any reason that the 
probabilities returned from pred.map-predict(svm.model, predict.data, 
probability=T)should be so off-base, but it seems like they are. 

Any thoughts?

James

   
-Original Message-
From: Steve Lianoglou [mailto:mailinglist.honey...@gmail.com] 
Sent: Thursday, August 19, 2010 10:24 AM
To: Watling,James I
Cc: r-h...@lists.r-project.org
Subject: Re: [R] probabilities from predict.svm

Hi James,

I'd like to help you out, but I'm not sure I understand what the problem is.

Does the problem lie with building a predictive SVM, or getting the
right values (class probabilities) to land in the right place on your
map/plot?

-steve

On Wed, Aug 18, 2010 at 3:09 PM, Watling,James I watli...@ufl.edu wrote:
 Dear R Community-

 I am a new user of support vector machines for species distribution modeling 
 and am using package e1071 to run svm() and predict.svm().  Briefly, I want 
 to create an svm model for classification of a factor response (species 
 presence or absence) based on climate predictor variables.  I have used a 
 training dataset to train the model, and tested it against a validation data 
 set with good results: AUC is high, and the confusion matrix indicates low 
 commission and omission errors.  The code for the best-fit model is:

 svm.model 
 -svm(as.factor(acutus)~p_feb+p_jan+p_mar+p_sep+t_feb+t_july+t_june+t_mar,cost=1,
  gamma=1, probability=T)

 Because ultimately I want to create prediction maps of probabilities of 
 species occurrence under future climate change, I want to use the results of 
 the validated model to predict probability of presence using data describing 
 future conditions.  I have created a data frame (predict.data) with new 
 values for the same predictor variables used in the original model; each 
 value corresponds to an observation from a raster grid of the study area.  I 
 enabled the probability option when creating the original model, and acquire 
 the probabilities using the predict function:
 pred.map -predict(svm.model, predict.data, probability=T).  However, when I 
 use probs-attr(pred.map, probabilities) to acquire the probabilities for 
 each grid cell, the spatial signature of the probabilities does make sense.  
 I have extracted the column of probabilities for class = 1 (probability of 
 presence), and the resulting map of the study area is spatially accurate (it 
 has the right shape), but the probability values are incorrect, or at least 
 in the wrong place.  I am attaching a pdf (SVM prediction maps) of the 
 resulting map using probabilities obtained using the code described above 
 (page 1) and a map of what the prediction map should look like given spatial 
 autocorrelation in climate predictors (page 2, map generated using 
 openmodeller).  Note that the openmodeller map was created with the same 
 input data and same svm algorithm (also using code from libsvm) as the model 
 in R, just run using different software.  I don't know why the prediction map 

Re: [R] ifelse command

2010-08-19 Thread Greg Snow
It would help us help you if you could give a description of what your ultimate 
goal is here.  Is it to simulate the dice?  Then you may want to just use the 
dice function in the TeachingDemos package (or you can animate the rolling with 
plot.rgl.die and roll.rgl.die in the same package).  Or is it to understand 
more use of the sample function?  Your original post did the correct thing with 
sample, but then immediately threw away the results without using them.  Is it 
to better understand random number generation?  Better understand putting 
values into categories? Use cut or findInterval (or others).

The more you help us understand your goals, the better we can help you. 

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Philip Wong
 Sent: Wednesday, August 18, 2010 8:46 PM
 To: r-help@r-project.org
 Subject: Re: [R] ifelse command
 
 
 well to be honest, it is a assignment for the Bayesian statistic paper
 I wish
 to take later in the academic year.  But I'm a slow learner, so I'm
 going to
 try out some of the assignments posted in the university forum hoping
 to get
 some practice in advance.
 
 Could you please elaborate more on the set.seed() function, I
 understood
 from the ?set.seed the general idea of set.seed (if I didn't
 misunderstood
 it).  I could stimulate a six side dice by set.seed(1:6) with n number
 of
 runs using runif(), does that meant if I use set.seed() I don't need to
 use
 the prob=c(1,1,2,3,2,1)/10) to create my bias dice?
 --
 View this message in context: http://r.789695.n4.nabble.com/ifelse-
 command-tp2329538p2330591.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Why does Bootstrap work for one of similar models but not for the other?

2010-08-19 Thread Bert Gunter
In future, when posting data in your message use dput() or
textConnection() so that helpeRs can more easily load them.

I was not able to replicate your results. Here's what I got:


Bootstrap Statistics :
   originalbiasstd. error
t1*  0.99975370  0.0044205644  0.04110232
t2* -0.06091574 -0.0078646847  0.05778133
t3*  0.27506204  0.0006121326  0.05296862
t4* -0.03040424  0.0002096330  0.02826951

 sessionInfo()
R version 2.11.0 (2010-04-22)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
 [1] datasets  splines   grid  tcltk stats graphics  grDevices
 [8] utils methods   base

other attached packages:
[1] boot_1.2-42 TinnR_1.0.3 R2HTML_1.59-1   Hmisc_3.7-0
[5] survival_2.35-8 svSocket_0.9-48 lattice_0.18-3  MASS_7.3-5


What does

getOption(digits)

give you just before you run each bootstrap?

Bert Gunter
Genentech nonclinical Statistics



On Thu, Aug 19, 2010 at 12:50 AM, Reiko Akiyama reiko.akiy...@ebc.uu.se wrote:
 Dear all,

 Could anyone help me figure out why bootstrap works for one of similar
 models but not for the other and how I can solve it?

 I am using R 2.11.1 in Windows and would like to get confidence intervals
 for my models A and B by bootstrapping. However, bootstrap gives expected
 output for the model A but not for B, which I found was puzzling because the
 structure of the models is similar as I describe below. I had another person
 running the models in another computer and the same thing happens so this
 does not seem to be computer-specific. I could not find a clue for a
 solution in the R archive or in the R book (at least to the extent I
 understood).

 Here are the properties of the models A and B and what happens when I run
 bootstrap.

 modelA: rA~stA1+ stA2+stA3
 model B: rB~stB1+stB2+stB3
 The variables for the models A and B are in the same dataset called ?data?.
 The sample size is 32 for both models and the value range and distribution
 of the variables in the two models are similar. (Variables from both models
 are at the end of this enquiry.)

 [bootstrap of the model A]

 A.fun-function(data,indices)coefficients(lm(rA~stA1+
 stA2+stA3,data=data[indices,]))
 bootA-boot(data,A.fun,1000);bootA

 ORDINARY NONPARAMETRIC BOOTSTRAP
 Call:
 boot(data = data, statistic = A.fun, R = 1000)
 Bootstrap Statistics :
       original       bias    std. error
 t1*  1.00016501 -0.004350842  0.05309877
 t2*  0.02343475  0.008501989  0.07638795
 t3* -0.01602954 -0.004980400  0.07806805
 t4*  0.03601194 -0.005417404  0.08510128

 [bootstrap of the model B]


 B.fun-function(data,indices)coefficients(lm(rB~stB1+stB2+stB3),data=data[indices,])
 bootB-boot(data,B.fun,1000);bootB

 ORDINARY NONPARAMETRIC BOOTSTRAP
 Call:
 boot(data = data, statistic = B.fun, R = 1000)
 Bootstrap Statistics :
       original  bias    std. error
 t1*  0.99975370       0           0
 t2* -0.06091574       0           0
 t3*  0.27506203       0           0
 t4* -0.03040424       0           0

 What am I missing here?
 I highly appreciate any comments and suggestions.

 Best Wishes,
 Reiko Akiyama
 Uppsala University
 Sweden

 [Variables from the model A]

 rA

  [1] 0.7100881 1.0406464 1.1100229 0.6182664 0.7345739 1.0577865 0.6856024
  [8] 0.5264447 1.5793340 1.1793993 0.6488737 1.0214076 1.3589618 1.0528893
 [15] 1.5242409 1.3761019 0.9427032 0.6794809 1.4752693 0.7737512 1.0120797
 [22] 0.8692458 1.2079660 1.0610513 0.8570029 0.9794319 1.0957395 0.8243552
 [29] 0.4162586 1.4079334 1.0692132 1.1059419

 stA1

  [1] -0.9126354 -0.8331680 -1.0239203 -0.3721959 -0.5311308  0.7564474
  [7] -1.1828933 -1.2146727 -0.8172593 -0.9921410 -0.5152602 -0.9285442
 [13] -0.4198840 -0.9444529 -0.4198840 -0.8331680  1.2810163  1.4081718
 [19]  1.7102091  2.3460247  1.3806653  1.3127957  1.2333282  1.4240806
 [25] -0.1337555 -0.1973142  0.2954372 -0.1337555 -0.4039753 -0.3880665
 [31]  0.2795666 -0.2291317

 stA2

  [1] -0.2292617 -0.4917962 -0.6437899 -1.2241293 -0.3398026 -2.0946384
  [7] -1.0721356 -1.2655821 -1.3484877 -1.8873744 -0.7543307 -0.9615948
 [13] -0.3674378  0.4483537  0.8761467 -0.8786892  0.5312593  1.1524988
 [19]  0.3234425 -0.4088906  0.5102565  1.1945044  1.7748438  0.6827002
 [25]  0.6418001  1.1801340  0.4207184  0.8076114  0.9181522  0.6827002
 [31]  0.9037819  0.9181522

 stA3

  [1]  0.86459627 -0.23416149 -2.00372671  0.04161491  0.78881988 -2.50869565
  [7] -0.02608696 -0.84161491 -0.95465839 -0.28012422  0.47080745  0.07577640
 [13]  0.84223602  0.24472050  2.83975155  0.43043478 -0.75652174 -0.92795031
 [19]  0.29192547 -0.78633540 -0.78385093 -0.51242236  0.59627329  0.19068323
 [25]  0.02919255  1.17018634 -0.19440994  0.68385093  1.08881988 -0.28385093
 [31] -0.71118012  1.06583851

 [Variables from the model B]

 rB

  [1] 1.5385568 1.5885100 1.3587255 0.8991566 1.4086787 

Re: [R] Linear regression equation and coefficient matrix

2010-08-19 Thread Greg Snow
Here is a quick example:


c1 - cor(iris[,-5])
s1 - sqrt(diag(var(iris[,-5])))

betas - diag( s1 ) %*% c1 %*% diag( 1/s1 )

# now compare:

coef( lm( Sepal.Length ~ Sepal.Width, data=iris ) )[2]
betas[1,2]


But if you cannot work that out on your own, then you really should review 
linear algebra and linear model theory.

Also when dealing with us absent minded professor types (I now have adjunct 
status at 2 universities, can I rationalize being twice as absent minded now?) 
it is best to include some context in your post (quote some of the previous 
conversation) to help us remember which of many discussions we have been part 
of recently you are asking about.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of ashz
 Sent: Thursday, August 19, 2010 3:02 AM
 To: r-help@r-project.org
 Subject: Re: [R] Linear regression equation and coefficient matrix
 
 
 Dear Greg,
 
 Thanks for the tip. As I am new in R can you please provide me a script
 how
 do to so. It will help my learning process.
 
 Thanks,
 Asher
 --
 View this message in context: http://r.789695.n4.nabble.com/Linear-
 regression-equation-and-coefficient-matrix-tp2329804p2330867.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] creation package

2010-08-19 Thread Michael Dewey

At 13:57 19/08/2010, anderson nuel wrote:

Dear r-help,

I don't use namespace.


Well, as I said in my original reply, it would be a good idea to do so.



How can I make asia available?


Without knowing where asia is that is quite a tough call. How do you 
access it when you test your code before you try to package it?




I think my problem in creating the package in this: I have a singleglobal
function (RT) in my package, but inside RT I need to call several other
function( comb l,earn_comb, nchoo). When I used package.sekeleton, Iput in
lists all the functions(comb l,earn_comb, nchoo,RT),but in the 'man' I left
only namepackage-package.Rd and RT.Rd. When I did do this, is it true??


Best Regards


2010/8/18, Michael Dewey 
mailto:i...@aghmed.fsnet.co.uki...@aghmed.fsnet.co.uk:

At 10:27 18/08/2010, anderson nuel wrote:
Dear r-help,

No, I find errors in the file C:/Rp/namepackage.Rcheck/00check.txt :

* using log directory 'C:/Rpackage/namepackage.Rcheck'
* using R version 2.10.1 (2009-12-14)
* using session charset: ISO8859-1
* checking for file 'namepackage/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'namepackage' version '1.0'
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking for executable files ... OK
* checking whether package 'namepackage' can be installed ... OK
* checking package directory ... OK
* checking for portable file names ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking for unstated dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... NOTE
comb: no visible global function definition for 'copy_bloc'
comb: no visible global function definition for 'copy_interl'
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... WARNING
Undocumented code objects:
 comb learn_comb nchoo
All user-level objects in a package should have documentation entries.
See the chapter 'Writing R documentation files' in manual 'Writing R
Extensions'.
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking examples ... ERROR
Running examples in 'namepackage-Ex.R' failed.
The error most likely occurred in:
 ### * RT

 flush(stderr()); flush(stdout())

 ### Name: RT
 ### Title: RT
 ### Aliases: RT

 ### ** Examples

 data(asia)
Warning in data(asia) : data set 'asia' not found
 RT(asia, c(2,2,2), c(1,2,3),c(a,b,c ))
Error in nrow(data) : object 'x' not found
Calls: RT - array - nrow
Execution halted


I think my problem in creating the package in this: I have a singleglobal
function (RT) in my package, but inside RT I need to call several other
function( comb l,earn_comb, nchoo). When I used package.sekeleton, Iput in
lists all the functions(comb l,earn_comb, nchoo,RT),but in the 'man' I left
only namepackage-package.Rd and RT.Rd. When I did do this, is it true??


Are you using a namespace?
If not I think it may help you with the warnings about documentation.

The other warning tells you R cannot find asia. You need to make it available.


Best Regards,











2010/8/16, Uwe Ligges 
mailto:lig...@statistik.tu-dortmund.delig...@statistik.tu-dortmund.de:




 On 16.08.2010 18:52, anderson nuel wrote:

 Dear r-help,

 the file C:/Rp/namepackage.Rcheck/00install.out :

 * install options are ' --no-html'
 * installing *source* package 'namepackage' ...
 ** R
 ** preparing package for lazy loading
 ** help
 *** installing help indices
 ** building package indices ...
 ** MD5 sums
 * DONE (namepackage)



 So it was successful.

 Uwe



 Best Regards,





 2010/8/14, Uwe 
Liggesmailto:lig...@statistik.tu-dortmund.delig...@statistik.tu-dortmund.de:





 On 14.08.2010 11:21, anderson nuel wrote:

 Dear r-help,

 I run R CMD INSTALL :

 c:\RpR CMD INSTALL namepackage

 *installing to library'c:/PROGRA~1/R/R-210~1-1/library'
 *installing *source* 'namepackage'...
 **R
 **preparing package for lazy loading
 **help
 Avis:./man/namepackage-package.Rd:25:'' inatttendue
 **installing help indices
 **building package indices
 **MD5sums
 *DONEnamepackage

 best



 OK, but strange that checking the package fails now in its installation
 checks. Can you send us the file
 C:/Rp/namepackage.Rcheck/00install.out
 please.

 Uwe Ligges





 2010/8/13, Uwe 
Liggesmailto:lig...@statistik.tu-dortmund.delig...@statistik.tu-dortmund.de:



 In my previous maiul I asked you to run R CMD INSTALL at first (rather
 than
 R CMD check).

 

[R] Pass By Value Questions

2010-08-19 Thread lists
I understand R is a Pass-By-Value language. I have a few practical
questions, however.

I'm dealing with a large dataset (~1GB) and so my understanding of the
nuances of memory usage in R is becoming important.

In an example such as:
 d - read.csv(file.csv);
 n - apply(d, 1, sum);
must d be copied to another location in memory in order to be used by
apply? In general, is copying only done when a variable is updated within
a function?

Would the following example be any different in terms of memory usage?
 d - read.csv(file.csv);
 n - apply(d[,2:10], 1, sum);
or can R reference the original d object since no changes to the object
are being made?

I'm familiar with FF and BigMemory, but are there any packages/tricks
which allow for passing such objects by reference without having to code
in C?

Regards,
Jeff Allen

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R reports

2010-08-19 Thread Greg Snow
Your question brings up a bit of a philosophical issue (or possibly economic 
theory).  The idea is the contrast between specialization and generalization.  
A purely specialized program will only do one thing (but hopefully do that one 
thing well), the ultimate generalized program will do everything (but usually 
none of the things very well, have you ever tried eating with one of those 
pocket knives that has a built in fork and spoon?)  most fall somewhere in 
between on the specialization/generalization continuum.

So when someone wants to do something that is not currently done in a program 
the question is: Do we make the program more general by adding this 
capability? Or do we delegate that task to another program that already 
specializes in that?.  The answer will be different for different 
programs/programmers/users/...

What you detail below as the benefits of SAS proc report actually includes 
several tasks.  Tasks that statistical programs do well like grouping and 
summarizing of data should be in the stats program.  In the case of R there are 
multiple ways, but I would suggest you look at the reshape and plyr packages 
which make a lot of this easy (while still giving more power than SAS proc 
report).

Then there is the display of the data and/or summaries.  R does have the basic 
print capabilities, but if you want more control and extras like 
headers/footers, titles, etc. then this is better done by delegating those jobs 
to more specialized programs (LaTeX, HTML, OpenOffice, MSWord, etc.), R has 
interfaces to many of these to make that delegation easy (and the results end 
up looking much nicer than SAS proc report).

If that is not sufficient for your needs then you can either create your own 
package that does what you want, contribute to other efforts, or motivate 
someone else to do this for you.

Personally I have not used SAS proc report for quite a while, so I did a quick 
internet search and found a quick tutorial with examples (of both input and 
output).  The main result was a good reminder of why I don't use SAS proc 
report any more and why I do use R and the other specialized programs that it 
interfaces with.

Hope this helps (or at least provokes thought),

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Donald Paul Winston
 Sent: Thursday, August 19, 2010 5:43 AM
 To: r-help@r-project.org
 Subject: Re: [R] R reports
 
 
 Oops, I meant 4GL. Part of SAS involves more or less declarative
 coding
 where SAS figures out how to process the information and you don't have
 to.
 Sweave and html generators in R are not what I'm looking for. I'm
 looking
 for a function whose arguments are data, column names, grouping
 variables,
 summary stats, titles, footnotes, etc. Sort of like what plot does
 except
 the function will generate a report. I suppose you could specify an
 output
 format or printer device as plain text, rich text, pdf, or html.
 --
 View this message in context: http://r.789695.n4.nabble.com/R-reports-
 tp2330733p2331037.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] assign multiple variables at once

2010-08-19 Thread Hosack, Michael
R community,

Brian generously provided the following code (see below) but I could not get it 
to run and it produced this error (after a few minutes of run time):

Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

I am using Tinn-R and on the IO screen I also received the following code:

source(.trPaths[5], echo=TRUE, max.deparse.length=150)

I am not sure whether the code is errant or whether I did not implement it 
correctly.
Does anyone know what could be the source of these errors? 

Thank you,

Mike Hosack

-Original Message-
From: Brian Diggs [mailto:dig...@ohsu.edu] 
Sent: Friday, August 13, 2010 4:11 PM
To: Hosack, Michael
Cc: r-help@r-project.org
Subject: Re: assign multiple variables at once

On 8/13/2010 11:08 AM, Hosack, Michael wrote:
 R Experts,

 I would like to create a series of variables without having
 to assign a separate line of code for each new variable. My dataframe (DF) 
 contains
 two groups of linked variables (ESP1:ESP9) and (ECRL1:ECRL9). Within 
 ESP1:ESP9 are
 abbreviated species codes (full dataframe contains 26 codes). ECRL1 
 represents the
 number of species x in variable ESP1 harvested, and so on through ESP9 and 
 ECRL9.
 What I want to do is create 26 new variables (one for each unique species 
 code) that
 contains the number harvested (ECRL) for each corresponding species code 
 listed for
 each row of the data set. Example (row 14), the new variable YP Harvest would 
 equal
 90 (ECRL2) and WP Harvest would equal 0 (ECRL1), all other species code var's 
 would
 contain NA.

 I hope I made this clear enough.

 Thank you,

 Mike

 Current method: one line per species

 EBTCH1.h$YP.H- with(EBTCH1.h,ifelse(ESP1 %in% 'YP',ECRL1,ifelse(ESP2 %in% 
 'YP',ECRL2,
 ifelse(ESP3 %in% 'YP',ECRL3,ifelse(ESP4 %in% 'YP',ECRL4,ifelse(ESP5 %in% 
 'YP',ECRL5,
 ifelse(ESP6 %in% 'YP',ECRL6,ifelse(ESP7 %in% 'YP',ECRL7,ifelse(ESP8 %in% 
 'YP',ECRL8,
 ifelse(ESP9 %in% 'YP',ECRL9,0))


 DF-
 structure(list(MM = c(5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
 5L, 5L, 5L, 5L, 5L), DD = c(3L, 3L, 3L, 3L, 3L, 3L, 7L, 7L, 7L,
 8L, 8L, 8L, 8L, 8L, 8L), DTYPE = c(2, 2, 2, 2, 2, 2, 1, 1, 1,
 1, 1, 1, 1, 1, 1), TOD = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
 1, 1, 1), SITENUM = c(102, 104, 104, 104, 101, 101,
 102, 103, 101, 101, 101, 101, 103, 103, 103
 ), CURTIM = c(1450L, 1736L, 1755L, 1804L, 1950L, 2007L, 1150L,
 1450L, 2000L, 1003L, 1030L, 1036L, 1300L, 1310L, 1320L), GRPFSH = c(2L,
 2L, 2L, 2L, 2L, 3L, 1L, 2L, 3L, 2L, 4L, 1L, 1L, 3L, 1L), EEFF = c(11.5,
 19, 5, 20, 0, 0, 5, 8, 0, 0, 0, 0, 3, 12, 6), ESP1 = c(SMB,
 SMB, SMB, SMB, NA, NA, YP, YP, NA, NA, NA, NA, RG,
 WP, WP), ESP2 = c(NA, RB, NA, NA, NA, NA, NA, NA, NA, NA,
 NA, NA, SMB, YP, YP), ESP3 = c(NA, NA, NA, NA, NA, NA,
 NA, NA, NA, NA, NA, NA, RB, RBS, NA), ESP4 = c(NA_character_,
 NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
 NA_character_, NA_character_, NA_character_, NA_character_, NA_character_,
 NA_character_, NA_character_, NA_character_, NA_character_),
  ESP5 = c(NA_character_, NA_character_, NA_character_, NA_character_,
  NA_character_, NA_character_, NA_character_, NA_character_,
  NA_character_, NA_character_, NA_character_, NA_character_,
  NA_character_, NA_character_, NA_character_), ESP6 = c(NA,
  NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  ESP7 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
  NA, NA, NA), ESP8 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA,
  NA, NA, NA, NA, NA, NA), ESP9 = c(NA, NA, NA, NA, NA, NA,
  NA, NA, NA, NA, NA, NA, NA, NA, NA), ECRL1 = c(0L, 0L, 0L,
  0L, 0L, 0L, 4L, 5L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), ECRL2 = c(0L,
  0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 90L, 30L),
  ECRL3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
  0L, 0L, 0L), ECRL4 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
  0L, 0L, 0L, 0L, 0L, 0L), ECRL5 = c(0L, 0L, 0L, 0L, 0L, 0L,
  0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), ECRL6 = c(0L, 0L, 0L,
  0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), ECRL7 = c(0L,
  0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
  ECRL8 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
  0L, 0L, 0L), ECRL9 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
  0L, 0L, 0L, 0L, 0L, 0L)), .Names = c(MM, DD, DTYPE,
 TOD, SITENUM, CURTIM, GRPFSH, EEFF, ESP1, ESP2,
 ESP3, ESP4, ESP5, ESP6, ESP7, ESP8, ESP9, ECRL1,
 ECRL2, ECRL3, ECRL4, ECRL5, ECRL6, ECRL7, ECRL8,
 ECRL9), row.names = c(NA, 15L), class = data.frame)


Michael,

An easier approach is to reshape this into a long format (one row for 
each ESP/ECRL combination, carrying the rest of the identifying 
variables), and then reshape it back to wide format using the ESP value 
to define the new column:

# for convenience, variables that don't vary for each observation
idvar - names(DF)[1:8]

DFr - reshape(DF, 
varying=list(c(ESP1,ESP2,ESP3,ESP4,ESP5,ESP6,ESP7,ESP8,ESP9), 

[R] plotmath question

2010-08-19 Thread array chip
Hi all, let me give a simple example:

b-20
I would like to print ylab as P20 where P is printed in Italic font. When I 
do the following:

plot(1, ylab=expression(paste(italic(P),b,sep=)))

I got y axis label printed as Pb instead of P20. What is the best solution 
to print platmath symbols with value of the variable at the same time?

Thanks

John

__
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] plotmath question

2010-08-19 Thread baptiste auguie
Try this,

b = 20

plot(1, ylab= bquote(italic(P) * .(b))  )

HTH,

baptiste

On 19 August 2010 20:02, array chip arrayprof...@yahoo.com wrote:
 Hi all, let me give a simple example:

 b-20
 I would like to print ylab as P20 where P is printed in Italic font. When 
 I
 do the following:

 plot(1, ylab=expression(paste(italic(P),b,sep=)))

 I got y axis label printed as Pb instead of P20. What is the best solution
 to print platmath symbols with value of the variable at the same time?

 Thanks

 John

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




-- 


Dr. Baptiste Auguié

Departamento de Química Física,
Universidade de Vigo,
Campus Universitario, 36310, Vigo, Spain

tel: +34 9868 18617
http://webs.uvigo.es/coloides

__
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] plotmath question

2010-08-19 Thread David Winsemius


On Aug 19, 2010, at 2:02 PM, array chip wrote:


Hi all, let me give a simple example:

b-20
I would like to print ylab as P20 where P is printed in Italic  
font. When I

do the following:

plot(1, ylab=expression(paste(italic(P),b,sep=)))

I got y axis label printed as Pb instead of P20. What is the  
best solution

to print platmath symbols with value of the variable at the same time?



?substitute
?plotmath

 plot(1, ylab=substitute(list(italic(P)*b), list(b=b) ) )

Or:

?bquote
plot(1, ylab=bquote(italic(P)*.(b) ) )

--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Trimmed Sample

2010-08-19 Thread Greg Snow
You can look at the code for mean.default and see how it does the trimming, 
then you can use that to create your own trimmed version to pass to other 
functions.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Turn  Fall
 Sent: Tuesday, August 17, 2010 5:13 AM
 To: r-help@r-project.org
 Subject: [R] Trimmed Sample
 
 
 I know about the trimmed mean function.
 
 Is there a function that trims values of an array, vector ect
 
 cheers
 --
 View this message in context: http://r.789695.n4.nabble.com/Trimmed-
 Sample-tp2328139p2328139.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plotmath question

2010-08-19 Thread array chip
Thanks, yes it worked!

What about if I want to print as P2, A where A is just letter A and 2 is from 
variable b.

John



- Original Message 
From: baptiste auguie baptiste.aug...@googlemail.com
To: array chip arrayprof...@yahoo.com
Cc: r-h...@stat.math.ethz.ch
Sent: Thu, August 19, 2010 11:08:10 AM
Subject: Re: [R] plotmath question

Try this,

b = 20

plot(1, ylab= bquote(italic(P) * .(b))  )

HTH,

baptiste

On 19 August 2010 20:02, array chip arrayprof...@yahoo.com wrote:
 Hi all, let me give a simple example:

 b-20
 I would like to print ylab as P20 where P is printed in Italic font. When 
I
 do the following:

 plot(1, ylab=expression(paste(italic(P),b,sep=)))

 I got y axis label printed as Pb instead of P20. What is the best solution
 to print platmath symbols with value of the variable at the same time?

 Thanks

 John

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




-- 


Dr. Baptiste Auguié

Departamento de Química Física,
Universidade de Vigo,
Campus Universitario, 36310, Vigo, Spain

tel: +34 9868 18617
http://webs.uvigo.es/coloides






__
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] Pass By Value Questions

2010-08-19 Thread Duncan Murdoch

On 19/08/2010 12:57 PM, li...@jdadesign.net wrote:

I understand R is a Pass-By-Value language. I have a few practical
questions, however.

I'm dealing with a large dataset (~1GB) and so my understanding of the
nuances of memory usage in R is becoming important.

In an example such as:
 d - read.csv(file.csv);
 n - apply(d, 1, sum);
must d be copied to another location in memory in order to be used by
apply? In general, is copying only done when a variable is updated within
a function?
  


Generally R only copies when the variable is modified, but its rules for 
detecting this are sometimes overly conservative, so you may get some 
unnecessary copying.  For example,


d[1,1] - 3

will probably not make a full copy of d when the internal version of 
[- is used, but if you have an R-level version, it probably will.  I 
forget whether the dataframe method is internal or R level. 

In the apply(d, 1, sum) example, it would probably make a copy of each 
row to pass to sum, but never a copy of the whole dataframe/array.

Would the following example be any different in terms of memory usage?
 d - read.csv(file.csv);
 n - apply(d[,2:10], 1, sum);
or can R reference the original d object since no changes to the object
are being made?
  


This would make a new object containing d[,2:10], and would pass that to 
apply.

I'm familiar with FF and BigMemory, but are there any packages/tricks
which allow for passing such objects by reference without having to code
in C?
  


Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Automated plot and linear regression line/data

2010-08-19 Thread Greg Snow
?pairs
?lattice::splom
?lattice::panel.xyplot


pairs( state.x77, panel=function(x,y){
points(x,y)
abline(lm(y~x), col='red')
})

library(lattice)
splom( ~state.x77, type=c('p','r') )



-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of ashz
 Sent: Tuesday, August 17, 2010 3:47 AM
 To: r-help@r-project.org
 Subject: [R] Automated plot and linear regression line/data
 
 
 Hi,
 
 I have an excel sheet (already imported to R) with multiple columns and
 I am
 looking for a way in R that will allow me to generate a plot for every
 possible pair and its linear regression line/data.
 
 Any tip/idea/script how do to so.
 
 Thanks,
 As hz
 
 --
 View this message in context: http://r.789695.n4.nabble.com/Automated-
 plot-and-linear-regression-line-data-tp2328027p2328027.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plotmath question

2010-08-19 Thread David Winsemius


On Aug 19, 2010, at 2:24 PM, array chip wrote:


Thanks, yes it worked!

What about if I want to print as P2, A where A is just letter A  
and 2 is from

variable b.


?plotmath

 plot(1, ylab= bquote(italic(P) *,*.(b)~A)  )


John



- Original Message 
From: baptiste auguie baptiste.aug...@googlemail.com
To: array chip arrayprof...@yahoo.com
Cc: r-h...@stat.math.ethz.ch
Sent: Thu, August 19, 2010 11:08:10 AM
Subject: Re: [R] plotmath question

Try this,

b = 20

plot(1, ylab= bquote(italic(P) * .(b))  )

HTH,

baptiste

On 19 August 2010 20:02, array chip arrayprof...@yahoo.com wrote:

Hi all, let me give a simple example:

b-20
I would like to print ylab as P20 where P is printed in Italic  
font. When

I

do the following:

plot(1, ylab=expression(paste(italic(P),b,sep=)))

I got y axis label printed as Pb instead of P20. What is the  
best solution
to print platmath symbols with value of the variable at the same  
time?


Thanks

John

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





--


Dr. Baptiste Auguié

Departamento de Química Física,
Universidade de Vigo,
Campus Universitario, 36310, Vigo, Spain

tel: +34 9868 18617
http://webs.uvigo.es/coloides






__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plotmath question

2010-08-19 Thread array chip
Thanks David!

John



- Original Message 
From: David Winsemius dwinsem...@comcast.net
To: array chip arrayprof...@yahoo.com
Cc: baptiste auguie baptiste.aug...@googlemail.com; r-h...@stat.math.ethz.ch
Sent: Thu, August 19, 2010 11:34:07 AM
Subject: Re: [R] plotmath question


On Aug 19, 2010, at 2:24 PM, array chip wrote:

 Thanks, yes it worked!

 What about if I want to print as P2, A where A is just letter A  
 and 2 is from
 variable b.

?plotmath

  plot(1, ylab= bquote(italic(P) *,*.(b)~A)  )

 John



 - Original Message 
 From: baptiste auguie baptiste.aug...@googlemail.com
 To: array chip arrayprof...@yahoo.com
 Cc: r-h...@stat.math.ethz.ch
 Sent: Thu, August 19, 2010 11:08:10 AM
 Subject: Re: [R] plotmath question

 Try this,

 b = 20

 plot(1, ylab= bquote(italic(P) * .(b))  )

 HTH,

 baptiste

 On 19 August 2010 20:02, array chip arrayprof...@yahoo.com wrote:
 Hi all, let me give a simple example:

 b-20
 I would like to print ylab as P20 where P is printed in Italic  
 font. When
 I
 do the following:

 plot(1, ylab=expression(paste(italic(P),b,sep=)))

 I got y axis label printed as Pb instead of P20. What is the  
 best solution
 to print platmath symbols with value of the variable at the same  
 time?

 Thanks

 John

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




 -- 
 

 Dr. Baptiste Auguié

 Departamento de Química Física,
 Universidade de Vigo,
 Campus Universitario, 36310, Vigo, Spain

 tel: +34 9868 18617
 http://webs.uvigo.es/coloides
 





 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Pass By Value Questions

2010-08-19 Thread Matt Shotwell
On Thu, 2010-08-19 at 14:27 -0400, Duncan Murdoch wrote:
 On 19/08/2010 12:57 PM, li...@jdadesign.net wrote:
  I understand R is a Pass-By-Value language. I have a few practical
  questions, however.
 
  I'm dealing with a large dataset (~1GB) and so my understanding of the
  nuances of memory usage in R is becoming important.
 
  In an example such as:
   d - read.csv(file.csv);
   n - apply(d, 1, sum);
  must d be copied to another location in memory in order to be used by
  apply? In general, is copying only done when a variable is updated within
  a function?

 
 Generally R only copies when the variable is modified, but its rules for 
 detecting this are sometimes overly conservative, so you may get some 
 unnecessary copying.  For example,
 
 d[1,1] - 3
 
 will probably not make a full copy of d when the internal version of 
 [- is used, but if you have an R-level version, it probably will.  I 
 forget whether the dataframe method is internal or R level. 
 
 In the apply(d, 1, sum) example, it would probably make a copy of each 
 row to pass to sum, but never a copy of the whole dataframe/array.
  Would the following example be any different in terms of memory usage?
   d - read.csv(file.csv);
   n - apply(d[,2:10], 1, sum);
  or can R reference the original d object since no changes to the object
  are being made?

 
 This would make a new object containing d[,2:10], and would pass that to 
 apply.

Since d is a data.frame, subsetting the columns would create a new
data.frame, as Duncan says. However, the columns of the new data.frame
would internally _reference_ the appropriate columns of d, until either
were modified. This does not apply to row subsetting. That is, d[2:10,]
would create a new data.frame and copy the relevant data. Nor does it
apply to _any_ subsetting of matrices.

  I'm familiar with FF and BigMemory, but are there any packages/tricks
  which allow for passing such objects by reference without having to code
  in C?


It's difficult to determine exactly when data is copied internally by R.
The tracemem function may be used to track when entire objects are
duplicated. However, tracemem would not detect the duplication that
occurs, for example, when subsetting the rows of d. Otherwise, we can
monitor memory usage with gc(), and experiment with code on a trial and
error basis.

I have had limited success in avoiding duplication by utilizing R
environments. See for example http://biostatmatt.com/archives/663 .
However, this may be more trouble that it's worth.

-Matt

 Duncan Murdoch
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Matthew S. Shotwell
Graduate Student 
Division of Biostatistics and Epidemiology
Medical University of South Carolina

__
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] plotmath question

2010-08-19 Thread David Winsemius


On Aug 19, 2010, at 2:46 PM, array chip wrote:


Thanks David!


I see that I didn't produce the correct answer, but perhaps I'm  
being thanked for something that was generalizable in that direction.  
Better would have ben one of these:


 plot(1, ylab= bquote(italic(P) *.(b)*,*~A)  )

 plot(1, ylab= bquote(paste(italic(P),.(b),,) ~ A)  )

In the second instance, paste() is a plotmath expression function,  
rather than the character vector function that lives out in the free- 
range R.


--
David.


- Original Message 
From: David Winsemius dwinsem...@comcast.net

On Aug 19, 2010, at 2:24 PM, array chip wrote:


Thanks, yes it worked!

What about if I want to print as P2, A where A is just letter A
and 2 is from
variable b.


?plotmath

 plot(1, ylab= bquote(italic(P) *,*.(b)~A)  )


John

- Original Message 
From: baptiste auguie baptiste.aug...@googlemail.com

Try this,

b = 20

plot(1, ylab= bquote(italic(P) * .(b))  )

HTH,

baptiste

On 19 August 2010 20:02, array chip arrayprof...@yahoo.com wrote:

Hi all, let me give a simple example:

b-20
I would like to print ylab as P20 where P is printed in Italic
font. When

I

do the following:

plot(1, ylab=expression(paste(italic(P),b,sep=)))

I got y axis label printed as Pb instead of P20. What is the
best solution
to print platmath symbols with value of the variable at the same
time?

Thanks

John




David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plotmath question

2010-08-19 Thread array chip
David, yes, I now see how it worked.

Thanks again,

John



- Original Message 
From: David Winsemius dwinsem...@comcast.net
To: array chip arrayprof...@yahoo.com
Cc: baptiste auguie baptiste.aug...@googlemail.com; r-h...@stat.math.ethz.ch
Sent: Thu, August 19, 2010 12:12:46 PM
Subject: Re: [R] plotmath question


On Aug 19, 2010, at 2:46 PM, array chip wrote:

 Thanks David!

I see that I didn't produce the correct answer, but perhaps I'm  
being thanked for something that was generalizable in that direction.  
Better would have ben one of these:

  plot(1, ylab= bquote(italic(P) *.(b)*,*~A)  )

  plot(1, ylab= bquote(paste(italic(P),.(b),,) ~ A)  )

In the second instance, paste() is a plotmath expression function,  
rather than the character vector function that lives out in the free- 
range R.

-- 
David.

 - Original Message 
 From: David Winsemius dwinsem...@comcast.net

 On Aug 19, 2010, at 2:24 PM, array chip wrote:

 Thanks, yes it worked!

 What about if I want to print as P2, A where A is just letter A
 and 2 is from
 variable b.

 ?plotmath

  plot(1, ylab= bquote(italic(P) *,*.(b)~A)  )

 John

 - Original Message 
 From: baptiste auguie baptiste.aug...@googlemail.com

 Try this,

 b = 20

 plot(1, ylab= bquote(italic(P) * .(b))  )

 HTH,

 baptiste

 On 19 August 2010 20:02, array chip arrayprof...@yahoo.com wrote:
 Hi all, let me give a simple example:

 b-20
 I would like to print ylab as P20 where P is printed in Italic
 font. When
 I
 do the following:

 plot(1, ylab=expression(paste(italic(P),b,sep=)))

 I got y axis label printed as Pb instead of P20. What is the
 best solution
 to print platmath symbols with value of the variable at the same
 time?

 Thanks

 John


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] csv vs. data frame

2010-08-19 Thread Bruce Como
Hi,
 
I am neither a statistician nor a user of R.  I am a programmer trying to
provide my users (both statisticians and R users) data in a format that
works best for them.
 
What is a data frame?  Is source data easier to work with in this format or
a csv file?  Or yet another format?
 
Thanks for your time.
 
Bruce
 

[[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] How to include trend (drift term) in arima.sim

2010-08-19 Thread StephenRichards

I have been trying to simulate from a time series with trend but I don't see
how to include the trend in the arima.sim() call.  The following code
illustrates the problem:

# Begin demonstration program
x - c(0.168766559,  0.186874000,  0.156710548,  0.151809531,  0.144638812,
   0.142106888,  0.140961714,  0.134054659,  0.138722419,  0.134037018,
   0.122829846,  0.120188714,  0.122060497,  0.137424358,  0.113311269,
   0.125051374,  0.103707302,  0.08121,  0.094848588,  0.100941354,
   0.096845633,  0.072098064,  0.081167803,  0.068140319,  0.063988361,
   0.053722446,  0.051986886,  0.044317196,  0.032021664,  0.023656304,
   0.025620223,  0.012297433, -0.003523446, -0.005782116, -0.027448303,
  -0.034745961, -0.042594172, -0.058662672, -0.072392916, -0.089123923,
  -0.093551415, -0.105782822, -0.117481560, -0.126549691, -0.141332587,
  -0.158428491, -0.166864452, -0.167363354, -0.177367386, -0.198326344,
  -0.218109541, -0.232391155, -0.237220250, -0.244477140, -0.255906978,
  -0.279480229)

#Fit arima(p=1,d=2,q=1)
Arima - arima(x, order = c(1,2,1))
Arima$coef

#Simulate from the fitted model:
set.seed(1)
x.sim - arima.sim(list(order = c(1,2,1), ar = Arima$coef[1], ma =
Arima$coef[2]), n = 1000, sd = sqrt(Arima$sig))
Arima2 - arima(x.sim, order = c(1,2,1))
Arima2$coef

# We recover the ar and ma coefficients but we haven't included the drift
# in the simulation so the simulated series is well wide of the mark.  The
# following plots demonstrate how wide:
par(mfrow = c(1,2))
plot(ts(x), main = Data)
plot(x.sim, main = Simulated data)

# End demonstration program


The documentation for arima.sim() isn't terribly clear on this area.  Any
ideas?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/How-to-include-trend-drift-term-in-arima-sim-tp2331581p2331581.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] meta-analysis in R

2010-08-19 Thread zhangweiwei

Dear Sir or Madam,

 

I am trying to explore the citation bias by perfroming meta-analysis. I need to 
plot a forest plot on some other proportions other than the usual effect size 
OR,RR, RD.

I still do not have any idea after searching google and reading relevant books. 
Can anyone kindly help? Thank you in advance.

 

 

 

Best wishes

weiwei
  
[[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] Can't read/write to _nonfi

2010-08-19 Thread minh

Good afternoon,
   Hope you all have a wonderful day. I am glad to be here. Hope you could
help me with the  following errors that i have been trying to figure it  all
out since last week.

  I am using Splus from Insightful, and as i read, R and Splus are very
similar. So hope you could help me.


 I have been continously received these error messages after i ran my small
program for couple of times.
 


Can' access to file _nonfi
Can't create file for assigning last.dump
(C:/WORKSPACE/DUNG/.Data/___bd40
 
 
 
It is frustrating since the program is so small , and as i look into my
project, the _nonfi is there under the data folder. So i don't know what the
compiler is complained about. Since i am new to Splus language, I have no
clue what i need to do.
 
for (i in 1: 1)

{

x - rnorm (1000);

y - rnorm (1000)

newx - x

newy - y

hist (newx)

hist (newy) 


}

 

 

 

If you happen to know what i need to do, please help me.

Thank you so much,
Min
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Can-t-read-write-to-nonfi-tp2331707p2331707.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] Can't read/write to _nonfi

2010-08-19 Thread stephen sefick
I don't think I understand what the problem is...  The code that you
provided works just fine without the for loop statement.  as for the
can't access...  The example that you provided doesn't address this.
Unless I am totally misunderstanding.  R is an interpreted language
not compiled.  Please, as to the instructions appended to the end of
each email, provide a minimal self-contained reproducible example.

Stephen

On Thu, Aug 19, 2010 at 1:48 PM, minh dtr...@student.gsu.edu wrote:

 Good afternoon,
   Hope you all have a wonderful day. I am glad to be here. Hope you could
 help me with the  following errors that i have been trying to figure it  all
 out since last week.

  I am using Splus from Insightful, and as i read, R and Splus are very
 similar. So hope you could help me.


  I have been continously received these error messages after i ran my small
 program for couple of times.



 Can' access to file _nonfi
 Can't create file for assigning last.dump
 (C:/WORKSPACE/DUNG/.Data/___bd40



 It is frustrating since the program is so small , and as i look into my
 project, the _nonfi is there under the data folder. So i don't know what the
 compiler is complained about. Since i am new to Splus language, I have no
 clue what i need to do.

 for (i in 1: 1)

 {

 x - rnorm (1000);

 y - rnorm (1000)

 newx - x

 newy - y

 hist (newx)

 hist (newy)


 }







 If you happen to know what i need to do, please help me.

 Thank you so much,
 Min
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Can-t-read-write-to-nonfi-tp2331707p2331707.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.




-- 
Stephen Sefick

| Auburn University                                   |
| Department of Biological Sciences           |
| 331 Funchess Hall                                  |
| Auburn, Alabama                                   |
| 36849                                                    |
|___|
| sas0...@auburn.edu                             |
| http://www.auburn.edu/~sas0025             |
|___|

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

                                -K. Mullis

__
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] csv vs. data frame

2010-08-19 Thread Bert Gunter
Do not post such questions to this list.
Read an Introduction to R first, please.

-- Bert

On Thu, Aug 19, 2010 at 12:55 PM, Bruce Como br...@lmcsoftware.com wrote:
 Hi,

 I am neither a statistician nor a user of R.  I am a programmer trying to
 provide my users (both statisticians and R users) data in a format that
 works best for them.

 What is a data frame?  Is source data easier to work with in this format or
 a csv file?  Or yet another format?

 Thanks for your time.

 Bruce


        [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Bert Gunter
Genentech Nonclinical Biostatistics
467-7374
http://devo.gene.com/groups/devo/depts/ncb/home.shtml

__
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] Can't read/write to _nonfi

2010-08-19 Thread William Dunlap
Min,

For S+-specific questions the S-news mailing list
would be better.
   s-n...@wubios.wustl.edu

Unlike R, S+ stores its data objects in files, one file
per object.  The ___nonfi (___nonfiles) file contains
a mapping for object names to file names, for those
objects whose names cannot be unambiguously used as
file names.

The copies of the error messages look garbled to me.
They are definitely missing some characters and I don't
see the Can't access to ... message in the S+ source
code, but perhaps I'm not looking in the right version
   Can' access to file _nonfi
   Can't create file for assigning last.dump
   (C:/WORKSPACE/DUNG/.Data/___bd40
What version of S+ are you using and what are the precise
error messages?

Do you own the C:/WORKSPACE/DUNG directory or is
it someone else's?  If it is someone else's and it
is sufficiently protected, you may not be able write
files into it.  Can you create any other data objects?
E.g., can you successfully execute the following?
qaz - 1:10
print(qaz)
and
Q.A.Z. - log(qaz)
print(Q.A.Z)

 
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of minh
 Sent: Thursday, August 19, 2010 11:48 AM
 To: r-help@r-project.org
 Subject: [R] Can't read/write to _nonfi
 
 
 Good afternoon,
Hope you all have a wonderful day. I am glad to be here. 
 Hope you could
 help me with the  following errors that i have been trying to 
 figure it  all
 out since last week.
 
   I am using Splus from Insightful, and as i read, R and 
 Splus are very
 similar. So hope you could help me.
 
 
  I have been continously received these error messages after 
 i ran my small
 program for couple of times.
  
 
 
 Can' access to file _nonfi
 Can't create file for assigning last.dump
 (C:/WORKSPACE/DUNG/.Data/___bd40
  
  
  
 It is frustrating since the program is so small , and as i 
 look into my
 project, the _nonfi is there under the data folder. So i 
 don't know what the
 compiler is complained about. Since i am new to Splus 
 language, I have no
 clue what i need to do.
  
 for (i in 1: 1)
 
 {
 
 x - rnorm (1000);
 
 y - rnorm (1000)
 
 newx - x
 
 newy - y
 
 hist (newx)
 
 hist (newy) 
 
 
 }
 
  
 
  
 
  
 
 If you happen to know what i need to do, please help me.
 
 Thank you so much,
 Min
 -- 
 View this message in context: 
 http://r.789695.n4.nabble.com/Can-t-read-write-to-nonfi-tp2331
707p2331707.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] csv vs. data frame

2010-08-19 Thread Erik Iverson



Bruce Como wrote:

Hi,
 
I am neither a statistician nor a user of R.  I am a programmer trying to

provide my users (both statisticians and R users) data in a format that
works best for them.
 


It sounds like they would be the best ones to ask then.



What is a data frame?  Is source data easier to work with in this format or
a csv file?  Or yet another format?
 


A data.frame is a class of a certain type of R object.  It is basically
a way to store rectangular data, rows for observations, columns for
variables.

Since R objects exist in memory, you can  write out things like
data.frames to disk with the ?save function, so others can load them
with the ?load function.

I think your users will have to tell you what is easiest for them.

__
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] Aggregate Help

2010-08-19 Thread Hall, Ken (CDC/OSELS/NCPHI)
Please let me know if this is or is not the right place to ask these
types of questions.

Warning: I am new to R by two days.

I have a simple dataset.
I have loaded the dataset successfully using the following code:

Filepath=(C:\temp\\pilot\dataset1.txt)
Pilot=read.table(filepath, header=TRUE)

Dataset1.txt is delimited and looks like this:

Dateillness count
2006/01/01  derm17
2006/01/01  derm35
2006/01/02  derm24
2006/01/02  derm80
.
.
.
Total records like this approximately 18,000

I would like to use the aggregate function to sum the count by similar
date and illness, so it should look like this after the aggregate

2006/01/01  derm52
2006/01/02  derm104
.
.
.

And, the illness changes to fever with the same pattern. I would like to
aggregate the same illnesses by date in the same fashion.

A nudge in the right direction would be appreciated.

Thanks.

Ken Hall 
Computer Scientist 
Division of Healthcare Information (DHI) (proposed)
Public Health Surveillance Program Office (proposed)
Office of Surveillance, Epidemiology,  Laboratory Services (OSELS)
(proposed)
Centers for Disease Control  Prevention (CDC)
k...@cdc.gov 
Mobile: 404-993-3311 
Office: 404-498-6839



[[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] Gathering different data types for aov etc

2010-08-19 Thread Bryan Hanson
Hello List Folks.  I¹m trying to do manova using a function which assembles
the response (LHS) and factors (RHS) from different sources.  When I do so,
the model routines complain that I'm passing a list for the RHS when I don't
think I am.

Here's a toy example:

r - matrix(rnorm(30), ncol = 3) # toy data
td - list(d = rnorm(10),
f1 = sample(c(A, B), 10, replace = TRUE),
f2 = sample(c(C, D), 10, replace = TRUE))

toyFn -
function(my.list, my.data, fac = NULL) {
response - my.data
fac - data.frame(my.list[fac])
#str(fac) # a data frame!
man - manova(response ~ fac)
print(summary(man))
invisible(man)
}

toyFn(td, r, fac = f1)
toyFn(td, r, fac = c(f1, f2))

Bot attempts just above gives the following error:

Error in model.frame.default(formula = response ~ fac, drop.unused.levels =
TRUE) : 
  invalid type (list) for variable 'fac'

But fac inside the function is a data frame.  What am I missing here?

Also, I want the function to use this formula: response ~ f1:f2 but once I
get past my problem of data type, I don't think what I have so far will do
the interaction, in fact, I suspect it will use only f1 or perhaps f1 + f2,
just a hunch.  Any suggestions to make this more elegant and robust? I've
been reading about model frames etc but don't quite see how to do a simple
example such as this.

Thanks, Bryan
*
Bryan Hanson
Professor of Chemistry  Biochemistry
DePauw University, Greencastle IN USA

 sessionInfo()
R version 2.11.0 (2010-04-22)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] datasets  tools grid  graphics  grDevices utils stats
methods   base 

other attached packages:
 [1] faraway_1.0.4  GGally_0.2 xtable_1.5-6   mvbutils_2.5.1
ggplot2_0.8.8 
 [6] proto_0.3-8reshape_0.8.3  ChemoSpec_1.45 R.utils_1.4.0
R.oo_1.7.2
[11] R.methodsS3_1.2.0  rgl_0.91   lattice_0.18-5 mvoutlier_1.4
plyr_1.0.3
[16] RColorBrewer_1.0-2 chemometrics_0.8   som_0.3-5
robustbase_0.5-0-1 rpart_3.1-46
[21] pls_2.1-0  pcaPP_1.8-1mvtnorm_0.9-9  nnet_7.3-1
mclust_3.4.4  
[26] MASS_7.3-5 lars_0.9-7 e1071_1.5-23   class_7.3-2

__
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] Aggregate Help

2010-08-19 Thread Phil Spector

Ken -
   Try

  aggregate(Pilot$Count,list(Date=Pilot$Date,illness=Pilot$illness),sum)

If you don't want to keep typing Pilot, use

  with(Pilot,aggregate(Count,list(Date=Date,illness=illness),sum))

Notice that the aggregated variable will be called x in the output
data frame from aggregate.

- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 spec...@stat.berkeley.edu

On Thu, 19 Aug 2010, Hall, Ken (CDC/OSELS/NCPHI) wrote:


Please let me know if this is or is not the right place to ask these
types of questions.

Warning: I am new to R by two days.

I have a simple dataset.
I have loaded the dataset successfully using the following code:

Filepath=(C:\temp\\pilot\dataset1.txt)
Pilot=read.table(filepath, header=TRUE)

Dataset1.txt is delimited and looks like this:

Dateillness count
2006/01/01  derm17
2006/01/01  derm35
2006/01/02  derm24
2006/01/02  derm80
.
.
.
Total records like this approximately 18,000

I would like to use the aggregate function to sum the count by similar
date and illness, so it should look like this after the aggregate

2006/01/01  derm52
2006/01/02  derm104
.
.
.

And, the illness changes to fever with the same pattern. I would like to
aggregate the same illnesses by date in the same fashion.

A nudge in the right direction would be appreciated.

Thanks.

Ken Hall
Computer Scientist
Division of Healthcare Information (DHI) (proposed)
Public Health Surveillance Program Office (proposed)
Office of Surveillance, Epidemiology,  Laboratory Services (OSELS)
(proposed)
Centers for Disease Control  Prevention (CDC)
k...@cdc.gov
Mobile: 404-993-3311
Office: 404-498-6839



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


  1   2   >