Displaying 20 results from an estimated 20000 matches similar to: "Distributing R Programs"
2005 Jul 01
5
Generating correlated data from uniform distribution
Dear R users,
I want to generate two random variables (X1, X2) from uniform
distribution (-0.5, 0.5) with a specified correlation coefficient r.
Does anyone know how to do it in R?
Many thanks!
Menghui
2006 Jan 20
3
abline() or predict.lm() when log="x"
Hello,
I'm trying to plot a fitted lm() line on a plot when the one
explanatory variable is log transformed and log="x". I get different
lines using abline and predict.lm().
#Example
x <- 1:100
y <- rnorm(100)
plot(y ~ x, log="x")
abline(lm(y ~ log(x)))
lines(x, predict(lm(y ~ log(x))), lwd=2)
I'm sure I'm missing something but could someone tell me which
2005 Nov 14
1
effect sizes for Wilcoxon tests
Hello,
I use t.test for normal distributed and wilcox.test for non-normal
distributed samples.
It is easy to write a function for t.test that calculates the effect
size, because all parts of the formula are available from the t.test
result: r = sqrt(t*t / (t*t + df))
However, for Wilcoxon tests, the formula for effect sizes is:
r = Z / sqrt(N)
I wonder how I can calculate the Z-score in R for
2009 Nov 27
2
using reshape to do ANOVA mixed models
Hi,
I just started with R and I found that there are many options to rearrange
the data to do mixed models.
I want to use the reshape function. I have 2 between subject variables and
one within.
I was able to change the data structure but still - the result of the aov
functions are calculating everything as a within subject.
the table looks like this:
SerialNo breed treatment distance_1
2009 Apr 09
3
type.convert (PR#13646)
Full_Name: Stefan Raberger
Version: 2.8.1
OS: Windows XP
Submission from: (NULL) (213.185.163.242)
Hi there,
I recently noticed some strange behaviour of the command "type.convert",
depending on the startup mode used. But there also seems to be different
behaviour on different PCs (all running the same OS and the same version of R).
On PC1:
When I start R in SDI mode (RGui --no-save
2008 May 05
4
Column renaming
Dear all,
Is there a less cumbersome way to rename a column by name (as opposed
to index) than --
names( X)[ names[ X] == "bob"]<-"sue"
?
A semi-related question: how does one get the index of a column by
name, something along the lines of col.index( X, "sue") ?
Chip Barnaby
---------------------------------------------------------
Chip Barnaby
2006 May 29
6
Numerical error in R (win32) (PR#8909)
Hi
I had observed the following problem in R (also C, Matlab, and Python).
sprintf('%1.2g\n', 3.15)
give 3.1 instead of 3.2 whereas an input of 3.75 gives 3.8.
Java's System.out.printf is ok though.
> round(3.75,1)
[1] 3.8
> round(3.15,1)
[1] 3.1
Similar outcome with sprintf in R.
However, the right answer should be 3.2
Regards
Teckpor
[[alternative HTML version
2006 Mar 02
5
Deparsing '...'
Hi,
The following function works, but is there a neater way to write it?
f = function(x,...)
{
# return a character vector of the arguments passed in after 'x'
gsub("
","",unlist(strsplit(deparse(substitute(list(...))),"[(,)]")))[-1]
}
> f(x,a,b,c*d)
[1] "a" "b" "c*d"
>
Thanks.
[[alternative HTML
2008 Mar 26
3
Misc/List Search Path from keyboard (PR#11036)
Full_Name: Richard Reed
Version: 2.6.2
OS: MS Windows XP Pro
Submission from: (NULL) (76.121.170.35)
Pressing Alt-M+s doesn't search path. It just generates another ">". It does
this in "vanilla" too. However, Alt-M+click "list search path" does work. Note
that when I press Alt-M (and the "Misc" menu drops down) the second "s" in
2007 Feb 06
2
when i run ./configure,i meet a problem
i get a message:
configure: WARNING: you cannot build info or html versions of the R manuals
what should i do ?
[[alternative HTML version deleted]]
2008 Dec 22
2
R 2.8.1
R 2.8.1 is packaged up and queued up for testing. Please test this out:
Fedora 9:
https://admin.fedoraproject.org/updates/rpy-1.0.3-6.fc9,R-2.8.1-1.fc9
Fedora 10:
https://admin.fedoraproject.org/updates/rpy-1.0.3-6.fc10,R-2.8.1-1.fc10
Once you've tested it, please, please, go to the update URL above and
click "Add A Comment". If it works for you, click "Works for me" and
2005 Jul 14
2
Calculate of data frame
Hello,
I have a dataframe which I read from a file:
df <- readtable(myFile);
The dataframe has 4 columns: "model", "count", "value" and "date" where
"model" and "date" are made of charactors and "count" and "value" are
numbers. An example is like:
model count value date
A 4 20.8
2006 Mar 16
3
sub returns garbage (PR#8687)
Full_Name: Todd Bailey
Version: 2.1
OS: Mac OS-X 10.4.3
Submission from: (NULL) (87.112.79.124)
sub returns garbage in some strings when replacing something with nothing and
fixed=TRUE. For example:
> a=c('hello','hello'); sub('lo','',a,fixed=TRUE)
[1] "hel" "hel\0\0"
> a=c('hello','hello');
2009 Nov 23
1
R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails
It works! But Once I have the square root of this matrix, how do I convert it
to a real (not imaginary) matrix which has the same property? Is that
possible?
Best,
Simon
>----Messaggio originale----
>Da: p.dalgaard at biostat.ku.dk
>Data: 21-nov-2009 18.56
>A: "Charles C. Berry"<cberry at tajo.ucsd.edu>
>Cc: "simona.racioppi at
2006 Oct 31
4
'make check' fails on d-p-q-r-tests (PR#9326)
'make check' fails on d-p-q-r-tests:
> ##-- non central Chi^2 :
> xB <- c(2000,1e6,1e50,Inf)
> for(df in c(0.1, 1, 10))
+ for(ncp in c(0, 1, 10, 100)) stopifnot(pchisq(xB, df=df, ncp=ncp) == 1)
Error: pchisq(xB, df = df, ncp = ncp) == 1 is not all TRUE
Execution halted
Here is some more testing:
xB <- c(2000,1e6,1e50,Inf)
for(df in c(0.1, 1, 10)) for(ncp in c(0, 1,
2006 Jun 27
2
Mauchly and Levene
Hallo!
I just started working with R to do the statistical analyses for my diploma thesis.
I got two sets of data.
Both contain repeated measures.
One has only one within-subject factor with four levels.
The other has one within-subject factor with two levels and one between-factor with two levels.
I want to compute a Mauchly test for both sets and a Levene test for the second set.
I
2006 Oct 30
3
Problem setting TMPDIR on the fly
Hi folks,
I'm having a spot of bother with tempdir(). If I set the environment
variable TMPDIR in my shell prior to invoking R it works as expected:
> Sys.getenv("TMPDIR")
TMPDIR
"/eurotempest/tmp/R"
> tempdir()
[1] "/eurotempest/tmp/R/Rtmp0xY4XD"
However if I don't set it prior to entry, but attempt to set it from
within
2006 Jul 11
2
Dropping unused levels of a factor that has "NA" as a level
Is this a bug?
> f1 <- factor(c("a", NA), levels = c("a", "NA") )
> f2 <- f1[, drop = TRUE]
> f2
[1] a <NA>
Levels: a <NA>
I would have expected f2 to have only one level, "a". It seems
to me that the code in [.factor does not follow the advice in
help("factor") on how to set factor codes to be
2005 Nov 10
2
make check failed on linux-amd64 using PGI compilers
Dear R-help,
I am trying to build R-2.2.0-patched (2005-11-07 r36217) on the head node of
a Scyld cluster (dual Opteron 250s) using PGI compilers (v6.0). I used the
flags suggested by Jennifer Lai on R-devel (taken from R-admin, except that
I had to add -L/usr/X11R6/lib64 to LDFLAGS). The build went fine, but make
check-all failed when running tests/Examples/graphics-Ex.R, at:
> plot(1:2,
2009 Dec 07
3
Crash with Unicode and sub (PR#14114)
Full_Name: George Russell
Version: 2.10.0
OS: Windows XP Version 2002 SP 2
Submission from: (NULL) (217.111.3.131)
The following typed into R --vanilla induces a crash:
-- cut here --
gctorture()
u <- intToUtf8(c(rep(1e3,1e2),32,c(rep(1e3,1e2))))
v <- rep(u,1e2)
v <- sub(" ","",v)
v %in% ""
-- cut here --
sessionInfo() says:
-- cut here --
R version