Re: [R] newton method

2009-03-24 Thread Yihui Xie
I'm not sure what you meant by a topic on newton's method
(algorithm? demo?), but the demonstration in the package 'animation'
might help:

install.packages('animation')
par(pch = 20)
ani.options(nmax = 50)
newton.method(function(x) 5 * x^3 - 7 * x^2 - 40 *
x + 100, 7.15, c(-6.2, 7.1))

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Mon, Mar 23, 2009 at 11:15 AM, Roslina Zakaria zrosl...@yahoo.com wrote:

 Hi R-users,

 Does R has a topic on newton's method?

 Thank you for the info.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Legend containing maths symbol and values of variables

2009-03-24 Thread Daren Tan
I tried sprintf and paste, which solves one of my problem i.e.
replacing the variable name by its value. However, = is not renderend
correctly as the inequality symbol.

On Tue, Mar 24, 2009 at 12:24 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 For the legend argument try this:

 leg = as.expression(c(sprintf(Up (= %d), threshold),
        Normal, Down, NA))

 or use paste in place of sprintf.

 On Mon, Mar 23, 2009 at 11:53 PM, Daren Tan darenta...@gmail.com wrote:
 I need to have the maths symbol for = in the legend, and to
 substitute threshold variable with its value. Somehow, various
 attempts weren't successful. Please help.

 threshold - 0.5

 plot(NA, xlab=, ylab=, main=, axes=F, xlim=c(0,1), ylim=c(0,1),
 xaxs=i, yaxs=i)
 legend(x=0, y=1, fill=c(orange, white, green, gray90),
 cex=0.8, pt.cex=1.8, x.intersp=0.6, bg = white,
           legend=c(expression(Up ( = threshold )), Normal,
 Down, NA), bty = n)

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Calculating percentage Missing value for variables using one object

2009-03-24 Thread Shreyasee
Hi,

I have a dataset in which there are in all 250 variables and for each
variable the data is entered over the months.
I need to calculate the percentage of missing values for each variable over
each month and then plot a graph for that.
I am running the following code for doing the same

*ds - read.csv(file=filepath, header=TRUE)
attach(ds)
may - length(variable1[variable1==]) / length(dos[dos==May-06]) * 100
jun - length(variable1[variable1==]) / length(dos[dos==June-06]) * 100
.
.
.
var1 - c(may, jun, ...)
x - seq(as.Date(2006-01-01), as.Date(2007-03-31), by=months)
plot(var1~x)*

So likewise I am calculating the percentage of missing values for each
variable for each month using different variables and storing the values in
those variables and then combining those variables in one object for
plotting the graph.
I need to know, whether can I combine all the variables from that dataset in
one object and calculate the missing values percentage over months together,
instead of creating different variables for each month and then combining
them.
Also, after doing that, I need to plot the graph for each variable and
combine it in a single pdf file.

I highly appreciate all your help.

Thanks,
Shreyasee

[[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] Barplot With Selected X-Axis Region

2009-03-24 Thread Gundala Viswanath
Dear all,

I have a data that looks like this:

 print(dat)
 V1   V2
1 -43342073   14
2 -433377304
3 -432846761

11372  75188572   11
11373  752061656
11374  75262720   24


What I want to do is to have a barplot where x-axis
is taken from V1 and y-axis taken from V2.

But I only want to plot the those region where V1 = -500
and = 500.

But some how this snippet doesn't seem to work:

 xlim = c(-500,500)
 barplot(as.matrix(dat[dat$V1 = -500  dat$V1 
 =500,dat$V2]),xlim=xlim,axes=TRUE, main =nm);

What's wrong with my approach.

So yes, I do want the V1 information, hence I am aware that
I dont' want:

 plot(hist(dat[dat =-500  dat =500]))

- Gundala Viswanath
Jakarta - Indonesia

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

2009-03-24 Thread Wacek Kusnierczyk
Berwin A Turlach wrote:
 G'day Carl,

 On Mon, 23 Mar 2009 20:11:19 -0400
 Carl Witthoft c...@witthoft.com wrote:

   
  From: Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk_at_idi.ntnu.no
  Date: Sun, 22 Mar 2009 22:58:49 +0100


  just for fun, you could do this with multiassignment, e.g., using
  the (highly experimental and premature!) rvalues:

  source('http://miscell.googlecode.com/svn/rvalues/rvalues.r') 
  if (TRUE)

 c(df1, df2) := list(4:8, 9:13)

  dput(df1)
  # 4:8
  dput(df2)
  # 9:13


 ---
 Now THAT's what I call an overloaded operator!   ^_^

 But seriously:  can someone explain to me what's going on in the 
 rvalues.r code?  I tried a simple experiment, replacing := with a 
 colec in the code, and of course the line

 c(df1, df2) colec list(4:8, 9:13)


 just gives me a syntax error response.   Clearly I need a pointer
 to some documentation about how the colon and equals sign get
 special treatment somewhere inside R.
 

 Not sure why := gets a special treatment, perhaps because it is not a
 valid name and, hence, the parser deduces that it is an operator?

   

possibly.  you'd have to look into the parser code, as it has, as duncan
explained, no documentation.  ?Syntax doesn't mention it either, as
doesn't the r language definition, as far as i can see.

 IIRC, the traditional way to define your own operator is to bound the
 name by percentage signs, i.e. replacing := by %colec% and then
 issuing the command

   c(df1, df2) %colec% list(4:8, 9:13)

 will work.
   

... and which was precisely why i wanted the simple ':=' -- because all
those traditional %*% are so ugly (syntactically).

vQ

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 set up a function for Central Limit Theorem

2009-03-24 Thread Thomas Lumley

On Mon, 23 Mar 2009, pfc_ivan wrote:



I tried using the for (i..) to make 1000 differents sets of numbers, but then
I dont know how to get the mean value of all of them... because I dont even
think 1000 different sets of numbers were made, because when i print it it
always shows me the same values, basically I dont know how to replicate the
funcion many times.



A useful approach for this sort of simulation problem (though not the most 
efficient approach for this particular example) is to write a function that 
does one simulation

  one.sim-function(mu, sigma, n){
   ## generate data
   ## compute the z-statistic
   return(zn)
   }
Then you can run simulations using replicate()
  lots.of.zs - replicate(1000, one.sim(mu=1,sigma=2, n=10))

-thomas



stephen sefick wrote:


homework?

On Mon, Mar 23, 2009 at 1:30 PM, pfc_ivan pfc_i...@hotmail.com wrote:


Hello guys, I am stuck here:

How do I make 1000 samples of n = 10 observations from an Exponential
distribution and then compute the mean for all those 1000 samples?

Basically I need to prove the Central Limit theorem, which states:

http://www.nabble.com/file/p22664113/d175f06cbf200bd52a2c27a2e56dc594.png

Where the Sn is sum of random variables, n we have from the question, mu
is
mean and (sigma)^2 is variance.

I am having trouble setting up the function to do this.

Any help apreciated!

--
View this message in context:
http://www.nabble.com/How-to-set-up-a-function-for-%22Central-Limit-Theorem%22-tp22664113p22664113.html
Sent from the R help mailing list archive at Nabble.com.

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





--
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

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




--
View this message in context: 
http://www.nabble.com/How-to-set-up-a-function-for-%22Central-Limit-Theorem%22-tp22664113p22666250.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.



Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] read in large data file (tsv) with inline filter?

2009-03-24 Thread Thomas Lumley

On Mon, 23 Mar 2009, David Reiss wrote:


I have a very large tab-delimited file, too big to store in memory via
readLines() or read.delim(). Turns out I only need a few hundred of those
lines to be read in. If it were not so large, I could read the entire file
in and grep the lines I need. For such a large file; many calls to
read.delim() with incrementing skip and nrows parameters, followed by
grep() calls is very slow.


You certainly don't want to use repeated reads from the start of the file with 
skip=,  but if you set up a file connection
   fileconnection - file(my.tsv, open=r)
you can read from it incrementally with readLines() or read.delim() without 
going back to the start each time.

The speed of approach should be within a reasonable constant factor of anything 
else, since reading the file once is unavoidable and should be the bottleneck.

  -thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] confidence interval or error of x intercept of a linear regression

2009-03-24 Thread Thomas Lumley
On Mon, 23 Mar 2009, Kevin J Emerson wrote:


 Now, it is simple enough to calculate the x-intercept itself ( - intercept / 
 slope ), but it is a whole separate process to generate the confidence 
 interval of it.  I can't figure out how to propagate the error of the slope 
 and intercept into the ratio of the two.  The option option I have tried to 
 figure out is to use the predict function to look for where the confidence 
 intervals cross the axis but this hasn't been too fruitful either.
 


A few people have written code to do nonlinear transformations automatically. 
There's one in my 'survey' package, and I think there's an example in Venables 
 Ripley's S Programming, and I'm sure there are others.

For example
 library(survey)
 m-lm(Dev.Rate~Temperature, data=t)
 svycontrast(m, quote(-`(Intercept)`/Temperature))
  nlcon SE
contrast 3.8061  0.1975

The `backquotes` are necessary because the coefficient name, (Intercept), isn't 
a legal variable name.

The svycontrast() function works on anything that has coef() and vcov() 
methods. The actual delta-method computations are in survey:::nlcon

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] confidence interval or error of x intercept of a linear regression

2009-03-24 Thread Thomas Lumley


I should probably also add the health warning that the delta-method approach to 
ratios of coefficients is REALLY BAD unless the denominator is well away from 
zero.

When the denominator is near zero nothing really works (Fieller's method is 
valid but only because 'valid' means less than you might like for a confidence 
interval method, and the bootstrap is useful but not necessarily valid)

 -thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

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

2009-03-24 Thread Wacek Kusnierczyk
Berwin A Turlach wrote:
 G'day Carl,

 On Mon, 23 Mar 2009 20:11:19 -0400
 Carl Witthoft c...@witthoft.com wrote:

   
  From: Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk_at_idi.ntnu.no
  Date: Sun, 22 Mar 2009 22:58:49 +0100


  just for fun, you could do this with multiassignment, e.g., using
  the (highly experimental and premature!) rvalues:

  source('http://miscell.googlecode.com/svn/rvalues/rvalues.r') 
  if (TRUE)

 c(df1, df2) := list(4:8, 9:13)

  dput(df1)
  # 4:8
  dput(df2)
  # 9:13


 ---
 Now THAT's what I call an overloaded operator!   ^_^
 

it's not really overloaded, it's *loaded*.  if you type

a :=  1

in an r session without defining '=', r cannot 'find such a function',
but it doesn't complain about invalid syntax.  so there is the operator,
only that it's not operational. 

 But seriously:  can someone explain to me what's going on in the 
 rvalues.r code? 

i think i-the-sinner'd be the right person to ask.  i'd suggest to
discuss offline, because rvalues is really an experiment, a proof of
concept, and as such may not be of interest for wider audience.  (it
might be that it will be developed into something substantial, but no
guarantees.)

vQ

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

2009-03-24 Thread Guillaume Filteau

Hello all,

I’m trying to take a huge dataset (1.5 GB) and separate it into smaller 
chunks with R.


So far I had nothing but problems.

I cannot load the whole dataset in R due to memory problems. So, I 
instead try to load a few (10) lines at a time (with read.table).


However, R kept crashing (with no error message) at about the 680 
line. This is extremely frustrating.


To try to fix this, I used connections with read.table. However, I now 
get a cryptic error telling me “no lines available in input”.


Is there any way to make this work?

Best,
Guillaume

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Which features would you like to see on the crantastic.org community portal?

2009-03-24 Thread Bjørn Arild Mæland
Hi,

As some of you know, one of the R Projects ideas for GSOC 2009 is to
expand the crantastic.org portal. Some ideas for what should be done
is mentioned in Hadley Wickham's project description [1], others have
been briefly mentioned on this mailing list before. Undoubtedly,
however, there are many other good ideas out there that could be
implemented. Please suggest any ideas you might have for such a
package portal. The main focus, as I see it, is to make it as easy as
possible to find the package you are looking for, without knowing the
name of the package.

To facilitate both collection of ideas and voting to show which ideas
are most popular, I've setup an account at uservoice.com, available
from this URL: http://crantastic.uservoice.com/pages/general . No
signup is required to vote and/or add your ideas, so please go ahead.

Best regards,
Bjørn Arild Mæland
Would-be GSOC student

[1]: http://www.statistik.lmu.de/~eugster/soc09/#p1

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

2009-03-24 Thread Wacek Kusnierczyk
Berwin A Turlach wrote:
 G'day Carl,

 On Mon, 23 Mar 2009 20:11:19 -0400
 Carl Witthoft c...@witthoft.com wrote:


   
 But seriously:  can someone explain to me what's going on in the 
 rvalues.r code?  I tried a simple experiment, replacing := with a 
 colec in the code, and of course the line

 c(df1, df2) colec list(4:8, 9:13)


 just gives me a syntax error response.   Clearly I need a pointer
 to some documentation about how the colon and equals sign get
 special treatment somewhere inside R.
 

 Not sure why := gets a special treatment, 

yet another bug??


 perhaps because it is not a
 valid name and, hence, the parser deduces that it is an operator?

   

well, you can't do it with, e.g., ':==', because you'd get a *syntactic*
error (while ':=' gives a semantic error):

a :== 1
# syntactic error: unexpected '=' in ':='

':==' = function(a, b) NULL
a :== 1
# syntactic error again, of course

it's indeed surprising that it works with ':=' but not with, e.g., ':'.

and in cases like ':-' you'd in fact use two operators (so an
'overloading' won't work for these):

':-' = function(a, b) a - if(a  b) b else 0
2 :- 1
# 2 1 0 -1
# not 1

it's interesting to note that

a : b
# error: unexpected '' in ':'

will tell you what's unexpected, while

a :% b
# error: unexpected input in 'a :% b'

a :_ b
# error: unexpected input in 'a :_'

will leave you wondering what's wrong there.



vQ

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

2009-03-24 Thread Romain Francois

Wacek Kusnierczyk wrote:

Berwin A Turlach wrote:
  

G'day Carl,

On Mon, 23 Mar 2009 20:11:19 -0400
Carl Witthoft c...@witthoft.com wrote:


  

But seriously:  can someone explain to me what's going on in the 
rvalues.r code?  I tried a simple experiment, replacing := with a 
colec in the code, and of course the line


c(df1, df2) colec list(4:8, 9:13)


just gives me a syntax error response.   Clearly I need a pointer
to some documentation about how the colon and equals sign get
special treatment somewhere inside R.

  
Not sure why := gets a special treatment, 



yet another bug??
  


This is probably due to that in the gram.y file :

case ':':
   if (nextchar(':')) {
   if (nextchar(':')) {
   yylval = install(:::);
   return NS_GET_INT;
   }
   else {
   yylval = install(::);
   return NS_GET;
   }
   }
   if (nextchar('=')) {
   yylval = install(:=);
   return LEFT_ASSIGN;
   }
   yylval = install(:);
   return ':';
   
which gives a meaning to :=, so that parsing x := 2 makes sense.


 parse( text = x := 2 )
expression(x := 2)
attr(,srcfile)
text

Romain
  

perhaps because it is not a
valid name and, hence, the parser deduces that it is an operator?

  



well, you can't do it with, e.g., ':==', because you'd get a *syntactic*
error (while ':=' gives a semantic error):

a :== 1
# syntactic error: unexpected '=' in ':='

':==' = function(a, b) NULL
a :== 1
# syntactic error again, of course

it's indeed surprising that it works with ':=' but not with, e.g., ':'.

and in cases like ':-' you'd in fact use two operators (so an
'overloading' won't work for these):

':-' = function(a, b) a - if(a  b) b else 0
2 :- 1
# 2 1 0 -1
# not 1

it's interesting to note that

a : b
# error: unexpected '' in ':'

will tell you what's unexpected, while

a :% b
# error: unexpected input in 'a :% b'

a :_ b
# error: unexpected input in 'a :_'

will leave you wondering what's wrong there.



vQ

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


  



--
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr

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

2009-03-24 Thread Wacek Kusnierczyk
Romain Francois wrote:
 This is probably due to that in the gram.y file :

 case ':':
if (nextchar(':')) {
if (nextchar(':')) {
yylval = install(:::);
return NS_GET_INT;
}
else {
yylval = install(::);
return NS_GET;
}
}
if (nextchar('=')) {
yylval = install(:=);
return LEFT_ASSIGN;
}
yylval = install(:);
return ':';
which gives a meaning to :=, so that parsing x := 2 makes sense.

  parse( text = x := 2 )
 expression(x := 2)
 attr(,srcfile)
 text

thanks.  so it seems to be intentionally parsable, though i wouldn't say
that this gives a meaning to ':=' -- the operator has a syntactic
category, but no semantics.  the syntactic category does not imply any
semantics, as in

'-' = function(a, b) NULL
1 - a
# NULL

where '-' is still parsed the original way (as a LEFT_ASSIGN, gram.y
again), but has now a completely different semantics.

it looks like a bug to me:  ':=' is parsed on par with '-' as a
LEFT_ASSIGN, but apparently is not backed by any function.  it's a
zombie.  (unless rvalues is used, that is.)

vQ

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

2009-03-24 Thread Thomas Lumley

On Tue, 24 Mar 2009, Wacek Kusnierczyk wrote:


thanks.  so it seems to be intentionally parsable, though i wouldn't say
that this gives a meaning to ':=' -- the operator has a syntactic
category, but no semantics.  the syntactic category does not imply any
semantics, as in

   '-' = function(a, b) NULL
   1 - a
   # NULL

where '-' is still parsed the original way (as a LEFT_ASSIGN, gram.y
again), but has now a completely different semantics.

it looks like a bug to me:  ':=' is parsed on par with '-' as a
LEFT_ASSIGN, but apparently is not backed by any function.  it's a
zombie.  (unless rvalues is used, that is.)


yes, it's a zombie. It used to assign to the R system environment rather than 
the global workspace (roughly what is the base namespace now).


-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

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

2009-03-24 Thread Thomas Lumley

On Tue, 24 Mar 2009, Guillaume Filteau wrote:


Hello all,

I’m trying to take a huge dataset (1.5 GB) and separate it into smaller chunks 
with R.


So far I had nothing but problems.

I cannot load the whole dataset in R due to memory problems. So, I instead try 
to load a few (10) lines at a time (with read.table).


However, R kept crashing (with no error message) at about the 680 line. 
This is extremely frustrating.


To try to fix this, I used connections with read.table. However, I now get a 
cryptic error telling me “no lines available in input”.


Is there any way to make this work?



There might be an error in line 42 of your script. Or somewhere else. The error 
message is cryptically saying that there were no lines of text available in the 
input connection, so presumably the connection wasn't pointed at your file 
correctly.

It's hard to guess without seeing what you are doing, but
   conn - file(mybigfile, open=r)
   chunk- read.table(conn, header=TRUE, nrows=1)
   nms - names(chunk)
   while(length(chunk)==1){
  chunk-read.table(conn, nrows=1,col.names=nms)
  ## do something to the chunk
   }
   close(conn)

should work. This sort of thing certainly does work routinely.

It's probably not worth reading 100,000 lines at a time unless your computer 
has a lot of memory. Reducing the chunk size to 10,000 shouldn't introduce much 
extra overhead and may well increase the speed by reducing memory use.

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

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

2009-03-24 Thread Wacek Kusnierczyk
Thomas Lumley wrote:
 On Tue, 24 Mar 2009, Wacek Kusnierczyk wrote:

 thanks.  so it seems to be intentionally parsable, though i wouldn't say
 that this gives a meaning to ':=' -- the operator has a syntactic
 category, but no semantics.  the syntactic category does not imply any
 semantics, as in

'-' = function(a, b) NULL
1 - a
# NULL

 where '-' is still parsed the original way (as a LEFT_ASSIGN, gram.y
 again), but has now a completely different semantics.

 it looks like a bug to me:  ':=' is parsed on par with '-' as a
 LEFT_ASSIGN, but apparently is not backed by any function.  it's a
 zombie.  (unless rvalues is used, that is.)

 yes, it's a zombie. It used to assign to the R system environment
 rather than the global workspace (roughly what is the base namespace
 now).


thanks for the explanation.  for the sake of rvalues, please do not fix
this bug.  i find it useful to avoid messing with = and -.

vQ

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

2009-03-24 Thread Thomas Lumley

On Tue, 24 Mar 2009, Wacek Kusnierczyk wrote:



thanks for the explanation.  for the sake of rvalues, please do not fix
this bug.  i find it useful to avoid messing with = and -.



If you insist on calling it a bug, the chances of its getting fixed are higher.

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Random sampling based on the observations

2009-03-24 Thread Arup

Hello!I am having a problem with Random sampling in R. I have used a syntax:
mydata.sub=sample(mydata,7,replace=FALSE,prob=NULL) which allows me to
choose a random sample based on the variables(correct me if I am wrong!).
Suppose I have 10 variable and if I use the above mentioned command then it
will choose 7 variables out of the 10 randomly. My problem is that I want to
have a random sample which is not based on the variables but on the values
of the variables that is the random sample will be based on the
observations. It will be great if someone can help me out me out with a
proper syntax. Thanks in Advance.
-- 
View this message in context: 
http://www.nabble.com/Random-sampling-based-on-the-observations-tp22673975p22673975.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] Unit root

2009-03-24 Thread Brajkovic J.
I am confused by obtaining different results when testing for unit root when 
using different packages. I have 2625 price entries for which I want to 
determine whether they exhibit unit root. First I test using adf.test from 
tseries package by running:
 adf.test(P, k=30)
Augmented Dickey-Fuller Test
data:  P
Dickey-Fuller = -4.685, Lag order = 30, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(P, k = 30) : p-value smaller than printed p-value

But adf.test includes a time trend that I wan to omit, which I do not know if 
it is possible. Thus I have to run ADF .test from uroot package and obtain the 
following:

ADF.test(Plevel, itsd=c(1,1,c(0)),regvar=0, selectlags=list(Pmax=30))
  - -- - -- 
  Augmented Dickey  Fuller test
  - -- - -- 
  Null hypothesis: Unit root.
  Alternative hypothesis: Stationarity.
  ADF statistic:
Estimate Std. Error t value Pr(|t|)
adf.reg   -0.326  0.015 -21.881 0.01

  Lag orders: 30
  Number of available observations: 2594
Warning message:
In interpolpval(code = code, stat = adfreg[, 3], N = N) :  p-value is smaller 
than printed p-value

The results are dramatically different. Even more interesting is when I include 
the option for the program to select the number of lags:


ADF.test(Plevel, itsd=c(1,1,c(0)),regvar=0, selectlags=list(mode='signf', 
Pmax=NULL))
  - -- - -- 
  Augmented Dickey  Fuller test
  - -- - -- 

  Null hypothesis: Unit root.
  Alternative hypothesis: Stationarity.


  ADF statistic:

Estimate Std. Error t value Pr(|t|)
adf.reg   -0.079  0.017  -4.727 0.01

  Lag orders: 1 2 3 4 5 6 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 27 
28 31 32 33 34
  Number of available observations: 2590
Warning message:
In interpolpval(code = code, stat = adfreg[, 3], N = N) :
  p-value is smaller than printed p-value


Can someone please explain these differences.

Many thanks,
Jurica Brajkovic
University of Southampton

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

2009-03-24 Thread per243

I have reviewed all the scripts that appear http://cran.es.r-project.org/ and
I cann´t find any suitable for cross-validation with a model of the form y =
aX^(b). exp(cZ). Please can someone help me?
Thanks, a lot of!!
-- 
View this message in context: 
http://www.nabble.com/cross-validation-tp22674165p22674165.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] help: what are the basis functions in {mgcv}: gam?

2009-03-24 Thread oliviax

Thanks for Andrew Robinson's suggestion. 

I am sorry that I have been looking for the book Wood (2006) Generalized
Additive Models: Introduction with R for a long time in my univerity and
book stores, but I failed to find one. I think it may take a long time to
buy one from the Internet, and we are required to submit the master thesis
soon... 

Could any one help me if you know other references or have knowledge about
this?? 

I will be very very thankful. 

Sincerely yours, 
Olivia




oliviax wrote:
 
 I am writing my thesis with the function gam(), with the package {mgcv}. 
 
 My command is: gam(y~s(x1,bs=cr)+s(x2, bs=cr)). 
 
 I need help to know what are the default basis funcitons for gam. I have
 not found any detailed reference for this. 
 
 Can anyone help me with this?? 
 

-- 
View this message in context: 
http://www.nabble.com/help%3A-what-are-the-basis-functions-in-%7Bmgcv%7D%3A-gam--tp22673295p22674337.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] Change teh datatype from factor to double

2009-03-24 Thread Maxl18

Hi all,
I want to read a .txt dataset, but when I test the type, some of the data is
a factor.
How can I avoid them to get a factor or how can I unfactor them without
loosing their values?

Thanks, Max
-- 
View this message in context: 
http://www.nabble.com/Change-teh-datatype-from-factor-to-double-tp22675854p22675854.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] Random sampling based on the observations

2009-03-24 Thread Adrian Dusa
On Tuesday 24 March 2009, you wrote:
 Hello!I am having a problem with Random sampling in R. I have used a
 syntax: mydata.sub=sample(mydata,7,replace=FALSE,prob=NULL) which allows me
 to choose a random sample based on the variables(correct me if I am
 wrong!).

Actually, no.
You are sampling from a vector, and where you're using the sampled values (on 
the rows or on the variables) is up to you.

Let's say we have a dataset with 100 cases and 10 variables:

Case 1:
mydata.sub - mydata[ , sample(10, 7)]

This will sample 7 variables out of 10.

Case 2:
mydata.sub - mydata[sample(100, 10), ]

This will sample 10 cases out of 100.

 Suppose I have 10 variable and if I use the above mentioned
 command then it will choose 7 variables out of the 10 randomly. My problem
 is that I want to have a random sample which is not based on the variables
 but on the values of the variables that is the random sample will be based
 on the observations. It will be great if someone can help me out me out with
 a proper syntax. Thanks in Advance.

I think you need to read the help for:
?[

and most probably one of the introductory books for R.
I hope this helps,
Adrian


-- 
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd.
050025 Bucharest sector 5
Romania
Tel.:+40 21 3126618 \
 +40 21 3120210 / int.101
Fax: +40 21 3158391


[[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] confidence interval or error of x intercept of a linear

2009-03-24 Thread Ted Harding
On 24-Mar-09 03:31:32, Kevin J Emerson wrote:
 Hello all,
 
 This is something that I am sure has a really suave solution in R,
 but I can't quite figure out the best (or even a basic) way to do it.
 
 I have a simple linear regression that is fit with lm for which I
 would like to estimate the x intercept with some measure of error
 around it (confidence interval). In biology, there is the concept
 of a developmental zero - a temperature under which development
 will not happen. This is often estimated by extrapolation of a
 curve of developmental rate as a function of temperature. This
 developmental zero is generally reported without error. I intend
 to change this! 
 There has to be some way to assign error to this term, I just have
 yet to figure it out.
 
 Now, it is simple enough to calculate the x-intercept itself ( -
 intercept / slope ), but it is a whole separate process to generate
 the confidence interval of it.  I can't figure out how to propagate
 the error of the slope and intercept into the ratio of the two.
 The option option I have tried to figure out is to use the predict
 function to look for where the confidence intervals cross the axis
 but this hasn't been too fruitful either.  
 
 I would greatly appreciate any insight you may be able to share.
 
 Cheers,
 Kevin
 
 Here is a small representative sample of some of my data where
 Dev.Rate ~ Temperature.

The difficulty with the situation you describe is that you are up
against what is known as the Calibration Problem in Statistics.
Essentially, the difficulty is that in the theory of the linear
regression there is sufficient probability for the slope to be
very close to zero -- and hence that the X-intercept maybe
very far out to the left or the right -- that the whole dconcept
of Standard error ceases to exist. Even the expected position of
the intercept does not exist. And this is true regardless of the
data (the one exception would be where it is absolutely certain
that the data will lie exactly on a straight line).

This has been addressed a number of times, and controversally,
in the statistical literature. One approach which I like (having
thought of it myself :)) is the use of likelihood-based confidence
intervals.

Given a linear regression

  Y = a + b*X + E

(where the error E has N(0, sig^2) distribution), suppose you
want to estimate the value X0 of X for which Y = Y0, a given value
(in your case Y0 = 0). For simplicity, measure X and Y from their
means sum(X)/N and sum(Y)/N.

The approach is based on comparing the likelihoods

[A] for unresticted ML estimation of a, b and sig
-- a.hat, b.hat, sig.hat
(where a.hat = 0 because of the origins of X and Y)
[B] for ML estimation assuming a particular value X1 for X0
-- a.tilde, b.tilde, sig.tilde

where
[A] a.hat = 0 (as above),
b.hat = (sum(X*Y))/(sum(X^2)
X0.hat= Y0/b.hat [ = -mean(Y)/b.hat in your case ]
sig.hat^2 = (sum(Y - b.hat*X)^2)/(N+1)

[B] a.tilde = (sum(X^2) - X0*sum(X*Y))/D
b.tilde = ((N+1)*sum(X*Y) + N*X1*Y0)/D
sig.hat.tilde^2
= (sum((Y - a.tilde - b.tilde*X)^2)
+ (Y0 - a.tilde - b.tilde*X1)^2)/(N+1)

where D = (N+1)*sum(X^2 + N*X1^2

Then let R(X1) = (sig.hat^2)/(sig.tilde^2)

A confidence interval for X0 is the set of values of X1 such
that R(X1)  R0 say, where Prob(R(X0)R0) = P, the desired
confidence level, when X0 is the true value.

It can be established that

  (N-2)*(1 - R(X0))/R(X0)

has the F distribution with 1 and (N-1) degrees of freedom.
Since this is independent of X0, the resulting set of values
of X1 constitute a confidence interval.

This was described in

  Harding, E.F. (1986). Modelling: the classical approach.
  The Statistician vol. 35, pp. 115-134
  (see pages 123-126)

and has been later referred to by P.J. Brown (thought I don't
have the references to hand just now).

When I have time for it (not today) I'll see if I can implement
this neatly in R. It's basically a question of solving

  (N-2)*(1 - R(X0))/R(X0) = qf(P,1,(N-1))

for X0 (two solutions, maybe one, if any exist). However, it is
quite possible that no solution exists (depending on P), so that
the confidence interval would then be (-inf,+inf); or, when only
one exists, it will be either (-inf,X0) or (X0,inf).
These possibilities of infinite intervals are directly related
to the possibility that, at significance level alpha = (1-P),
the estimated slope may not differ significantly from 0.

Maybe more later!
Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 24-Mar-09   Time: 10:04:30
-- 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 

Re: [R] If statement generates two outputs

2009-03-24 Thread Wacek Kusnierczyk
Thomas Lumley wrote:
 On Tue, 24 Mar 2009, Wacek Kusnierczyk wrote:


 thanks for the explanation.  for the sake of rvalues, please do not fix
 this bug.  i find it useful to avoid messing with = and -.


 If you insist on calling it a bug, the chances of its getting fixed
 are higher.

no no, it's *NOT* a b(...)!

vQ

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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: what are the basis functions in {mgcv}: gam?

2009-03-24 Thread Simon Wood
If you can't get hold of the book, try appendix A of 
http://www.maths.bath.ac.uk/~sw283/simon/papers/psm.pdf
-- what's described there is the cr basis

best,
Simon
 

On Tuesday 24 March 2009 05:01, oliviax wrote:
 Thanks for Andrew Robinson's suggestion.

 I am sorry that I have been looking for the book Wood (2006) Generalized
 Additive Models: Introduction with R for a long time in my univerity and
 book stores, but I failed to find one. I think it may take a long time to
 buy one from the Internet, and we are required to submit the master thesis
 soon...

 Could any one help me if you know other references or have knowledge about
 this??

 I will be very very thankful.

 Sincerely yours,
 Olivia

 oliviax wrote:
  I am writing my thesis with the function gam(), with the package {mgcv}.
 
  My command is: gam(y~s(x1,bs=cr)+s(x2, bs=cr)).
 
  I need help to know what are the default basis funcitons for gam. I have
  not found any detailed reference for this.
 
  Can anyone help me with this??

-- 
 Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
 +44 1225 386603  www.maths.bath.ac.uk/~sw283

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] install.package(TinnR) - there is no package called 'TinnR'

2009-03-24 Thread Martin Tomko
I have troubles make TinnR 2.2.0.2 work, it seems that the dependency on 
the package TinnR that cannot be found (I tried also manual downloads, 
but I cannot find the package anywhere on any CRAN mirror).


I even set a default cran mirror in the Rprofile.site file, so that the 
later command can find it:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

No luck. Even manually issuing the comand in Rterm fails, package 
‘TinnR’ is not available.
Any idea how I could make my TinnR work? I googled extensively, but 
without luck...


Thanks
Martin

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

2009-03-24 Thread Thomas Steiner
Hi,
I'd like to execute simple commands and functions in R through a
website, is there any service like this somewhere?
I only found http://www.osvisions.com/r-online/ but it does not work
(last update 2003) and the links to releated websites only give errors
(if I calculate 7+3).
Thanks for help  hints,
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Legend containing maths symbol and values of variables

2009-03-24 Thread Gabor Grothendieck
Try this:

L - list(bquote(Up ( = .(threshold) ~ )), Normal, Down, NA)
legend(top, leg = L)


On Tue, Mar 24, 2009 at 2:52 AM, Daren Tan darenta...@gmail.com wrote:
 I tried sprintf and paste, which solves one of my problem i.e.
 replacing the variable name by its value. However, = is not renderend
 correctly as the inequality symbol.

 On Tue, Mar 24, 2009 at 12:24 PM, Gabor Grothendieck
 ggrothendi...@gmail.com wrote:
 For the legend argument try this:

 leg = as.expression(c(sprintf(Up (= %d), threshold),
        Normal, Down, NA))

 or use paste in place of sprintf.

 On Mon, Mar 23, 2009 at 11:53 PM, Daren Tan darenta...@gmail.com wrote:
 I need to have the maths symbol for = in the legend, and to
 substitute threshold variable with its value. Somehow, various
 attempts weren't successful. Please help.

 threshold - 0.5

 plot(NA, xlab=, ylab=, main=, axes=F, xlim=c(0,1), ylim=c(0,1),
 xaxs=i, yaxs=i)
 legend(x=0, y=1, fill=c(orange, white, green, gray90),
 cex=0.8, pt.cex=1.8, x.intersp=0.6, bg = white,
           legend=c(expression(Up ( = threshold )), Normal,
 Down, NA), bty = n)

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Legend containing maths symbol and values of variables

2009-03-24 Thread Uwe Ligges

So what about

threshold - 0.5
plot(NA, xlab=, ylab=, main=, axes=F, xlim=c(0,1),
ylim=c(0,1), xaxs=i, yaxs=i)
legend1 - substitute(Up ( * phantom() = threshold * ),
list(threshold=threshold))
legend(x=0, y=1, fill=c(orange, white, green, gray90),
  cex=0.8, pt.cex=1.8, x.intersp=0.6, bg = white, bty = n,
  legend =
do.call(expression, list(legend1, Normal, Down, NA)))




Daren Tan wrote:

I tried sprintf and paste, which solves one of my problem i.e.
replacing the variable name by its value. However, = is not renderend
correctly as the inequality symbol.

On Tue, Mar 24, 2009 at 12:24 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:

For the legend argument try this:

leg = as.expression(c(sprintf(Up (= %d), threshold),
   Normal, Down, NA))

or use paste in place of sprintf.

On Mon, Mar 23, 2009 at 11:53 PM, Daren Tan darenta...@gmail.com wrote:

I need to have the maths symbol for = in the legend, and to
substitute threshold variable with its value. Somehow, various
attempts weren't successful. Please help.

threshold - 0.5

plot(NA, xlab=, ylab=, main=, axes=F, xlim=c(0,1), ylim=c(0,1),
xaxs=i, yaxs=i)
legend(x=0, y=1, fill=c(orange, white, green, gray90),
cex=0.8, pt.cex=1.8, x.intersp=0.6, bg = white,
  legend=c(expression(Up ( = threshold )), Normal,
Down, NA), bty = n)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] How to find the path or the current file?

2009-03-24 Thread Marie Sivertsen
Dear useRs,

I have a collection of source file and some of these call others.  The files
are distribute among a number of directories, and to know how to call some
other file they need to know what file is currently executed.

As example, I have a file 'search.R' located in directory 'bin' which needs
to access the file 'terms.conf' located in the directory 'conf', a sibling
of 'bin'.  I can have somethings like readLines('../conf/terms.conf') in
search.R, but this work only if search.R is executed from bin, when getwd is
'bin'.  But when search.R calls from the parent as bin/search.R or any other
derectory then R complains that it could not find the file
'../conf/terms.conf'.

So my questions is:  how can the file search.R, when executied, discover its
own location and load terms.conf from location of
search.R/../conf/terms.conf?  the location of search.R can be unrelated to
the current directory.

Mvh.
Marie

[[alternative HTML version deleted]]

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


[R] Variogram with Gstat

2009-03-24 Thread giuseppef...@libero.it
Dear all can you help me? i have this problem: i have a dataset in a text file 
in a matrix of 3 columns: x, y, z where x and y are the coordinates and Z are 
the mesurements. How  can i do a variogram with R?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] read in large data file (tsv) with inline filter?

2009-03-24 Thread Gabor Grothendieck
On Mon, Mar 23, 2009 at 5:53 PM, David Reiss dre...@systemsbiology.org wrote:
 I have a very large tab-delimited file, too big to store in memory via
 readLines() or read.delim(). Turns out I only need a few hundred of those
 lines to be read in. If it were not so large, I could read the entire file
 in and grep the lines I need. For such a large file; many calls to
 read.delim() with incrementing skip and nrows parameters, followed by
 grep() calls is very slow. I am aware of possibilities via SQLite; I would
 prefer to not use that in this case.


Why the restriction?  Using sqldf with sqlite its only
two R statements.

The first statement defines the name of the file and the
second statement defines what you want to extract from
it and its format.  First create a sample file using built in
data frame BOD and lets specify tab delimiters.  A header,
i.e. col.names = TRUE, is the default for write.table:

# create tab delimited test file with headers
write.table(BOD, file = myfile.dat, sep = \t)

# now read in only those records satisfying a condition
library(sqldf)

# here are the two statements
myfile - file(myfile.dat)
DF - sqldf(select * from myfile where demand  10 or demand  15,
  file.format = list(sep = \t))

See examples on the home page http://sqldf.googlecode.com and
see ?sqldf for info on the file.format argument in case your format differs.

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

2009-03-24 Thread Duncan Murdoch

On 24/03/2009 7:16 AM, Marie Sivertsen wrote:

Dear useRs,

I have a collection of source file and some of these call others.  The files
are distribute among a number of directories, and to know how to call some
other file they need to know what file is currently executed.

As example, I have a file 'search.R' located in directory 'bin' which needs
to access the file 'terms.conf' located in the directory 'conf', a sibling
of 'bin'.  I can have somethings like readLines('../conf/terms.conf') in
search.R, but this work only if search.R is executed from bin, when getwd is
'bin'.  But when search.R calls from the parent as bin/search.R or any other
derectory then R complains that it could not find the file
'../conf/terms.conf'.

So my questions is:  how can the file search.R, when executied, discover its
own location and load terms.conf from location of
search.R/../conf/terms.conf?  the location of search.R can be unrelated to
the current directory.


In general it can't.  Since source() can work on a connection and a 
connection doesn't have to be a file, there may not be a location.


You could write your own Source function, something like this:

filenamestack - c()

Source - function(filename, ...) {
   # push the new filename
   filenamestack - c(filename, filenamestack)

   # on exit pop it off the stack
   on.exit(filenamestack - filenamestack[-1])

   source(filename, ...)
}

and then examine filenamestack[1] to find the name of the file currently 
being sourced.  (But Source() won't work on connections, only on filenames.)


Duncan Murdoch

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


Re: [R] Legend containing maths symbol and values of variables

2009-03-24 Thread Gabor Grothendieck
that should have been:

L - list(bquote(Up ( = .(threshold) ~ )), Normal, Down, NA)
legend(top, leg = as.expression(L))


On Tue, Mar 24, 2009 at 7:18 AM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 Try this:

 L - list(bquote(Up ( = .(threshold) ~ )), Normal, Down, NA)
 legend(top, leg = L)


 On Tue, Mar 24, 2009 at 2:52 AM, Daren Tan darenta...@gmail.com wrote:
 I tried sprintf and paste, which solves one of my problem i.e.
 replacing the variable name by its value. However, = is not renderend
 correctly as the inequality symbol.

 On Tue, Mar 24, 2009 at 12:24 PM, Gabor Grothendieck
 ggrothendi...@gmail.com wrote:
 For the legend argument try this:

 leg = as.expression(c(sprintf(Up (= %d), threshold),
        Normal, Down, NA))

 or use paste in place of sprintf.

 On Mon, Mar 23, 2009 at 11:53 PM, Daren Tan darenta...@gmail.com wrote:
 I need to have the maths symbol for = in the legend, and to
 substitute threshold variable with its value. Somehow, various
 attempts weren't successful. Please help.

 threshold - 0.5

 plot(NA, xlab=, ylab=, main=, axes=F, xlim=c(0,1), ylim=c(0,1),
 xaxs=i, yaxs=i)
 legend(x=0, y=1, fill=c(orange, white, green, gray90),
 cex=0.8, pt.cex=1.8, x.intersp=0.6, bg = white,
           legend=c(expression(Up ( = threshold )), Normal,
 Down, NA), bty = n)

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





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


Re: [R] r online

2009-03-24 Thread Gerhard Schön

try:
http://bayes.math.montana.edu/Rweb/Rweb.general.html

Gerhard

Thomas Steiner schrieb am 24.03.2009 12:06:

Hi,
I'd like to execute simple commands and functions in R through a
website, is there any service like this somewhere?
I only found http://www.osvisions.com/r-online/ but it does not work
(last update 2003) and the links to releated websites only give errors
(if I calculate 7+3).
Thanks for help  hints,
Thomas

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



--
Gerhard Schön
Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf
Martinistr. 52, building W34
Phone: +49(40) 7410 57458
Fax:   +49(40) 7410 57790
Web: www.uke.de/imbe


--
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und 
Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf
Körperschaft des öffentlichen Rechts
Gerichtsstand: Hamburg

Vorstandsmitglieder:
Prof. Dr. Jörg F. Debatin (Vorsitzender)
Dr. Alexander Kirstein
Ricarda Klein
Prof. Dr. Dr. Uwe Koch-Gromus
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Change teh datatype from factor to double

2009-03-24 Thread David Winsemius

?read.table

Consult the help file for the parameters:

as.is =or
stringsAsFactors =

-- David Winsemius

On Mar 24, 2009, at 4:22 AM, Maxl18 wrote:



Hi all,
I want to read a .txt dataset, but when I test the type, some of the  
data is

a factor.
How can I avoid them to get a factor or how can I unfactor them  
without

loosing their values?

Thanks, Max
--
View this message in context: 
http://www.nabble.com/Change-teh-datatype-from-factor-to-double-tp22675854p22675854.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] r online

2009-03-24 Thread Dirk Eddelbuettel

On 24 March 2009 at 12:06, Thomas Steiner wrote:
| Hi,
| I'd like to execute simple commands and functions in R through a
| website, is there any service like this somewhere?
| I only found http://www.osvisions.com/r-online/ but it does not work
| (last update 2003) and the links to releated websites only give errors
| (if I calculate 7+3).
| Thanks for help  hints,

Please read the R FAQ which has an entire section devoted to this that I
include below, copied and pasted from the txt version of the R
FAQ. Personally, I'd go with Rpad.

Dirk

4 R Web Interfaces
**

*Rweb* is developed and maintained by Jeff Banfield
j...@math.montana.edu.  The Rweb Home Page
(http://www.math.montana.edu/Rweb/) provides access to all three versions
of Rweb--a simple text entry form that returns output and graphs, a more
sophisticated Javascript version that provides a multiple window
environment, and a set of point and click modules that are useful for
introductory statistics courses and require no knowledge of the R language.
All of the Rweb versions can analyze Web accessible datasets if a URL is
provided.

   The paper Rweb: Web-based Statistical Analysis, providing a detailed
explanation of the different versions of Rweb and an overview of how Rweb
works, was published in the Journal of Statistical Software
(`http://www.jstatsoft.org/v04/i01/').

   Ulf Bartel u...@cs.tu-berlin.de has developed *R-Online*, a simple
on-line programming environment for R which intends to make the first steps
in statistical programming with R (especially with time series) as easy as
possible.  There is no need for a local installation since the only
requirement for the user is a JavaScript capable browser.  See
`http://osvisions.com/r-online/' for more information.

   *Rcgi* is a CGI WWW interface to R by MJ Ray m...@dsl.pipex.com.  It
had the ability to use embedded code: you could mix user input and code,
allowing the HTML author to do anything from load in data sets to enter
most of the commands for users without writing CGI scripts.  Graphical
output was possible in PostScript or GIF formats and the executed code was
presented to the user for revision.  However, it is not clear if the
project is still active.  Currently, a modified version of *Rcgi* by Mai
Zhou m...@ms.uky.edu (actually, two versions: one with (bitmap) graphics
and one without) as well as the original code are available from
`http://www.ms.uky.edu/~statweb/'.

   CGI-based web access to R is also provided at
`http://hermes.sdu.dk/cgi-bin/go/'.  There are many additional examples of
web interfaces to R which basically allow to submit R code to a remote
server, see for example the collection of links available from
`http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/StatCompCourse'.

   David Firth (http://www.warwick.ac.uk/go/dfirth) has written *CGIwithR*,
an R add-on package available from CRAN.  It provides some simple
extensions to R to facilitate running R scripts through the CGI interface
to a web server, and allows submission of data using both GET and POST
methods.  It is easily installed using Apache under Linux and in principle
should run on any platform that supports R and a web server provided that
the installer has the necessary security permissions.  David's paper
CGIwithR: Facilities for Processing Web Forms Using R was published in
the Journal of Statistical Software (`http://www.jstatsoft.org/v08/i10/').
The package is now maintained by Duncan Temple Lang
dun...@wald.ucdavis.edu and has a web page at
`http://www.omegahat.org/CGIwithR/'.

   Rpad (http://www.rpad.org/Rpad), developed and actively maintained by
Tom Short, provides a sophisticated environment which combines some of the
features of the previous approaches with quite a bit of Javascript,
allowing for a GUI-like behavior (with sortable tables, clickable graphics,
editable output), etc.

   Jeff Horner is working on the R/Apache Integration Project which embeds
the R interpreter inside Apache 2 (and beyond).  A tutorial and
presentation are available from the project web page at
`http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/RApacheProject'.

   Rserve (http://stats.math.uni-augsburg.de/Rserve/) is a project actively
developed by Simon Urbanek.  It implements a TCP/IP server which allows
other programs to use facilities of R.  Clients are available from the web
site for Java and C++ (and could be written for other languages that
support TCP/IP sockets).

   OpenStatServer (http://openstatserver.org/index.html) is being developed
by a team lead by Greg Warnes; it aims to provide clean access to
computational modules defined in a variety of computational environments
(R, SAS, Matlab, etc) via a single well-defined client interface and to
turn computational services into web services.

   Two projects use PHP to provide a web interface to R.  R_PHP_Online
(http://steve-chen.net/R_PHP/) by Steve Chen (though it is unclear if this
project is still active) is somewhat 

Re: [R] How to find the path or the current file?

2009-03-24 Thread Gabor Grothendieck
See:

https://stat.ethz.ch/pipermail/r-help/2009-January/184745.html

On Tue, Mar 24, 2009 at 7:16 AM, Marie Sivertsen mariesiv...@gmail.com wrote:
 Dear useRs,

 I have a collection of source file and some of these call others.  The files
 are distribute among a number of directories, and to know how to call some
 other file they need to know what file is currently executed.

 As example, I have a file 'search.R' located in directory 'bin' which needs
 to access the file 'terms.conf' located in the directory 'conf', a sibling
 of 'bin'.  I can have somethings like readLines('../conf/terms.conf') in
 search.R, but this work only if search.R is executed from bin, when getwd is
 'bin'.  But when search.R calls from the parent as bin/search.R or any other
 derectory then R complains that it could not find the file
 '../conf/terms.conf'.

 So my questions is:  how can the file search.R, when executied, discover its
 own location and load terms.conf from location of
 search.R/../conf/terms.conf?  the location of search.R can be unrelated to
 the current directory.

 Mvh.
 Marie

        [[alternative HTML version deleted]]

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


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Legend containing maths symbol and values of variables

2009-03-24 Thread Daren Tan
Thanks, that works beautifully. Without your help, I will be
struggling for a long time.

On Tue, Mar 24, 2009 at 7:46 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 that should have been:

 L - list(bquote(Up ( = .(threshold) ~ )), Normal, Down, NA)
 legend(top, leg = as.expression(L))


 On Tue, Mar 24, 2009 at 7:18 AM, Gabor Grothendieck
 ggrothendi...@gmail.com wrote:
 Try this:

 L - list(bquote(Up ( = .(threshold) ~ )), Normal, Down, NA)
 legend(top, leg = L)


 On Tue, Mar 24, 2009 at 2:52 AM, Daren Tan darenta...@gmail.com wrote:
 I tried sprintf and paste, which solves one of my problem i.e.
 replacing the variable name by its value. However, = is not renderend
 correctly as the inequality symbol.

 On Tue, Mar 24, 2009 at 12:24 PM, Gabor Grothendieck
 ggrothendi...@gmail.com wrote:
 For the legend argument try this:

 leg = as.expression(c(sprintf(Up (= %d), threshold),
        Normal, Down, NA))

 or use paste in place of sprintf.

 On Mon, Mar 23, 2009 at 11:53 PM, Daren Tan darenta...@gmail.com wrote:
 I need to have the maths symbol for = in the legend, and to
 substitute threshold variable with its value. Somehow, various
 attempts weren't successful. Please help.

 threshold - 0.5

 plot(NA, xlab=, ylab=, main=, axes=F, xlim=c(0,1), ylim=c(0,1),
 xaxs=i, yaxs=i)
 legend(x=0, y=1, fill=c(orange, white, green, gray90),
 cex=0.8, pt.cex=1.8, x.intersp=0.6, bg = white,
           legend=c(expression(Up ( = threshold )), Normal,
 Down, NA), bty = n)

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] read in large data file (tsv) with inline filter?

2009-03-24 Thread Dirk Eddelbuettel

Hi David,

On 23 March 2009 at 15:09, Dylan Beaudette wrote:
| On Monday 23 March 2009, David Reiss wrote:
|  I have a very large tab-delimited file, too big to store in memory via
|  readLines() or read.delim(). Turns out I only need a few hundred of those
|  lines to be read in. If it were not so large, I could read the entire file
|  in and grep the lines I need. For such a large file; many calls to
|  read.delim() with incrementing skip and nrows parameters, followed by
|  grep() calls is very slow. I am aware of possibilities via SQLite; I would
|  prefer to not use that in this case.
| 
|  My question is...Is there a function for efficiently reading in a file
|  along the lines of read.delim(), which allows me to specify a filter (via
|  grep or something else) that tells the function to only read in certain
|  lines that match?
| 
|  If not, I would *love* to see a filter parameter added as an option to
|  read.delim() and/or readLines().
| 
| How about pre-filtering before loading the data into R:
| 
| grep -E 'your pattern here' your_file_here  your_filtered_file
| 
| alternatively if you need to search in fields, see 'awk', and 'cut', or if 
you 
| need to delete things see 'tr'.
| 
| These tools come with any unix-like OS, and you can probably get them on 
| windows without much effort.

Also note that read.delim() and friends all read from connections, and 'piped
expressions' (in the Unix shell command sense) can provide a source.

That way you can build an ad-hoc filter extension by running readLines() over
a pipe() connection.  Consider this trivial example of grepping out Section
headers from the R FAQ.  We get everything double because of the Table of
Contents and the actual section headers:

R readLines( pipe(awk '/^[0-9+] / {print $1, $2, $3}' 
src/debian/R/R-alpha.20090320/doc/FAQ) )
 [1] 1 Introduction  2 R Basics  3 R and 4 R Web
 [5] 5 R Add-On  6 R and 7 R Miscellanea 8 R Programming
 [9] 9 R Bugs1 Introduction  2 R Basics  3 R and
[13] 4 R Web 5 R Add-On  6 R and 7 R Miscellanea
[17] 8 R Programming 9 R Bugs   
R 

The regexp is simply 'digits at start of line followed by space' which skips
subsections like 1.1, 1.2, ...

Hth, Dirk

-- 
Three out of two people have difficulties with fractions.

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

2009-03-24 Thread Gavin Simpson
On Sun, 2009-03-22 at 22:45 -0400, Josh Stumpf wrote:
 Hello all,
 
 When attempting a classification tree using mvpart, I get the following
 error:
 
  thesis2.mvp=mvpart(bat_sp~., data=alltrees.df)
 Error in all(keep) :
   unused argument(s) (c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE))
 
 bat_sp is an unordered categorical variable

That looks wrong for a start. mvpart is an extension to the rpart
routines to allow *multivariate* recursive partitioning. You'd be better
off just using rpart directly. Have you tried that (i.e.
require(rpart) in a clean session, not require(mvpart) )? Does it
work then?

 , and the predictors are a
 mixture of categorical and continuous variables. I had run the algorithm
 successfully in the past (about 1.5 years ago) on a preliminary subset of
 the same dataset using a previous version of R  The current system is R
 2.8.1 running under Ubuntu Jaunty. Any ideas as to the cause?

You've not given us much to go on. Please provide either the data
(privately; I promise to use it only to work through this issue and
delete immediately thereafter) or (to the list) the output from:

str(alltrees.df)

I tried to replicate your data and it ran fine in the version of mvpart
on my linux box, so seeing what your data looks like may help.

Also provide the results of traceback() called immediately after you get
the error, eg: 

 thesis2.mvp=mvpart(bat_sp~., data=alltrees.df)
Error in all(keep) :
   unused argument(s) (c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE))
 traceback()

I can't find a call to 'all(keep)' in either the mvpart() or rpart()
functions, so without knowing where the error occurred or the means to
replicate exactly the error, our hands are tied behind our backs
somewhat.

Finally, send the output from sessionInfo() so we can see what versions
of software you are using.

HTH

 
 Josh Stumpf
 
 Eastern Michigan University
 
   [[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. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.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] install.package(TinnR) - there is no package called 'TinnR'

2009-03-24 Thread David Winsemius

Tinn-R is not an R package. It is a standalone text editor:

http://www.lmgtfy.com/?q=tinn-r


--  
David Winsemius


On Mar 24, 2009, at 7:05 AM, Martin Tomko wrote:

I have troubles make TinnR 2.2.0.2 work, it seems that the  
dependency on the package TinnR that cannot be found (I tried also  
manual downloads, but I cannot find the package anywhere on any CRAN  
mirror).


I even set a default cran mirror in the Rprofile.site file, so that  
the later command can find it:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

No luck. Even manually issuing the comand in Rterm fails, package  
‘TinnR’ is not available.
Any idea how I could make my TinnR work? I googled extensively, but  
without luck...


Thanks
Martin

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] install.package(TinnR) - there is no package called 'TinnR'

2009-03-24 Thread Martin Tomko

David,
that is not helpful. I KNOW that TinnR is a standalone editor. If you 
had a look at the Rprofile.site required by TinnR, you would notice the 
part of the code I send earlier:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

These are executed by the TinnR editor upon start. The TinnR package 
MUST therefore exist, and is required.


Hope that someone else can REALLY help.

Martin

David Winsemius wrote:

Tinn-R is not an R package. It is a standalone text editor:

http://www.lmgtfy.com/?q=tinn-r


-- David Winsemius

On Mar 24, 2009, at 7:05 AM, Martin Tomko wrote:

I have troubles make TinnR 2.2.0.2 work, it seems that the dependency 
on the package TinnR that cannot be found (I tried also manual 
downloads, but I cannot find the package anywhere on any CRAN mirror).


I even set a default cran mirror in the Rprofile.site file, so that 
the later command can find it:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

No luck. Even manually issuing the comand in Rterm fails, package 
‘TinnR’ is not available.
Any idea how I could make my TinnR work? I googled extensively, but 
without luck...


Thanks
Martin

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

2009-03-24 Thread David Winsemius

Google with rweb

--
David Winsemius

On Mar 24, 2009, at 7:06 AM, Thomas Steiner wrote:


Hi,
I'd like to execute simple commands and functions in R through a
website, is there any service like this somewhere?
I only found http://www.osvisions.com/r-online/ but it does not work
(last update 2003) and the links to releated websites only give errors
(if I calculate 7+3).
Thanks for help  hints,
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] install.package(TinnR) - there is no package called 'TinnR'

2009-03-24 Thread Richardson, Patrick
Hi Martin,

If all else fails, you could download the package from 
http://cran.r-project.org/web/packages/TinnR/index.html
and install as a .zip file from within R.

That is bizarre that R cannot find the package. I've had no problems 
downloading and installing.

Best regards,

Patrick





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Martin Tomko
Sent: Tuesday, March 24, 2009 8:25 AM
To: David Winsemius
Cc: r-help@r-project.org
Subject: Re: [R] install.package(TinnR) - there is no package called 'TinnR'

David,
that is not helpful. I KNOW that TinnR is a standalone editor. If you 
had a look at the Rprofile.site required by TinnR, you would notice the 
part of the code I send earlier:
# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

These are executed by the TinnR editor upon start. The TinnR package 
MUST therefore exist, and is required.

Hope that someone else can REALLY help.

Martin

David Winsemius wrote:
 Tinn-R is not an R package. It is a standalone text editor:

 http://www.lmgtfy.com/?q=tinn-r


 -- David Winsemius

 On Mar 24, 2009, at 7:05 AM, Martin Tomko wrote:

 I have troubles make TinnR 2.2.0.2 work, it seems that the dependency 
 on the package TinnR that cannot be found (I tried also manual 
 downloads, but I cannot find the package anywhere on any CRAN mirror).

 I even set a default cran mirror in the Rprofile.site file, so that 
 the later command can find it:
 # check necesary packages
 necessary = c('TinnR', 'svSocket')
 installed = necessary %in% installed.packages()[, 'Package']
 if (length(necessary[!installed]) =1)
 install.packages(necessary[!installed], dep=T).

 No luck. Even manually issuing the comand in Rterm fails, package 
 'TinnR' is not available.
 Any idea how I could make my TinnR work? I googled extensively, but 
 without luck...

 Thanks
 Martin

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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.
This email message, including any attachments, is for th...{{dropped:6}}

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

2009-03-24 Thread LiatL

I've built a poisson regression model for multiple subjects by using the
GLMER function. I've also developed some curves for defining its limits but
I did not succeed in developing confidence interval for the model's curve
(confint or predict does not work - only for glm).
Does anyone know how can I produce confidence interva for a glmer model?
I'll appriciate any help...
Liat
-- 
View this message in context: 
http://www.nabble.com/CONFIDENCE-INTERVAL-FOR-GLMER-MODEL-tp22677543p22677543.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] Variogram with Gstat

2009-03-24 Thread ONKELINX, Thierry
Have a look at the examples in the helpfile for variogram from the gstat
package.

data(meuse)
# no trend:
coordinates(meuse) = ~x+y
variogram(log(zinc)~1, meuse)
# residual variogram w.r.t. a linear trend:
variogram(log(zinc)~x+y, meuse)
# directional variogram:
variogram(log(zinc)~x+y, meuse, alpha=c(0,45,90,135))

# GLS residual variogram:
v = variogram(log(zinc)~x+y, meuse)
v.fit = fit.variogram(v, vgm(1, Sph, 700, 1))
v.fit
set = list(gls=1)
v
g = gstat(NULL, log-zinc, log(zinc)~x+y, meuse, model=v.fit, set =
set)
variogram(g)

if (require(rgdal)) {
  proj4string(meuse) = CRS(+init=epsg:28992)
  meuse.ll = spTransform(meuse, CRS(+proj=longlat))
# variogram of unprojected data, using great-circle distances, returning
km as units
  variogram(log(zinc) ~ 1, meuse.ll)
}

HTH,

Thierry 




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 giuseppef...@libero.it
Verzonden: dinsdag 24 maart 2009 12:45
Aan: r-help@r-project.org
Onderwerp: [R] Variogram with Gstat

Dear all can you help me? i have this problem: i have a dataset in a
text file 
in a matrix of 3 columns: x, y, z where x and y are the coordinates and
Z are 
the mesurements. How  can i do a variogram with R?

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


Re: [R] install.package(TinnR) - there is no package called 'TinnR'

2009-03-24 Thread Martin Tomko

Patrick, Romain,
thank you very much for your help!
I have found the site of the package at

http://r-forge.r-project.org/projects/tinnr/ , as Romain suggests, but when you try to download, iyou find that the package is actually not contributed to the repository, it is just a space holder for it! Patrick's 
http://cran.r-project.org/web/packages/TinnR/index.html

is better, and I will give it a try... I was just not sure abouyt the versions, 
but it seems to be a relatively recent one, so hopefully it will work.
Thanks again!
Martin




Richardson, Patrick wrote:

Hi Martin,

If all else fails, you could download the package from 
http://cran.r-project.org/web/packages/TinnR/index.html
and install as a .zip file from within R.

That is bizarre that R cannot find the package. I've had no problems 
downloading and installing.

Best regards,

Patrick





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Martin Tomko
Sent: Tuesday, March 24, 2009 8:25 AM
To: David Winsemius
Cc: r-help@r-project.org
Subject: Re: [R] install.package(TinnR) - there is no package called 'TinnR'

David,
that is not helpful. I KNOW that TinnR is a standalone editor. If you 
had a look at the Rprofile.site required by TinnR, you would notice the 
part of the code I send earlier:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

These are executed by the TinnR editor upon start. The TinnR package 
MUST therefore exist, and is required.


Hope that someone else can REALLY help.

Martin

David Winsemius wrote:
  

Tinn-R is not an R package. It is a standalone text editor:

http://www.lmgtfy.com/?q=tinn-r


-- David Winsemius

On Mar 24, 2009, at 7:05 AM, Martin Tomko wrote:


I have troubles make TinnR 2.2.0.2 work, it seems that the dependency 
on the package TinnR that cannot be found (I tried also manual 
downloads, but I cannot find the package anywhere on any CRAN mirror).


I even set a default cran mirror in the Rprofile.site file, so that 
the later command can find it:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

No luck. Even manually issuing the comand in Rterm fails, package 
'TinnR' is not available.
Any idea how I could make my TinnR work? I googled extensively, but 
without luck...


Thanks
Martin

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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.
This email message, including any attachments, is for ...{{dropped:5}}


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] install.package(TinnR) - there is no package called 'TinnR'

2009-03-24 Thread Duncan Murdoch

On 3/24/2009 7:05 AM, Martin Tomko wrote:
I have troubles make TinnR 2.2.0.2 work, it seems that the dependency on 
the package TinnR that cannot be found (I tried also manual downloads, 
but I cannot find the package anywhere on any CRAN mirror).


What R version are you using, on what platform?  I have no trouble with 
an automatic install of the TinnR package into 2.8.1 on Windows.


Duncan Murdoch



I even set a default cran mirror in the Rprofile.site file, so that the 
later command can find it:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

No luck. Even manually issuing the comand in Rterm fails, package 
‘TinnR’ is not available.
Any idea how I could make my TinnR work? I googled extensively, but 
without luck...


Thanks
Martin

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Calculating percentage Missing value for variables using one object

2009-03-24 Thread David Winsemius
It looks to me that you should be using the table or the xtabs  
function. You have apparently already decided not to use NA for  
missing values, so the instances in which variable1 ==  you should  
get counts with those functions:


dft - data.frame(var1 = sample(c(, this, that, and), 120,  
replace=TRUE),
   dt = sample( seq(as.Date(2006-01-01),  
as.Date(2007-12-31), by=months),

   120, replace=TRUE))

mo.tbl - xtabs( ~var1+ dt, data=dft)  # the == entry is the  
first row


 mo.tbl[1,]
2006-01-01 2006-02-01 2006-03-01 2006-04-01 2006-05-01 2006-06-01  
2006-07-01
 2  1  1  2  2   
3  1
2006-08-01 2006-09-01 2006-10-01 2006-11-01 2006-12-01 2007-01-01  
2007-02-01
 0  1  1  1  2   
1  2
2007-03-01 2007-04-01 2007-05-01 2007-06-01 2007-07-01 2007-08-01  
2007-09-01
 2  2  2  0  1   
3  4

2007-10-01 2007-11-01 2007-12-01
 1  3  2

x - seq(as.Date(2006-01-01), as.Date(2007-03-31), by=months)
plot(mo.tbl[1,]~x)

--
David Winsemius

On Mar 24, 2009, at 2:58 AM, Shreyasee wrote:


Hi,

I have a dataset in which there are in all 250 variables and for each
variable the data is entered over the months.
I need to calculate the percentage of missing values for each  
variable over

each month and then plot a graph for that.
I am running the following code for doing the same

*ds - read.csv(file=filepath, header=TRUE)
attach(ds)
may - length(variable1[variable1==]) / length(dos[dos==May-06])  
* 100
jun - length(variable1[variable1==]) /  
length(dos[dos==June-06]) * 100

.
.
.
var1 - c(may, jun, ...)
x - seq(as.Date(2006-01-01), as.Date(2007-03-31), by=months)
plot(var1~x)*

So likewise I am calculating the percentage of missing values for each
variable for each month using different variables and storing the  
values in

those variables and then combining those variables in one object for
plotting the graph.
I need to know, whether can I combine all the variables from that  
dataset in
one object and calculate the missing values percentage over months  
together,
instead of creating different variables for each month and then  
combining

them.
Also, after doing that, I need to plot the graph for each variable and
combine it in a single pdf file.

I highly appreciate all your help.

Thanks,
Shreyasee

[[alternative HTML version deleted]]

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


David Winsemius, 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] install.package(TinnR) - there is no package called 'TinnR' (RESOLVED)

2009-03-24 Thread Martin Tomko

Hi Duncan,
it is Win Xp with the 2.6.0 R-project version. Sorry, I should have 
included this before.
Installing the TinnR package manually from a local zip file downloaded 
from CRAN helped. I am still not sure why the package was not picked in 
the repositories. Can anyone please see if the package is visible to 
other under install packages in any repository?

Thanks
Martin


Duncan Murdoch wrote:

On 3/24/2009 7:05 AM, Martin Tomko wrote:
I have troubles make TinnR 2.2.0.2 work, it seems that the dependency 
on the package TinnR that cannot be found (I tried also manual 
downloads, but I cannot find the package anywhere on any CRAN mirror).


What R version are you using, on what platform?  I have no trouble 
with an automatic install of the TinnR package into 2.8.1 on Windows.


Duncan Murdoch



I even set a default cran mirror in the Rprofile.site file, so that 
the later command can find it:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

No luck. Even manually issuing the comand in Rterm fails, package 
‘TinnR’ is not available.
Any idea how I could make my TinnR work? I googled extensively, but 
without luck...


Thanks
Martin

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] help: what are the basis functions in {mgcv}: gam?

2009-03-24 Thread oliviax

Thank you very much. 
I have downloaded your paper.

Best regards.

Olivia


Simon Wood-4 wrote:
 
 If you can't get hold of the book, try appendix A of 
 http://www.maths.bath.ac.uk/~sw283/simon/papers/psm.pdf
 -- what's described there is the cr basis
 
 best,
 Simon
  
 
 On Tuesday 24 March 2009 05:01, oliviax wrote:
 Thanks for Andrew Robinson's suggestion.

 I am sorry that I have been looking for the book Wood (2006) Generalized
 Additive Models: Introduction with R for a long time in my univerity and
 book stores, but I failed to find one. I think it may take a long time to
 buy one from the Internet, and we are required to submit the master
 thesis
 soon...

 Could any one help me if you know other references or have knowledge
 about
 this??

 I will be very very thankful.

 Sincerely yours,
 Olivia

 oliviax wrote:
  I am writing my thesis with the function gam(), with the package
 {mgcv}.
 
  My command is: gam(y~s(x1,bs=cr)+s(x2, bs=cr)).
 
  I need help to know what are the default basis funcitons for gam. I
 have
  not found any detailed reference for this.
 
  Can anyone help me with this??
 
 -- 
 Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
 +44 1225 386603  www.maths.bath.ac.uk/~sw283
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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/help%3A-what-are-the-basis-functions-in-%7Bmgcv%7D%3A-gam--tp22673295p22679875.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] RES: Plot Means Line with Standard Deviation as Whiskers

2009-03-24 Thread Rodrigo Aluizio
Thanks for the answer, I'll take a look at these, meanwhile I forged some
data as an example of what I'll have soon.

Sam.Vol.
A1R179,40
A1R2102,09
A1R3102,09
A2R1124,78
A2R2158,81
A2R3153,13
A3R1226,87
A3R2164,48
A3R3153,13
A4R1181,49
A4R2175,82
A4R3170,15
A5R1175,82
A5R2175,82
A5R3289,25
B1R1119,10
B1R2204,18
B1R3232,54
B2R1164,48
B2R2113,43
B2R3130,45
B3R1102,09
B3R2107,76
B3R3107,76
B4R1136,12
B4R2158,81
B4R3198,51
C1R176,30
C1R270,65
C1R362,17
C2R176,30
C2R270,65
C2R373,48
C3R150,87
C3R284,78
C3R3110,21
C4R1141,79
C4R2175,82
C4R3102,09
C5R190,43
C5R2113,04
C5R3141,30
D1R162,17
D1R242,39
D1R353,69
D2R167,82
D2R267,82
D2R359,35
D4R168,06
D5R1153,13
D5R2119,10
D5R3119,10
E1R1141,79
E1R285,07
E1R3107,76
E2R1130,45
E2R2175,82
E2R3107,76
E5R1158,81
F1R151,04
F1R290,75
F1R385,07
F2R173,73
F2R268,06
F2R373,73
F3R134,03
F3R239,70
F3R339,70
F4R139,70
F4R239,70
F4R351,04
G1R190,75
G1R262,39
G2R168,06
G2R279,40
G2R385,07
G3R1158,81
G3R2158,81
G3R3158,81
G5R145,37
G5R239,70
G5R351,04
H1R145,37
H1R2102,09
H1R345,37
H2R117,01
H2R222,69
H2R322,69
H3R168,06
H3R268,06
H3R345,37
H4R151,04
H4R245,37
H4R385,07
H5R156,72
H5R279,40
H5R373,73
I1R185,07
I1R273,73
I1R368,06
I2R1141,79
I2R2119,10
I2R3119,10
I3R173,73
I4R162,39
I4R245,37
I4R373,73
I5R1204,18
I5R2158,81
I5R3181,49

-Mensagem original-
De: Peter Alspach [mailto:palsp...@hortresearch.co.nz] 
Enviada em: segunda-feira, 23 de março de 2009 19:55
Para: Rodrigo Aluizio; R Help
Assunto: RE: [R] Plot Means Line with Standard Deviation as Whiskers

Tena koe Rodrigo

You could always make up some data and then show us what you have tried to
do.  I would guess you need to check out:

plot # to do the basic plot
lines # to add lines to the plot
points # to add points to the plot
arrows # can be used to give the whiskers
apply # to get the means and standard deviations

HTH 

Peter Alspach

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Rodrigo Aluizio
 Sent: Tuesday, 24 March 2009 11:44 a.m.
 To: R Help
 Subject: [R] Plot Means Line with Standard Deviation as Whiskers
 
 Hi list members.
 
 I'll try to plot the abundance means of nine transects as 
 lines, with five points on each transect (A to I). I will 
 also need to plot for each point, it's standard deviation 
 (once each point will have tree replicates) as whiskers. 
 Another problem will be that all the points should exist for 
 each transect, but we know that six of the nine transects 
 will have blanks (A1, A2, A3, -, A5). So the line have to be 
 interrupted and can't induce an inexistent value by link A3 
 to A5 (an example).
 
  
 
 Well, unfortunately I still don't have the data, I'm just 
 anticipating a future situation, and I can't find any clear 
 suggestion by googling the issue, and I guess the help 
 files may have something but I was unable to find by myself.
 
  
 
 Thanks in advance. Any help will be appreciated.
 
  
 
 -
 
 MSc.  mailto:r.alui...@gmail.com Rodrigo Aluizio
 
 Centro de Estudos do Mar/UFPR
 Laboratório de Micropaleontologia
 Avenida Beira Mar s/n - CEP 83255-000
 Pontal do Paraná - PR - Brasil
 Fone: (0**41) 3455-3620 ramal 217
 Fax: (0**41) 3455-3623
 
 
 
 
   [[alternative HTML version deleted]]
 
 

The contents of this e-mail are confidential and may be ...{{dropped:15}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] install.package(TinnR) - there is no package called 'TinnR' (RESOLVED)

2009-03-24 Thread Uwe Ligges



Martin Tomko wrote:

Hi Duncan,
it is Win Xp with the 2.6.0 R-project version. Sorry, I should have 
included this before.
Installing the TinnR package manually from a local zip file downloaded 
from CRAN helped. I am still not sure why the package was not picked in 
the repositories. Can anyone please see if the package is visible to 
other under install packages in any repository?


Please upgrade to a recent version of R! We do not build binary packages 
for completely out of date versions of R.


Uwe Ligges



Thanks
Martin


Duncan Murdoch wrote:

On 3/24/2009 7:05 AM, Martin Tomko wrote:
I have troubles make TinnR 2.2.0.2 work, it seems that the dependency 
on the package TinnR that cannot be found (I tried also manual 
downloads, but I cannot find the package anywhere on any CRAN mirror).


What R version are you using, on what platform?  I have no trouble 
with an automatic install of the TinnR package into 2.8.1 on Windows.


Duncan Murdoch



I even set a default cran mirror in the Rprofile.site file, so that 
the later command can find it:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

No luck. Even manually issuing the comand in Rterm fails, package 
‘TinnR’ is not available.
Any idea how I could make my TinnR work? I googled extensively, but 
without luck...


Thanks
Martin

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

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






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

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


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


Re: [R] CONFIDENCE INTERVAL FOR GLMER MODEL

2009-03-24 Thread Douglas Bates
On Tue, Mar 24, 2009 at 5:25 AM, LiatL liat.lam...@gmail.com wrote:

 I've built a poisson regression model for multiple subjects by using the
 GLMER function. I've also developed some curves for defining its limits but
 I did not succeed in developing confidence interval for the model's curve
 (confint or predict does not work - only for glm).
 Does anyone know how can I produce confidence interva for a glmer model?
 I'll appriciate any help...

You would need to be more explicit about what you mean by the model's
curve and what the confidence interval would represent, in the sense
of what components of the variability would be incorporated in the
confidence interval, before we could answer such a question.

May I suggest that the discussion be moved to the
r-sig-mixed-mod...@r-project.org mailing list, which I have cc:d on
this reply?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Calculating percentage Missing value for variables using one object

2009-03-24 Thread Gabor Grothendieck
Read in the data, aggregate it by month and
then turn it into a monthly zoo object and plot
using a custom X axis:

Lines - 'dos,variable1,variable2
May-06,1,
May-06,2,
June-06,,2
June-06,1,4
July-06,1,4
July-06,1,4
August-06,1,4
August-06,1,4'
DF - read.table(textConnection(Lines), header = TRUE, sep = ,)

library(zoo)
DF.na - aggregate(DF[-1], DF[dos], function(x) mean(is.na(x)))

z - zoo(as.matrix(DF.na[-1]), as.yearmon(DF.na$dos, %B-%y))

i - 1
plot(z[,i], xaxt = n, ylab = Fraction Missing, main = names(DF)[i+1])
axis(1, time(z), format(time(z), %m/%y), cex.axis = .7)


On Tue, Mar 24, 2009 at 2:58 AM, Shreyasee shreyasee.prad...@gmail.com wrote:
 Hi,

 I have a dataset in which there are in all 250 variables and for each
 variable the data is entered over the months.
 I need to calculate the percentage of missing values for each variable over
 each month and then plot a graph for that.
 I am running the following code for doing the same

 *ds - read.csv(file=filepath, header=TRUE)
 attach(ds)
 may - length(variable1[variable1==]) / length(dos[dos==May-06]) * 100
 jun - length(variable1[variable1==]) / length(dos[dos==June-06]) * 100
 .
 .
 .
 var1 - c(may, jun, ...)
 x - seq(as.Date(2006-01-01), as.Date(2007-03-31), by=months)
 plot(var1~x)*

 So likewise I am calculating the percentage of missing values for each
 variable for each month using different variables and storing the values in
 those variables and then combining those variables in one object for
 plotting the graph.
 I need to know, whether can I combine all the variables from that dataset in
 one object and calculate the missing values percentage over months together,
 instead of creating different variables for each month and then combining
 them.
 Also, after doing that, I need to plot the graph for each variable and
 combine it in a single pdf file.

 I highly appreciate all your help.

 Thanks,
 Shreyasee

        [[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] install.package(TinnR) - there is no package called 'TinnR' (RESOLVED)

2009-03-24 Thread Duncan Murdoch

On 3/24/2009 8:55 AM, Martin Tomko wrote:

Hi Duncan,
it is Win Xp with the 2.6.0 R-project version. Sorry, I should have 
included this before.
Installing the TinnR package manually from a local zip file downloaded 
from CRAN helped. I am still not sure why the package was not picked in 
the repositories. Can anyone please see if the package is visible to 
other under install packages in any repository?


Your version of R is too old.  TinnR was last updated in February this 
year and claims to support 2.6.0, but CRAN no longer builds binaries for 
2.6.x.  (Version 2.6.0 became obsolete in November 2007 when 2.6.1 was 
released, and binaries for the 2.6.x series stopped being built sometime 
last year.)


If you are set up for installing from source, you could try downloading 
the source package


http://cran.r-project.org/src/contrib/TinnR_1.0.3.tar.gz

and running

Rcmd INSTALL TinnR_1.0.3.tar.gz

but it is probably easier to update your R to the current release.

Duncan Murdoch


Thanks
Martin


Duncan Murdoch wrote:

On 3/24/2009 7:05 AM, Martin Tomko wrote:
I have troubles make TinnR 2.2.0.2 work, it seems that the dependency 
on the package TinnR that cannot be found (I tried also manual 
downloads, but I cannot find the package anywhere on any CRAN mirror).


What R version are you using, on what platform?  I have no trouble 
with an automatic install of the TinnR package into 2.8.1 on Windows.


Duncan Murdoch



I even set a default cran mirror in the Rprofile.site file, so that 
the later command can find it:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

No luck. Even manually issuing the comand in Rterm fails, package 
‘TinnR’ is not available.
Any idea how I could make my TinnR work? I googled extensively, but 
without luck...


Thanks
Martin

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

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






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


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


Re: [R] install.package(TinnR) - there is no package called 'TinnR' (RESOLVED)

2009-03-24 Thread Martin Tomko
Yes, will do. I just was not in need to upgrade as everything worked... 
An R is not my primary development environment - i.e., I need it a 
couple of times a year.

But you are right, it is good to be on an updated version.
Cheers
Martin

Duncan Murdoch wrote:

On 3/24/2009 8:55 AM, Martin Tomko wrote:

Hi Duncan,
it is Win Xp with the 2.6.0 R-project version. Sorry, I should have 
included this before.
Installing the TinnR package manually from a local zip file 
downloaded from CRAN helped. I am still not sure why the package was 
not picked in the repositories. Can anyone please see if the package 
is visible to other under install packages in any repository?


Your version of R is too old.  TinnR was last updated in February this 
year and claims to support 2.6.0, but CRAN no longer builds binaries 
for 2.6.x.  (Version 2.6.0 became obsolete in November 2007 when 2.6.1 
was released, and binaries for the 2.6.x series stopped being built 
sometime last year.)


If you are set up for installing from source, you could try 
downloading the source package


http://cran.r-project.org/src/contrib/TinnR_1.0.3.tar.gz

and running

Rcmd INSTALL TinnR_1.0.3.tar.gz

but it is probably easier to update your R to the current release.

Duncan Murdoch


Thanks
Martin


Duncan Murdoch wrote:

On 3/24/2009 7:05 AM, Martin Tomko wrote:
I have troubles make TinnR 2.2.0.2 work, it seems that the 
dependency on the package TinnR that cannot be found (I tried also 
manual downloads, but I cannot find the package anywhere on any 
CRAN mirror).


What R version are you using, on what platform?  I have no trouble 
with an automatic install of the TinnR package into 2.8.1 on Windows.


Duncan Murdoch



I even set a default cran mirror in the Rprofile.site file, so that 
the later command can find it:

# check necesary packages
necessary = c('TinnR', 'svSocket')
installed = necessary %in% installed.packages()[, 'Package']
if (length(necessary[!installed]) =1)
install.packages(necessary[!installed], dep=T).

No luck. Even manually issuing the comand in Rterm fails, package 
‘TinnR’ is not available.
Any idea how I could make my TinnR work? I googled extensively, but 
without luck...


Thanks
Martin

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

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






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

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






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


Re: [R] Barplot With Selected X-Axis Region

2009-03-24 Thread Uwe Ligges



Gundala Viswanath wrote:

Dear all,

I have a data that looks like this:


print(dat)

 V1   V2
1 -43342073   14
2 -433377304
3 -432846761

11372  75188572   11
11373  752061656
11374  75262720   24


What I want to do is to have a barplot where x-axis
is taken from V1 and y-axis taken from V2.

But I only want to plot the those region where V1 = -500
and = 500.

But some how this snippet doesn't seem to work:


xlim = c(-500,500)
barplot(as.matrix(dat[dat$V1 = -500  dat$V1 
=500,dat$V2]),xlim=xlim,axes=TRUE, main =nm);


You need to change

dat$V1 = -500  dat$V1 =500

to

dat$V1 = -500  dat$V1 =500

and read about the difference between  and .


So probably you want something like:

  subsetdat - dat[dat$V1 = -500  dat$V1 =500,]
  barplot(subsetdat$V2, names.arg=subsetdat$V1)

Uwe Ligges







What's wrong with my approach.

So yes, I do want the V1 information, hence I am aware that
I dont' want:


plot(hist(dat[dat =-500  dat =500]))


- Gundala Viswanath
Jakarta - Indonesia

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Do we have to control for block in block designs if it is insignificant?

2009-03-24 Thread J S


 

I am wondering if in a block experimental design (ex. triple square lattice), 
the block effect was not significant, is it all right not to include the block 
effect in an empirical model (even though the sampling was done from different 
blocks)? Or we are forced to control for the block effect in block designs 
anyway?
 
Thanks,
Julia
 

_
Internet Explorer 8 – Now Available. Faster, safer, easier.

[[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 find the path or the current file?

2009-03-24 Thread Marie Sivertsen
Thank you Gabor and Duncan for your replys.

Mvh.
Marie


On Tue, Mar 24, 2009 at 1:00 PM, Gabor Grothendieck ggrothendi...@gmail.com
 wrote:

 See:

 https://stat.ethz.ch/pipermail/r-help/2009-January/184745.html

 On Tue, Mar 24, 2009 at 7:16 AM, Marie Sivertsen mariesiv...@gmail.com
 wrote:
  Dear useRs,
 
  I have a collection of source file and some of these call others.  The
 files
  are distribute among a number of directories, and to know how to call
 some
  other file they need to know what file is currently executed.
 
  As example, I have a file 'search.R' located in directory 'bin' which
 needs
  to access the file 'terms.conf' located in the directory 'conf', a
 sibling
  of 'bin'.  I can have somethings like readLines('../conf/terms.conf') in
  search.R, but this work only if search.R is executed from bin, when getwd
 is
  'bin'.  But when search.R calls from the parent as bin/search.R or any
 other
  derectory then R complains that it could not find the file
  '../conf/terms.conf'.
 
  So my questions is:  how can the file search.R, when executied, discover
 its
  own location and load terms.conf from location of
  search.R/../conf/terms.conf?  the location of search.R can be unrelated
 to
  the current directory.
 
  Mvh.
  Marie
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


[[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] as.list cannot handle an environment

2009-03-24 Thread Wacek Kusnierczyk
?as.list states that as.list can be used with environments as arguments
(what is referred to there as the 'environment method for as.list). 
indeed,

e = globalenv()
as.list(e)
# $e
# environment: R_GlobalEnv

however, it seems to have problems with environment objects with a class
attribute:

e = structure(globalenv(), class='foo')
as.list(e)
# Error in as.vector(x, list) :
#  cannot coerce type 'environment' to vector of type 'list'

the error message is misleading.  instead of complaining about the class
'foo', it says that as.list cannot coerce an environment to a list,
which is nonsense, since this is precisely what it does in the first
example above, and what is also clear from ?as.list:


 The 'environment' method for 'as.list' copies the name-value
 pairs (for names not beginning with a dot) from an environment to
 a named list.


a different error message might be more appropriate.

vQ

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

2009-03-24 Thread Steve_Friedman

Hello.

I'm working on a windows XP machine with R 2.8.1


I'm working with lattice and I don't understand how to set the size of the
text for the labels.  Can anyone suggest a solution?

 I'm establishing a melted dataframe first and then setting a key and
calling the plot  as follows;

  key.variable - list(space = right, text =
list(levels(wbirdm$variable)), points = list(pch = 1:3, col=c(1:9)))

 dotplot(wbirdm$value  ~ wbirdm$variable | wbirdm$Region, col=c(1:9), pch=
rep(c(1:3), key = key.variable,  groups=wbirdm$variable, ylab= Mean HSI))

This works pretty well, with the exception that the size of x axis labels
is too large.  Also, the key does not appear.

I do appreciate all of the help this group provides.

Thanks


Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

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


[R] using residuals of binomial GLM

2009-03-24 Thread Yuval Sapir

Hi all,
This is more a question in statistics, but I hope to get also the R 
practice for my question:
I have an ancova model where the response variable is flowering (plant 
has a flower = 1, no flower = 0). The explanatory variables are leaf 
length, leaf thick (both continuous variables), and soil type (factorial 
with three levels):

 model-glm(flower~(thick+length)*soil,family=binomial)
summary(aov(model))
In the aov summary I find a significant effect of all variables, and a 
significant interaction between thick and soil, so I want to explore 
this interaction after cleaning the effect of length. I thought of two 
possible ways to extract the residuals:

 res.thick-resid(update(model,~.-thick-soil-thick:soil))
or:
 res.thick-resid(glm(flower~length+length:soil,family=binomial))
I validated that the two methods give the same results. Anyhow, now I 
want to compare the effect of thick on flowering probability,separately 
for each soil. But the residuals extracted are not 0 or 1 anymore.  
Linear glm, such as

 model1-glm(res.thick1~thick*soil)
doesn't seem to be right, and, moreover, I am interested in the 
estimated coefficients and their interpretation (say - plotting a 
meaningful graph). How can I get a logistic regression from residuals? 
Do I NEED logistic regression? How should I understand the coefficients 
I get in summary of the residuals model? How can I use the results of 
the residuals model for plotting the separate lines for the probability 
(logistic) curve?

Thanks in advance
Yuval

--
Yuval Sapir, PhD
Porter School of Environmental Studies
Dept. of Plant Sciences
Tel Aviv University, Tel Aviv, 69978 Israel
Mobile:054-7203140; Lab: 03-6405877

http://www.yeruka.org.il/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Random sampling based on the observations

2009-03-24 Thread Arup

Thank you Adrian. Its working.Thank you so much. Take care =^D=)

Cheers

Arup Pramanik
Business Analyst
Redwood Associates
Bangalore,India.



Adrian Dusa wrote:
 
 On Tuesday 24 March 2009, you wrote:
 Hello!I am having a problem with Random sampling in R. I have used a
 syntax: mydata.sub=sample(mydata,7,replace=FALSE,prob=NULL) which allows
 me
 to choose a random sample based on the variables(correct me if I am
 wrong!).
 
 Actually, no.
 You are sampling from a vector, and where you're using the sampled values
 (on 
 the rows or on the variables) is up to you.
 
 Let's say we have a dataset with 100 cases and 10 variables:
 
 Case 1:
 mydata.sub - mydata[ , sample(10, 7)]
 
 This will sample 7 variables out of 10.
 
 Case 2:
 mydata.sub - mydata[sample(100, 10), ]
 
 This will sample 10 cases out of 100.
 
 Suppose I have 10 variable and if I use the above mentioned
 command then it will choose 7 variables out of the 10 randomly. My
 problem
 is that I want to have a random sample which is not based on the
 variables
 but on the values of the variables that is the random sample will be
 based
 on the observations. It will be great if someone can help me out me out
 with
 a proper syntax. Thanks in Advance.
 
 I think you need to read the help for:
 ?[
 
 and most probably one of the introductory books for R.
 I hope this helps,
 Adrian
 
 
 -- 
 Adrian Dusa
 Romanian Social Data Archive
 1, Schitu Magureanu Bd.
 050025 Bucharest sector 5
 Romania
 Tel.:+40 21 3126618 \
  +40 21 3120210 / int.101
 Fax: +40 21 3158391
 
 
   [[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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Random-sampling-based-on-the-observations-tp22673975p22681075.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] Has someone connected R with ITK?

2009-03-24 Thread Brandon . J . Whitcher
Dear R users,

I am curious to know if someone has connected R with the Insight 
Segmentation and Registration Toolkit (www.itk.org).  From the website...

ITK is an open-source, cross-platform system that provides developers with 
an extensive suite of software tools for image analysis. 
Developed through extreme programming methodologies, ITK employs 
leading-edge algorithms for registering and segmenting multidimensional 
data.

A project already exists to provide a matlab-based interface to ITK at 
Simon Fraser University (matitk.cs.sfu.ca), but I would prefer a 100% 
open-source platform.  Searching through the R-site and R-help produced 
zero hits, so I assume it has not been attempted or at least not announced 
anywhere. 

If anyone would be interested in participating in such an endeavour, 
please feel free to contact me.

cheers...

Brandon


---
This e-mail was sent by GlaxoSmithKline Services Unlimited 
(registered in England and Wales No. 1047315), which is a 
member of the GlaxoSmithKline group of companies. The 
registered address of GlaxoSmithKline Services Unlimited 
is 980 Great West Road, Brentford, Middlesex TW8 9GS.
---

[[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] Odp: error statement: missing value where TRUE/FALSE needed

2009-03-24 Thread Petr PIKAL
Hi


r-help-boun...@r-project.org napsal dne 23.03.2009 15:38:49:

 Hi list,
 
 I want to try Gibbs sampling as a method of estimating a 
markov-switching 
 model of a mean-deviating, pth-order autoregressive process with time 
 varying transition probabilities via R and am using a code originally 
 written by another person; I attach the useful pdf document explaining 
the 
 code. When I run the code, I get an error message:
 
 Error in if (r  vQ[i]) { : missing value where TRUE/FALSE needed
 
 I am using R.2.6.0 on Windows XP. Can anyone tell me what the error 
message 
 means?

The error message means that there is missing value instead of logical 
when you are calling if

 a-NA
 b-1
 ab
[1] NA
 if(ab) print(No.way)
Error in if (a  b) print(No.way) : 
  missing value where TRUE/FALSE needed
 a-0
 if(ab) print(No.way)
[1] No.way

So test r and vQ if they contain missing values or change your code

Besides, it looks like code written in Basic not in R

Few other comments

* read.table() already produce data frame

* This is really strange, I did not see such construction yet

 mG0 -rbind(cbind(100,0,0,0), cbind(0,100,0,0), cbind(0,0,100,0), 
cbind(0,0,0,100))

what about

 x-matrix(0, 4,4)
 diag(x)-100
 x
 [,1] [,2] [,3] [,4]
[1,]  100000
[2,]0  10000
[3,]00  1000
[4,]000  100

* Better upgrade to 2.8.1, or maybe wait about a month for 2.9.0

* I do not think that somebody will go through whole your code, it is 
terribly complicated.

Regards
Petr



 
 The specific line in the code is:
 
 if (rvQ[i]){ vS[i]=0 } else vS[i]=1 
 
 The code is available at: 
 http://www.michael-curran.com/gibbs.html
 and the two data sets are available at:
 http://www.geocities.jp/atsmatsumoto/ci.txt
 and
 http://www.geocities.jp/atsmatsumoto/callrate.txt
 
 Note: I saved the first data set as ci.txt and the second as boj.txt and 
so 
 these are the file names that the code loads. If anyone uses the code 
and 
 the data and manages to get it to work, I would gratefully appreciate if 

 they could tell me what adjustments they made to the code in order to do 

 so.
 
 Kind regards,
 
 Michael
 -- 
 Michael Curran
 Candidate for the MPhil in Economics
 Cambridge University
 http://www.michael-curran.com/
 
 
 
 [příloha gibbsms-1.pdf odstraněna uživatelem Petr PIKAL/CTCAP] 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Do we have to control for block in block designs if it is insignificant?

2009-03-24 Thread Liaw, Andy
The short answer is no (meaning to leave the blocks in the model).  As
Frank Harrell said, you've spent your degrees of freedom.  Go home and
be happy.

Best,
Andy 

From: J S
 Sent: Tuesday, March 24, 2009 9:49 AM
 To: r-help@r-project.org
 Subject: [R] Do we have to control for block in block designs 
 if it is insignificant?
 
 
 
  
 
 I am wondering if in a block experimental design (ex. triple 
 square lattice), the block effect was not significant, is it 
 all right not to include the block effect in an empirical 
 model (even though the sampling was done from different 
 blocks)? Or we are forced to control for the block effect in 
 block designs anyway?
  
 Thanks,
 Julia
  
 
 _
 Internet Explorer 8 - Now Available. Faster, safer, easier.
 
   [[alternative HTML version deleted]]
 
 
Notice:  This e-mail message, together with any attachme...{{dropped:12}}

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

2009-03-24 Thread Xin Shi
Dear:

I try to do the trend.test {pastecs} for a subset data. Anyone have this
experience?

Many thanks!

Xin 




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

2009-03-24 Thread MarcioRibeiro

Hi listers,
I would like to do a graphic of the power function of the Hotteling test
(T2).
T2~F(p,n-p;lambda), lambda is my paremeter of non-centrality.
So I would like to do a graphic of the power of the test as a function of
the parameter lambda. I also would like to define lambda varying between
0.05 and 1.
I am really not sure if the way that I am doing the graphic is the best
methodology.
I am working on this code...
N-20
p-3
alpha-0.05
mean0-matrix(c(0,0,0),nrow=3,ncol=1,byrow=TRUE)
mean1-matrix(c(0,1,0),nrow=3,ncol=1,byrow=TRUE)
sigma-matrix(c(1,0.2,-0.8,0.2,1,0.4,-0.8,0.4,1),nrow=3,ncol=3,byrow=TRUE)
T2-N*(t((mean1-mean0))%*%solve(sigma)%*%(mean1-mean0))
lambda-N*(t((mean1-mean0))%*%solve(sigma)%*%(mean1-mean0))/2
critique-qf(1-alpha,3,17)#critique ~ Fp,n-p(α)
beta-1-pf(critique,p,n-p,ncp=lambda)
beta

beta1-c(rep(0,112))
lambda1-c(1:112)
for (i in 1:112){
beta1[i]-1-pf(critique,p,N-p,ncp=lambda1[i])
}
if (0.05beta11){
plot(beta1,pch=.)
}

Thanks,
Marcio
-- 
View this message in context: 
http://www.nabble.com/Hotteling-Test-tp22682412p22682412.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 find the path or the current file?

2009-03-24 Thread William Dunlap
I sometimes deal with this problem by putting all the
scripts into a package (in the inst/ directory if they
don't fit elsewhere, perhaps in demo/) and then have
them all use system.file(package=myPkg,...) to locate
the related files.  E.g.,
terms.conf - system.file(package=myPkg,conf,terms.conf)
if (terms.conf==)
 stop(Cannot find  , file.path(conf,terms.conf),  in
package , myPkg)
source(terms.conf)

(It would be nice if system.file itself had an option
to halt if no file could be found but one can write a wrapper
for that.)

Putting all the scripts in a package also makes them easier
to deploy on other machines.  By using the Depends: line
in the DESCRIPTION file you can arrange for packages to
have a core set of scripts available in a standard place.

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


[R] How to find the path or the current file?

Marie Sivertsen mariesivert at gmail.com 
Tue Mar 24 12:16:22 CET 2009

Dear useRs,

I have a collection of source file and some of these call others.  The
files
are distribute among a number of directories, and to know how to call
some
other file they need to know what file is currently executed.

As example, I have a file 'search.R' located in directory 'bin' which
needs
to access the file 'terms.conf' located in the directory 'conf', a
sibling
of 'bin'.  I can have somethings like readLines('../conf/terms.conf') in
search.R, but this work only if search.R is executed from bin, when
getwd is
'bin'.  But when search.R calls from the parent as bin/search.R or any
other
derectory then R complains that it could not find the file
'../conf/terms.conf'.

So my questions is:  how can the file search.R, when executied, discover
its
own location and load terms.conf from location of
search.R/../conf/terms.conf?  the location of search.R can be unrelated
to
the current directory.

Mvh.
Marie

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

2009-03-24 Thread David Winsemius
That question seems too vague to be answered. There should be no  
problem in doing such. Do you have a problem that you are encountering?


--
David Winsemius
On Mar 24, 2009, at 10:52 AM, Xin Shi wrote:


Dear:

I try to do the trend.test {pastecs} for a subset data. Anyone have  
this

experience?

Many thanks!

Xin




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] confidence interval or error of x intercept of a linear

2009-03-24 Thread Peter Dalgaard
(Ted Harding) wrote:
 On 24-Mar-09 03:31:32, Kevin J Emerson wrote:
...
 When I have time for it (not today) I'll see if I can implement
 this neatly in R. It's basically a question of solving
 
   (N-2)*(1 - R(X0))/R(X0) = qf(P,1,(N-1))
 
 for X0 (two solutions, maybe one, if any exist). 
etc.

A quick and probably not-too-dirty way is to rewrite it as a nonlinear
model:

x - 1:10
Y - 2*x - 3 + rnorm(10, sd=.1)
cf - coef(lm(Y~x))
confint(nls(Y~beta*(x-x0), start=c(beta=cf[[2]],x0=-cf[[1]]/cf[[2]])))




-- 
   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] R: how to estimate multidimensional spectral measure of coherence

2009-03-24 Thread stephen sefick
Look at the function wco to see if you can use it.  I don't have R on
my work computer right now to test and see, but AI think you could
look at this.  I don't know what a slidding window is, but wavelets
are time localized so I don't think this would be a problem.  Also,
you could easily slide the time series with lag.  I don't know if this
helps.

stephen sefick

On Mon, Mar 23, 2009 at 11:22 AM,  mau...@alice.it wrote:
 Does it work on a sliding window ? Does it estimate the cospectrum (the real
 part) and the quadrature spectrum (complex), the coherence squared, and the
 phase difference between two vector time series ?
 SOme time ago I started to read its author's thesis. It seemed to me
 strictly tailored on the specific problems he studied more than a wider
 purpose toolkit.

 Maura

 have you tried sowas?  I know you had talked about it, but it may do
 what you want.  I have used it for the wavelet cross spectrum.

 On Mon, Mar 23, 2009 at 9:47 AM,  mau...@alice.it wrote:
 Please, does anyone know of an R packge to estimate multidimensional
 spectral measure of coherence within a moving time window ?
 Some time ago I expeimented with a similar package that performs Cross
 Spectrum Analysis on the whole signal though.
 Unluckily I deal with non-stationary signals whose properties change along
 with time. Therefore estimates can only be made over time periods
 roughly proportional to the reciprocal of the rate at which properties are
 changing.
 Thank you very much.
 Maura


 tutti i telefonini TIM!


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




 --
 Stephen Sefick

 Let's not spend our time and resources thinking about things that are
 so little or so large that all they really do for us is puff us up and
 make us feel like gods.  We are mammals, and have not exhausted the
 annoying little problems of being mammals.

                                 -K. Mullis



 Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e
 tutti i telefonini TIM!
 Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

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


Re: [R] r online

2009-03-24 Thread j verzani
Dirk Eddelbuettel edd at debian.org writes:

 
 
 On 24 March 2009 at 12:06, Thomas Steiner wrote:
 | Hi,
 | I'd like to execute simple commands and functions in R through a
 | website, is there any service like this somewhere?
 | I only found http://www.osvisions.com/r-online/ but it does not work
 | (last update 2003) and the links to releated websites only give errors
 | (if I calculate 7+3).
 | Thanks for help  hints,
 
 Please read the R FAQ which has an entire section devoted to this that I
 include below, copied and pasted from the txt version of the R
 FAQ. Personally, I'd go with Rpad.


To add to the FAQ that Dirk quotes:

The Sage project has an online notebook server at sagenb.org that allows one
to use numerous open source math programs including R. Sage can be installed
locally as well. (The R feature seems to be broken at the moment though, but it
does work on a local install.)

The gWidgetsWWW package (needs testing still) provides an interface to Rpad that
you could use to quickly create a web page to interpret R commands, e.g. the
simplistic http://www.math.csi.cuny.edu/gWidgetsWWW/ex-cli.html. However,
graphics are easier done using Rpad, than gWidgetsWWW.

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

2009-03-24 Thread Douglas M. Hultstrand

Hello,

I am using the lm to fit a linear model to data, I was wondering if 
there is a way to display the equation on a plot using the extracted lm 
coefficients?  I am using the plot() function to create the plot/.png.


Example:
lm_mod - lm(data1~data2)

intercept = 48.54
slope = 0.4856

I want to display equation on a plot as y=0.4856x+48.54

Any thoughts or suggestions are appreciated.

Thanks,
Doug

--
-
Douglas M. Hultstrand, MS
Senior Hydrometeorologist
Metstat, Inc. Windsor, Colorado
voice: 970.686.1253
email: dmhul...@metstat.com
web: http://www.metstat.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] Display Equation on plot

2009-03-24 Thread Uwe Ligges



Douglas M. Hultstrand wrote:

Hello,

I am using the lm to fit a linear model to data, I was wondering if 
there is a way to display the equation on a plot using the extracted lm 
coefficients?  I am using the plot() function to create the plot/.png.


Example:
lm_mod - lm(data1~data2)

intercept = 48.54
slope = 0.4856

I want to display equation on a plot as y=0.4856x+48.54

Any thoughts or suggestions are appreciated.



See ?abline:
abline(lm_mod)

Uwe Ligges





Thanks,
Doug



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] no snowfall on debian after lenny upgrade

2009-03-24 Thread Martin Renner
I feel like I've tried the works on something that should be obvious  
but I'm stuck. Package snowfall used to run just great under debian  
etch (amd-64, 2x quad-core). After upgrading to lenny (debian 5,  
reinstalled from scratch), I haven't been able to get snowfall running  
again. Password-less ssh works fine to localhost, its IP, or zero- 
config name. But when calling sfInit I invariably get this error  
message below. What puzzles me is that ssh localhost works without a  
hitch but the socket connection fails. Any suggestions would be  
greatly appreciated.


Best,
Martin


Error in socketConnection(port = port, server = TRUE, blocking =  
TRUE,  :

  cannot open the connection
In addition: Warning message:
In socketConnection(port = port, server = TRUE, blocking = TRUE,  :
  port 10187 cannot be opened
Error in sfInit() :
  Starting of snow cluster failed! Error in socketConnection(port =  
port, server = TRUE, blocking = TRUE,  :

  cannot open the connection
 Error in socketConnection(port = port, server = TRUE, blocking =  
TRUE,  :

  cannot open the connection
Calls: source - eval.with.vis - eval.with.vis - sfInit
Execution halted

I've tried this with the stable debian version of R (2.7.1) as well as  
compiled from R-2.8.1 (with current snowfall) and the latest from sid  
(see below).


platform   x86_64-pc-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status alpha
major  2
minor  9.0
year   2009
month  03
day20
svn rev48169
language   R
version.string R version 2.9.0 alpha (2009-03-20 r48169)



Martin Renner   Postdoctoral Fellow
School of Aquatic and Fishery Sciences  University of Washington
Seattle, WA 98195-5020, USA

current address:
Alaska Maritime NWR 
Homer, AK 99603, USA

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


Re: [R] Display Equation on plot

2009-03-24 Thread Duncan Murdoch

On 3/24/2009 12:50 PM, Douglas M. Hultstrand wrote:

Hello,

I am using the lm to fit a linear model to data, I was wondering if 
there is a way to display the equation on a plot using the extracted lm 
coefficients?  I am using the plot() function to create the plot/.png.


Example:
lm_mod - lm(data1~data2)

intercept = 48.54
slope = 0.4856

I want to display equation on a plot as y=0.4856x+48.54


mtext(bquote( y == .(slope) * x + .(intercept)), side=1, line=4)

will put it in the bottom margin.  Use text() with appropriate 
coordinates to put it in the plot area instead.


Duncan Murdoch



Any thoughts or suggestions are appreciated.

Thanks,
Doug



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

2009-03-24 Thread Matthieu Dubois
Douglas M. Hultstrand dmhultst at metstat.com writes:

 
 Hello,
 
 I am using the lm to fit a linear model to data, I was wondering if 
 there is a way to display the equation on a plot using the extracted lm 
 coefficients?  I am using the plot() function to create the plot/.png.
 
 Example:
 lm_mod - lm(data1~data2)
 
 intercept = 48.54
 slope = 0.4856
 
 I want to display equation on a plot as y=0.4856x+48.54

see ?bquote for building the equation expression
and ?mtext to display text within margins

e.g.
# generate random x and y values
x - rnorm(100)
y - 3*x+15 + rnorm(x)

lm_mod - lm(y ~ x)

plot(x, y)
abline(lm_mod) # add regression line to the plot

lm_coef - round(coef(lm_mod), 3) # extract coefficients
mtext(bquote(y == .(lm_coef[2])*x + .(lm_coef[1])), 
adj=1, padj=0) # display equation

regards, 

Matthieu

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

2009-03-24 Thread Gregoire Pau

Hello,

How can I test in R whether a file is a symbolic link or not ? I haven't 
found anything relevant in R-help but I may be wrong.

Thanks !

Greg
---
Gregoire Pau
Research Officer
EMBL Heidelberg, Germany
http://www.ebi.ac.uk/~gpau/

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

2009-03-24 Thread Arafat Ud Zaman
Dear sir,
I want to know about R command for parameter estimation for generalized
Poisson regression.

yours faithfully

Arafat Ud Zaman
4th year(Hons)
Applied statistics
University of Dhaka
Mob- +8801715173176
E-mail: arafat.za...@yahoo.com
  azam...@isrt.ac.bd
  azam...@quantummethod.org.bd

[[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] Workspace Image

2009-03-24 Thread Yikan Liu
Hello,
 
I'm wondering how to delete previously saved workspace in R. Thank you.
 
 
Regards,
Yikan Liu

[[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] Why na.rm=FALSE is the default

2009-03-24 Thread Adam D. I. Kramer

Dear Colleagues,

I've been searching for a post or article or something which
explains why having na.rm=FALSE or na.action=na.fail as the default is a
better choice than TRUE or na.omit.

I understand the basic argument: it does not make sense to average a
nonexistance into an aggregate, and removing them implicitly leads to
accidental pairwise deletion in some cases, and sum(x) / length(x)  mean(x)
(which many would find disturbing)...I'm just looking for a source to cite
on this issue to support mimicking R's behavior in a database system's
aggregating functions (sum, avg, var, etc.).

Cordially,
Adam Kramer
Ph.D. Candidate, Social Psychology
University of Oregon
adik at uoregon dot edu

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

2009-03-24 Thread Rob Denniker
Not 100% sure what you are looking for, but have a look at the Generalized 
Event Count model in the Zelig package. It will also let you fit a Poisson and 
other event count models by MLE. 

 -Original Message-
 From: azam...@isrt.ac.bd
 Sent: Tue, 24 Mar 2009 23:26:59 +0600
 To: r-help@r-project.org
 Subject: [R] generalized Poisson regression
 
 Dear sir,
 I want to know about R command for parameter estimation for generalized
 Poisson regression.
 
 yours faithfully
 
 Arafat Ud Zaman
 4th year(Hons)
 Applied statistics
 University of Dhaka
 Mob- +8801715173176
 E-mail: arafat.za...@yahoo.com
   azam...@isrt.ac.bd
   azam...@quantummethod.org.bd
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
Check it out at http://www.inbox.com/earth

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

2009-03-24 Thread CE.KA

Hi R users,
I have a big program
So in Rgui I can t see all the execution of it
Is there a way to ask R if there is Errors in my program
Sincerely yours
-- 
View this message in context: 
http://www.nabble.com/Search-%22Errors%22-tp22687080p22687080.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] Workspace Image

2009-03-24 Thread Dieter Menne
Yikan Liu u4297812 at anu.edu.au writes:

 
 I'm wondering how to delete previously saved workspace in R.

file.remove(mywork.rdata)

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Summarizing each row into a frequency table

2009-03-24 Thread William Dunlap
Have you tried
   table(row(m), m)
?   If there is a chance that m doesn't have
at least 1 of each of c(-1,0,1) then force them
into the table with
   table(row(m), factor(m, levels=c(-1,0,1)))

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


[R] Summarizing each row into a frequency table

Daren Tan darentan76 at gmail.com 
Tue Mar 24 01:46:21 CET 2009

I have a matrix containing -1, 0, 1, however certain rows will not
have all 3 numbers. I have written some codes to compute the frequency
table of how many -1s, 0s, 1s per row, but it is very ugly and not
efficient if there are more than 3 numbers. Please suggest.

m - rbind(sample(0:1, replace=T, 10), sample(-1:1, replace=T, 10))
m.table - t(apply(m, 1, function(x) c(sum(x==-1, na.rm=T), sum(x==0,
na.rm=T), sum(x==1, na.rm=T)) ))
m.table - prop.table(m.table, 1)*100
colnames(m.table) - -1:1

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


Re: [R] Why na.rm=FALSE is the default

2009-03-24 Thread Greg Snow
The only reference that I can think of (a bit subtle/indirect) is: 
http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html (look in the 
section on Propagation of Blanks).

But I think that it really comes down to the following 2 variations on a rule:

1. Important decisions (such as throwing away information) should be made by a 
human not a computer
2. Important decisions (such as throwing away information) should be made by a 
person familiar with the data and scientific question, not by a programmer 
separated in time and space from the real question who was unlikely to be able 
to anticipate every situation.

-- 
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 Adam D. I. Kramer
 Sent: Tuesday, March 24, 2009 12:24 PM
 To: r-help@r-project.org
 Subject: [R] Why na.rm=FALSE is the default
 
 Dear Colleagues,
 
   I've been searching for a post or article or something which
 explains why having na.rm=FALSE or na.action=na.fail as the default is
 a
 better choice than TRUE or na.omit.
 
   I understand the basic argument: it does not make sense to
 average a
 nonexistance into an aggregate, and removing them implicitly leads to
 accidental pairwise deletion in some cases, and sum(x) / length(x) 
 mean(x)
 (which many would find disturbing)...I'm just looking for a source to
 cite
 on this issue to support mimicking R's behavior in a database system's
 aggregating functions (sum, avg, var, etc.).
 
 Cordially,
 Adam Kramer
 Ph.D. Candidate, Social Psychology
 University of Oregon
 adik at uoregon dot edu
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] read in large data file (tsv) with inline filter?

2009-03-24 Thread David Reiss
Hi all,
Thanks a lot for your responses. I forgot to mention in my posting that I
also want to try to be as cross-platform as possible (and thus to avoid
relying on external calls to UNIX programs such as grep). I like the idea
from Thomas:

You certainly don't want to use repeated reads from the start of the file
 with skip=,  but if you set up a file connection
   fileconnection - file(my.tsv, open=r)
 you can read from it incrementally with readLines() or read.delim() without
 going back to the start each time.


But doing this (with the required calls to grep()) is *MUCH* slower than
piping the file through UNIX grep -- so I think I will end up just
sticking with that option and just ask Windows users install grep in order
to use my software.

--David

 *David J Reiss, PhD http://dreiss.isb.googlepages.com*
Senior Research Scientist, Computational Biology, Baliga
Labhttp://baliga.systemsbiology.net/
Institute for Systems Biology http://www.systemsbiology.org
1441 N 34th St., Seattle, WA 98103 (USA)



On Tue, Mar 24, 2009 at 5:12 AM, Dirk Eddelbuettel e...@debian.org wrote:


 Hi David,

 On 23 March 2009 at 15:09, Dylan Beaudette wrote:
 | On Monday 23 March 2009, David Reiss wrote:
 |  I have a very large tab-delimited file, too big to store in memory via
 |  readLines() or read.delim(). Turns out I only need a few hundred of
 those
 |  lines to be read in. If it were not so large, I could read the entire
 file
 |  in and grep the lines I need. For such a large file; many calls to
 |  read.delim() with incrementing skip and nrows parameters, followed
 by
 |  grep() calls is very slow. I am aware of possibilities via SQLite; I
 would
 |  prefer to not use that in this case.
 | 
 |  My question is...Is there a function for efficiently reading in a file
 |  along the lines of read.delim(), which allows me to specify a filter
 (via
 |  grep or something else) that tells the function to only read in certain
 |  lines that match?
 | 
 |  If not, I would *love* to see a filter parameter added as an option
 to
 |  read.delim() and/or readLines().
 |
 | How about pre-filtering before loading the data into R:
 |
 | grep -E 'your pattern here' your_file_here  your_filtered_file
 |
 | alternatively if you need to search in fields, see 'awk', and 'cut', or
 if you
 | need to delete things see 'tr'.
 |
 | These tools come with any unix-like OS, and you can probably get them on
 | windows without much effort.

 Also note that read.delim() and friends all read from connections, and
 'piped
 expressions' (in the Unix shell command sense) can provide a source.

 That way you can build an ad-hoc filter extension by running readLines()
 over
 a pipe() connection.  Consider this trivial example of grepping out Section
 headers from the R FAQ.  We get everything double because of the Table of
 Contents and the actual section headers:

 R readLines( pipe(awk '/^[0-9+] / {print $1, $2, $3}'
 src/debian/R/R-alpha.20090320/doc/FAQ) )
  [1] 1 Introduction  2 R Basics  3 R and 4 R Web
  [5] 5 R Add-On  6 R and 7 R Miscellanea 8 R
 Programming
  [9] 9 R Bugs1 Introduction  2 R Basics  3 R and
 [13] 4 R Web 5 R Add-On  6 R and 7 R
 Miscellanea
 [17] 8 R Programming 9 R Bugs
 R

 The regexp is simply 'digits at start of line followed by space' which
 skips
 subsections like 1.1, 1.2, ...

 Hth, Dirk

 --
 Three out of two people have difficulties with fractions.


[[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] modelling probabilities instead of binary data with logistic regression

2009-03-24 Thread joris meys
Dear all,

I have a dataset where I reduced the dimensionality, and now I have a
response variable with probabilities/proportions between 0 and 1. I wanted
to do a logistic regression on those, but the function glm refuses to do
that with non-integer values in the response. I also tried lrm, but that one
interpretes the probabilities as different levels and gives for every level
a different intercept. Not exactly what I want...

Is there a way to specify that the response variable should be interpreted
as a probability?

Kind regards
Joris

[[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] Probability trees

2009-03-24 Thread Waldir Leôncio
How can I create probability trees in R?  I've searched everywhere I could
and still have no clue. :-/

[[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] segfault when running heatmap()

2009-03-24 Thread Andrew Yee
Hi, I was wondering if someone in the mailing list has any insight into this
segfault error that I consistently find when running a script containing
heatmap() in R 2.8.1 and 2.8.0 on a Linux 64-bit machine.

Some points:

1. This occurs when running heatmap().
2. Interestingly, if I source() the script or copy and paste the script in
its entirety, this error occurs.  However, if I run the commands
individually, heatmap() will actually work.
3. I've had this error occur on two types of machines as follows.  Intel
64bit, linux kernel 2.6.18-92.1.22.el5, gcc version 4.1.2 as well as AMD
64bit, linux kernel 2.6.9-5.ELsmp, gcc version 3.4.3

Here is the error messages that I receive when I debug(heatmap) and source()
the script containing heatmap().  The sessionInfo() follows.


Browse[1]
debug: op - par(no.readonly = TRUE)
Browse[1]

 *** caught segfault ***
address 0x103c93d53, cause 'memory not mapped'

Traceback:
 1: function (display = , width, height, pointsize, gamma, bg, canvas,
fonts, xpos, ypos, title, type, antialias) {if (display ==  
.Platform$GUI == AQUA  is.na(Sys.getenv(DISPLAY, NA)))
Sys.setenv(DISPLAY = :0)new - list()if (!missing(display))
  new$display - displayif (!missing(width)) new$width - width
   if (!missing(height)) new$height - heightif
(!missing(gamma)) new$gamma - gammaif (!missing(pointsize))
new$pointsize - pointsizeif (!missing(bg)) new$bg - bg
 if (!missing(canvas)) new$canvas - canvasif (!missing(xpos))
  new$xpos - xposif (!missing(ypos)) new$ypos - yposif
(!missing(title)) new$title - titleif
(!checkIntFormat(new$title)) stop(invalid 'title')if
(!missing(type)) new$type - match.arg(type, c(Xlib, cairo,
nbcairo))if (!missing(antialias)) {new$antialias -
pmatch(antialias, c(default, none, gray, subpixel))
   if (is.na(new$antialias)) stop(invalid value for
'antialias')}d - check.options(new, name.opt = .X11.Options,
envir = .X11env)type - if (capabilities(cairo))
switch(d$type, cairo = 1, nbcairo = 2, 0)else 0if (display ==
XImage) type - 0.Internal(X11(d$display, d$width, d$height,
d$pointsize, d$gamma, d$colortype, d$maxcubesize, d$bg, d$canvas,
  d$fonts, NA_integer_, d$xpos, d$ypos, d$title, type,
d$antialias))}()
 2: par(no.readonly = TRUE)
 3: heatmap(selected.matrix, distfun = cor.dist, zlim = zlim, col =
colors.for.heatmap)
 4: eval.with.vis(expr, envir, enclos)
 5: eval.with.vis(ei, envir)

Here is the sessionInfo()

 sessionInfo()
R version 2.8.1 (2008-12-22)
x86_64-unknown-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

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

other attached packages:
[1] u133x3p.db_2.2.5RSQLite_0.7-1   DBI_0.2-4
[4] AnnotationDbi_1.4.3 Biobase_2.2.2   vcd_1.2-3
[7] colorspace_1.0-0MASS_7.2-46



Thanks,
Andrew

[[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] Testing for symbolic links

2009-03-24 Thread Rolf Turner


On 25/03/2009, at 6:29 AM, Gregoire Pau wrote:


Hello,

How can I test in R whether a file is a symbolic link or not ? I  
haven't

found anything relevant in R-help but I may be wrong.
Thanks !


Since symbolic links are a Unix thing, I assume you are working on a  
system

that is sufficiently Unix-like for the following roll-your-own to work:

cfsl - function(file) {
# cfsl -- check for symbolic link
xxx - system(paste(ls -l,file),intern=TRUE)
if(substr(xxx,1,1)==l) TRUE else FALSE
}

HTH

cheers,

Rolf Turner


##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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


Re: [R] modelling probabilities instead of binary data with logistic regression

2009-03-24 Thread joris meys
Thank you all for the very fast answers.

My proportions come from a factor analysis on a number of binary variables,
in order to avoid having to fit 12 logistic regressions on the same dataset.
By scaling the obtained scores to 0 and 1, I get weighted averages of the
response combinations I'm interested in.

I tried the betareg function, but that one can't deal with probabilities 0
and 1 unfortunately. I'll have to manually do the logit transformation, I'm
afraid. Thanks for the help.

Kind regards
Joris

On Tue, Mar 24, 2009 at 8:48 PM, Kjetil Halvorsen 
kjetilbrinchmannhalvor...@gmail.com wrote:

 You did'nt say how your proportions have arisen! If each corresonds to one
 observation, you could simply simulate
 indicator variables with those proportions as prob's, fit glm, repeat many
 times, and
 average results!

 More seriously, you could transform the proportions to logits
 logit - log(p/(1-p))
 and fit a linear regression.

 Kjetil

 On Tue, Mar 24, 2009 at 3:30 PM, joris meys jorism...@gmail.com wrote:

 Dear all,

 I have a dataset where I reduced the dimensionality, and now I have a
 response variable with probabilities/proportions between 0 and 1. I wanted
 to do a logistic regression on those, but the function glm refuses to do
 that with non-integer values in the response. I also tried lrm, but that
 one
 interpretes the probabilities as different levels and gives for every
 level
 a different intercept. Not exactly what I want...

 Is there a way to specify that the response variable should be interpreted
 as a probability?

 Kind regards
 Joris

[[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] Green and Byar (1980) Prostate Cancer Data set from Andrews and Herzberg - Data

2009-03-24 Thread Ravi Varadhan
Hi,

I am looking for a data set containing the information from a randomized trial 
evaluating the effect of DES (diethylsilbestrol) on multiple time-to-event 
endpoints, prostate cancer, CVD, and other causes.  The original source of this 
data is Green and Byar (1980).  This is a popular competing risks problem that 
has subsequently been discussed in a number of statistical papers including Kay 
(1986).  

Does anyone have a digital version of this data set?  

This data is also presented in Andrews, D. F. and Herzberg, A. M. (1985). Data. 
  Does a digital version of all the data sets in A  H exist?

Thanks very much,
Ravi.



Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvarad...@jhmi.edu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Executing an external executable from within R?

2009-03-24 Thread Jason Rupert

For example, from within an R script I would like to be able to launch 
NotePad.exe.  

Is there an R call for launching Notepad.exe from within R? 

I've tried the following, but they don't seem to work:
 system(paste('C:/WINDOWS/NOTEPAD.exe'), wait = FALSE)
 system(C:/WINDOWS/NOTEPAD.exe, wait = FALSE)
 system(NOTEPAD, wait = FALSE)

That is, these do not bring up the Notepad GUI.  

Thanks for any insights.

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