[R] Customized Sweavel Style File

2010-08-24 Thread r.ookie
Liviu, thanks again for the suggestion. Do you have a customized style file 
that you wouldn't mind sharing?

I like the default output but I'm curious about others.

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


Re: [R] Sweave.sty

2010-08-24 Thread r.ookie
That is great Liviu, thanks for letting me know. My LaTeX documents have been 
looking like this, however I have been doing all the cosmetics through LaTeX. 
Thanks for letting me know about this!

On Aug 24, 2010, at 2:34 PM, Liviu Andronic wrote:

On Tue, Aug 24, 2010 at 10:40 PM, r.ookie  wrote:
> Does anyone know where I can download the latest version of Sweave.sty? I 
> have looked all over the site http://www.stat.umn.edu/~charlie/Sweave/ with 
> no luck.
> 
Not exactly an answer, Frank Harrell once published a fork of Sweave,
Sweavel [1], which can provide fancier output.
Liviu

[1] http://biostat.mc.vanderbilt.edu/wiki/Main/SweaveTemplate

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

2010-08-24 Thread r.ookie
Does anyone know where I can download the latest version of Sweave.sty? I have 
looked all over the site http://www.stat.umn.edu/~charlie/Sweave/ with no luck.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to obtain seed after generating random number?

2010-08-24 Thread r.ookie
Thanks for your solution, however, which values would I then provide someone 
else so that they can produce the same results?

On Aug 24, 2010, at 12:06 PM, William Dunlap wrote:

The following will attach (as an attribute) the current global value
of .Random.seed to the value of the evaluated 'expr' argument.  If you
supply
the initial.Random.seed argument then it will use that when evaluating
the expression (and also attach it to the result) so you can repeat the
'unusual' computation.  I sometimes use this sort of thing when doing QA
work.
   f <- function(expr, initial.Random.seed) {
   if (missing(initial.Random.seed)) {
if (!exists(".Random.seed", envir=.GlobalEnv)) {
runif(1) # force generation of a .Random.seed
}
initial.Random.seed <- get(".Random.seed",
envir=.GlobalEnv)
   }
   .Random.seed <<- initial.Random.seed
   structure(expr, .Random.seed=.Random.seed)
   }

E.g.,
> z0 <- f(runif(3))
> str(z0)
atomic [1:3] 0.15 0.225 0.607
- attr(*, ".Random.seed")= int [1:626] 403 19 1644829386 1412664364
-3288017 -689767195 792688028 -702547982 -676502931 402532263 ...
> z1 <- f(runif(3))
> str(z1)
atomic [1:3] 0.786 0.325 0.789
- attr(*, ".Random.seed")= int [1:626] 403 22 1644829386 1412664364
-3288017 -689767195 792688028 -702547982 -676502931 402532263 ...
> str(f(runif(3), attr(z0,".Random.seed"))) # repeat with .Random.seed
used to make z0
atomic [1:3] 0.15 0.225 0.607
- attr(*, ".Random.seed")= int [1:626] 403 19 1644829386 1412664364
-3288017 -689767195 792688028 -702547982 -676502931 402532263 ...

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

> -----Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of r.ookie
> Sent: Tuesday, August 24, 2010 11:48 AM
> To: Bogaso Christofer
> Cc: r-help@r-project.org
> Subject: Re: [R] How to obtain seed after generating random number?
> 
> I have wondered this in the past too so thanks for the question.
> 
> On Aug 24, 2010, at 10:11 AM, Bogaso Christofer wrote:
> 
> Dear all, I was doing an experiment to disprove some theory therefore
> performing lot of random simulation. Goal is to show the audience that
> although something has very rare chance to occur but it 
> doesn't mean that
> event would be impossible.
> 
> 
> 
> In this case after getting that rare event I need to show 
> that same scenario
> for multiple times to explain other audience. Hence I need to 
> somehow save
> that seed which generates that random numbers after doing the 
> experiment.
> However as it is very rare event it is not very practical to 
> start with a
> fixed seed and then generate random numbers. Hence I am 
> looking for some way
> which will tell me about that corresponding seed which was 
> responsible to
> generate that particular series of random numbers responsible 
> for occurrence
> of that rare event.
> 
> 
> 
> In short, I need to know the seed ***after*** generating the 
> random numbers.
> 
> 
> 
> Is there any possibility to know this?
> 
> 
> 
> Thanks and regards,
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 obtain seed after generating random number?

2010-08-24 Thread r.ookie
I have wondered this in the past too so thanks for the question.

On Aug 24, 2010, at 10:11 AM, Bogaso Christofer wrote:

Dear all, I was doing an experiment to disprove some theory therefore
performing lot of random simulation. Goal is to show the audience that
although something has very rare chance to occur but it doesn't mean that
event would be impossible.



In this case after getting that rare event I need to show that same scenario
for multiple times to explain other audience. Hence I need to somehow save
that seed which generates that random numbers after doing the experiment.
However as it is very rare event it is not very practical to start with a
fixed seed and then generate random numbers. Hence I am looking for some way
which will tell me about that corresponding seed which was responsible to
generate that particular series of random numbers responsible for occurrence
of that rare event.



In short, I need to know the seed ***after*** generating the random numbers.



Is there any possibility to know this?



Thanks and regards,


[[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] multiple assignments ?

2010-08-24 Thread r.ookie
Do you mean something like this?

>
 n <- 5

>
 (vec1 <- matrix(rep(1, n)))
 [,1]
[1,]1
[2,]1
[3,]1
[4,]1
[5,]1

>
 (vec2 <- matrix(rep(2, n)))
 [,1]
[1,]2
[2,]2
[3,]2
[4,]2
[5,]2

>
 (vec3 <- matrix(rep(3, n)))
 [,1]
[1,]3
[2,]3
[3,]3
[4,]3
[5,]3

>
 

>
 (vec <- matrix(c(vec1, vec2, vec3)))
  [,1]
 [1,]1
 [2,]1
 [3,]1
 [4,]1
 [5,]1
 [6,]2
 [7,]2
 [8,]2
 [9,]2
[10,]2
[11,]3
[12,]3
[13,]3
[14,]3
[15,]3

> 

On Aug 24, 2010, at 4:58 AM, Maas James Dr (MED) wrote:

Simple one, have read and googled, still no luck!

I want to create several empty vectors all of the same length.

I would like multiple empty vectors (vec1, vec2, vec3) and want to create them 
all in one line.

I've tried

vec1,vec2,vec3 <- vector(length=5)
and
c(vec1,vec2,vec3) <- vector(length=5)

and several other attempts but nothing seems to work ... suggestions?

Thanks

Jim

===
Dr. Jim Maas
University of East Anglia


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

2010-08-21 Thread r.ookie
Thanks.

On Aug 21, 2010, at 4:01 PM, RICHARD M. HEIBERGER wrote:

cbind(A=x, B=y)



On Sat, Aug 21, 2010 at 6:53 PM, r.ookie  wrote:
Is there a way to rename the columns to something like A and B in the cbind 
function?

x <- rnorm(n = 10, mean = 0, sd = 1)
y <- rnorm(n = 10, mean = 0, sd = 1)
cbind(x,y)

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

2010-08-21 Thread r.ookie
Is there a way to rename the columns to something like A and B in the cbind 
function?

x <- rnorm(n = 10, mean = 0, sd = 1)
y <- rnorm(n = 10, mean = 0, sd = 1)
cbind(x,y)

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

2010-08-21 Thread r.ookie
I'm glad he asked that question, I found Barry's and your suggestion useful for 
myself. Thanks! (R surprises me every day).

On Aug 21, 2010, at 1:12 PM, RICHARD M. HEIBERGER wrote:

The question isn't completely clear.  I am guessing you want something
like Figure 1.7 or Figure 7.18 in Paul Murrell's book.

library(party)
example(ctree)

Rich



On Sat, Aug 21, 2010 at 3:40 PM, Bernard Leemon wrote:

> I want to make a graph where each element plotted is itself a graph.  I can
> see how to use par(fig=) and viewport to do that, but they require (i
> think)
> me to do my own scaling as they are scaled to the graphics window.  any
> advice on which approach I should take (just bite the bullet and do my own
> scaling), or is there something else I should try, or any examples I should
> look at.  many thanks for any pointers.
> 
> bernie leemon (aka gary mcclelland)
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

[[alternative HTML version deleted]]

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

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

2010-08-21 Thread r.ookie
I'm trying to understand your question because when I think of a graph, I think 
of one canvas, on which, various functions are plotted (a function can be one 
point for example).

So, when you say each 'element' do you mean each function?
If so, then that seems to be asking how to plot a function per graph (which is 
probably obvious and not what you're asking)

How about you clarify first :)

On Aug 21, 2010, at 12:40 PM, Bernard Leemon wrote:

I want to make a graph where each element plotted is itself a graph.  I can
see how to use par(fig=) and viewport to do that, but they require (i think)
me to do my own scaling as they are scaled to the graphics window.  any
advice on which approach I should take (just bite the bullet and do my own
scaling), or is there something else I should try, or any examples I should
look at.  many thanks for any pointers.

bernie leemon (aka gary mcclelland)

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

2010-08-21 Thread r.ookie
I agree, instead of burning this guy, why not convert him? He may forever 
resent R because of the hostility he's experienced here.

Some people have had negative comments towards me simply because I've asked an 
obvious question but it has not affected me whatsoever. However, the negativity 
could have affected me if I didn't know what I wanted to get from here.

I know there are some really smart people here but it amazes me as to how 
childish some smart people can be.

Peace.

On Aug 21, 2010, at 11:23 AM, John Sorkin wrote:

If I may quote Rodney King, "Why Can't We All Just Get Along?"
I suggest the time is long past to end this thread and its vitriol.
John
John Sorkin
Chief Biostatistics and Informatics
Univ. of Maryland School of Medicine
Division of Gerontology and Geriatric Medicine
jsor...@grecc.umaryland.edu 
-Original Message-
From: Liviu Andronic 
Cc:  
To: Donald Paul Winston 

Sent: 8/21/2010 1:24:46 PM
Subject: Re: [R] R reports

On Sat, Aug 21, 2010 at 3:32 PM, Donald Paul Winston
 wrote:
> Good grief. Adding a report function is not going to make R less flexible. 
> Don't
> you want to use a tool that's relevant to the rest of the world? That world is
> much bigger then your world. This is ridiculous.
> 
> Looks like some people are complaining about me criticizing R and the people 
> who
> defend it. Good grief again.
> 
Just write your own report() function, or pay someone to write it for
you. But please stop complaining (so loudly) about a product that you
don't pay for. Good grief
Liviu

PS As for philosophical aspects, you might want to look at this:
require(fortunes)
fortune("4-wheel")

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

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:10}}

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


Re: [R] R reports

2010-08-21 Thread r.ookie
Sweave/LaTeX is really not as bad as you think. I started using it and I'm 
generating reports without a glitch. I'd consider giving it an honest effort.

On Aug 20, 2010, at 10:01 PM, Donald Paul Winston wrote:


Sweave and LaTex is way to much overhead to deal with. There should be a
built in standard report() function analogous to plot().

Something like the following is necessary if you want real people to take R
seriously:

report(data=, vars=,
label=, by=,
sum=vectorOfColumnNames>, title=, footer=,
pageBy=, sumBy=,
filename=, fileType=...etc)

Did I say "real" people?  I've been Palinized.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-reports-tp2330733p2333264.html
Sent from the R help mailing list archive at Nabble.com.

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

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


Re: [R] R reports

2010-08-21 Thread r.ookie
Yeah but, in considering Revolution, they do not offer a Mac version. Their Mac 
version (community version) is just an older version of R---?? What was that 
about? Their support is patchy and personally I would avoid them like the 
plague (for other reasons not mentioned). I would however encourage the actual 
R developers to develop a report generating function. That would be the 
direction to go.

On Aug 20, 2010, at 10:13 PM, Donald Paul Winston wrote:


People have been generating reports with a computer for many years. R is
supposed to be an analytical engine. Report writing is fundamental to any
kind of analysis tool. SAS has had several report procedures/functions since
the very beginning(1960's?). SAS stands for Statistical Analysis System. Do
you really expect users to have to piece together a half dozen or so bits of
R code to create a report?

It's not like it's difficult to do! I see this new company called Revolution
Analytics who thinks R is the next big thing. Good grief. Maybe they can
rescue it from the ghettoized academic world.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-reports-tp2330733p2333267.html
Sent from the R help mailing list archive at Nabble.com.

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

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


Re: [R] question

2010-08-20 Thread r.ookie
I'm not sure I understand exactly what you're asking but look at the truncated 
normal distribution.

On Aug 20, 2010, at 5:13 PM, solafah bh wrote:

Hello
 
I want to know how can i sampling from upper and lower tail of normal 
distribution , in two cases , if i know the upper and lower bounds of 
distribution and if i do not.
 
Regards



[[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] Has anyone used Sweave with the Beamer poster macro for Latex ?

2010-08-20 Thread r.ookie
Good to be aware of this, thanks for mentioning it!

On Aug 20, 2010, at 12:58 PM, Paul wrote:

Hello,

I'm trying to make a poster in Latex using the beamer poster macro 
(http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php), and use 
Sweave to add in R output.

This works fine for adding graphics and tables, but if I want to put code in, 
the file fails to build in Latex.

My Rnw file looks like
\documentclass[final,hyperref={pdfpagelabels=false}]{beamer}
\mode {
\usetheme{Berlin}
}
\usepackage{sweave}
\begin{document}
\begin{frame}
  \begin{columns}
 \begin{column}
\begin{block}{A Block}
   Some text
<>=
x<-rnorm(100,mean=100,sd=15)
print(x)
@
\end{block}
 \end{column}
  \end{columns}
 \end{frame}
\end{document}
but this doesn't work.  Has anyone else done this ? Any ideas ?

Thanks

Paul.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] which one give clear picture-pdf, jpg or tiff?

2010-08-20 Thread r.ookie
>From my experience, *.pdf is the best of the three file formats.

On Aug 19, 2010, at 8:32 PM, Roslina Zakaria wrote:

Hi,

I need some opinion.  I would like to use graph that I generate from R code and 
save it into word document.  Which format is better? pdf, jpeg or tiff?

Thank you.



[[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] Aspect Ratio

2010-08-19 Thread r.ookie
Well-stated.

On Aug 19, 2010, at 4:31 PM, Spencer Graves wrote:

The 'fortunes' package contains the following:


library(fortunes)
fortune('rtfm')

This is all documented in TFM. Those who WTFM don't want to have to WTFM again
on the mailing list. RTFM.
  -- Barry Rowlingson
 R-help (October 2003)


 I see two problems with this:


   1.  It's difficult to RTFM if one does not know which FMTR.


   2. No piece of prose in any language is ever perfectly clear, 
complete and concise to all readers.  In learning mathematics, it is common to 
spend hours on one page.  I once heard of a famous professor in the middle of a 
lecture start to say, "It is intuitively obvious".  The he paused for 15 
minutes before repeating, "Yes, it is intuitively obvious that ... ."  One of 
the enormous advantages of the R package system is that anything not obvious to 
a particular reader can be traced line by line in any number of different 
examples until sufficient enlightenment is achieved.


 Best Wishes,
 Spencer Graves


On 8/19/2010 3:38 PM, r.ookie wrote:
> Thanks for your example as well. Ted's example was exactly what I needed.
> 
> On Aug 19, 2010, at 3:18 PM, Gavin Simpson wrote:
> 
> On Thu, 2010-08-19 at 14:28 -0700, r.ookie wrote:
>> Well, I had to look further into the documentation to see 'If asp is a
>> finite positive value then the window is set up so that one data unit
>> in the x direction is equal in length to asp * one data unit in the y
>> direction'
>> 
>> Okay, so in what situations is the 'asp' helpful?
> If 'x' and 'y' are in the same units but one covers a larger/smaller
> range than the other, asp will make the axes be scaled in the same units
> such that the distance along the 'y' axis for 1 unit change is the same
> as the distance along the 'x' axis for a 1 unit change.
> 
> dat<- data.frame(x = seq(1, 100, length = 100),
>  y = seq(1, 10, length = 100))
> 
> layout(matrix(1:2, ncol = 2))
> plot(y ~ x, data = dat)
> plot(y ~ x, data = dat, asp = 1, main = expression(asp == 1))
> layout(1)
> 
> If x and y are both in say metres the second plot respects the natural
> scale whereas the first doesn't.
> 
> G
> 
>> On Aug 19, 2010, at 2:24 PM, David Winsemius wrote:
>> 
>> 
>> On Aug 19, 2010, at 5:13 PM, r.ookie wrote:
>> 
>>> set.seed(1)
>>> x<- rnorm(n = 1000, mean = 0, sd = 1)
>>> plot(x = x, asp = 2000)
>>> 
>>> Could someone please explain what the 'asp' parameter is doing?
>> You want us to read the help page to you?

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

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


Re: [R] csv vs. data frame

2010-08-19 Thread r.ookie
I have no doubt that Bret has been a huge contributor and my comment was (not) 
directed at him, nor in direct reply to his. My comment was a general statement 
that he (I don't recall his name) should not be offended because there is going 
to be hostility in any environment, and that I personally just focus on 
learning and picking things up.

I personally don't see a problem with this forum as being used as a (first 
resort) because you never know, someone (like myself) would learn and pick up 
some information. After all, this is R Help, right? Not just Help for the 
advanced users. If it's known knowledge to you, then why not just delete it or 
not even read it? I don't see the harm in that, meanwhile, less advanced users, 
beginners like myself, could pick up a few things here and there :)

I'm only replying to your response because it was a thoughtful response and I 
didn't just want to just ignore it.

On Aug 19, 2010, at 3:11 PM, Gavin Simpson wrote:

On Thu, 2010-08-19 at 14:02 -0700, r.ookie wrote:
> I agree with you Duncan because I sense the hostility too, but, in any
> environment, there are going to be those who 'don't play well with
> others.' I just delete and read the next posting. I'm personally here
> to learn :)

If you knew Bert's contributions to this list (and No, I don't know him
personally), linking him with "those who 'don't play well with others.'"
is way off mark.

There is an increasing tendency for this list to be the first, only and
instant avenue of support for anyone using R. One could argue that
Bruce's question was sufficiently basic that had he read the posting
guide, which points to the manual Bert mentioned, he could have answered
his question with 5 minutes of locating/downloading and ten minutes
reading. Yet the question came here.

Yes, I agree that this list must remain civil and be a place that is
welcoming of new users, but it is frustrating when such questions are
asked after people (not me) have gone to the trouble of writing
documentation that explains the answers and posters don't bother to read
it.

Bruce; to link Bert's and Duncan's replies, it is easy to read data
stored as CSV data into R. As CSV files can be read by external software
such as MS Excel and OpenOffice.org leaving source data in this format
is probably preferable to importing to a data frame and then saving out
the R representation of this data frame object.

The read.csv() function is designed for this purpose. It will result in
a data frame (an object of class "data.frame") in the global
environment/workspace if assigned to an object name:

foo <- read.csv("foo.csv")

If your users are from European countries where "," is the decimal and
CSV file fields are separated by ";", then the read.csv2() function
should be used instead. Or cook your own via read.table().

Read the relevant section of An Introduction to R:

http://cran.r-project.org/doc/manuals/R-intro.html#Data-frames

so you get a feel for what data frames are in R, and also look at the
help for read.csv() (?read.csv executed from an R prompt) to learn how
non-numeric data is interpreted by R; for example, character data may be
imported as a factor in R, which may not be what you/your users want.
Arguments to read.csv() and the underlying read.table() function allow
you to control this.

HTH

G

> On Aug 19, 2010, at 1:42 PM, Duncan Murdoch wrote:
> 
> On 19/08/2010 4:15 PM, Bert Gunter wrote:
>> Do not post such questions to this list.
>> Read an Introduction to R first, please.
>> 
> 
> I think that's a bit harsh:  Bruce is trying to help R users, but doesn't 
> necessarily want to learn to be one.
>> -- Bert
>> 
>> On Thu, Aug 19, 2010 at 12:55 PM, Bruce Como  wrote:
>>> Hi,
>>> 
>>> I am neither a statistician nor a user of R.  I am a programmer trying to
>>> provide my users (both statisticians and R users) data in a format that
>>> works best for them.
>>> 
>>> What is a data frame?  Is source data easier to work with in this format or
>>> a csv file?  Or yet another format?
>> 
> 
> A data frame is an internal structure in R.  If you produce data in a csv 
> file, it is easy for an R user to import it into a data frame.  Take the 
> usual care
> with quotes, commas, etc. within strings in the file.
> 
> Duncan Murdoch
> 
>>> 
>>> Thanks for your time.
>>> 
>>> Bruce
>>> 
>>> 
>>>   [[alternative HTML version deleted]]
>>> 
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read t

Re: [R] Aspect Ratio

2010-08-19 Thread r.ookie
Thanks for your example as well. Ted's example was exactly what I needed.

On Aug 19, 2010, at 3:18 PM, Gavin Simpson wrote:

On Thu, 2010-08-19 at 14:28 -0700, r.ookie wrote:
> Well, I had to look further into the documentation to see 'If asp is a
> finite positive value then the window is set up so that one data unit
> in the x direction is equal in length to asp * one data unit in the y
> direction'
> 
> Okay, so in what situations is the 'asp' helpful?

If 'x' and 'y' are in the same units but one covers a larger/smaller
range than the other, asp will make the axes be scaled in the same units
such that the distance along the 'y' axis for 1 unit change is the same
as the distance along the 'x' axis for a 1 unit change.

dat <- data.frame(x = seq(1, 100, length = 100),
 y = seq(1, 10, length = 100))

layout(matrix(1:2, ncol = 2))
plot(y ~ x, data = dat)
plot(y ~ x, data = dat, asp = 1, main = expression(asp == 1))
layout(1)

If x and y are both in say metres the second plot respects the natural
scale whereas the first doesn't.

G

> 
> On Aug 19, 2010, at 2:24 PM, David Winsemius wrote:
> 
> 
> On Aug 19, 2010, at 5:13 PM, r.ookie wrote:
> 
>> set.seed(1)
>> x <- rnorm(n = 1000, mean = 0, sd = 1)
>> plot(x = x, asp = 2000)
>> 
>> Could someone please explain what the 'asp' parameter is doing?
> 
> You want us to read the help page to you?
> 

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
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] Aspect Ratio

2010-08-19 Thread r.ookie
This example definitely clarified a situation where 'asp' is useful/helpful. 
Thanks!

On Aug 19, 2010, at 3:05 PM, (Ted Harding) wrote:

Spencer, you came up with your example just as I finished making mine:

 set.seed(54321); X <- rnorm(200) ; Y <- 0.25*X+0.25*rnorm(200)
##Compare:
 plot(X,Y,pch="+",col="blue")
##with:
 plot(X,Y,pch="+",col="blue",asp=1.0)

With R left to choose the X and Y limits by itself, the first
plot gives the superficial impression that Y increases equally
as X increases -- until you look at the scales on the Y and X
axes. Hence it tends to be misleading about how Y depends on X.
The second plot shows their proportional relationship correctly.

Of course you could achive a similar effect by explicitly setting
the X and Y limits yourself:

plot(X,Y,pch="+",col="blue",xlim=c(-2.5,2.5),ylim=c(-2.5,2.5))

but "asp=1.0" saves you the bother of working out what they
should be.

There are, of course, cases where, for the sake of the desired
visual effect, you would want to use an aspect ratio different
from 1. The basic point is that it is a tool to help you get
the vertical and horizontal dimensions of the graph in the
proportions that help to achieve the visual effect you seek.

Ted.

On 19-Aug-10 21:50:12, Spencer Graves wrote:
>The documentation is not clear.  It would help if it had an 
> example like the following:
> 
> plot(1:2, 1:2/10)
> plot(1:2, 1:2/10, asp=1)
> 
>   Does looking at these two plots answer the question?
>   Spencer Graves
> 
> On 8/19/2010 2:36 PM, David Winsemius wrote:
>> 
>> On Aug 19, 2010, at 5:28 PM, r.ookie wrote:
>> 
>>> Well, I had to look further into the documentation to see 'If asp is 
>>> a finite positive value then the window is set up so that one data 
>>> unit in the x direction is equal in length to asp * one data unit in 
>>> the y direction'
>>> 
>>> Okay, so in what situations is the 'asp' helpful?
>> 
>> It yet again appears that you are asking us to read the help pages for
>> you.
>> 
>> 
>>> 
>>> On Aug 19, 2010, at 2:24 PM, David Winsemius wrote:
>>> 
>>> 
>>> On Aug 19, 2010, at 5:13 PM, r.ookie wrote:
>>> 
>>>> set.seed(1)
>>>> x <- rnorm(n = 1000, mean = 0, sd = 1)
>>>> plot(x = x, asp = 2000)
>>>> 
>>>> Could someone please explain what the 'asp' parameter is doing?
>>> 
>>> You want us to read the help page to you?
>>> 
>>> -- 
>> 
>> David Winsemius, MD
>> West Hartford, CT
>> 
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
> 
> -- 
> Spencer Graves, PE, PhD
> President and Chief Operating Officer
> Structure Inspection and Monitoring, Inc.
> 751 Emerson Ct.
> San José, CA 95126
> ph:  408-655-4567
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 19-Aug-10   Time: 23:05:49
-- XFMail --

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

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

2010-08-19 Thread r.ookie
I understand Joshua, it's a way to display the plotted data in a graph. I've 
been using 'ylim = c()' and 'xlim = c()' so far but it's nice to be aware of 
'asp' too.

On Aug 19, 2010, at 2:58 PM, Joshua Wiley wrote:

On Thu, Aug 19, 2010 at 2:46 PM, r.ookie  wrote:
> I'm asking to get people's interpretation and also whether they've 
> encountered situations where it was useful, helpful, etc.

In general, it would probably help your responses on this list if you
were clearer in the first place then.  For instance, "In the
documentation I read that 'asp' is _, but I have tried x and y I
do not understand when it would be helpful to set 'asp' to values
other than the default".

Imagine you have two variables, X and Y.  X has a very small range
(lets say a probability of having an accident) and Y has a huge range
(number of kilometers driven in a year).  Setting different aspect
ratios, may make it easier to see the data.  What follows are some
examples.  The y axis data is the same in all four, but I there are
two sets of data for the x axis.  You can see how setting different
aspect ratios makes the relationship between X and Y more or less
clear.


x1 <- seq(from = 0, to = .1, by = .01)
x2 <- seq(from = 0, to = 1000, by = 100)
y <- 0:10
# so that four plots can be in one window for comparison
par(mfcol=c(2,2))

# Make the four plots with a variety of aspect ratios
plot(x = x1, y = y, asp = 1/1,
main = expression(paste(frac(y, x) == frac(1, 1
plot(x = x1, y = y, asp = 1/100,
main = expression(paste(frac(y, x) == frac(1, 100
plot(x = x2, y = y, asp = 1/1,
main = expression(paste(frac(y, x) == frac(1, 1
plot(x = x2, y = y, asp = 100/1,
main = expression(paste(frac(y, x) == frac(100, 1

#######

> 
> On Aug 19, 2010, at 2:36 PM, David Winsemius wrote:
> 
> 
> On Aug 19, 2010, at 5:28 PM, r.ookie wrote:
> 
>> Well, I had to look further into the documentation to see 'If asp is a 
>> finite positive value then the window is set up so that one data unit in the 
>> x direction is equal in length to asp * one data unit in the y direction'
>> 
>> Okay, so in what situations is the 'asp' helpful?
> 
> It yet again appears that you are asking us to read the help pages for you.
> 
> 
>> 
>> On Aug 19, 2010, at 2:24 PM, David Winsemius wrote:
>> 
>> 
>> On Aug 19, 2010, at 5:13 PM, r.ookie wrote:
>> 
>>> set.seed(1)
>>> x <- rnorm(n = 1000, mean = 0, sd = 1)
>>> plot(x = x, asp = 2000)
>>> 
>>> Could someone please explain what the 'asp' parameter is doing?
>> 
>> You want us to read the help page to you?
>> 
>> --
> 
> David Winsemius, MD
> West Hartford, CT
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.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] Aspect Ratio

2010-08-19 Thread r.ookie
plot(1:3) # usual way to view

plot(1:3, asp = 2) # convenient way to apply horizontal compression for 
visibility

plot(1:3, xlim = c(0, 4)) # but if you have information on what the graph looks 
like, you can manually apply the same horizontal compression

Was I going through some sort of "gang initiation" because I'm new, and didn't 
know it?

Phew, I'm glad it's over. Thanks for the help Spencer.

On Aug 19, 2010, at 2:50 PM, Spencer Graves wrote:

The documentation is not clear.  It would help if it had an example like the 
following:


plot(1:2, 1:2/10)
plot(1:2, 1:2/10, asp=1)


Does looking at these two plots answer the question?


Spencer Graves


On 8/19/2010 2:36 PM, David Winsemius wrote:
> 
> On Aug 19, 2010, at 5:28 PM, r.ookie wrote:
> 
>> Well, I had to look further into the documentation to see 'If asp is a 
>> finite positive value then the window is set up so that one data unit in the 
>> x direction is equal in length to asp * one data unit in the y direction'
>> 
>> Okay, so in what situations is the 'asp' helpful?
> 
> It yet again appears that you are asking us to read the help pages for you.
> 
> 
>> 
>> On Aug 19, 2010, at 2:24 PM, David Winsemius wrote:
>> 
>> 
>> On Aug 19, 2010, at 5:13 PM, r.ookie wrote:
>> 
>>> set.seed(1)
>>> x <- rnorm(n = 1000, mean = 0, sd = 1)
>>> plot(x = x, asp = 2000)
>>> 
>>> Could someone please explain what the 'asp' parameter is doing?
>> 
>> You want us to read the help page to you?
>> 
>> -- 
> 
> David Winsemius, MD
> West Hartford, CT
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

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

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


Re: [R] Aspect Ratio

2010-08-19 Thread r.ookie
I'm asking to get people's interpretation and also whether they've encountered 
situations where it was useful, helpful, etc.

On Aug 19, 2010, at 2:36 PM, David Winsemius wrote:


On Aug 19, 2010, at 5:28 PM, r.ookie wrote:

> Well, I had to look further into the documentation to see 'If asp is a finite 
> positive value then the window is set up so that one data unit in the x 
> direction is equal in length to asp * one data unit in the y direction'
> 
> Okay, so in what situations is the 'asp' helpful?

It yet again appears that you are asking us to read the help pages for you.


> 
> On Aug 19, 2010, at 2:24 PM, David Winsemius wrote:
> 
> 
> On Aug 19, 2010, at 5:13 PM, r.ookie wrote:
> 
>> set.seed(1)
>> x <- rnorm(n = 1000, mean = 0, sd = 1)
>> plot(x = x, asp = 2000)
>> 
>> Could someone please explain what the 'asp' parameter is doing?
> 
> You want us to read the help page to you?
> 
> -- 

David Winsemius, MD
West Hartford, CT

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


Re: [R] Aspect Ratio

2010-08-19 Thread r.ookie
Well, I had to look further into the documentation to see 'If asp is a finite 
positive value then the window is set up so that one data unit in the x 
direction is equal in length to asp * one data unit in the y direction'

Okay, so in what situations is the 'asp' helpful?

On Aug 19, 2010, at 2:24 PM, David Winsemius wrote:


On Aug 19, 2010, at 5:13 PM, r.ookie wrote:

> set.seed(1)
> x <- rnorm(n = 1000, mean = 0, sd = 1)
> plot(x = x, asp = 2000)
> 
> Could someone please explain what the 'asp' parameter is doing?

You want us to read the help page to you?

-- 

David Winsemius, MD
West Hartford, CT

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


[R] Aspect Ratio

2010-08-19 Thread r.ookie
set.seed(1)
x <- rnorm(n = 1000, mean = 0, sd = 1)
plot(x = x, asp = 2000)

Could someone please explain what the 'asp' parameter is doing?

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


Re: [R] csv vs. data frame

2010-08-19 Thread r.ookie
I agree with you Duncan because I sense the hostility too, but, in any 
environment, there are going to be those who 'don't play well with others.' I 
just delete and read the next posting. I'm personally here to learn :)

On Aug 19, 2010, at 1:42 PM, Duncan Murdoch wrote:

On 19/08/2010 4:15 PM, Bert Gunter wrote:
> Do not post such questions to this list.
> Read an Introduction to R first, please.
>  

I think that's a bit harsh:  Bruce is trying to help R users, but doesn't 
necessarily want to learn to be one.
> -- Bert
> 
> On Thu, Aug 19, 2010 at 12:55 PM, Bruce Como  wrote:
> > Hi,
> >
> > I am neither a statistician nor a user of R.  I am a programmer trying to
> > provide my users (both statisticians and R users) data in a format that
> > works best for them.
> >
> > What is a data frame?  Is source data easier to work with in this format or
> > a csv file?  Or yet another format?
>  

A data frame is an internal structure in R.  If you produce data in a csv file, 
it is easy for an R user to import it into a data frame.  Take the usual care
with quotes, commas, etc. within strings in the file.

Duncan Murdoch

> >
> > Thanks for your time.
> >
> > Bruce
> >
> >
> >[[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 
> 
> 
> 

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

2010-08-18 Thread r.ookie
I apologize if this posting shows up again, for some reason I wasn't able to 
post from a different account. So, here I am (reborn). Could I have some 
suggestions as to how I can display my results and their respective CIs in an 
aesthetically pleasing manner?

Below is the example code.

rm(list = ls())
set.seed(1)
func <- function(d,t,beta,lambda,alpha,p.gamma,delta,B){
d <- c(5,1,5,14,3,19,1,1,4,22)
t <- c(94.32,15.72,62.88,125.76,5.24,31.44,1.048,1.048,2.096,10.48)
post <- matrix(0, nrow = 11, ncol = B)
theta <- c(lambda,beta)
beta.hat <- 2.471546
for(j in 1:B){
for(i in 1:(B-1)){
c.lambda <- rgamma(10,d+alpha,t+beta.hat)
c.beta <- rgamma(1,10*alpha+p.gamma,delta+sum(lambda))
c.theta <- c(c.lambda,c.beta)
pi.func <- 
prod((c.lambda/lambda)^(d+alpha-1)*exp(-t*(c.lambda-lambda)))*(c.beta/beta)^(10*alpha+p.gamma-1)*exp(-c.beta*(delta+sum(c.lambda))+beta*(delta+sum(lambda)))
g.x <- 
prod((beta.hat+t)^(alpha+d)*lambda^(alpha+d-1)*exp(-lambda*(beta.hat+t))/gamma(alpha+d))*(sum(lambda)+delta)^(p.gamma+10*alpha)*beta^(p.gamma+10*alpha-1)*exp(-beta*(sum(lambda)+delta))/gamma(p.gamma+10*alpha)
g.y <- 
prod((beta.hat+t)^(alpha+d)*c.lambda^(alpha+d-1)*exp(-lambda*(beta.hat+t))/gamma(alpha+d))*(sum(c.lambda)+delta)^(p.gamma+10*alpha)*c.beta^(p.gamma+10*alpha-1)*exp(-c.beta*(sum(c.lambda)+delta))/gamma(p.gamma+10*alpha)
a <- pi.func*(g.x/g.y)
if(a>1){
theta<-c.theta
}
else
theta <- theta+(c.theta-theta)*rbinom(1,1,alpha)
}
post[,j] <- theta
#print(post[,j])
}
mean <- apply(post,1,mean)
ci <- apply(post,1,quants)
return(list("The Means" = mean, "The Corresponding Confidence 
Intervals" = ci))
}
quants <- function(x){
lo <- quantile(x,.025)
hi <- quantile(x,.975)
return(c(lo,hi))
}
(out <- 
func(d,t,beta=1.5,lambda=rep(0.5,10),alpha=1.8,p.gamma=0.01,delta=1,B=100))
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.