Hi,
I would like to generate two correlated variables.
I found that funktion for doing that:
a <- rmvnorm(n=1,mean=c(20,20),sigma=matrix(c(5,0.8*sqrt(50),
0.8*sqrt(50),10),2,2))
(using library(mvtnorm))
Now I also want to generate two correlated variables where the error
variance vary
Is there an easy way to add a text into an R-plot and place it in the
upper left corner?
Like that:
| (a) |
| |
| |
|
gt;
> plot(1:10)
> legend("topleft",c("Your text here"),pch=1)
>
> See ?legend and ?text for more information.
>
> HTH,
>
> Jorge
>
>
> On Tue, Jul 29, 2008 at 6:04 PM, Jörg Groß <[EMAIL PROTECTED]>
> wrote:
>
I am searching for a way to get nearest position of a number in a
vector from a search-value.
So perhaps if I have this vector:
1.0 1.2 1.4 1.6 1.8 2.0
I want to get the position of a special number.
with match(1.4 ,x), I get "3" for position three.
But now I want the nearest numbe
Hi,
How can I make the distance between an axis-label and the axis bigger?
I haven't found anything in par()...
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org
Hi,
I don't understand what
hist(x, freq=FALSE)
does.
At first I thought it would be just the relative frequencies instead
of the absolute frequencies,
by just computing "frequencies / n" in every category.
But with a small dataset the y-values (densities) don't sum to one.
Is there a wa
If the bars are chosen at unit spacings it will sum to one.
How can I do that?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provid
Hi,
I want to draw a boxplot and I want to get rid of the surrounding box.
So that there are only the axis lines left on the bottom and on the
left.
I tried a litte bit with box() but I dont get it the way I want.
Can somebody help me out?
__
R-he
par(bty="l")
boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
#is that what you want?
Stephen
Thanks! That's what I needed.
On Sat, Aug 9, 2008 at 8:12 PM, Jörg Groß <[EMAIL PROTECTED]>
wrote:
Hi,
I want to draw a boxplot and I want to g
Hi,
I want to plot the mean of a variable and add the standard deviation
as a line going above and below the mean (like the whiskers in a
boxplot) but I don't know how to add these residual-lines.
Is there an easy way to do that or do I have to use the line()-
function to create them on my
Hi,
I want to customize the x-axis.
I tried that:
par(bty="n", xaxt="n")
so that the x-axis is supressed.
then I tried to plot two variables and add a customized x-axis:
plot(x, y)
axis(1, at=c(1,2), labels=c("group1", "group2"))
but the axis is not added to the plot.
I don't understand why..
, what I want is to plot the mean for two different groups.
So that I get group 1 and 2 on the x-axis and also label it like that.
On Sun, Aug 10, 2008 at 11:29 AM, Jörg Groß <[EMAIL PROTECTED]>
wrote:
Hi,
I want to customize the x-axis.
I tried that:
par(bty="n", xaxt="n
xaxt="n")
axis(1, at=c(1,2), labels=c("group1", "group2"))
On Sun, Aug 10, 2008 at 12:09 PM, Jörg Groß <[EMAIL PROTECTED]
malerei.de> wrote:
Am 10.08.2008 um 17:46 schrieb stephen sefick:
Would you provide reproducible code because form your example it
looks
l
Hi,
I have a problem sorting a table;
When I read a table into R by x <- read.table() I get something like
this:
V1 V2 V3
yes 1 3
no 2 6
yes 3 9
no 4 12
Now I want to generate a vector of V2.
But R should only put in the numbers of V2 into
Hi,
I would like to make a stem and leaf plot and I want to edit the
category-names.
So, by doing this:
> x <- c(1,2,2,3,3,3,3,2,2,1)
> stem(x)
I get:
1 | 00
1 |
2 |
2 |
3 |
First Question: Why do I get gaps between the categories?
(like in line 2 and line 4)
And seco
Hi,
How can I generate lower case letters for my axis-titles?
Thanks,
Jörg
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide comm
Oh, ok ...
perhaps it was the wrong description;
I want lowered cases...
In LaTeX I get them with x_1 for example.
Or x^2 for upper cases.
But how can I make this in R?
Am 24.09.2008 um 16:17 schrieb Dimitris Rizopoulos:
check:
?tolower()
Best,
Dimitris
Jörg Groß wrote:
Hi,
How can I
Great thanks and sorry for my bad english!
Am 24.09.2008 um 16:32 schrieb Dimitris Rizopoulos:
so you mean subscripts and superscripts, then check:
?plotmath
Best,
Dimitris
Jörg Groß wrote:
Oh, ok ...
perhaps it was the wrong description;
I want lowered cases...
In LaTeX I get them
Hi,
I tried to calculate the formula for the birthday problem
(the probability that at least two people out of a group of n people
share the same birthday)
But the factorial-function allows me only to calculate factorials up
to 170.
So is there a way to push that limit?
to solve this fo
Hi,
I want to plot a binomial propability distribution.
I know how to generate the data;
x <- seq(from=0, to=14, by=1)
y <- dbinom(x, 14, 0.7, log = FALSE)
but what I don't know is how to plot this within a histogram like plot.
Because the histogram function only accepts one variable.
Is
Hi,
I found this example for producing multiple histograms;
require(plotrix)
l <- list(rnorm(50),rnorm(50,sd=2),rnorm(50,mean=3))
multhist(l)
Now I want something like that, for creating multiple density
distributions (in one plot).
But I have two variables for one density distribution
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
project.org] On Behalf Of Jörg Groß
Sent: Monday, September 29, 2008 2:06 PM
To: r-help@r-project.org
Subject: [R] histogram-like plot - m
Hi,
Is there a way to simulate a population with R and pull out m samples,
each with n values
for calculating m means?
I need that kind of data to plot a graphic, demonstrating the central
limit theorem
and I don't know how to begin.
So, perhaps someone can give me some tips and hints ho
Hi,
I know how to plot an histogram and how to add a density line.
But how can I plot only the density line without the bars?
Is there a way to say the hist() function not to plot bars, but a
density line instead?
__
R-help@r-project.org mailing li
Am 16.10.2008 um 17:12 schrieb Yihui Xie:
plot(density(x))
Regards,
Yihui
--
Thanks!
Is there also a way to plot the frequency-bars (not the density) as
lines instead of bars?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/l
Hi,
Is there a function which counts the frequencies of the occurence of a
number within an interval?
for example I have this vector:
x <- c(1, 3, 1.2, 5, 5.9)
and I want a vector that gives me the frequencies within an interval
of 2, beginning at 0
(so the intervals are 0-2, 2-4, 4-6 a
Thanks for your great help!
I have now what I wanted.
For sure it's not well written and you can realize it with much less
lines.
But it works and it's like how I wanted it to look like;
z1 <- rnorm(4500, mean=20, sd=5)
z2 <- rnorm(3600, mean=28, sd=5)
z3 <- rnorm(1300, mean=40, sd=7)
z4 <
hi,
I try to append a line to a file with;
writeLines("xxx", con = "file.txt, sep = "\n")
but it always overwrites the existing content.
How can I "change" the "mode" of writeLines to append ("a") ?
__
R-help@r-project.org mailing list
https://sta
hi,
I want to append a string to a string like;
x <- c("abc")
append(x, "def")
so that I get for x:
[1] "abcdef"
not (!)
[1] "abc" "def"
How can I do that in R?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-hel
Hi,
I have a data frame and would like to have summary statistics for
grouped data.
With summary() I get the central tendencies for the overall data.
How can I get descriptive statistics with variances and standard
deviations?
for example my data.frame:
group x y
exp
Hi,
I'd like to change the y-tickmarks of a boxplot.
But it doesn't work with yaxp (like I would do it in a plot-function).
Can someone help me out?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the p
Hi,
I try to write an own function in R.
I want a summary table with descriptive statistics.
For example, I have this data.frame:
d <- data.frame(c(rep("m",5), rep("f",5)), c(1:10))
names(d) <- c("x", "y")
d
x y
1 m 1
2 m 2
3 m 3
4 m 4
5 m 5
6
Hi,
I have a problem with the R syntax.
It's perhaps pretty simple, but I don't understand it ...
I can extract a column from a data.frame with the following code for
example ...
b$row1[b$row1 == "male"]
so I see all male-entries.
But I cannot extract all lines of a data.frame dependin
Hi,
I have this variable;
x <- c("test_01.log")
and I want to extract the number (01) out of the variable.
So that I get;
> x
[1] 1
I tried strsplit, but I don't know how to refer to the result.
Can someone help me with that?
[[alternative HTML version deleted]]
Hi,
I know how to convert a factor-variable into a numeric variable via
as.numeric().
But how can I control the values that are assigned?
For example, I have this factor-variable:
z <- c("male", "male", "female")
z <- as.factor(z)
And I want to convert male in 3 and female into the nume
Hi,
If I have following vector;
x <- c(1,1,1,2,2,3,4,4,5)
and I want to change values in the range of 1 to 3 into the value 1,
how can I do that?
I tried
x[x == c(1:3)] <- c(1)
but than I get;
x
[1] 1 1 1 2 1 1 4 4 5
R doesn't change the 2 into a 1.
But why?
___
thanks for the great help!
But I have one additional question (hope I can work alone then);
I want to replace the values of a vector, like this:
x <- c(1,2,2,3,3,4,4,4,5,1)
x[x==1] <- c(12)
x[x==2] <- c(13)
x[x==3] <- c(17)
x[x==4] <- c(20)
x[x==5] <- c(22)
is there a way to do that just i
Hi,
is there a way to increase the distance beween the plot (or plot-
region) and the main-title?
I haven't found anything via ?par().
Thanks for any help!
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE d
Hi,
I am currently writing some own functions that I frequently need.
So, it would be perfect if I could load these functions at the
beginning of each R-session with a small command.
I tried to generate a R-package and install it that way.
But it seems that it is not so easy to add new fun
Is there a way to execute this command on every R-start?
I tried to add something in the Startup.h file - but that didn't work.
(working on a mac)
Thanks!
Am 20.01.2009 um 01:25 schrieb Duncan Murdoch:
On 19/01/2009 7:13 PM, Jörg Groß wrote:
Hi,
I am currently writing som
Hi,
I tried to generate a .Rprofile file.
But R does not load it automatically.
Is there a tutorial on the web on generating such a file?
(haven't found anything that helped me)
And where do I have to put this .Rprofile-file?
In the working directory?
Does R generate a .Rprofile file when R is
Hi,
is there a way to define, that a line drawn via abline() should only
go from for example -2 to 1 on the x-axis (with something working
similiar to xlim()) ?
thanks for any help!
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailma
Remko Duursma
Post-Doctoral Fellow
Centre for Plant and Food Science
University of Western Sydney
Hawkesbury Campus
Richmond NSW 2753
Dept of Biological Science
Macquarie University
North Ryde NSW 2109
Australia
Mobile: +61 (0)422 096908
On Thu, Jan 22, 2009 at 11:0
Hi,
I have a quit abstract problem, hope someone can help me here.
I have a vector like this:
x <- c(1,2,3,4,5,2,6)
x
[1] 1 2 3 4 5 2 6
now I want to get the number where the previous number is 1 and the
next number is 3
(that is the 2 at the second place)
I tried something with tail(x,
DF
x nxt prv
1 1 2 NA
2 2 3 1
3 3 4 2
4 4 5 3
5 5 2 4
6 2 6 5
7 6 NA 2
subset(DF, nxt == 3 & prv == 1)$x
[1] 2
On Sun, Jan 25, 2009 at 5:29 PM, Jörg Groß
wrote:
Hi,
I have a quit abstract problem, hope someone can help me here.
I have a vector like this:
Hi,
I have a quit abstract problem, hope someone can help me here.
I have a vector like this:
x <- c(1,2,3,4,5,2,6)
x
[1] 1 2 3 4 5 2 6
now I want to get the number where the previous number is 1 and the
next number is 3
(that is the 2 at the second place)
I tried something with tail(x
fish[fish$GeoArea == 1 & fish$Month == 10]
Am 25.01.2009 um 23:06 schrieb pfc_ivan:
I am a beginner using this R software and have a quick question.
I added a file into the R called fish.txt using this line.
fish<-read.table("fish.txt", head=T, fill=T)
The .txt file looks like this. Since
sorry,
there is a comma missing;
fish[fish$GeoArea == 1 & fish$Month == 10, ]
Am 25.01.2009 um 23:33 schrieb Jörg Groß:
fish[fish$GeoArea == 1 & fish$Month == 10]
Am 25.01.2009 um 23:06 schrieb pfc_ivan:
I am a beginner using this R software and have a quick question.
I adde
Hi,
what exactly is the difference between the computation of intercept
and slope coefficents in a standard bivariate regression via the lm()
function and the line() function?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listi
Hi,
can someone help me;
I don't understand why this code doesn't do what it's supposed to do;
x <- c("F+", "F+")
x <- sub("F+", "F", x)
x
[1] "F+" "F+"
(I want "F" "F")
when I try this;
x <- c("F+", "F+")
x <- sub("+", "", x)
x
I get an error message ("invalid regular expression")
Hi,
Is there a way to define the height of an y-axis not only by defining
the tick-marks
but by defining a height in inches or cm?
So that the absolute axis height is the same over different plots...
__
R-help@r-project.org mailing list
https://sta
Hi,
I have added a second y-axis via axis() to a plot.
Then I tried to add an y axis title.
But the axis() function seems to have no argument like ylab.
and if I add a title with title() the text is centered at the first
axis, not the second defined one.
Is there a way to add an axis-title
Hi,
I have a data frame with several columns.
Now I want to transfer the data into a new variable (also a data
frame), but I only want a part of the data, defined by a rule ...
for example; I have following data frame:
row1row2row3
x 2 3
x
Hi,
how can I change a defined factor-variable?
Like adding levels, renaming existing levels or merge several levels
of a factor to one level?
For example; following factor-variable is given:
x <- factor(c("xyz1", "abc1", "xyz2", "abc2"))
How can I add the level fgh?
And how can I merge
Hi,
I have a problem sorting and selecting entries within a data-frame and
I don't know if it is possible to solve it with R ... (probably yes,
but I have no idea how).
Following Data;
row1row2
a 12
pos NA
a 3
neg NA
a
55 matches
Mail list logo