On 03-Aug-2012 20:46:56 R. Michael Weylandt wrote:
> On Fri, Aug 3, 2012 at 3:39 PM, darnold wrote:
>> All,
>>
>> Can someone explain why this does not print the contents of x when I source
>> this file?
>>
>> CoinTosses <- function(n,print=TRUE) {
>> x <- sample(c(0,1), n, replace=TRUE)
>> y
p-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of R. Michael Weylandt
> Sent: Friday, August 03, 2012 1:47 PM
> To: darnold
> Cc: r-help@r-project.org
> Subject: Re: [R] Printing contents of a variable
>
> On Fri, Aug 3, 2012 at 3
On Fri, Aug 3, 2012 at 3:39 PM, darnold wrote:
> All,
>
> Can someone explain why this does not print the contents of x when I source
> this file?
>
> CoinTosses <- function(n,print=TRUE) {
> x <- sample(c(0,1), n, replace=TRUE)
> y <- x
> y[y==0] <- "T"
> y[y==1] <- "H"
> p <- sum(x)/n
All,
Can someone explain why this does not print the contents of x when I source
this file?
CoinTosses <- function(n,print=TRUE) {
x <- sample(c(0,1), n, replace=TRUE)
y <- x
y[y==0] <- "T"
y[y==1] <- "H"
p <- sum(x)/n
p
}
x <- CoinTosses(40)
x
On the other hand, if I source this fi
4 matches
Mail list logo