Re: [R] Testing memory limits in R??

2009-07-07 Thread Peter Dalgaard

Duncan Murdoch wrote:

On 06/07/2009 4:16 PM, Peter Dalgaard wrote:

Scott Zentz wrote:

Hello Everyone,

   We have recently purchased a server which has 64GB of memory 
running a 64bit OS and I have compiled R from source with the 
following config


./configure --prefix=/usr/local/R-2.9.1 --enable-Rshlib 
--enable-BLAS-shlib --enable-shared --with-readline --with-iconv 
--with-x --with-tcktk --with-aqua --with-libpng --with-jpeglib


and I would like to verify that I can use 55GB-60GB of the 64GB of 
memory within R. Does anyone know how this is possible? Will R be 
able to access that amount of memory from a single process? I am not 
an R user myself but I just wanted to test this before I turned the 
server over to the researchers..


Hmm, it's slightly tricky because R often duplicates objects, so you 
may hit the limit only transiently. Also, R has an internal 2GB limit 
on single vectors. But something like this


Is it a 2 GB limit in size, or in the number of elements?  I'm still 
spending almost all my time in 32 bit land, so it's hard to check.


It's in length. I was getting a couple of wires crossed there.

-p


Duncan Murdoch



Y - replicate(30, rnorm(2^28-1))

should create an object of about 30*2GB. Then lapply(Y, mean) should 
generate 30 very good and very expensive approximations to 0.


(For obvious reasons, I haven't tested this on a 1GB ThinkPad X40)







--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] bigglm() results different from glm()+Another question

2009-07-07 Thread utkarshsinghal
Trust me, it is the same total data I am using, even the chunksizes are 
all equal. I also crosschecked by manually creating the chunks and 
updating as in example given on biglm help page.
  ?biglm


Regards
Utkarsh



Greg Snow wrote:

 Are you sure that you are fitting all the models on the same total 
 data?  A first glance looks like you may be including more data in 
 some of the chunk sizes, or be producing an error that update does not 
 know how to deal with.

  

 -- 

 Gregory (Greg) L. Snow Ph.D.

 Statistical Data Center

 Intermountain Healthcare

 greg.s...@imail.org

 801.408.8111

  

 *From:* utkarshsinghal [mailto:utkarsh.sing...@global-analytics.com]
 *Sent:* Monday, July 06, 2009 8:58 AM
 *To:* Thomas Lumley; Greg Snow
 *Cc:* r help
 *Subject:* Re: [R] bigglm() results different from glm()+Another question

  


 The AIC of the biglm models is highly dependent on the size of chunks 
 selected (example provided below). This I can somehow expect because 
 the model error will increase with the number of chunks.

 It will be helpful if you can provide your opinion for comparing 
 different models in such cases:

 * can I compare two models fitted with different chunksizes, or
   should I always use the same chunk size.

 * although I am not going to use AIC at all in my model selection,
   but I think any other model parameters will also vary in the
   same way. Am I right?
 * what would be the ideal chunksize? should it be the maximum
   possible size R and my system's RAM is able to handle?

 Any comments will be helpful.


 *Example of AIC variation with chunksize:*

 I ran the following code on my data which has 1 observations and 3 
 independent variables

  chunksize = 500
  fit = biglm(y~x1+x2+x3, data=xx[1:chunksize,])
  for(i in seq(chunksize,1,chunksize)) fit=update(fit, 
 data=xx[(i+1):(i+chunksize),])
  AIC(fit)
 [1] 30647.79

 Here are the AIC for other chunksizes:
 chunksizeAIC
 500  30647.79
 100029647.79
 200027647.79
 250026647.79
 500021647.79
 1  11647.79


 Regards
 Utkarsh




 utkarshsinghal wrote:

 Thank you Mr. Lumley and Mr. Greg. That was helpful.

 Regards
 Utkarsh



 Thomas Lumley wrote:

 On Fri, 3 Jul 2009, utkarshsinghal wrote:



 Hi Sir,

 Thanks for making package available to us. I am facing few problems if 
 you can give some hints:

 Problem-1:
 The model summary and residual deviance matched (in the mail below) 
 but I didn't understand why AIC is still different.


 AIC(m1)

 [1] 532965


 AIC(m1big_longer)

 [1] 101442.9


 That's because AIC.default uses the unnormalized loglikelihood and 
 AIC.biglm uses the deviance.  Only differences in AIC between models 
 are meaningful, not individual values.



 Problem-2:
 chunksize argument is there in bigglm but not in biglm, consequently, 
 udate.biglm is there, but not update.bigglm
 Is my observation correct? If yes, why is this difference?


 Because update.bigglm is impossible.

 Fitting a glm requires iteration, which means that it requires 
 multiple passes through the data. Fitting a linear model requires only 
 a single pass. update.biglm can take a fitted or partially fitted 
 biglm and add more data. To do the same thing for a bigglm you would 
 need to start over again from the beginning of the data set.

 To fit a glm, you need to specify a data source that bigglm() can 
 iterate over.  You do this with a function that can be called 
 repeatedly to return the next chunk of data.

   -thomas

 Thomas LumleyAssoc. Professor, Biostatistics
 tlum...@u.washington.edu mailto:tlum...@u.washington.edu
 University of Washington, Seattle




 I don't know why the AIC is different, but remember that there are 
 multiple definitions for AIC (generally differing in the constant 
 added) and it may just be a difference in the constant, or it could be 
 that you have not fit the whole dataset (based on your other question).

 For an lm model biglm only needs to make a single pass through the 
 data.  This was the first function written for the package and the 
 update mechanism was an easy way to write the function (and still 
 works well).

 The bigglm function came later and the models other than Gaussian 
 require multiple passes through the data so instead of the update 
 mechanism that biglm uses, bigglm requires the data argument to be a 
 function that returns the next chunk of data and can restart to the 
 beginning of the dataset.

 Also note that the bigglm function usually only does a few passes 
 through the data, usually this is good enough, but in some cases you 
 may need to increase the number of passes.

 Hope this helps,

  



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

Re: [R] Solving quadratic equations with covariance term

2009-07-07 Thread Stein, Luba (AIM SE)
Hi,

more precisely I consider a matrix with three column vectors a_i (i=1,2,3), 
i.e. A=(a_1,a_2,a_3). On the other hand x should take vectors as values, i.e. 
x=v_j, while j goes also from 1 till 3.
Now I just want to calculate the equation Cov(a_i,x_j) = 0, where Cov(a_i,x_j) 
is the covariance matrix.
A is a given value and x is the variable I am looking for. 

In my opinion this is an quadratic equation and makes sense.

Best wishes,
Luba





-Urspr?ngliche Nachricht-
Von: Rolf Turner [mailto:r.tur...@auckland.ac.nz] 
Gesendet: Montag, 6. Juli 2009 23:16
An: Stein, Luba (AIM SE)
Cc: R-help@r-project.org
Betreff: Re: [R] Solving quadratic equations with covariance term


On 7/07/2009, at 2:15 AM, Stein, Luba (AIM SE) wrote:

 Hi,

 I would like to solve the following equation with R: Cov(A,x)=0.
 A is a given matrix, x is the an unknown vector.

 Is there any nice solution for this?

What on earth do you mean by ``Cov(A,x)''?  This makes no sense
at all.

cheers,

Rolf Turner

##
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.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] OK - I got the data - now what? :-)

2009-07-07 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 06.07.2009 01:58:38:

 On Sun, Jul 5, 2009 at 1:44 PM, hadley wickhamh.wick...@gmail.com 
wrote:
I think the root cause of a number of my coding problems in R right
  now is my lack of skills in reading and grabbing portions of the data
  out of arrays. I'm new at this. (And not a programmer) I need to find
  some good examples to read and test on that subject. If I could 
locate
  which column was called C1, then read row 3 from C1 up to the last
  value before a 0, I'd have proper data to plot for one line. Repeat 
as
  necessary through the array and I get all the lines. Doing the lines
  one at a time should allow me the opportunity to apply color or not
  plot based on values in the first few columns.
 
  Thanks,
  Mark
 
  test - data.frame(A=1:10, B=100, C1=runif(10), C2=runif(10),
  C3=runif(10), C4=runif(10), C5=runif(10), C6=runif(10))
  test-round(test,2)
 
  #Make array ragged
  test$C3[2]-0;test$C4[2]-0;test$C5[2]-0;test$C6[2]-0
  test$C4[3]-0;test$C5[3]-0;test$C6[3]-0
  test$C6[7]-0
  test$C4[8]-0;test$C5[8]-0;test$C6[8]-0
 
  #Print array
  test
 
  Are the zeros always going to be arranged like this? i.e. for
  experiment there is a point at which all later values are zero?  If
  so, the following is a much simpler way of getting to the core of your
  data, without fussing with overly complicated matrix indexing:
 
  library(reshape)
  testm - melt(test, id = c(A, B))
  subset(testm, value  0)
 
  I suspect you will also find this form easier to plot and analyse.
 
  Hadley
 
  --
  http://had.co.nz/
 
 
 Hi Hadley,
I wanted to look at reshape.
 
Yes, there exists a point in each row (unless I get to the end with
 all numbers) where I get to a zero and everything to the right is
 zero.
 
I'm looking at ReShape. It's interesting but I clearly don't
 understand it yet so I'm reading your ReShaping data with the reshap
 package form 11/07. Interesting.
 
I know so little about R that I'm sort of drowning at this point
 that it's hard for me to understand why this would make plotting
 easier. Analysis possibly. Just the way it goes when you get started
 with something new.

E.g. to give different colour according to C1-C6 and/or different shape 
for each A value.

test. - subset(testm, value  0)
plot(test.$value, col=as.numeric(test.$variable), pch=test.$A)

And even fancier plots with ggplot2 package.

Regards
Petr


 
In ReShape lingo I think I have ID's. They cover things like time,
 date, success/failure and a few other things of interest. Once the
 data starts on a row it is all data from there on to the end of the
 row.
 
My initial goal is to make a line plot of the data on a single row.
 All the data points should connect together. There is no real
 interaction planned with data on other rows, at least at this time.
 
Thanks for the pointers and the code stub. I'll be looking at this.
 
 Cheers,
 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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 separate the string?

2009-07-07 Thread Hemavathi Ramulu
Hi everyone,
Hi want to separate the string(column1) for example

column1 column2 column3 column4 column5 column6
bear   b   e a  r
cat c   a  t
tigert   i   g  e   r

I know how to do this in excel where using MID function.
Now I want to solve it using R. The list of strings is in text file. I
looked up the help but did not find it.
Can someone help me here?

Thank you very much.

Regards,
Hema

[[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 separate the string?

2009-07-07 Thread milton ruser
hi hema

may be strsplit can help on the job.

bests.

milton

On Tue, Jul 7, 2009 at 3:54 AM, Hemavathi Ramulu hema.ram...@gmail.comwrote:

 Hi everyone,
 Hi want to separate the string(column1) for example

 column1 column2 column3 column4 column5 column6
 bear   b   e a  r
 cat c   a  t
 tigert   i   g  e   r

 I know how to do this in excel where using MID function.
 Now I want to solve it using R. The list of strings is in text file. I
 looked up the help but did not find it.
 Can someone help me here?H

 Thank you very much.

 Regards,
 Hema

[[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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

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


[R] Multiplication of data frame with vector

2009-07-07 Thread cir p

Dear group:
sorry for my beginners question, but I'm rather new to R and was searching high 
and low without success:

I have a data frame (df) with variables in the rows and observations in the 
columns like (the actual data frame has 15 columns and 1789 rows):

  early1 early2 early3 early4 early5
M386T1000  57056  55372  58012  55546  57309
M336T9011063  10312  10674  10840  11208
M427T9112064  11956  12692  12340  11924
M429T91 4594   3890   4096   4019   4204
M447T9026553  27647  26889  26751  26929

Now I'm trying to transform each value column-wise to make columns to all have 
the same mean with:

df * mean(mean(df)) / mean(df).

I just can't get my head around this: mean(df) gives me the correct column 
means vector, and mean(mean(df)) gives me the correct total mean. The above 
operation works correctly for individual rows, i.e. if I do
 df[1,]*mean(mean(df))/mean(df)

Can someone tell me what I am doing wrong??
Thanks!

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


[R] Odp: How to separate the string?

2009-07-07 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 07.07.2009 09:54:30:

 Hi everyone,
 Hi want to separate the string(column1) for example

Well, how did you get the data in R? Are they in separated columns of 
data.frame? What do you mean by separate?

 
 column1 column2 column3 column4 column5 column6
 bear   b   e a  r
 cat c   a  t
 tigert   i   g  e   r
 
 I know how to do this in excel where using MID function.

As Microsoft is more user friendly and uses translated functions in 
language specific versions of Excel I do not have function MID. I suspect 
it takes values from middle of string set by some identifiers. If it is 
the case see

?substr

However I would start with

?read.table

and related read.* functions to get the data into R in appropriate shape.

Regards
Petr


 Now I want to solve it using R. The list of strings is in text file. I
 looked up the help but did not find it.
 Can someone help me here?
 
 Thank you very much.
 
 Regards,
 Hema
 
[[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] output too large to display all

2009-07-07 Thread Christine Griffiths

Dear All

Thanks for the suggestions. Mark's suggestion to specify corr=FALSE did 
the job and removed the reams of correlations that were being outputted 
from the model and using up all the output space.


Thanks
Christine

--On 06 July 2009 12:44 -0600 Lyman, Mark mark.ly...@atk.com wrote:


Take a look at the print method for the mer class, class?mer. I believe
setting the correlation argument to FALSE will give you what you want.
See the examples.

Mark Lyman, Statistician
Engineering Systems  Integration, ATK


Hi R Users,

Hopefully a very simple solution, but I am stumped nevertheless. I am
running glmer in which the output is too large so that not all the
correlations are displayed. I expanded the max.print as recommended on

this

website. However, this still does not allow me to see the relevant
information regarding the model fit (AIC etc), random and fixed

effects. I

have not been able to find any similar posts.

I would be very grateful if someone could specify what I need to state

in

order to view all the results generated from the model.

Many thanks in advance,
Christine

__
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Odp: Multiplication of data frame with vector

2009-07-07 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 07.07.2009 10:05:09:

 
 Dear group:
 sorry for my beginners question, but I'm rather new to R and was 
searching 
 high and low without success:
 
 I have a data frame (df) with variables in the rows and observations in 
the 
 columns like (the actual data frame has 15 columns and 1789 rows):
 
   early1 early2 early3 early4 early5
 M386T1000  57056  55372  58012  55546  57309
 M336T9011063  10312  10674  10840  11208
 M427T9112064  11956  12692  12340  11924
 M429T91 4594   3890   4096   4019   4204
 M447T9026553  27647  26889  26751  26929
 
 Now I'm trying to transform each value column-wise to make columns to 
all have
 the same mean with:
 
 df * mean(mean(df)) / mean(df).
 
 I just can't get my head around this: mean(df) gives me the correct 
column 
 means vector, and mean(mean(df)) gives me the correct total mean. The 
above 
 operation works correctly for individual rows, i.e. if I do
  df[1,]*mean(mean(df))/mean(df)

a little bit awkward

t(t(as.matrix(df))*mean(mean(df))/mean(df))

or with apply
ttt-mean(mean(df))/mean(df)
t(apply(df, 1, function(x) x*ttt))

There could be some sapply version of it but at present time I can not 
find it.
Regards
Petr

 
 Can someone tell me what I am doing wrong??
 Thanks!
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] How to separate the string?

2009-07-07 Thread Hemavathi Ramulu
Hi Petr,
The data in text file and not csv format.
The word separate  which I mean in this content is like split/separate the
string to each alphabet
where each alphabet will be in different column.

thanks alot.

regards,
Hema.

On Tue, Jul 7, 2009 at 4:12 PM, Petr PIKAL petr.pi...@precheza.cz wrote:

 Hi

 r-help-boun...@r-project.org napsal dne 07.07.2009 09:54:30:

  Hi everyone,
  Hi want to separate the string(column1) for example

 Well, how did you get the data in R? Are they in separated columns of
 data.frame? What do you mean by separate?

 
  column1 column2 column3 column4 column5 column6
  bear   b   e a  r
  cat c   a  t
  tigert   i   g  e   r
 
  I know how to do this in excel where using MID function.

 As Microsoft is more user friendly and uses translated functions in
 language specific versions of Excel I do not have function MID. I suspect
 it takes values from middle of string set by some identifiers. If it is
 the case see

 ?substr

 However I would start with

 ?read.table

 and related read.* functions to get the data into R in appropriate shape.

 Regards
 Petr


  Now I want to solve it using R. The list of strings is in text file. I
  looked up the help but did not find it.
  Can someone help me here?
 
  Thank you very much.
 
  Regards,
  Hema
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

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


[R] help me about data format.

2009-07-07 Thread yongkook Kwon
Hi

I am used to handle bio information such as NMR data or IR data .

I want to perform pls regression, so I search the help page of plsr. and I
use the example of plsr.

But I have a problem to make appropriate data format to do plsr.

these example data type like this :


A data frame with components NIR Numeric matrix of NIR measurements
density Numeric
vector of densities train Logical vector with TRUE for the training samples
and FALSE for the test samples

I want to make a matrix and vector in same data frame.

how can I do ?

[[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 separate the string?

2009-07-07 Thread Petr PIKAL
Hi

If you have data frame like this

test=data.frame(x=c(abcd, abc, abcde))
than
strsplit(as.matrix(test), )

makes a list with splitted character vectors. If you want them in data 
frame you would need to combine vectors of unequal length.

However I would try reading your text file with

read.fwf(file, 1)

Regards
Petr


Hemavathi Ramulu hema.ram...@gmail.com napsal dne 07.07.2009 10:36:40:

 Hi Petr,
 
 The data in text file and not csv format. 
 The word separate  which I mean in this content is like split/separate 
the 
 string to each alphabet 
 where each alphabet will be in different column.
 
 thanks alot.
 
 regards,
 Hema.

 On Tue, Jul 7, 2009 at 4:12 PM, Petr PIKAL petr.pi...@precheza.cz 
wrote:
 Hi
 
 r-help-boun...@r-project.org napsal dne 07.07.2009 09:54:30:
 
  Hi everyone,
  Hi want to separate the string(column1) for example

 Well, how did you get the data in R? Are they in separated columns of
 data.frame? What do you mean by separate?
 
 
  column1 column2 column3 column4 column5 column6
  bear   b   e a  r
  cat c   a  t
  tigert   i   g  e   r
 
  I know how to do this in excel where using MID function.

 As Microsoft is more user friendly and uses translated functions in
 language specific versions of Excel I do not have function MID. I 
suspect
 it takes values from middle of string set by some identifiers. If it is
 the case see
 
 ?substr
 
 However I would start with
 
 ?read.table
 
 and related read.* functions to get the data into R in appropriate 
shape.
 
 Regards
 Petr
 
 
  Now I want to solve it using R. The list of strings is in text file. I
  looked up the help but did not find it.
  Can someone help me here?
 
  Thank you very much.
 
  Regards,
  Hema
 
 [[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] curve from a formula with ggplot2

2009-07-07 Thread Benoit Boulinguiez
Hi all,
 
I'm smoothly transferring my lattice graphs to ggplot2 graphs, but I'm stuck
on representing a curve from a formula.
I'm looking for the equivalent of curve() in ggplot2, Hadley Wickham
mentions geom_curve, but as far as I've seen in the help it doesn't exist.
 
My need is to plot a regular scatter plot of experimental data (easy to do
actually) and then add the fitting model according to a specific formula
like
y = a*(b*x^n)/(1+b*x^p)
 
where a,b,n and p are known parameters.
 
I guess it's possible and easy to add this layer with ggplot, somehow I
didn't find the right function.
 
Any help would be warmly appreciated.

Regards/Cordialement

-
Benoit Boulinguiez
Ph.D student
Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 
Equipe CIP UMR CNRS 6226 Sciences Chimiques de Rennes
Avenue du Général Leclerc 
CS 50837 
35708 Rennes CEDEX 7 
Tel 33 (0)2 23 23 80 83
Fax 33 (0)2 23 23 81 20
 http://www.ensc-rennes.fr/ http://www.ensc-rennes.fr/ 

 

[[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] Large Stata file Import in R

2009-07-07 Thread Xavier
Thomas Lumley vas escriure el dia dt, 30 jun 2009:

 On Tue, 30 Jun 2009, Xavier wrote:

 saurav pathak vas escriure el dia dl, 29 jun 2009:

 Hi

 I am using Stata 10 and I need to import a data set in stata 10 to R, I 
 have
 saved the dataset in lower versions of Stata as well by using saveold
 command in Stata.

 My RAM is 4gb and the stata file is 600MB, I am getting an error message
 which says :

 Error: cannot allocate vector of size 3.4 Mb
 In addition: There were 50 or more warnings (use warnings() to see the 
 first
 50)

 Thus far I have already tried the following

 Maybe it does not adress the R problem that you are asking for, but you 
 can
 try to compress the stata file prior to save it. And maybe the size of
 the file will decrease.


 This can't possibly help.  The problem is that *R* is running out of 
 memory, and storing the data elements in less space *on disk* won't help 
 with the space used in memory.  Stata's -compress- option just chooses 
 smaller data types, eg, byte instead of integer.

I have done a small test and it seems that it can help.

I have a big dataset in stata (big) to which I apply the compress command
(in Stata), getting a small file. Those are the sizes in stata:
-8---
# original data size in stata
Contains data from G:\tmp\example-big.dta
  obs:52,547  Written by R.  
 vars:54  
 size:21,807,005 (96.4% of memory free)


# data size once compress has been used
Contains data from example-small.dta
  obs:52,547  Written by R.  
 vars:54  3 Jul 2009 15:27
 size:17,918,527 (97.1% of memory free)

-8---

And when loaded into R:
-8---
 library(foreign)
 big - read.dta(example-big.dta) 
 small - read.dta(example-small.dta)
 object.size(big)
20819600 bytes
 object.size(small)
19558520 bytes
-8---

Maybe the difference once objects are stored in memory is not as big as it
is when stored in disk, but it seems a good idea to compress data in stata
prior to load it into R, if memory is a problem.

-- 
-  Xavier  -

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 me about data format.

2009-07-07 Thread Claudia Beleites
 I want to make a matrix and vector in same data frame.

You need to protect your matrix by I ()

Btw: I'm actually writing a package for handling spectra that I plan to 
release in some weeks. 
It contains a vignette showing how pls calibration can be done. 
If you want to give it a try, let me know.

Claudia Beleites

-- 
Claudia Beleites
DMRN, Università degli Studi di Trieste 
Via Alfonso Valerio 6/a 
I-34127 Trieste

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 in object$coefficients : $ operator not defined for this S4 class

2009-07-07 Thread aledanda

Hallo, 

I received this error message while calculating the coefficents

coef(fit, matrix=TRUE)

Error in object$coefficients : $ operator not defined for this S4 class

what is this? How can I solve it?

Ale
-- 
View this message in context: 
http://www.nabble.com/Error-in-object%24coefficients-%3A-%24-operator-not-defined-for-this-S4-class-tp24371231p24371231.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] rle

2009-07-07 Thread aledanda

Hallo,

I have an other problem, I have this vector signData with an alternation of
1 and -1 that corrispond to the duration of two different percepts. I
extracted the durations like this:

signData- scan(dataTR10.txt)
dur-rle(signData)$length

Now I would like to extract only the positive duration, e.g. 

signData - c(1,1,1,1,-1,-1,-1,1,1,-1,-1)
posduration - c(4,2)

I think I should use rle in a  nested way, this is what I tried but it
doesn't work:

posduration- rle(signData[=1])$length

Could you please help me?

Thanks a lot, this forum is extremely useful.

Ale
-- 
View this message in context: http://www.nabble.com/rle-tp24371336p24371336.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] Error in object$coefficients : $ operator not defined for this S4 class

2009-07-07 Thread Ronggui Huang
What is fit in your example?

Ronggui

2009/7/7 aledanda danda.ga...@gmail.com:

 Hallo,

 I received this error message while calculating the coefficents

 coef(fit, matrix=TRUE)

 Error in object$coefficients : $ operator not defined for this S4 class

 what is this? How can I solve it?

 Ale
 --
 View this message in context: 
 http://www.nabble.com/Error-in-object%24coefficients-%3A-%24-operator-not-defined-for-this-S4-class-tp24371231p24371231.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.




-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] rle

2009-07-07 Thread Henrique Dallazuanna
Try this:

rle(signData)$lengths[rle(signData)$values == 1]

On Tue, Jul 7, 2009 at 8:11 AM, aledanda danda.ga...@gmail.com wrote:


 Hallo,

 I have an other problem, I have this vector signData with an alternation of
 1 and -1 that corrispond to the duration of two different percepts. I
 extracted the durations like this:

 signData- scan(dataTR10.txt)
 dur-rle(signData)$length

 Now I would like to extract only the positive duration, e.g.

 signData - c(1,1,1,1,-1,-1,-1,1,1,-1,-1)
 posduration - c(4,2)

 I think I should use rle in a  nested way, this is what I tried but it
 doesn't work:

 posduration- rle(signData[=1])$length

 Could you please help me?

 Thanks a lot, this forum is extremely useful.

 Ale
 --
 View this message in context:
 http://www.nabble.com/rle-tp24371336p24371336.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.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

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

2009-07-07 Thread Henrique Dallazuanna
Or:

 with(rle(signData), lengths[values == 1])

On Tue, Jul 7, 2009 at 8:26 AM, Henrique Dallazuanna www...@gmail.comwrote:

 Try this:

 rle(signData)$lengths[rle(signData)$values == 1]


 On Tue, Jul 7, 2009 at 8:11 AM, aledanda danda.ga...@gmail.com wrote:


 Hallo,

 I have an other problem, I have this vector signData with an alternation
 of
 1 and -1 that corrispond to the duration of two different percepts. I
 extracted the durations like this:

 signData- scan(dataTR10.txt)
 dur-rle(signData)$length

 Now I would like to extract only the positive duration, e.g.

 signData - c(1,1,1,1,-1,-1,-1,1,1,-1,-1)
 posduration - c(4,2)

 I think I should use rle in a  nested way, this is what I tried but it
 doesn't work:

 posduration- rle(signData[=1])$length

 Could you please help me?

 Thanks a lot, this forum is extremely useful.

 Ale
 --
 View this message in context:
 http://www.nabble.com/rle-tp24371336p24371336.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.




 --
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

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

2009-07-07 Thread Richard . Cotton
 I have an other problem, I have this vector signData with an alternation 
of
 1 and -1 that corrispond to the duration of two different percepts. I
 extracted the durations like this:
 
 signData- scan(dataTR10.txt)
 dur-rle(signData)$length

I think that last line should be 
dur-rle(signData)$lengths

 Now I would like to extract only the positive duration, e.g. 
 
 signData - c(1,1,1,1,-1,-1,-1,1,1,-1,-1)
 posduration - c(4,2)

If you know that the first element of signData will always be 1, then you 
can simply extract the first, third, fifth etc values from signdata, like 
so:

posduration - dur[c(TRUE, FALSE)]

Otherwise you need to test to see if you are extracting odd or even 
elements.

if(signData[1]==1)
{
   index - c(TRUE, FALSE)
} else
{
   index - c(FALSE, TRUE)
}
posduration - dur[index]

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

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


Re: [R] Remove all spaces from a string so it can be used by assign() -- A Fortune?

2009-07-07 Thread Kurt Smith

Thank you for all the advice and I shall listen with regards to assign() and 
think of another way of writing what I want.



Cheers!



 From: gunter.ber...@gene.com
 To: greg.s...@imail.org; kurt.sm...@hotmail.co.uk; r-help@r-project.org
 Subject: RE: [R] Remove all spaces from a string so it can be used by 
 assign() -- A Fortune?
 Date: Mon, 6 Jul 2009 08:35:30 -0700
 
 The below seems like a Fortunes candidate to me.
 
 -- Bert Gunter
 Genentech Nonclinical Biostatistics
 
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
 Behalf Of Greg Snow
 Sent: Friday, July 03, 2009 7:00 PM
 To: Kurt Smith; r-help@r-project.org
 Subject: Re: [R] Remove all spaces from a string so it can be used by
 assign()
 
 The only people who should use the assign function are those who fully
 understand why you should never use the assign function.
 
 -- 
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 greg.s...@imail.org
 801.408.8111
 
 

_
[[elided Hotmail spam]]

[[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] Odp: Multiplication of data frame with vector

2009-07-07 Thread Henrique Dallazuanna
maybe with sweep:

 sweep(df, 2, mean(mean(df))/mean(df), *)

On Tue, Jul 7, 2009 at 5:36 AM, Petr PIKAL petr.pi...@precheza.cz wrote:

 Hi

 r-help-boun...@r-project.org napsal dne 07.07.2009 10:05:09:

 
  Dear group:
  sorry for my beginners question, but I'm rather new to R and was
 searching
  high and low without success:
 
  I have a data frame (df) with variables in the rows and observations in
 the
  columns like (the actual data frame has 15 columns and 1789 rows):
 
early1 early2 early3 early4 early5
  M386T1000  57056  55372  58012  55546  57309
  M336T9011063  10312  10674  10840  11208
  M427T9112064  11956  12692  12340  11924
  M429T91 4594   3890   4096   4019   4204
  M447T9026553  27647  26889  26751  26929
 
  Now I'm trying to transform each value column-wise to make columns to
 all have
  the same mean with:
 
  df * mean(mean(df)) / mean(df).
 
  I just can't get my head around this: mean(df) gives me the correct
 column
  means vector, and mean(mean(df)) gives me the correct total mean. The
 above
  operation works correctly for individual rows, i.e. if I do
   df[1,]*mean(mean(df))/mean(df)

 a little bit awkward

 t(t(as.matrix(df))*mean(mean(df))/mean(df))

 or with apply
 ttt-mean(mean(df))/mean(df)
 t(apply(df, 1, function(x) x*ttt))

 There could be some sapply version of it but at present time I can not
 find it.
 Regards
 Petr

 
  Can someone tell me what I am doing wrong??
  Thanks!
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] Mathematical annotation axis in lattice

2009-07-07 Thread Coster, Albart
Dear list,

making mathematical expressions in plots is not difficult: expression(phi[1]) 
for example. At this moment I am stuck in creating a vector of expressions:

pos - 1:10
lab - letters[pos]

Now, I would like to create a vector of expressions which I could use for 
labeling the x-axis of a lattice plot. 

ll - as.expression(paste(pos, phi[,lab,],sep = )

xyplot(1:10~11:10,scales = list(x = list(labels = ll,at = 1:10)))

does not work. I read about the function substitute, but that did not solve it.

Could you recommend me how I should do this? 

Thanks in advance,

Albart Coster

Wageningen Universiteit
Netherlands

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 in object$coefficients : $ operator not defined for this S4 class

2009-07-07 Thread Ronggui Huang
I can not reproduce your problem with the latest version of VGAM.

Besides, if you want to get the coef and std. error etc.
you can use
 summary(fit)@coef3
  Value Std. Error   t value
(Intercept):1 -1.020388 0.03215889 -31.72957
(Intercept):2  1.335657 0.04206706  31.75067


2009/7/7 Alessandra Galli danda.ga...@gmail.com:
 Sure, sorry,

 I am fitting with beta distribution:

 y= rbeta(n - 1000, shape1=exp(0), shape2=exp(1))
 fit = vglm (y ~ 1, betaff, trace =TRUE)

 Thanks

 2009/7/7 Ronggui Huang ronggui.hu...@gmail.com

 What is fit in your example?

 Ronggui

 2009/7/7 aledanda danda.ga...@gmail.com:
 
  Hallo,
 
  I received this error message while calculating the coefficents
 
  coef(fit, matrix=TRUE)
 
  Error in object$coefficients : $ operator not defined for this S4 class
 
  what is this? How can I solve it?
 
  Ale
  --
  View this message in context:
  http://www.nabble.com/Error-in-object%24coefficients-%3A-%24-operator-not-defined-for-this-S4-class-tp24371231p24371231.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.
 



 --
 HUANG Ronggui, Wincent
 PhD Candidate
 Dept of Public and Social Administration
 City University of Hong Kong
 Home page: http://asrr.r-forge.r-project.org/rghuang.html



 --
 Alessandra Galli
 Mechelsestraat 155 /6
 3000 Leuven
 Belgium
 T: +32 473 588179





-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] logic question

2009-07-07 Thread matsumotoN

Setting:
200 input variables, 1 binary target variable.
Run a principle component analysis on the data
then
use the output of the principle component analysis (the generated factors)
as input into a neural network -but first having partitioned the pca data
into training and testing sets so that a neural network model can be trained
on the first partition and tested on the second.

I was told that it was not logically sound to include the target variable as
an input into the principle component algorithm.

Normally that sounds correct. You never want to include the target variable
as an input variable in your model.
However, I argued that it is ok here because I am only using the target
variable to build the principle components the model. So each record now has
a value for each of the principle components. Then take the training
partition only to build the neural network. Then test the neural network on
the testing partition.

Is this wrong?

(sorry to post this twice, the first time I was not properly logged in and I
don't think it registered correctly, won't happen again as I have registered
and logged in correctly now)
-- 
View this message in context: 
http://www.nabble.com/logic-question-tp24372208p24372208.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] logic question

2009-07-07 Thread matsumotoN

Setting:
200 input variables, 1 binary target variable.
Run a principle component analysis on the data 
then
use the output of the principle component analysis (the generated factors)
as input into a neural network -but first having partitioned the pca data
into training and testing sets so that a neural network model can be trained
on the first partition and tested on the second.

I was told that it was not logically sound to include the target variable as
an input into the principle component algorithm.

Normally that sounds correct. You never want to include the target variable
as an input variable in your model.
However, I argued that it is ok here because I am only using the target
variable to build the principle components the model. So each record now has
a value for each of the principle components. Then take the training
partition only to build the neural network. Then test the neural network on
the testing partition. 

Is this wrong?
-- 
View this message in context: 
http://www.nabble.com/logic-question-tp24369772p24369772.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] subscripted assignment of grid units

2009-07-07 Thread pbarros

Hi,

I want to do subscripted assignment of grid units, but I cannot find a
straightforward way of doing it (and I have searched all forums and places I
could think about, including Paul Murrell,s page). The usual subscripted
assignment operator does replace the numeric part, but does not update the
attributes. Before I write my own function, manipulating attributes etc I
would like to know if such a function already exists (I am sure it does).
What I want to do can be reflected as in the code below:

 testUnit - unit(1, lines)
 testUnit
[1] 1lines
 testUnits - rep(testUnit, 5)
 testUnits
[1] 1lines 1lines 1lines 1lines 1lines
 testUnit2 - unit(0.5, grobwidth, textGrob(Testing))
 testUnits[3] - testUnit2
 testUnits
[1] 1lines   1lines   0.5lines 1lines   1lines 

I would like to obtain
[1] 1lines   1lines   0.5grobwidth 1lines   1lines 

Any tips?

Thanks,
Pedro
-- 
View this message in context: 
http://www.nabble.com/subscripted-assignment-of-grid-units-tp24371172p24371172.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] Testing memory limits in R??

2009-07-07 Thread Scott Zentz

Hello Everyone!

   Thanks for all your replies! This was very helpful!  I found that 
there seems to be a limitation to only 32GB of memory which I think will 
be fine. I was able to consume the 32GB of memory with the following:

Start R with the following command: R --max-vsize 55000M
then within R run
x=rep(0.1,2.141e9)
and watch the process with top and R will consume about 32GB of 
memory... Hopefully this will be enough for the researchers ;)


Thanks!
-scz

Scott Zentz wrote:

Hello Everyone,

   We have recently purchased a server which has 64GB of memory 
running a 64bit OS and I have compiled R from source with the 
following config


./configure --prefix=/usr/local/R-2.9.1 --enable-Rshlib 
--enable-BLAS-shlib --enable-shared --with-readline --with-iconv 
--with-x --with-tcktk --with-aqua --with-libpng --with-jpeglib


and I would like to verify that I can use 55GB-60GB of the 64GB of 
memory within R. Does anyone know how this is possible? Will R be able 
to access that amount of memory from a single process? I am not an R 
user myself but I just wanted to test this before I turned the server 
over to the researchers..


Thanks!
-scz

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Multiplication of data frame with vector

2009-07-07 Thread David Freedman

Would the scale function work for this?  Something like
new=scale(df, center=T)

HTH,
david freedman

cir p wrote:
 
 
 Dear group:
 sorry for my beginners question, but I'm rather new to R and was searching
 high and low without success:
 
 I have a data frame (df) with variables in the rows and observations in
 the columns like (the actual data frame has 15 columns and 1789 rows):
 
   early1 early2 early3 early4 early5
 M386T1000  57056  55372  58012  55546  57309
 M336T9011063  10312  10674  10840  11208
 M427T9112064  11956  12692  12340  11924
 M429T91 4594   3890   4096   4019   4204
 M447T9026553  27647  26889  26751  26929
 
 Now I'm trying to transform each value column-wise to make columns to all
 have the same mean with:
 
 df * mean(mean(df)) / mean(df).
 
 I just can't get my head around this: mean(df) gives me the correct column
 means vector, and mean(mean(df)) gives me the correct total mean. The
 above operation works correctly for individual rows, i.e. if I do
  df[1,]*mean(mean(df))/mean(df)
 
 Can someone tell me what I am doing wrong??
 Thanks!
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Multiplication-of-data-frame-with-vector-tp24368878p24372764.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] Testing memory limits in R??

2009-07-07 Thread Whit Armstrong
Seems strange. I can go all the way up to 50GB on our machine which
has 64GB as well.  It starts swapping after that, so I killed the
process.

try this:
ans - list()
for(i in 1:100) {
ans[[ i ]] - numeric(2^30/2)
cat(iteration: ,i,\n)
print(gc())
}

 source(scripts/test.memory.r)
iteration:  1
used   (Mb) gc trigger   (Mb)  max used   (Mb)
Ncells1091715.9 35   18.735   18.7
Vcells 536990895 4097.0  592369806 4519.5 536992095 4097.0
iteration:  2
 used   (Mb) gc trigger   (Mb)   max used   (Mb)
Ncells 1092765.9 35   18.7 35   18.7
Vcells 1073861851 8193.0 1184270079 9035.3 1073861858 8193.0
...
...
...
iteration:  13
 used(Mb) gc trigger(Mb)   max used(Mb)
Ncells 109287 5.9 3518.7 3518.7
Vcells 6979441897 53249.0 7458515495 56904.0 6979442076 53249.0

you might want to check your kernel.shmmax setting, although I'm not
sure if it will help R.

-Whit


On Tue, Jul 7, 2009 at 8:39 AM, Scott Zentzze...@email.unc.edu wrote:
 Hello Everyone!

   Thanks for all your replies! This was very helpful!  I found that there
 seems to be a limitation to only 32GB of memory which I think will be fine.
 I was able to consume the 32GB of memory with the following:
 Start R with the following command: R --max-vsize 55000M
 then within R run
 x=rep(0.1,2.141e9)
 and watch the process with top and R will consume about 32GB of memory...
 Hopefully this will be enough for the researchers ;)

 Thanks!
 -scz

 Scott Zentz wrote:

 Hello Everyone,

   We have recently purchased a server which has 64GB of memory running a
 64bit OS and I have compiled R from source with the following config

 ./configure --prefix=/usr/local/R-2.9.1 --enable-Rshlib
 --enable-BLAS-shlib --enable-shared --with-readline --with-iconv --with-x
 --with-tcktk --with-aqua --with-libpng --with-jpeglib

 and I would like to verify that I can use 55GB-60GB of the 64GB of memory
 within R. Does anyone know how this is possible? Will R be able to access
 that amount of memory from a single process? I am not an R user myself but I
 just wanted to test this before I turned the server over to the
 researchers..

 Thanks!
 -scz

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

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


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


[R] Uncorrelated random vectors

2009-07-07 Thread Stein, Luba (AIM SE)
Hello,

is it possible to create two uncorrelated random vectors for a given 
distribution.

In fact, I would like to have something like the function rnorm or rlogis 
with the extra property that they are uncorrelated.

Thanks for your help,
Luba




[[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 get R to print only one column per line when outputting a matrix?

2009-07-07 Thread Godmar Back
Hi,

I'm trying to make it easier for my survey evaluators to read the
results of my survey analysis. To that end, I'd like to suppress R's
habit of filling every line up to width columns.  How do I do that?

For instance, using 'print()', R outputs something like:

 [,1] [,2]
var2 someshortname someothershortname
r0.33417550.3275274
N136  136
 [,3]
var2 somereallyreallyreallyreallyreallylongname
r0.323306
N136
 [,4]
var2 someotherreallyreallyreallyreallyreallylongname
r0.3121291
N101


How can I get it to place every column on a new line to avoid
confusing the reader?

I read the help for print, print.default, format, cat, and
options(width) and wasn't able to find an answer.

Thanks!

 - Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Testing memory limits in R??

2009-07-07 Thread Scott Zentz
Hey Whit,

That worked! I was able to consume all the memory on the server!

Thanks!

-scz

Whit Armstrong wrote:
 Seems strange. I can go all the way up to 50GB on our machine which
 has 64GB as well.  It starts swapping after that, so I killed the
 process.

 try this:
 ans - list()
 for(i in 1:100) {
 ans[[ i ]] - numeric(2^30/2)
 cat(iteration: ,i,\n)
 print(gc())
 }

   
 source(scripts/test.memory.r)
 
 iteration:  1
 used   (Mb) gc trigger   (Mb)  max used   (Mb)
 Ncells1091715.9 35   18.735   18.7
 Vcells 536990895 4097.0  592369806 4519.5 536992095 4097.0
 iteration:  2
  used   (Mb) gc trigger   (Mb)   max used   (Mb)
 Ncells 1092765.9 35   18.7 35   18.7
 Vcells 1073861851 8193.0 1184270079 9035.3 1073861858 8193.0
 ...
 ...
 ...
 iteration:  13
  used(Mb) gc trigger(Mb)   max used(Mb)
 Ncells 109287 5.9 3518.7 3518.7
 Vcells 6979441897 53249.0 7458515495 56904.0 6979442076 53249.0

 you might want to check your kernel.shmmax setting, although I'm not
 sure if it will help R.

 -Whit


 On Tue, Jul 7, 2009 at 8:39 AM, Scott Zentzze...@email.unc.edu wrote:
   
 Hello Everyone!

   Thanks for all your replies! This was very helpful!  I found that there
 seems to be a limitation to only 32GB of memory which I think will be fine.
 I was able to consume the 32GB of memory with the following:
 Start R with the following command: R --max-vsize 55000M
 then within R run
 x=rep(0.1,2.141e9)
 and watch the process with top and R will consume about 32GB of memory...
 Hopefully this will be enough for the researchers ;)

 Thanks!
 -scz

 Scott Zentz wrote:
 
 Hello Everyone,

   We have recently purchased a server which has 64GB of memory running a
 64bit OS and I have compiled R from source with the following config

 ./configure --prefix=/usr/local/R-2.9.1 --enable-Rshlib
 --enable-BLAS-shlib --enable-shared --with-readline --with-iconv --with-x
 --with-tcktk --with-aqua --with-libpng --with-jpeglib

 and I would like to verify that I can use 55GB-60GB of the 64GB of memory
 within R. Does anyone know how this is possible? Will R be able to access
 that amount of memory from a single process? I am not an R user myself but I
 just wanted to test this before I turned the server over to the
 researchers..

 Thanks!
 -scz

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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.

 

[[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] Multiplication of data frame with vector

2009-07-07 Thread Stein, Luba (AIM SE)
 
Thank you for your help!
But is it possible to produe two vectors x and y with a given length such that 
there correlation is zero.

For me ist not enough just to simulate two vectors with there correlation.

Thank you,
Luba





-Urspr?ngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im 
Auftrag von David Freedman
Gesendet: Dienstag, 7. Juli 2009 14:53
An: r-help@r-project.org
Betreff: Re: [R] Multiplication of data frame with vector


Would the scale function work for this?  Something like
new=scale(df, center=T)

HTH,
david freedman

cir p wrote:
 
 
 Dear group:
 sorry for my beginners question, but I'm rather new to R and was searching
 high and low without success:
 
 I have a data frame (df) with variables in the rows and observations in
 the columns like (the actual data frame has 15 columns and 1789 rows):
 
   early1 early2 early3 early4 early5
 M386T1000  57056  55372  58012  55546  57309
 M336T9011063  10312  10674  10840  11208
 M427T9112064  11956  12692  12340  11924
 M429T91 4594   3890   4096   4019   4204
 M447T9026553  27647  26889  26751  26929
 
 Now I'm trying to transform each value column-wise to make columns to all
 have the same mean with:
 
 df * mean(mean(df)) / mean(df).
 
 I just can't get my head around this: mean(df) gives me the correct column
 means vector, and mean(mean(df)) gives me the correct total mean. The
 above operation works correctly for individual rows, i.e. if I do
  df[1,]*mean(mean(df))/mean(df)
 
 Can someone tell me what I am doing wrong??
 Thanks!
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Multiplication-of-data-frame-with-vector-tp24368878p24372764.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] Uncorrelated random vectors

2009-07-07 Thread Stein, Luba (AIM SE)
Thank you for your help!
But is it possible to produe two vectors x and y with a given length such that 
there correlation is zero.

For me ist not enough just to simulate two vectors with there correlation.

Thank you,
Luba 




-Urspr?ngliche Nachricht-
Von: ONKELINX, Thierry [mailto:thierry.onkel...@inbo.be] 
Gesendet: Dienstag, 7. Juli 2009 15:51
An: Stein, Luba (AIM SE); r-help@r-project.org
Betreff: RE: [R] Uncorrelated random vectors

cor.test(rnorm(1), rnorm(1)) 




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and 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 Stein, Luba (AIM SE)
Verzonden: dinsdag 7 juli 2009 15:46
Aan: r-help@r-project.org
Onderwerp: [R] Uncorrelated random vectors

Hello,

is it possible to create two uncorrelated random vectors for a given
distribution.

In fact, I would like to have something like the function rnorm or
rlogis with the extra property that they are uncorrelated.

Thanks for your help,
Luba




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

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.


[R] cor vs cor.test

2009-07-07 Thread Godmar Back
Hi,

I am trying to use R for some survey analysis, and need to compute the
significance of some correlations. I read the man pages for cor and
cor.test, but I am confused about

- whether these functions are intended to work the same way
- about how these functions handle NA values
- whether cor.test supports 'use = complete.obs'.

Some example output may explain why I am confused:

---
WORKS:
 cor(q[[9]], q[[10]])
  perceivedlearningcurve
overallimpression  0.7440637
---

DOES NOT WORK:
 cor.test(q[[9]], q[[10]])
Error in `[.data.frame`(x, OK) : undefined columns selected
---

(I assume that's because of R's generous type coercions does R
have a typeof operator to learn what the type of q[[9]] is?)

---
WORKS:
 cor.test(q[[9]][,1], q[[10]][,1])

Pearson's product-moment correlation

data:  q[[9]][, 1] and q[[10]][, 1]
t = 12.9877, df = 136, p-value  2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.6588821 0.8104055
sample estimates:
  cor
0.7440637
---

WORKS, but propagates NAs:
 cor(q[[9]], q[[51]])
  usefulnessautodetectionbox_ord
overallimpression NA
---
WORKS, and uses complete observations only

 cor(q[[9]], q[[51]], use=complete.obs)
  usefulnessautodetectionbox_ord
overallimpression  0.2859895
---
WORKS, apparently, but does not require 'use=complete.obs' (!?)

 cor.test(q[[9]][,1], q[[51]][,1])

Pearson's product-moment correlation

data:  q[[9]][, 1] and q[[51]][, 1]
t = 3.1016, df = 108, p-value = 0.002456
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.1043351 0.4491779
sample estimates:
  cor
0.2859895
---

The help page for cor.test states that 'getOption('na.action')'
describes the action taken on NAs:

 getOption(na.option)
NULL
---

No action is taken, yet cor.test appears to only use complete observations (!?)

Others believe that cor.test accepts 'use=complete.obs':
http://markmail.org/message/nuzqeouqhbb7f6ok

--

Needless to say, this makes writing robust code very hard.

I'm wondering what the rationale for the inconsistencies between cor
and cor.test is.

Thanks!

 - Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Uncorrelated random vectors

2009-07-07 Thread Andrew Dolman
You could use the mvtnorm package to generate correlated vectors of random
normal deviates where the nominal correlation is 0.

library(mvtnorm)
rho - 0.0
Cor - array(c(1, rho, rho, 1), dim=c(2,2))
Y - rmvnorm(1000, sigma=Cor)

plot(Y)
cor(Y)
cor.test(Y[,1],Y[,2])


Any given random set will have some small amount of random correlation.


You can then transform the distribution of the normal random deviates to
another distribution using pnorm, qnorm and their equivalents for the other
dist.


Andy.




andydol...@gmail.com


2009/7/7 Stein, Luba (AIM SE) luba.st...@allianz.com

 Thank you for your help!
 But is it possible to produe two vectors x and y with a given length such
 that there correlation is zero.

 For me ist not enough just to simulate two vectors with there correlation.

 Thank you,
 Luba




 -Urspr?ngliche Nachricht-
 Von: ONKELINX, Thierry [mailto:thierry.onkel...@inbo.be]
 Gesendet: Dienstag, 7. Juli 2009 15:51
 An: Stein, Luba (AIM SE); r-help@r-project.org
 Betreff: RE: [R] Uncorrelated random vectors

 cor.test(rnorm(1), rnorm(1))


 
 
 ir. Thierry Onkelinx
 Instituut voor natuur- en bosonderzoek / Research Institute for Nature
 and Forest
 Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
 methodology and 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 Stein, Luba (AIM SE)
 Verzonden: dinsdag 7 juli 2009 15:46
 Aan: r-help@r-project.org
 Onderwerp: [R] Uncorrelated random vectors

 Hello,

 is it possible to create two uncorrelated random vectors for a given
 distribution.

 In fact, I would like to have something like the function rnorm or
 rlogis with the extra property that they are uncorrelated.

 Thanks for your help,
 Luba




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

 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] bigglm() results different from glm()+Another question

2009-07-07 Thread Greg Snow
How many rows does xx have?

Let's look at your example for chunksize 1, you initially fit the first 
1 observations, then the seq results in just the value 1 which means 
that you do the update based on vaues 10001 through 2, if xx only has 1 
rows, then this should give at least one error.  If xx has 2 or more rows, 
then only chunksize 1 will ever see the 2th value, the other chunksizes 
will use less of the data.

Also looking at the help for update.biglm, the 2nd argument is moredata not 
data, so if the code below is the code that you actually ran, then the new 
data chunks are going into the ... argument (and being ignored as that is 
there for future expansion and does nothing yet) and the moredata argument is 
left empty, which should also be giving an error.  For the code below, the 
model is only being fit to the initial chunk and never updated, so with 
different chunk sizes, there is different amounts of data per model.  You can 
check this by doing summary(fit) and looking at the sample size in the 2nd line.

It is easier for us to help you if you provide code that can be run by copying 
and pasting (we don't have xx, so we can't just run the code below, you could 
include a line to randomly generate an xx, or a link to where a copy of xx can 
be downloaded from).  It also helps if you mention any errors or warnings that 
you receive in the process of running your code.

Hope this helps,

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

From: utkarshsinghal [mailto:utkarsh.sing...@global-analytics.com]
Sent: Tuesday, July 07, 2009 12:10 AM
To: Greg Snow
Cc: Thomas Lumley; r help
Subject: Re: [R] bigglm() results different from glm()+Another question

Trust me, it is the same total data I am using, even the chunksizes are all 
equal. I also crosschecked by manually creating the chunks and updating as in 
example given on biglm help page.
 ?biglm


Regards
Utkarsh



Greg Snow wrote:
Are you sure that you are fitting all the models on the same total data?  A 
first glance looks like you may be including more data in some of the chunk 
sizes, or be producing an error that update does not know how to deal with.

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

From: utkarshsinghal [mailto:utkarsh.sing...@global-analytics.com]
Sent: Monday, July 06, 2009 8:58 AM
To: Thomas Lumley; Greg Snow
Cc: r help
Subject: Re: [R] bigglm() results different from glm()+Another question


The AIC of the biglm models is highly dependent on the size of chunks selected 
(example provided below). This I can somehow expect because the model error 
will increase with the number of chunks.

It will be helpful if you can provide your opinion for comparing different 
models in such cases:

 *   can I compare two models fitted with different chunksizes, or should I 
always use the same chunk size.

 *   although I am not going to use AIC at all in my model selection, but I 
think any other model parameters will also vary in the same way. Am I right?
 *   what would be the ideal chunksize? should it be the maximum possible size 
R and my system's RAM is able to handle?
Any comments will be helpful.


Example of AIC variation with chunksize:

I ran the following code on my data which has 1 observations and 3 
independent variables

 chunksize = 500
 fit = biglm(y~x1+x2+x3, data=xx[1:chunksize,])
 for(i in seq(chunksize,1,chunksize)) fit=update(fit, 
 data=xx[(i+1):(i+chunksize),])
 AIC(fit)
[1] 30647.79

Here are the AIC for other chunksizes:
chunksizeAIC
500  30647.79
100029647.79
200027647.79
250026647.79
500021647.79
1  11647.79


Regards
Utkarsh




utkarshsinghal wrote:
Thank you Mr. Lumley and Mr. Greg. That was helpful.

Regards
Utkarsh



Thomas Lumley wrote:


On Fri, 3 Jul 2009, utkarshsinghal wrote:




Hi Sir,

Thanks for making package available to us. I am facing few problems if you can 
give some hints:

Problem-1:
The model summary and residual deviance matched (in the mail below) but I 
didn't understand why AIC is still different.



AIC(m1)
[1] 532965



AIC(m1big_longer)
[1] 101442.9

That's because AIC.default uses the unnormalized loglikelihood and AIC.biglm 
uses the deviance.  Only differences in AIC between models are meaningful, not 
individual values.




Problem-2:
chunksize argument is there in bigglm but not in biglm, consequently, 
udate.biglm is there, but not update.bigglm
Is my observation correct? If yes, why is this difference?

Because update.bigglm is impossible.

Fitting a glm requires iteration, which means that it requires multiple passes 
through the data. Fitting a linear model requires only a single pass. 
update.biglm can take a fitted or partially fitted biglm and add more data. To 
do the same thing for a bigglm you would need to 

Re: [R] cor vs cor.test

2009-07-07 Thread Peter Ehlers

?cor says that cor() can be applied to
 'numeric vector, matrix or data frame'

?cor.test requires
 'numeric vectors of data values'

So, what's your q?

As to na.action:
?cor.test makes no reference to na.action for the default method.
Looking at the code of cor.test.default shows that only complete
cases are used. The formula method does have an argument na.action
and it works just fine for me.
Try getOption('na.action') and you'll probably find that it is set
  ^^
to 'na.omit'.

 -Peter Ehlers

Godmar Back wrote:

Hi,

I am trying to use R for some survey analysis, and need to compute the
significance of some correlations. I read the man pages for cor and
cor.test, but I am confused about

- whether these functions are intended to work the same way
- about how these functions handle NA values
- whether cor.test supports 'use = complete.obs'.

Some example output may explain why I am confused:

---
WORKS:

cor(q[[9]], q[[10]])

  perceivedlearningcurve
overallimpression  0.7440637
---

DOES NOT WORK:

cor.test(q[[9]], q[[10]])

Error in `[.data.frame`(x, OK) : undefined columns selected
---

(I assume that's because of R's generous type coercions does R
have a typeof operator to learn what the type of q[[9]] is?)

---
WORKS:

cor.test(q[[9]][,1], q[[10]][,1])


Pearson's product-moment correlation

data:  q[[9]][, 1] and q[[10]][, 1]
t = 12.9877, df = 136, p-value  2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.6588821 0.8104055
sample estimates:
  cor
0.7440637
---

WORKS, but propagates NAs:

cor(q[[9]], q[[51]])

  usefulnessautodetectionbox_ord
overallimpression NA
---
WORKS, and uses complete observations only


cor(q[[9]], q[[51]], use=complete.obs)

  usefulnessautodetectionbox_ord
overallimpression  0.2859895
---
WORKS, apparently, but does not require 'use=complete.obs' (!?)


cor.test(q[[9]][,1], q[[51]][,1])


Pearson's product-moment correlation

data:  q[[9]][, 1] and q[[51]][, 1]
t = 3.1016, df = 108, p-value = 0.002456
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.1043351 0.4491779
sample estimates:
  cor
0.2859895
---

The help page for cor.test states that 'getOption('na.action')'
describes the action taken on NAs:


getOption(na.option)

NULL
---

No action is taken, yet cor.test appears to only use complete observations (!?)

Others believe that cor.test accepts 'use=complete.obs':
http://markmail.org/message/nuzqeouqhbb7f6ok

--

Needless to say, this makes writing robust code very hard.

I'm wondering what the rationale for the inconsistencies between cor
and cor.test is.

Thanks!

 - Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Uncorrelated random vectors

2009-07-07 Thread Ted Harding
Be careful to be clear what you are referring to when you say
correlation is zero.

The commands
  x - rnorm(100)
  y - rnorm(100)
will produce two vectors of given length (100) which (to within the
effectively ignorable limitations of the ransom number generator)
will have been produced independently. Hence the *theoretical*
correlation is zero. If that is what you meant, then it is already
answered. When you compute cor(x,y), however, the answer will in
general be non-zero (though only rarely significantly so). This is
because the numbers produced by the second independent run of rnrom()
have an almost zero probability of producing two vectors for which
the value of cor(x,y) = 0.

However, possibly you mean that you want two vectors for which the
result of cor(x,y) = 0. One way to achieve this is along the following
lines:

  set.seed(54321)
  x  - rnorm(100)
  y0 - rnorm(100)
  My - mean(y0)
  Sy - sd(y0)
  y1 - lm(y0 ~ x)$res ; y1 - y1/sd(y1)
  y  - My + y1*Sy

  mean(y0)
  # [1] 0.04497584
  mean(y)
  # [1] 0.04497584
  sd(y0)
  # [1] 0.848231
  sd(y)
  # [1] 0.848231

  cor(x,y0)
  # [1] 0.05556468
  cor(x,y)
  # [1] 6.451072e-18 [effectively 0, to within rounding error]

In this case, however, note that
[A]: The 100 elements of y, given the values of x, are NOT independent
of each other, since they satisfy the linear constraint

  x[1]*y[1] + x[2]*y[2] + ... + x[100]*y[100]
  - (sum(x))*[y[1] + y[2] + ... + y[100])/100 = 0

and therefore can vary only in 99 dimensions, not 100. Nor are they
independent of the values of x (even though the numerical correlation
is 0).
On the other hand, the values of y0 are independent of the values
of x, and of each other.

You need to be very clear why you want to have two vectors x,y
such that cor(x,y) = 0, since otherwise you are at risk of carrying
out an invalid analysis.

Hoping this helps,
Ted.



On 07-Jul-09 14:26:02, Stein, Luba (AIM SE) wrote:
 Thank you for your help!
 But is it possible to produe two vectors x and y with a given length
 such that there correlation is zero.
 
 For me ist not enough just to simulate two vectors with there
 correlation.
 
 Thank you,
 Luba 
 
 
 
 
 -Urspr?ngliche Nachricht-
 Von: ONKELINX, Thierry [mailto:thierry.onkel...@inbo.be] 
 Gesendet: Dienstag, 7. Juli 2009 15:51
 An: Stein, Luba (AIM SE); r-help@r-project.org
 Betreff: RE: [R] Uncorrelated random vectors
 
 cor.test(rnorm(1), rnorm(1)) 
 
 
 
 
 ir. Thierry Onkelinx
 ~ 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 Stein, Luba (AIM SE)
 Verzonden: dinsdag 7 juli 2009 15:46
 Aan: r-help@r-project.org
 Onderwerp: [R] Uncorrelated random vectors
 
 Hello,
 
 is it possible to create two uncorrelated random vectors for a given
 distribution.
 
 In fact, I would like to have something like the function rnorm or
 rlogis with the extra property that they are uncorrelated.
 
 Thanks for your help,
 Luba


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 07-Jul-09   Time: 16:48:06
-- XFMail --

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


Re: [R] Solving quadratic equations with covariance term

2009-07-07 Thread Charles C. Berry

On Tue, 7 Jul 2009, Stein, Luba (AIM SE) wrote:


Hi,

more precisely I consider a matrix with three column vectors a_i (i=1,2,3), 
i.e. A=(a_1,a_2,a_3). On the other hand x should take vectors as values, i.e. 
x=v_j, while j goes also from 1 till 3.
Now I just want to calculate the equation Cov(a_i,x_j) = 0, where Cov(a_i,x_j) 
is the covariance matrix.
A is a given value and x is the variable I am looking for.

In my opinion this is an quadratic equation and makes sense.


Well, x_j = (0,0,...,0)' will satisfy Cov( A, x_j ) = (0,...0)'.

Suggest you Google 'orthogonal complement' for nontrivial solutions.

Then peruse

?qr

HTH,

Chuck


p.s. Don't lose sight of FAQ 7.31

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f



Best wishes,
Luba





-Urspr?ngliche Nachricht-
Von: Rolf Turner [mailto:r.tur...@auckland.ac.nz]
Gesendet: Montag, 6. Juli 2009 23:16
An: Stein, Luba (AIM SE)
Cc: R-help@r-project.org
Betreff: Re: [R] Solving quadratic equations with covariance term


On 7/07/2009, at 2:15 AM, Stein, Luba (AIM SE) wrote:


Hi,

I would like to solve the following equation with R: Cov(A,x)=0.
A is a given matrix, x is the an unknown vector.

Is there any nice solution for this?


What on earth do you mean by ``Cov(A,x)''?  This makes no sense
at all.

cheers,

Rolf Turner

##
Attention:
This e-mail message is privileged and confidential. If you are not the
intended recipient please delete the message and notify the sender.
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal
www.marshalsoftware.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.



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu   UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Mathematical annotation axis in lattice

2009-07-07 Thread Paul Hiemstra

Hi Albart,

This bugged me also for quite some time. After some experiments the 
following syntax worked best:


library(lattice)
a = 0.11
xyplot(1:10~10:11, xlab = as.expression(bquote(R^2~ equals ~.(a

With the combination of as.expression and bquote you can mix text, math 
expression and the content of objects (in the case here of a). Read the 
documentation of bquote for more details.


cheers,
Paul

Coster, Albart wrote:

Dear list,

making mathematical expressions in plots is not difficult: expression(phi[1]) 
for example. At this moment I am stuck in creating a vector of expressions:

pos - 1:10
lab - letters[pos]

Now, I would like to create a vector of expressions which I could use for labeling the x-axis of a lattice plot. 


ll - as.expression(paste(pos, phi[,lab,],sep = )

xyplot(1:10~11:10,scales = list(x = list(labels = ll,at = 1:10)))

does not work. I read about the function substitute, but that did not solve it.

Could you recommend me how I should do this? 


Thanks in advance,

Albart Coster

Wageningen Universiteit
Netherlands

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



--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Uncorrelated random vectors

2009-07-07 Thread Greg Snow
Here are some examples that may get you started (note that there is no 
guarantee that a variable follows a given distribution after it has been 
adjusted to have 0 correlation with another variable):

library(MASS)
tmp - mvrnorm(25, c(0,0), diag(2), empirical=TRUE)
zapsmall(cor(tmp))

tmp2 - exp(tmp)
zapsmall(cor(tmp2))

x - rexp(100, 3)
y - rexp(100, 2)
par(mfrow=c(2,1))
plot(x,y)
tmp3 - cbind(x,y)
zapsmall(cor(tmp3))



tmp4 - tmp3 %*% solve(chol(var(tmp3)))
zapsmall(cor(tmp4))
plot(tmp4)
hist(tmp4[,1])
hist(tmp4[,2])
plot(tmp4[,1], x)
plot(tmp4[,2], y)


Hope this helps,

-- 
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 Stein, Luba (AIM SE)
 Sent: Tuesday, July 07, 2009 8:26 AM
 To: ONKELINX, Thierry; r-help@r-project.org
 Subject: Re: [R] Uncorrelated random vectors
 
 Thank you for your help!
 But is it possible to produe two vectors x and y with a given length
 such that there correlation is zero.
 
 For me ist not enough just to simulate two vectors with there
 correlation.
 
 Thank you,
 Luba
 
 
 
 
 -Urspr?ngliche Nachricht-
 Von: ONKELINX, Thierry [mailto:thierry.onkel...@inbo.be]
 Gesendet: Dienstag, 7. Juli 2009 15:51
 An: Stein, Luba (AIM SE); r-help@r-project.org
 Betreff: RE: [R] Uncorrelated random vectors
 
 cor.test(rnorm(1), rnorm(1))
 
 
 ---
 -
 
 ir. Thierry Onkelinx
 Instituut voor natuur- en bosonderzoek / Research Institute for Nature
 and Forest
 Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
 methodology and 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 Stein, Luba (AIM SE)
 Verzonden: dinsdag 7 juli 2009 15:46
 Aan: r-help@r-project.org
 Onderwerp: [R] Uncorrelated random vectors
 
 Hello,
 
 is it possible to create two uncorrelated random vectors for a given
 distribution.
 
 In fact, I would like to have something like the function rnorm or
 rlogis with the extra property that they are uncorrelated.
 
 Thanks for your help,
 Luba
 
 
 
 
   [[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.
 
 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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 get R to print only one column per line when outputting a matrix?

2009-07-07 Thread David Winsemius
It looks like you are printing a matrix and that you want to print all  
rows of the first column before all rows of the second column. Apply  
should do it. Assume the matrix is named AA


apply(AA, c(2,1), cat, \n)   # the \n is the line-feed character

--
DW


On Jul 7, 2009, at 10:06 AM, Godmar Back wrote:


Hi,

I'm trying to make it easier for my survey evaluators to read the
results of my survey analysis. To that end, I'd like to suppress R's
habit of filling every line up to width columns.  How do I do that?

For instance, using 'print()', R outputs something like:


But you have not offered the code that produced this.



[,1] [,2]
var2 someshortname someothershortname
r0.33417550.3275274
N136  136
[,3]
var2 somereallyreallyreallyreallyreallylongname
r0.323306
N136
[,4]
var2 someotherreallyreallyreallyreallyreallylongname
r0.3121291
N101


How can I get it to place every column on a new line to avoid
confusing the reader?

I read the help for print, print.default, format, cat, and
options(width) and wasn't able to find an answer.

Thanks!

- Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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
Heritage Laboratories
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] Thanks!

2009-07-07 Thread Mark Knecht
Hi all,
   I just wanted to send a general word of thanks to the list for
making my first week using R successful (by my measures) and
reasonably pleasurable. (Not a single literal RTFM!) ;-)

   I appreciate all the help I've received from folks. I have a long
way to go but I'm starting to get data and plots that look interesting
and I couldn't have gotten there this fast without your help.

Cheers,
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.


[R] error: no such index at level 2

2009-07-07 Thread Godmar Back
Hi,

I am confused about how to select elements from a list.

I'm trying to select all rows of a table 'crossRsorted' such that the
mean of a related vector is  0.  The related vector is accessible as
a list element l[[i]] where i is the row index.

I thought this would work:

 crossRsorted[mean(q[[ crossRsorted[,1] ]], na.rm = TRUE)  0, ]
Error in q[[crossRsorted[, 1]]] : no such index at level 2

How can I express: select only those rows 'r_i' from crossRsorted
where mean(q[[r_i[1]]])  0?

Thanks,

 - Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] cor vs cor.test

2009-07-07 Thread Godmar Back
Thanks, Peter.

You're right, I mistyped and getOption('na.action') shows na.omit.

Perhaps my question was more commentary about my perceived lack of
rationale and orthogonality in R than it should have been. Presumably,
q[[i]] is a data frame and q[[i]][,1] is a numeric vector, so cor and
cor.test work differently. The interfaces for how to handle NAs
between the two functions are completely different. Why design things
this way, though.

 - Godmar

On Tue, Jul 7, 2009 at 11:42 AM, Peter Ehlersehl...@ucalgary.ca wrote:
 ?cor says that cor() can be applied to
  'numeric vector, matrix or data frame'

 ?cor.test requires
  'numeric vectors of data values'

 So, what's your q?

 As to na.action:
 ?cor.test makes no reference to na.action for the default method.
 Looking at the code of cor.test.default shows that only complete
 cases are used. The formula method does have an argument na.action
 and it works just fine for me.
 Try getOption('na.action') and you'll probably find that it is set
                  ^^
 to 'na.omit'.

  -Peter Ehlers

 Godmar Back wrote:

 Hi,

 I am trying to use R for some survey analysis, and need to compute the
 significance of some correlations. I read the man pages for cor and
 cor.test, but I am confused about

 - whether these functions are intended to work the same way
 - about how these functions handle NA values
 - whether cor.test supports 'use = complete.obs'.

 Some example output may explain why I am confused:

 ---
 WORKS:

 cor(q[[9]], q[[10]])

                  perceivedlearningcurve
 overallimpression              0.7440637
 ---

 DOES NOT WORK:

 cor.test(q[[9]], q[[10]])

 Error in `[.data.frame`(x, OK) : undefined columns selected
 ---

 (I assume that's because of R's generous type coercions does R
 have a typeof operator to learn what the type of q[[9]] is?)

 ---
 WORKS:

 cor.test(q[[9]][,1], q[[10]][,1])

        Pearson's product-moment correlation

 data:  q[[9]][, 1] and q[[10]][, 1]
 t = 12.9877, df = 136, p-value  2.2e-16
 alternative hypothesis: true correlation is not equal to 0
 95 percent confidence interval:
  0.6588821 0.8104055
 sample estimates:
      cor
 0.7440637
 ---

 WORKS, but propagates NAs:

 cor(q[[9]], q[[51]])

                  usefulnessautodetectionbox_ord
 overallimpression                             NA
 ---
 WORKS, and uses complete observations only

 cor(q[[9]], q[[51]], use=complete.obs)

                  usefulnessautodetectionbox_ord
 overallimpression                      0.2859895
 ---
 WORKS, apparently, but does not require 'use=complete.obs' (!?)

 cor.test(q[[9]][,1], q[[51]][,1])

        Pearson's product-moment correlation

 data:  q[[9]][, 1] and q[[51]][, 1]
 t = 3.1016, df = 108, p-value = 0.002456
 alternative hypothesis: true correlation is not equal to 0
 95 percent confidence interval:
  0.1043351 0.4491779
 sample estimates:
      cor
 0.2859895
 ---

 The help page for cor.test states that 'getOption('na.action')'
 describes the action taken on NAs:

 getOption(na.option)

 NULL
 ---

 No action is taken, yet cor.test appears to only use complete observations
 (!?)

 Others believe that cor.test accepts 'use=complete.obs':
 http://markmail.org/message/nuzqeouqhbb7f6ok

 --

 Needless to say, this makes writing robust code very hard.

 I'm wondering what the rationale for the inconsistencies between cor
 and cor.test is.

 Thanks!

  - Godmar

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




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


Re: [R] how to get R to print only one column per line when outputting a matrix?

2009-07-07 Thread Godmar Back
On Tue, Jul 7, 2009 at 12:20 PM, David Winsemiusdwinsem...@comcast.net wrote:
 It looks like you are printing a matrix and that you want to print all rows
 of the first column before all rows of the second column. Apply should do
 it. Assume the matrix is named AA

 apply(AA, c(2,1), cat, \n)   # the \n is the line-feed character


I thought along these lines, too, but:

 AA
 [,1][,2][,3]
[1,] overallimpression yourinitialimpression managementprocess_as_ord
[2,] 0.7440637   0.7270246   0.5550202
 [,4]
[1,] userinterfacechangedisplayorder:It was very easy to use with
either option
[2,] -0.4476622

[ remainder deleted ]

 apply(AA, c(2,1), cat, \n)
Error in cat(list(...), file, sep, fill, labels, append) :
  argument 1 (type 'list') cannot be handled by 'cat'

This may give more information about what AA is:

 attributes(AA)
$dim
[1]  2 13

 is.matrix(AA)
[1] TRUE

 - Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 get R to print only one column per line when outputting a matrix?

2009-07-07 Thread Godmar Back
On Tue, Jul 7, 2009 at 1:22 PM, Godmar Backgod...@gmail.com wrote:

 apply(AA, c(2,1), cat, \n)
 Error in cat(list(...), file, sep, fill, labels, append) :
  argument 1 (type 'list') cannot be handled by 'cat'


ps: but your idea of using 'apply' led me to this:

  dummy - apply(AA, c(2), function (r) { cat(sprintf(%f - %s\n, r[2], 
 format(r[1]))) })
0.744064 - overallimpression
0.727025 - yourinitialimpression
0.555020 - managementprocess_as_ord
[...]

which is exactly what I'd like.

Thanks!

 - Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 due to non-conformable arrays

2009-07-07 Thread spime

Hello,

Consider this function for generalized ridge regression:

gre - function (X,y,D){
n - dim(X)[1]
p - dim(X)[2]
intercept - rep(1, n) 
X - cbind(intercept, X) 
X2D - crossprod(X,X)+ D
Xy - crossprod(X,y) 
bth - qr.solve(X2D, Xy) 
}

# suppose X is an (nxp) design matrix and y is an (nx1) response vector
p - dim(x)[2]
D- diag(rep(1.5,p)) 
bt - gre(X,y,D)

I am getting following error:
Error in crossprod(X, X) + D : non-conformable arrays

But when  i define D within the function 'gre()' then everything is fine.
What wrong i have done?

thanks. 
-- 
View this message in context: 
http://www.nabble.com/Error-due-to-non-conformable-arrays-tp24377781p24377781.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] Error due to non-conformable arrays

2009-07-07 Thread Henrique Dallazuanna
I think that is because X in your function has (n + 1) columns and D with
only n coluimns:

matrix(1:9, ncol = 3) + matrix(1:8, ncol = 2)

On Tue, Jul 7, 2009 at 2:30 PM, spime saby...@gmail.com wrote:


 Hello,

 Consider this function for generalized ridge regression:

 gre - function (X,y,D){
n - dim(X)[1]
p - dim(X)[2]
intercept - rep(1, n)
X - cbind(intercept, X)
X2D - crossprod(X,X)+ D
Xy - crossprod(X,y)
bth - qr.solve(X2D, Xy)
 }

 # suppose X is an (nxp) design matrix and y is an (nx1) response vector
 p - dim(x)[2]
 D- diag(rep(1.5,p))
 bt - gre(X,y,D)

 I am getting following error:
 Error in crossprod(X, X) + D : non-conformable arrays

 But when  i define D within the function 'gre()' then everything is fine.
 What wrong i have done?

 thanks.
 --
 View this message in context:
 http://www.nabble.com/Error-due-to-non-conformable-arrays-tp24377781p24377781.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.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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 due to non-conformable arrays

2009-07-07 Thread David Winsemius

Incomplete code leaves us able to do naught but guess;

Perhaps you are unaware that x != X

--  
DW

On Jul 7, 2009, at 1:30 PM, spime wrote:



Hello,

Consider this function for generalized ridge regression:

gre - function (X,y,D){
n - dim(X)[1]
p - dim(X)[2]
intercept - rep(1, n)
X - cbind(intercept, X) 
X2D - crossprod(X,X)+ D
Xy - crossprod(X,y)
bth - qr.solve(X2D, Xy)
}

# suppose X is an (nxp) design matrix and y is an (nx1) response  
vector

p - dim(x)[2]
D- diag(rep(1.5,p))
bt - gre(X,y,D)

I am getting following error:
Error in crossprod(X, X) + D : non-conformable arrays

But when  i define D within the function 'gre()' then everything is  
fine.

What wrong i have done?

thanks.
--
View this message in context: 
http://www.nabble.com/Error-due-to-non-conformable-arrays-tp24377781p24377781.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
Heritage Laboratories
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] Error due to non-conformable arrays

2009-07-07 Thread Jorge Ivan Velez
Hi spime,
What is x?  Did you have any other X defined in your R-session? Be aware
that R is case-sensitive.
Best,

Jorge


On Tue, Jul 7, 2009 at 1:30 PM, spime saby...@gmail.com wrote:


 Hello,

 Consider this function for generalized ridge regression:

 gre - function (X,y,D){
n - dim(X)[1]
p - dim(X)[2]
intercept - rep(1, n)
X - cbind(intercept, X)
X2D - crossprod(X,X)+ D
Xy - crossprod(X,y)
bth - qr.solve(X2D, Xy)
 }

 # suppose X is an (nxp) design matrix and y is an (nx1) response vector
 p - dim(x)[2]
 D- diag(rep(1.5,p))
 bt - gre(X,y,D)

 I am getting following error:
 Error in crossprod(X, X) + D : non-conformable arrays

 But when  i define D within the function 'gre()' then everything is fine.
 What wrong i have done?

 thanks.
 --
 View this message in context:
 http://www.nabble.com/Error-due-to-non-conformable-arrays-tp24377781p24377781.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.


[R] how to read point shp file to R?

2009-07-07 Thread Sunny
I am new with R and want do some analysis with a point vector data file. Any
help is appreciate.  Sunny

[[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] object .trPaths not found

2009-07-07 Thread Knut Krueger

Uwe Ligges schrieb:



Maybe, but the may depend on your script, your OS, your R version, 
used packages and so on.


Hence please read and follow the posting guide and provide commented, 
minimal, self-contained, reproducible code.



Hi Uwe,
I was just asked the same question and hat the same problem before. It 
seem that it is a Tinn_R installation problem
. I do not now what I changed to get it working, but the single line (R 
send line) mode is working, the

R send selection and Rsend file mode not.

System Windows XP new installed TinnR File permissions should not a 
problem on windows systems. Maybe any file is set to read only?


The same srcipt which is working at home is not working at the new system.

Regards Knut

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Quantitative Risk Management by McNeil

2009-07-07 Thread spencerg
Dear Andriy: 



 1.  The help file for  fit.NH says the first argument  should be 
a vector of data.  Consider the following modification of the example 
on that help page: 



 rs - matrix(rseries, 10, 202, dimnames=list(letters[1:10], 1:202))
 rs. - fit.NH(rs)
Error: cannot allocate vector of size 238 Kb
In addition: Warning messages:
1: In sqrt(3/(variance * ekurt)) : NaNs produced
2: In optim(par = theta, fn = negloglik, gr = NULL, datavector = data,  :
 Reached total allocation of 3583Mb: see help(memory.size)
3: In optim(par = theta, fn = negloglik, gr = NULL, datavector = data,  :
 Reached total allocation of 3583Mb: see help(memory.size)


 2.  This suggests you try the following: 



fit.NH(as.numeric(Transpose), case=NIG, symmetric=FALSE, se=FALSE)


 3.  If this doesn't work, I suggest you look at str(Transpose):  
Is this character? 




 4.  If this does not solve your problem, have you tried emailing 
directly Scott Ulman scottul...@hotmail.com for  Alexander McNeil? 



 5.  You could make it easier for others to reply to a question 
like this by helping your readers find the fit.NH function.  I have 
not seen Quantitative Risk Management by McNeil, but it sounded 
interesting, so I looked at your question.  I found fit.NH as follows: 



library(RSiteSearch)
fitNH - RSiteSearch.function('fit.NH')
HTML(fitNH)


 This last line opened a web browser with links to 6 different help 
pages in the QRMlib package. 



 Hope this helps.   
 Spencer Graves



Andriy Fetsun wrote:

Dear Specialists in R,

May be somebody has experiment in using pakage for the book Quantitative
Risk Management by McNeil?

This package is writen in R.

I have run this package for fitting the data to Nornal Inverse Gaussian
distribution and fased with following problem.

  

Return-read.csv(data.csv)
Transpose-t(Return)
fit.NH(Transpose, case=NIG, symmetric=FALSE, se=FALSE)


Error: cannot allocate vector of size 57 Kb
In addition: Warning messages:
1: In var.default(data) :
  Reached total allocation of 222Mb: see help(memory.size)
2: In optim(par = theta, fn = negloglik, gr = NULL, datavector = data,  :
  Reached total allocation of 222Mb: see help(memory.size)
3: In optim(par = theta, fn = negloglik, gr = NULL, datavector = data,  :
  Reached total allocation of 222Mb: see help(memory.size)

In the attachment you can find the description of the function.

the link where I took this soft is
http://cran.r-project.org/web/packages/QRMlib/index.html

Thank you in advance!
  



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



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 count number of elements in a vector that are not NA ?

2009-07-07 Thread Godmar Back
Hi,

is there a simpler way to count the number of elements in a vector
that are not NA than this:

countN - function (v) {
return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1)))
}

?

 - Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 count number of elements in a vector that are not NA ?

2009-07-07 Thread Jorge Ivan Velez
Dear Godmar,
Yes. One way would be

sum( !is.na( yourvector ) )

HTH,

Jorge



On Tue, Jul 7, 2009 at 2:56 PM, Godmar Back god...@gmail.com wrote:

 Hi,

 is there a simpler way to count the number of elements in a vector
 that are not NA than this:

 countN - function (v) {
return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1)))
 }

 ?

  - Godmar

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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 count number of elements in a vector that are not NA ?

2009-07-07 Thread Henrique Dallazuanna
another option should be:

length(na.omit(v))

On Tue, Jul 7, 2009 at 3:56 PM, Godmar Back god...@gmail.com wrote:

 Hi,

 is there a simpler way to count the number of elements in a vector
 that are not NA than this:

 countN - function (v) {
return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1)))
 }

 ?

  - Godmar

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] Test for X=1 fails, test for 0 works, data in text file is 1

2009-07-07 Thread Mark Knecht
Hi,
   I am apparently not understanding some nuance about either the use
of subset or more likely my ability to test for a numerical match
using '='. Which is it? Thanks in advance.

   I've read a data file, reshaped it and then created MyResults by
keeping only lines where the value column is greater than 0. So far so
good. The data in MyResults looks good to me by eye.

   The problem comes in when I try to further subset MyResults into
two files, one with PosType=1 and the other with PosType=-1. Looking
at the dimension of the results there's no change. It didn't work
which is verified by eye. However if I test for PosType=1 by actually
testing for PosType0 then it does work.

   Is this the general case in R that if I've read data that was
written into a csv file as 1 - it is 1 if I look into the file with a
text editor - that I cannot test for that? Or is some case where I
need to use maybe as.numeric or something else first to ensure R sees
the number the way I'm thinking about the number?

Cheers,
Mark

 dim(X)
[1]  25 425

 ReShapeX - melt(X, id = c(Trade, PosType, EnDate, EnTime,  ExDate, 
  ExTime, PL_Pos, Costs, Save2))

 dim(ReShapeX)
[1] 1040011

 MyResults - subset(ReShapeX, value  0)

 dim(MyResults)
[1] 1105   11

 MyResults.GroupA - subset(MyResults, PosType = 1)

 dim(MyResults.GroupA)
[1] 1105   11

 MyResults.GroupB - subset(MyResults, PosType = -1)

 dim(MyResults.GroupB)
[1] 1105   11

 MyResults.GroupA - subset(MyResults, PosType  0)

 dim(MyResults.GroupA)
[1] 432  11

 MyResults.GroupB - subset(MyResults, PosType  0)

 dim(MyResults.GroupB)
[1] 673  11


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 count number of elements in a vector that are not NA ?

2009-07-07 Thread David Huffer
How about

countN - function ( v ) {
  sum ( !is.na ( v ) ) - sum ( is.na ( v ) )
} 

--
 David
 
 -
 David Huffer, Ph.D.   Senior Statistician
 CSOSA/Washington, DC   david.huf...@csosa.gov
 -

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Godmar Back
Sent: Tuesday, July 07, 2009 2:57 PM
To: R-help@r-project.org
Subject: [R] how to count number of elements in a vector that are not NA ?

Hi,

is there a simpler way to count the number of elements in a vector
that are not NA than this:

countN - function (v) {
return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1)))
}

?

 - Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Test for X=1 fails, test for 0 works, data in text file is 1

2009-07-07 Thread Henrique Dallazuanna
Try this:

MyResults.GroupA - subset(MyResults, PosType == 1)


On Tue, Jul 7, 2009 at 4:06 PM, Mark Knecht markkne...@gmail.com wrote:

 Hi,
   I am apparently not understanding some nuance about either the use
 of subset or more likely my ability to test for a numerical match
 using '='. Which is it? Thanks in advance.

   I've read a data file, reshaped it and then created MyResults by
 keeping only lines where the value column is greater than 0. So far so
 good. The data in MyResults looks good to me by eye.

   The problem comes in when I try to further subset MyResults into
 two files, one with PosType=1 and the other with PosType=-1. Looking
 at the dimension of the results there's no change. It didn't work
 which is verified by eye. However if I test for PosType=1 by actually
 testing for PosType0 then it does work.

   Is this the general case in R that if I've read data that was
 written into a csv file as 1 - it is 1 if I look into the file with a
 text editor - that I cannot test for that? Or is some case where I
 need to use maybe as.numeric or something else first to ensure R sees
 the number the way I'm thinking about the number?

 Cheers,
 Mark

  dim(X)
 [1]  25 425
 
  ReShapeX - melt(X, id = c(Trade, PosType, EnDate, EnTime,
  ExDate,  ExTime, PL_Pos, Costs, Save2))
 
  dim(ReShapeX)
 [1] 1040011
 
  MyResults - subset(ReShapeX, value  0)
 
  dim(MyResults)
 [1] 1105   11
 
  MyResults.GroupA - subset(MyResults, PosType = 1)
 
  dim(MyResults.GroupA)
 [1] 1105   11
 
  MyResults.GroupB - subset(MyResults, PosType = -1)
 
  dim(MyResults.GroupB)
 [1] 1105   11
 
  MyResults.GroupA - subset(MyResults, PosType  0)
 
  dim(MyResults.GroupA)
 [1] 432  11
 
  MyResults.GroupB - subset(MyResults, PosType  0)
 
  dim(MyResults.GroupB)
 [1] 673  11
 

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] Test for X=1 fails, test for 0 works, data in text file is 1

2009-07-07 Thread Jorge Ivan Velez
Hi Mark,
X = 1

assings the number 1 to X whereas

X == 1

test if X is equal to 1. I suspect you want to do this :-)   Here is an
example:

# R code
X = 1
X
# [1] 1

X == 1
# [1] TRUE


HTH,

Jorge


On Tue, Jul 7, 2009 at 3:06 PM, Mark Knecht markkne...@gmail.com wrote:

 Hi,
   I am apparently not understanding some nuance about either the use
 of subset or more likely my ability to test for a numerical match
 using '='. Which is it? Thanks in advance.

   I've read a data file, reshaped it and then created MyResults by
 keeping only lines where the value column is greater than 0. So far so
 good. The data in MyResults looks good to me by eye.

   The problem comes in when I try to further subset MyResults into
 two files, one with PosType=1 and the other with PosType=-1. Looking
 at the dimension of the results there's no change. It didn't work
 which is verified by eye. However if I test for PosType=1 by actually
 testing for PosType0 then it does work.

   Is this the general case in R that if I've read data that was
 written into a csv file as 1 - it is 1 if I look into the file with a
 text editor - that I cannot test for that? Or is some case where I
 need to use maybe as.numeric or something else first to ensure R sees
 the number the way I'm thinking about the number?

 Cheers,
 Mark

  dim(X)
 [1]  25 425
 
  ReShapeX - melt(X, id = c(Trade, PosType, EnDate, EnTime,
  ExDate,  ExTime, PL_Pos, Costs, Save2))
 
  dim(ReShapeX)
 [1] 1040011
 
  MyResults - subset(ReShapeX, value  0)
 
  dim(MyResults)
 [1] 1105   11
 
  MyResults.GroupA - subset(MyResults, PosType = 1)
 
  dim(MyResults.GroupA)
 [1] 1105   11
 
  MyResults.GroupB - subset(MyResults, PosType = -1)
 
  dim(MyResults.GroupB)
 [1] 1105   11
 
  MyResults.GroupA - subset(MyResults, PosType  0)
 
  dim(MyResults.GroupA)
 [1] 432  11
 
  MyResults.GroupB - subset(MyResults, PosType  0)
 
  dim(MyResults.GroupB)
 [1] 673  11
 

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Test for X=1 fails, test for 0 works, data in text file is 1

2009-07-07 Thread Duncan Murdoch

On 7/7/2009 3:06 PM, Mark Knecht wrote:

Hi,
   I am apparently not understanding some nuance about either the use
of subset or more likely my ability to test for a numerical match
using '='. Which is it? Thanks in advance.

   I've read a data file, reshaped it and then created MyResults by
keeping only lines where the value column is greater than 0. So far so
good. The data in MyResults looks good to me by eye.

   The problem comes in when I try to further subset MyResults into
two files, one with PosType=1 and the other with PosType=-1. Looking


PosType = 1 is an assignment.  The test is PosType == 1.

Duncan Murdoch


at the dimension of the results there's no change. It didn't work
which is verified by eye. However if I test for PosType=1 by actually
testing for PosType0 then it does work.

   Is this the general case in R that if I've read data that was
written into a csv file as 1 - it is 1 if I look into the file with a
text editor - that I cannot test for that? Or is some case where I
need to use maybe as.numeric or something else first to ensure R sees
the number the way I'm thinking about the number?

Cheers,
Mark


dim(X)

[1]  25 425


ReShapeX - melt(X, id = c(Trade, PosType, EnDate, EnTime,  ExDate,  ExTime, PL_Pos, 
Costs, Save2))

dim(ReShapeX)

[1] 1040011


MyResults - subset(ReShapeX, value  0)

dim(MyResults)

[1] 1105   11


MyResults.GroupA - subset(MyResults, PosType = 1)

dim(MyResults.GroupA)

[1] 1105   11


MyResults.GroupB - subset(MyResults, PosType = -1)

dim(MyResults.GroupB)

[1] 1105   11


MyResults.GroupA - subset(MyResults, PosType  0)

dim(MyResults.GroupA)

[1] 432  11


MyResults.GroupB - subset(MyResults, PosType  0)

dim(MyResults.GroupB)

[1] 673  11




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


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


Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread David Huffer
On Tuesday, July 07, 2009 3:20 PM, Godmar Back wrote:

  ...That would be wrong, wouldn't it, if  the
  other replies are correct

Yes. It was wrong. This isn't:

   countN - function ( v ) {
 length ( v ) - sum ( is.na ( v ) )
   }

But there are really tons of ways to do it. Even your way is not
wrong...

--
 David
 
 -
 David Huffer, Ph.D.   Senior Statistician
 CSOSA/Washington, DC   david.huf...@csosa.gov

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] find duplicates... need help!

2009-07-07 Thread njhuang86

Hi all,
Suppose I have x = c('a', 't', 'c', 'y', 'g')
and also y = c('a', 'a', 'g', 's')

If I do something like x%in%y, I obtain a vector like this: [TRUE, FALSE,
FALSE, FALSE, TRUE] which I can easily turn into this: [1, 0, 0, 0, 1].
I was wondering is there anyway for me to get a vector back in return in the
form of: [2, 0, 0, 0, 1]? Essentially, the 2 will tell me that in the first
position of vector 'x', there were two matches found with vector y.

Thanks a ton in advance!
-- 
View this message in context: 
http://www.nabble.com/find-duplicates...-need-help%21-tp24379828p24379828.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] Test for X=1 fails, test for 0 works, data in text file

2009-07-07 Thread Ted Harding
On 07-Jul-09 19:06:59, Mark Knecht wrote:
 Hi,
I am apparently not understanding some nuance about either the use
 of subset or more likely my ability to test for a numerical match
 using '='. Which is it? Thanks in advance.

It looks as though you have tripped over the distinction between =
and ==. The first is (in effect) an assignment operator (like -).
The second is a comparison operator: X==Y is TRUE if X equals Y.

So, for example, to select rows from MyResults according to your
criteria below, you could do something like:

  MyResultsNeg - MyResults[(MyResults$PosType==(-1)),]
  MyResultsPos - MyResults[(MyResults$PosType==1   ),]

[Note: the parentheses (...) are in fact logically superfluous,
but I like to use them (a) to make it absolutely clear, visually,
how things are being evaluated; (b) (not relevant in this particular
context) to avoid falling into traps like N - 10 ; X - 1:N-1
which results in X == (0:9) = (1:10) - 1. The correct syntax for
the latter would be X - 1:(N-1).]

Hoping this helps,
Ted.


I've read a data file, reshaped it and then created MyResults by
 keeping only lines where the value column is greater than 0. So far so
 good. The data in MyResults looks good to me by eye.
 
The problem comes in when I try to further subset MyResults into
 two files, one with PosType=1 and the other with PosType=-1. Looking
 at the dimension of the results there's no change. It didn't work
 which is verified by eye. However if I test for PosType=1 by actually
 testing for PosType0 then it does work.
 
Is this the general case in R that if I've read data that was
 written into a csv file as 1 - it is 1 if I look into the file with a
 text editor - that I cannot test for that? Or is some case where I
 need to use maybe as.numeric or something else first to ensure R sees
 the number the way I'm thinking about the number?
 
 Cheers,
 Mark
 
 dim(X)
 [1]  25 425

 ReShapeX - melt(X, id = c(Trade, PosType, EnDate, EnTime, 
 ExDate,  ExTime, PL_Pos, Costs, Save2))

 dim(ReShapeX)
 [1] 1040011

 MyResults - subset(ReShapeX, value  0)

 dim(MyResults)
 [1] 1105   11

 MyResults.GroupA - subset(MyResults, PosType = 1)

 dim(MyResults.GroupA)
 [1] 1105   11

 MyResults.GroupB - subset(MyResults, PosType = -1)

 dim(MyResults.GroupB)
 [1] 1105   11

 MyResults.GroupA - subset(MyResults, PosType  0)

 dim(MyResults.GroupA)
 [1] 432  11

 MyResults.GroupB - subset(MyResults, PosType  0)

 dim(MyResults.GroupB)
 [1] 673  11

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


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 07-Jul-09   Time: 20:28:44
-- XFMail --

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


Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Godmar Back
Thank you for the many replies! This is really a very friendly and
helpful community!

On Tue, Jul 7, 2009 at 3:06 PM, Henrique Dallazuannawww...@gmail.com wrote:
 another option should be:

 length(na.omit(v))


I think the above is what I was looking for since, presumably, it uses
the very same test as other methods that exploit na.*, such as
cor.test.

... so I tried it out and, of course, R's typing trips me over:

 length(na.omit(q[[51]]))
[1] 1

Why?  I think I know: q[[51]] is a data frame with 1 component, and
'length' applied to a data frame counts its components.  Not a
problem, I can do:

 length(na.omit(q[[51]][,1]))
[1] 110

or

 length(na.omit(q[[51]])[,1])
[1] 110

for this data frame of 1 components.

Do other functions act like length()?  Let's look at sum():

 sum(na.omit(q[[51]]))
[1] 132
 sum(na.omit(q[[51]][,1]))
[1] 132
 sum(na.omit(q[[51]])[,1])
[1] 132

Nope.

Easy to get wrong.  I buy the last two, but the first? I assume sum()
applied to a data frame reduces all its elements across all
components(?).  Letting the call sum(na.omit(q[[51]])) fail would
have been a sensible design decision too, IMO. One needs to be really
careful in R.

Thank you again,

 - Godmar

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Test for X=1 fails, test for 0 works, data in text file is 1

2009-07-07 Thread Mark Knecht
On Tue, Jul 7, 2009 at 12:17 PM, Henrique Dallazuannawww...@gmail.com wrote:
 Try this:

 MyResults.GroupA - subset(MyResults, PosType == 1)


SNIP

Darn those small screen fonts. I never noticed that! Every example I'm
looking at jsut looks like a single '=' until you pointed it out!

Thanks to everyone who responded.

Cheers,
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] find duplicates... need help!

2009-07-07 Thread Jorge Ivan Velez
Dear njhuang86,
Here is one way:

x - c('a', 't', 'c', 'y', 'g')
y - c('a', 'a', 'g', 's')
table(factor(y, levels = x))
# a t c y g
# 2 0 0 0 1

HTH,

Jorge


On Tue, Jul 7, 2009 at 3:28 PM, njhuang86 njhuan...@yahoo.com wrote:


 Hi all,
 Suppose I have x = c('a', 't', 'c', 'y', 'g')
 and also y = c('a', 'a', 'g', 's')

 If I do something like x%in%y, I obtain a vector like this: [TRUE, FALSE,
 FALSE, FALSE, TRUE] which I can easily turn into this: [1, 0, 0, 0, 1].
 I was wondering is there anyway for me to get a vector back in return in
 the
 form of: [2, 0, 0, 0, 1]? Essentially, the 2 will tell me that in the first
 position of vector 'x', there were two matches found with vector y.

 Thanks a ton in advance!
 --
 View this message in context:
 http://www.nabble.com/find-duplicates...-need-help%21-tp24379828p24379828.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.


[R] vectorizing a function

2009-07-07 Thread Steve Jaffe

I'm sure I'm missing something obvious but I'm not seeing how to simply
vectorize a function of two or more variables.

Say I have
f - function(x,y) if (x0) y else -y

Now I have vectors x and y of equal length and I'd like to apply f
element-wise. I.e. conceptually
 z - f(x,y) where x, y, z are vectors of the same length

Some magic involving apply? 

Thanks
-- 
View this message in context: 
http://www.nabble.com/vectorizing-a-function-tp24380064p24380064.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] vectorizing a function (NEVERMIND)

2009-07-07 Thread Steve Jaffe

Nevermind, indeed it is obvious: Vectorize ! 


Steve Jaffe wrote:
 
 I'm sure I'm missing something obvious but I'm not seeing how to simply
 vectorize a function of two or more variables.
 

-- 
View this message in context: 
http://www.nabble.com/vectorizing-a-function-tp24380064p24380136.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] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Zhiliang Ma
how about sum(!is.na(x)) ?

On Tue, Jul 7, 2009 at 2:56 PM, Godmar Backgod...@gmail.com wrote:
 Hi,

 is there a simpler way to count the number of elements in a vector
 that are not NA than this:

 countN - function (v) {
    return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1)))
 }

 ?

  - Godmar

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] vectorizing a function

2009-07-07 Thread Greg Snow
For this case it is quite simple, see ?ifelse

 z - ifelse( x  0, y, -y )

Hope this helps,

-- 
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 Steve Jaffe
 Sent: Tuesday, July 07, 2009 1:42 PM
 To: r-help@r-project.org
 Subject: [R] vectorizing a function
 
 
 I'm sure I'm missing something obvious but I'm not seeing how to simply
 vectorize a function of two or more variables.
 
 Say I have
 f - function(x,y) if (x0) y else -y
 
 Now I have vectors x and y of equal length and I'd like to apply f
 element-wise. I.e. conceptually
  z - f(x,y) where x, y, z are vectors of the same length
 
 Some magic involving apply?
 
 Thanks
 --
 View this message in context: http://www.nabble.com/vectorizing-a-
 function-tp24380064p24380064.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] vectorizing a function

2009-07-07 Thread Bert Gunter
?ifelse

Bert Gunter
Genentech Nonclinical Biostatistics

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Steve Jaffe
Sent: Tuesday, July 07, 2009 12:42 PM
To: r-help@r-project.org
Subject: [R] vectorizing a function


I'm sure I'm missing something obvious but I'm not seeing how to simply
vectorize a function of two or more variables.

Say I have
f - function(x,y) if (x0) y else -y

Now I have vectors x and y of equal length and I'd like to apply f
element-wise. I.e. conceptually
 z - f(x,y) where x, y, z are vectors of the same length

Some magic involving apply? 

Thanks
-- 
View this message in context:
http://www.nabble.com/vectorizing-a-function-tp24380064p24380064.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] Solving quadratic equations with covariance term

2009-07-07 Thread Giovanni Petris

It is not clear to me whether you are talking about a covariance (a
theoretical quantity depending on the distribution of A and x) or an
empirical covariance, estimated from some data. 

In the first case you don't need to solve anything because, as long as
A is fixed, i.e. non-random, its covariance with anything else is
zero.

Best,
Giovanni

 Date: Tue, 07 Jul 2009 09:37:53 +0200
 From: Stein, Luba (AIM SE) luba.st...@allianz.com
 Sender: r-help-boun...@r-project.org
 Cc: R-help@r-project.org R-help@r-project.org
 Accept-Language: en-US, de-DE
 Precedence: list
 Thread-topic: [R] Solving quadratic equations with covariance term
 Thread-index: Acn+fxCBg0P+0HykRKGeDofFN9YatQAVYRSw
 acceptlanguage: en-US, de-DE
 
 Hi,
 
 more precisely I consider a matrix with three column vectors a_i (i=1,2,3), 
 i.e. A=(a_1,a_2,a_3). On the other hand x should take vectors as values, i.e. 
 x=v_j, while j goes also from 1 till 3.
 Now I just want to calculate the equation Cov(a_i,x_j) = 0, where 
 Cov(a_i,x_j) is the covariance matrix.
 A is a given value and x is the variable I am looking for. 
 
 In my opinion this is an quadratic equation and makes sense.
 
 Best wishes,
 Luba
 
 
 
 
 
 -Urspr?ngliche Nachricht-
 Von: Rolf Turner [mailto:r.tur...@auckland.ac.nz] 
 Gesendet: Montag, 6. Juli 2009 23:16
 An: Stein, Luba (AIM SE)
 Cc: R-help@r-project.org
 Betreff: Re: [R] Solving quadratic equations with covariance term
 
 
 On 7/07/2009, at 2:15 AM, Stein, Luba (AIM SE) wrote:
 
  Hi,
 
  I would like to solve the following equation with R: Cov(A,x)=0.
  A is a given matrix, x is the an unknown vector.
 
  Is there any nice solution for this?
 
 What on earth do you mean by ``Cov(A,x)''?  This makes no sense
 at all.
 
   cheers,
 
   Rolf Turner
 
 ##
 Attention: 
 This e-mail message is privileged and confidential. If you are not the 
 intended recipient please delete the message and notify the sender. 
 Any views or opinions presented are solely those of the author.
 
 This e-mail has been scanned and cleared by MailMarshal 
 www.marshalsoftware.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] Test for X=1 fails, test for 0 works, data in text file is 1

2009-07-07 Thread William Dunlap
subset(), like many R methods, has an argument list that
ends with '...', meaning that it will not tell you that an argument
you gave it by name= is not in the official list of arument names.
If the ... were not there then you would have gotten an error
message.  E.g., the following makes a version of subset.data.frame
without the ... argument:

 sb-subset.data.frame
 formals(sb) - formals(sb)[1:4]
 data(cars)
 sb(cars, speed==19)
   speed dist
3619   36
3719   46
3819   68
 sb(cars, speed=19)
Error in sb(cars, speed = 19) : unused argument(s) (speed = 19)

subset(cars, speed=19) silently ignores the argument you 
named speed and returns the entire cars dataset.

I think that it is unfortunate that the method system requires
these ... arguments, as it leads users to waste time tracking down
typing errors that would otherwise be flagged.

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com  

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Knecht
 Sent: Tuesday, July 07, 2009 12:39 PM
 To: Henrique Dallazuanna
 Cc: r-help
 Subject: Re: [R] Test for X=1 fails, test for 0 works,data 
 in text file is 1
 
 On Tue, Jul 7, 2009 at 12:17 PM, Henrique 
 Dallazuannawww...@gmail.com wrote:
  Try this:
 
  MyResults.GroupA - subset(MyResults, PosType == 1)
 
 
 SNIP
 
 Darn those small screen fonts. I never noticed that! Every example I'm
 looking at jsut looks like a single '=' until you pointed it out!
 
 Thanks to everyone who responded.
 
 Cheers,
 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.
 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Uncorrelated random vectors

2009-07-07 Thread Giovanni Petris

Here is one way:

 x - rnorm(100)
 y - rnorm(100)
 z - residuals(lm(y ~ x))
 cor(x, z)
[1] 3.610290e-17

Best,
Giovanni

 Date: Tue, 07 Jul 2009 16:26:02 +0200
 From: Stein, Luba (AIM SE) luba.st...@allianz.com
 Sender: r-help-boun...@r-project.org
 Accept-Language: en-US, de-DE
 Precedence: list
 Thread-topic: [R] Uncorrelated random vectors
 Thread-index: Acn/CUJmE2gw3SggRTqBPK7cXE4i5QAAMBVwAAE0SfA=
 acceptlanguage: en-US, de-DE
 
 Thank you for your help!
 But is it possible to produe two vectors x and y with a given length such 
 that there correlation is zero.
 
 For me ist not enough just to simulate two vectors with there correlation.
 
 Thank you,
 Luba 
 
 
 
 
 -Urspr?ngliche Nachricht-
 Von: ONKELINX, Thierry [mailto:thierry.onkel...@inbo.be] 
 Gesendet: Dienstag, 7. Juli 2009 15:51
 An: Stein, Luba (AIM SE); r-help@r-project.org
 Betreff: RE: [R] Uncorrelated random vectors
 
 cor.test(rnorm(1), rnorm(1)) 
 
 
 
 
 ir. Thierry Onkelinx
 Instituut voor natuur- en bosonderzoek / Research Institute for Nature
 and Forest
 Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
 methodology and 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 Stein, Luba (AIM SE)
 Verzonden: dinsdag 7 juli 2009 15:46
 Aan: r-help@r-project.org
 Onderwerp: [R] Uncorrelated random vectors
 
 Hello,
 
 is it possible to create two uncorrelated random vectors for a given
 distribution.
 
 In fact, I would like to have something like the function rnorm or
 rlogis with the extra property that they are uncorrelated.
 
 Thanks for your help,
 Luba
 
 
 
 
   [[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.
 
 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.
 


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] building 2.0.6 on Win32/Py2.5

2009-07-07 Thread Chuck White
After I posted the previous message, I repeated the process on a windows 
machine with Python 2.6 and still get the same error.

I would appreciate any help.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dump plots to powerpoint?

2009-07-07 Thread Thomas
Hi,

Is it possible to dump a series of plots directly into a powerpoint 
presentation (as is possible in Splus)?

Thank you,
Thomas



  
[[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] subscripted assignment of grid units

2009-07-07 Thread Paul Murrell

Hi

You have encountered the fact that, while there are [ methods for grid 
unit objects, there are NOT any [- methods for grid unit objects.


I guess that needs to go (back) onto my todo list.

A workaround for your simple example is ...

unit.c(testUnits[1:2], testUnit2, testUnits[4:5])

... though I can imagine that getting pretty tedious in more complex cases.

Paul


pbarros wrote:

Hi,

I want to do subscripted assignment of grid units, but I cannot find a
straightforward way of doing it (and I have searched all forums and places I
could think about, including Paul Murrell,s page). The usual subscripted
assignment operator does replace the numeric part, but does not update the
attributes. Before I write my own function, manipulating attributes etc I
would like to know if such a function already exists (I am sure it does).
What I want to do can be reflected as in the code below:

 testUnit - unit(1, lines)

testUnit

[1] 1lines

testUnits - rep(testUnit, 5)
testUnits

[1] 1lines 1lines 1lines 1lines 1lines

testUnit2 - unit(0.5, grobwidth, textGrob(Testing))
testUnits[3] - testUnit2
testUnits

[1] 1lines   1lines   0.5lines 1lines   1lines

I would like to obtain
[1] 1lines   1lines   0.5grobwidth 1lines   1lines

Any tips?

Thanks,
Pedro
--
View this message in context: 
http://www.nabble.com/subscripted-assignment-of-grid-units-tp24371172p24371172.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.


--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Numbering sequences of non-NAs in a vector

2009-07-07 Thread Krishna Tateneni
Greetings, I have a vector of the form:
[10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9...]  That is, a combination
of sequences of non-missing values and missing values, with each sequence
possibly of a different length.

I'd like to create another vector which will help me pick out the sequences
of non-missing values.  For the example above, this would be:
[1,1,1,1,1,1,NA,NA,NA,NA,2,2,2,NA,NA,NA,3,3,3,3...].  The goal ultimately is
to calculate means separately for each sequence.

Your help is appreciated.  If I'm making this more complicated than
necessary, I'd appreciate knowing that as well!

Many thanks.

[[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] object .trPaths not found

2009-07-07 Thread Uwe Ligges
I have to admit that I have no idea what we are talking about here (yes, 
I tend to forget many things these days) - and you have not cited the 
original message, unfortunately (nor have you specifies R versions, 
Tinn-R versions and both OS versions, but just one) ...


Best wishes,
Uwe




Knut Krueger wrote:

Uwe Ligges schrieb:



Maybe, but the may depend on your script, your OS, your R version, 
used packages and so on.


Hence please read and follow the posting guide and provide commented, 
minimal, self-contained, reproducible code.



Hi Uwe,
I was just asked the same question and hat the same problem before. It 
seem that it is a Tinn_R installation problem
. I do not now what I changed to get it working, but the single line (R 
send line) mode is working, the

R send selection and Rsend file mode not.

System Windows XP new installed TinnR File permissions should not a 
problem on windows systems. Maybe any file is set to read only?


The same srcipt which is working at home is not working at the new system.

Regards Knut

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dump plots to powerpoint?

2009-07-07 Thread Mark Wardle
I generate PDF images and then rasterise using imagemagick to large,
high quality JPG files. Then manually insert into powerpoint. Former
two can definitely be automated, I'm sure the latter insertion could
be automated with judicious use of scripting if really necessary.

2009/7/7 Thomas aikto...@yahoo.com:
 Hi,

 Is it possible to dump a series of plots directly into a powerpoint 
 presentation (as is possible in Splus)?

 Thank you,
 Thomas




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





-- 
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK

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


Re: [R] building 2.0.6 on Win32/Py2.5

2009-07-07 Thread Uwe Ligges
Which previous message? Should we all look up the archives now? Please 
cite and stay within the same thread.


Thank you,
Uwe LIgges





Chuck White wrote:

After I posted the previous message, I repeated the process on a windows 
machine with Python 2.6 and still get the same error.

I would appreciate any help.

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


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


Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Giovanni Petris

sum(!is.na(x))

 Date: Tue, 07 Jul 2009 14:56:54 -0400
 From: Godmar Back god...@gmail.com
 Sender: r-help-boun...@r-project.org
 Precedence: list
 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
 
 Hi,
 
 is there a simpler way to count the number of elements in a vector
 that are not NA than this:
 
 countN - function (v) {
 return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1)))
 }
 
 ?
 
  - Godmar
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] ReShape to create Time from Observations?

2009-07-07 Thread Mark Knecht
Here is a couple of very simple data.frames:

X-data.frame(A=1:10, B=0, C=1, Ob1=1:10, Ob2=2:11, Ob3=3:12,
Ob4=4:13, Ob5=3:12, Ob6=2:11)
Y-data.frame(A=1:20, B=0, C=1, D=5, Ob1=1:10, Ob2=2:11, Ob3=3:12,
Ob4=4:13, Ob5=3:12, Ob6=2:11, Ob7=5:9)
Z-data.frame(A=1:30, B=0, C=1, D=6, E=1:2, Ob1=1:10, Ob2=2:11,
Ob3=3:12, Ob4=4:13, Ob5=3:12, Ob6=2:11, Ob7=1:10, Ob8=3:12)

Each row in the data.frame is a unique experiment. The fields Ob1:Ob6
(in the case of the first data.frame) represent observations taken at
fixed intervals for specific that experiment. (Observation 1,
Observation2, etc.) IMPORTANT - Different data files have different
numbers of both experiments and observations as well as different
observation rates. Some data.frames might have 50
observations/experiment at 10 minute intervals (a work day) while
others might have 2000 observations/experiment at daily intervals
representing years of data. The number of columns preceding OB1 varies
from file to file but once I get to Ob1 I have set it up so that the
names to the right are consecutive to the end of the row, so 2000
observations will have names Ob1:Ob2000.

How could I use ReShape to create a generic new data.frame where all
of the ObX columns become 'time' for the experiments in that
data.frame? I.e. - Ob1:ObX become s single variable called time
incrementing from 1:X.

The generic answer cannot use any numbers like 1:3 or 4:12 because
every file is different. I think I need to discover the dimensions of
the data.frames and locations of Ob1 as well as the name of the last
column, etc., to construct the right fields. We could (if it's legal
in R) say things like Ob1:Ob11 but it doesn't seem legal. I do see I
can say things like names(X[4]) to discover Ob1, and cute things like
names(X[dim(X)[2]]) to get the last name, etc., but I cannot put it
together how to use this to drive ReShape into making all the
Observations into a single variable called time.

I hope this is clear.

Thanks,
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] Numbering sequences of non-NAs in a vector

2009-07-07 Thread Jorge Ivan Velez
Dear Krishna,
Here is one way. It is not very elegant, but seems to work:

# x is the vector you want to change
foo - function(x){
   R1 - rle(!is.na(x))
   R2 - rle(is.na(x))
   len - R1$lengths[!R2$values]
   x[!is.na(x)] - rep(1:length(len), len)
   x
  }

# Example
x - c(10, 8, 1, 3, 0, 8, NA, NA, NA, NA, 2, 1, 6, NA, NA, NA, 0, 5, 1, 9)
foo(x)
# [1]  1  1  1  1  1  1 NA NA NA NA  2  2  2 NA NA NA  3  3  3  3

HTH,

Jorge


On Tue, Jul 7, 2009 at 5:08 PM, Krishna Tateneni taten...@gmail.com wrote:

 Greetings, I have a vector of the form:
 [10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9...]  That is, a
 combination
 of sequences of non-missing values and missing values, with each sequence
 possibly of a different length.

 I'd like to create another vector which will help me pick out the sequences
 of non-missing values.  For the example above, this would be:
 [1,1,1,1,1,1,NA,NA,NA,NA,2,2,2,NA,NA,NA,3,3,3,3...].  The goal ultimately
 is
 to calculate means separately for each sequence.

 Your help is appreciated.  If I'm making this more complicated than
 necessary, I'd appreciate knowing that as well!

 Many thanks.

[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


[R] R2WinBUGS under Linux/WINE fails

2009-07-07 Thread Harlan Harris
Hi,

I'm running wine-1.0.1, OpenBUGS 3.0.3, R 2.9.0, and R2WinBUGS on a Redhat
Enterprise Linux machine.

Following various peoples' suggestions...

This works perfectly (yay!): wine Z:/opt/OpenBUGS/winbugs.exe

Within R, however, I get this:

(setup the example from ?bugs, then)

R schools.sim - bugs(data, inits, parameters, model.file, n.chains=3,
n.iter=5000,bugs.directory=Z:/opt/OpenBUGS/)
Error in file(con, rb) : cannot open the connection
In addition: Warning message:
In file(con, rb) :
  cannot open file
'/home/harlan/.wine/dosdevices/z:/opt/OpenBUGS//System/Rsrc/Registry.odc':
No such file or directory
Error in bugs.run(n.burnin, bugs.directory, WINE = WINE, useWINE = useWINE,
:
  WinBUGS executable does not exist in
/home/harlan/.wine/dosdevices/z:/opt/OpenBUGS/

Trying to figure out these path issues:

 ls /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS/
BackBUGS.lnk CompareDocu  Graph Lindev
OleRandnumseeds.odc  Std  Updater
brugs.dllCorrel DoodleHost  Manuals
OpenBUGS.zip   Ranks Summary  Win
brugs.so DevExamples  Html  Maps
Plots  Samples   System   winbugs.exe
Bugs Developer  Form  libtaucs.dll  Math
randnumseeds0.bmp  Script.odcTest Xhtml
classicbugs.exe  Deviance   GeoBUGS   Lin   Monitors
Randnumseeds.html  Spatial   Text

 ls /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS//System/Rsrc/Registry.odc
ls: /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS//System/Rsrc/Registry.odc:
No such file or directory

So, the warning message is correct, but the error is not. winbugs.exe
clearly exists, and I'd expect bugs.run to find it...

If I add program=openbugs, then I get the warning to install BRugs,
which no longer exists. (But it's not clear if that's necessary.)

Is it possible to make this work?

If not, I'm extremely thankful that I can use Bugs under Wine, but I'd
really prefer to use the R interface if possible!

Thank you for any guidance!

 -Harlan

[[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] Numbering sequences of non-NAs in a vector

2009-07-07 Thread Stavros Macrakis
Here's one possibility:

vv - c(10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9)
 (1+cumsum(diff(is.na(c(vv[1],vv)))==1)) * !is.na(vv)
 [1] 1 1 1 1 1 1 0 0 0 0 2 2 2 0 0 0 3 3 3 3



On Tue, Jul 7, 2009 at 5:08 PM, Krishna Tateneni taten...@gmail.com wrote:

 Greetings, I have a vector of the form:
 [10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9...]  That is, a
 combination
 of sequences of non-missing values and missing values, with each sequence
 possibly of a different length.

 I'd like to create another vector which will help me pick out the sequences
 of non-missing values.  For the example above, this would be:
 [1,1,1,1,1,1,NA,NA,NA,NA,2,2,2,NA,NA,NA,3,3,3,3...].  The goal ultimately
 is
 to calculate means separately for each sequence.

 Your help is appreciated.  If I'm making this more complicated than
 necessary, I'd appreciate knowing that as well!

 Many thanks.

[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


Re: [R] Numbering sequences of non-NAs in a vector

2009-07-07 Thread Marc Schwartz


On Jul 7, 2009, at 4:08 PM, Krishna Tateneni wrote:


Greetings, I have a vector of the form:
[10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9...]  That is, a  
combination
of sequences of non-missing values and missing values, with each  
sequence

possibly of a different length.

I'd like to create another vector which will help me pick out the  
sequences

of non-missing values.  For the example above, this would be:
[1,1,1,1,1,1,NA,NA,NA,NA,2,2,2,NA,NA,NA,3,3,3,3...].  The goal  
ultimately is

to calculate means separately for each sequence.

Your help is appreciated.  If I'm making this more complicated than
necessary, I'd appreciate knowing that as well!

Many thanks.


Here is one possibility:

Vec - c(10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9)

 Vec
 [1] 10  8  1  3  0  8 NA NA NA NA  2  1  6 NA NA NA  0  5  1  9


Use rle() to get the runs of NA and non-NA values. See ?rle

Runs - rle(is.na(Vec))

 Runs
Run Length Encoding
  lengths: int [1:5] 6 4 3 3 4
  values : logi [1:5] FALSE TRUE FALSE TRUE FALSE


Create grouping values for each run:

Grps - rep(seq(length(Runs$lengths)), Runs$lengths)

 Grps
 [1] 1 1 1 1 1 1 2 2 2 2 3 3 3 4 4 4 5 5 5 5


Now get the means for each run, split by Grps. See ?aggregate

 aggregate(Vec, list(Grps = Grps), mean)
  Grpsx
11 5.00
22   NA
33 3.00
44   NA
55 3.75


If you don't want the NA runs included in the result, you could use  
subset():


 subset(aggregate(Vec, list(Grps = Grps), mean), !is.na(x))
  Grpsx
11 5.00
33 3.00
55 3.75


HTH,

Marc Schwartz

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


[R] r-project.org address blacklisted by anti-spam software

2009-07-07 Thread Hans W Borchers
Dear List:

An e-mail mentioning the r-project.org address and sent to a friend at a German
university was considered spam by the local spam filter.

Its reasoning: the URL r-project.org is blacklisted at uribl.swinog.ch resp.
at antispam.imp.ch. I checked the list

http://antispam.imp.ch/swinog-uri-rbl.txt  [caution: long list]

and indeed, there it was. Can anybody explain how or why the R project made its
way onto the list? Is it reasonable to file a protest?

--Hans Werner

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] wordStem problems in R 2.9, Fedora 11; Linux Kernel 2.6.29.5-191.fc11.i586

2009-07-07 Thread Reitsma, Rene - COB
Dear All,

I just updated from Fedora 9 to Fedora 11, kernel version
2.6.29.5-191.fc11.i586. I'm running R 2.9.

I successfully installed package Rstem from source (it always ran fine
for me in F9). However:

 wordStem(c(This,is,a,test))
Error in wordStem(c(This, is, a, test)) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'character'

Any idea what causes this / how I can fix this?

RR

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Question in using e1071 svm routine

2009-07-07 Thread Michael
Hi all,

I've got the following error message in using e1071 svm routine...

Could anybody please help me?

Thank you!

-
model - svm(y=factor(mytraindata[, 1]), x=mytraindata[, -1], probability=T)
Error in if (any(co)) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In FUN(newX[, i], ...) : NAs introduced by coercion

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


Re: [R] building 2.0.6 on Win32/Py2.5

2009-07-07 Thread Chuck White
My sincere apologies. This message was intended for the rpy2 mailing list.

Thanks.

 Uwe Ligges lig...@statistik.tu-dortmund.de wrote: 
 Which previous message? Should we all look up the archives now? Please 
 cite and stay within the same thread.
 
 Thank you,
 Uwe LIgges
 
 
 
 
 
 Chuck White wrote:
  After I posted the previous message, I repeated the process on a windows 
  machine with Python 2.6 and still get the same error.
  
  I would appreciate any help.
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/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] odfWeave: odt-file damaged

2009-07-07 Thread ukoenig

Hi,
I think, I can answer my own posting. I found out, that the directory  
structure

of the ODT-file created by odfWeave causes the error message.

The file structure of the unzipped odt-file looks like this:

DIR Pictures
  content_1-Boxplot.png
content.xml
current.xml
manifest.xml
meta.xml
mimetype
settings.xml
styles.xml
thumbnail.png


But it should look like this:

DIR META-INF
  manifest.xml
DIR Thumbnails
  thumbnail.png
DIR Pictures
  content_1-Boxplot.png
meta.xml
mimetype
settings.xml
styles.xml
content.xml

Now I know. what causes the message odt file damaged,
but I don´t know a solution. Does anyone do so?

Thanks, Udo





Dear all,
I am doing my first steps with odfWeave.

After running the r code (see below), I am trying to open the ODF-document
with open office, but I am getting the error message:

The file is damaged, but it can be repaired. If I confirm the question and
repair the file with open office, I can open it with the desired output,
which seems to be fine.

My system:
R Version 2.9.1
Open Office 3.0.1
7-Zip 4.65
Windows XP

Using zip (http://www.info-zip.org/, zip232xN.zip) had the same result.

What causes the error message?  Is the structure of the ODF document
as it should be (for the structure please have a look at the bottom of
this mail)?

I'd greatly appreciate any help.


Udo K o e n i g

Clinic for Child and Adolescent Psychiatry
Philipps University of Marburg, Germany


###
#R code
library(odfWeave)

#odfWeave call
odfWeave(c:/temp/odfWeave-test.odt, c:/temp/odfWeave-test-out.odt,
  control=odfWeaveControl(zipCmd = c(7z a -tzip $$file$$ .,
  7z e -tzip $$file$$)))

###
# Contents of my Open office document

Initiate, results = hide, echo= FALSE=
#First steps with odfWeave
attach(iris)
@

There are \Sexpr{length(iris[, 1])} observations.

Table, echo=FALSE, results= xml=
odfTable(iris[1:5,])
@

Table2, echo=FALSE, results= xml=
tab - round(apply(iris[, 1:4], 2, mean), 2)
odfTable(tab, horizontal= TRUE)
@

Boxplot, echo=FALSE, fig=TRUE=
boxplot(Sepal.Length~Species)
@

###
#Log


odfWeave(c:/temp/odfWeave-test.odt, c:/temp/odfWeave-test-out.odt,

+  control=odfWeaveControl(zipCmd = c(7z a -tzip $$file$$ .,
+  7z e -tzip $$file$$)))
   Copying  c:/temp/odfWeave-test.odt
   Setting wd to
C:\DOCUME~1\Udo_2\LOCALS~1\Temp\Rtmp6QrXgk/odfWeave05190748330
   Unzipping ODF file using 7z e -tzip odfWeave-test.odt

7-Zip 4.65  Copyright (c) 1999-2009 Igor Pavlov  2009-02-03

Processing archive: odfWeave-test.odt

Extracting  mimetype
Extracting  Configurations2\statusbar
Extracting  Configurations2\accelerator\current.xml
Extracting  Configurations2\floater
Extracting  Configurations2\popupmenu
Extracting  Configurations2\progressbar
Extracting  Configurations2\menubar
Extracting  Configurations2\toolbar
Extracting  Configurations2\images\Bitmaps
Extracting  content.xml
Extracting  styles.xml
Extracting  meta.xml
Extracting  Thumbnails\thumbnail.png
Extracting  settings.xml
Extracting  META-INF\manifest.xml

Everything is Ok

Folders: 7
Files: 8
Size:   28518
Compressed: 8768

   Removing  odfWeave-test.odt
   Creating a Pictures directory

   Pre-processing the contents
   Sweaving  content.Rnw

   Writing to file content_1.xml
   Processing code chunks ...
 1 : term hide(label=Initiate)
 2 : term xml(label=Table)
 3 : term xml(label=Table2)
 4 : term verbatim(label=Boxplot)

   'content_1.xml' has been Sweaved

   Removing content.xml

   Post-processing the contents
   Removing content.Rnw
   Removing styles.xml
   Renaming styles_2.xml to styles.xml
   Removing extra files

   Packaging file using 7z a -tzip odfWeave-test.odt .

7-Zip 4.65  Copyright (c) 1999-2009 Igor Pavlov  2009-02-03
Scanning

Creating archive odfWeave-test.odt

Compressing  content.xml
Compressing  current.xml
Compressing  manifest.xml
Compressing  meta.xml
Compressing  mimetype
Compressing  Pictures\content_1-Boxplot.png
Compressing  settings.xml
Compressing  styles.xml
Compressing  thumbnail.png

Everything is Ok
   Copying  odfWeave-test.odt
   Resetting wd
   Removing  C:\DOCUME~1\Udo_2\LOCALS~1\Temp\Rtmp6QrXgk/odfWeave05190748330

   Done

###
#Structure of the unzipped odf-document that produced the error message

05.07.2009  11:43DIR  Bitmaps
05.07.2009  19:0713.820 content.xml
05.07.2009  11:43 0 current.xml
05.07.2009  11:43DIR  floater
05.07.2009  11:43 1.889 manifest.xml
05.07.2009  11:43DIR  menubar
05.07.2009  11:43   968 meta.xml
05.07.2009  11:4339 mimetype
05.07.2009  22:18DIR  Pictures
05.07.2009  11:43DIR  

Re: [R] r-project.org address blacklisted by anti-spam software

2009-07-07 Thread Duncan Murdoch

On 07/07/2009 5:59 PM, Hans W Borchers wrote:

Dear List:

An e-mail mentioning the r-project.org address and sent to a friend at a German
university was considered spam by the local spam filter.

Its reasoning: the URL r-project.org is blacklisted at uribl.swinog.ch resp.
at antispam.imp.ch. I checked the list

http://antispam.imp.ch/swinog-uri-rbl.txt  [caution: long list]

and indeed, there it was. Can anybody explain how or why the R project made its
way onto the list? Is it reasonable to file a protest?


Presumably you should be asking those questions to someone at the 
antispam site, or at the university you can't send email to.


Duncan Murdoch

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


[R] Tex fonts in R plots

2009-07-07 Thread KARAVASILIS GEORGE

Hello, R users.
I would like to display the font of Math Mode of MikTex 2.3, WinEdt 5.4 
in R plots, e.g. in xlab, ylab or legend.

How can I do that?
Thank you in advance.

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


  1   2   >