[R] second axis title orientation

2009-02-13 Thread Jörg Groß
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

[R] height of y-axis (in inches or cm)

2009-02-10 Thread Jörg Groß
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

[R] sub() with + - invalid regular expression

2009-02-07 Thread Jörg Groß
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)

[R] difference between line() and lm()

2009-01-27 Thread Jörg Groß
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

[R] comparing the previous and next entry of a vector

2009-01-25 Thread Jörg Groß
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,

Re: [R] comparing the previous and next entry of a vector

2009-01-25 Thread Jörg Groß
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ß jo...@licht-malerei.de wrote: Hi, I have a quit abstract problem, hope someone can help me here. I have a vector

[R] comparing the previous and next entry of a vector to a criterium

2009-01-25 Thread Jörg Groß
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

Re: [R] Omitting a desired line from a table [Beginner Question]

2009-01-25 Thread 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 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 it

Re: [R] Omitting a desired line from a table [Beginner Question]

2009-01-25 Thread Jörg Groß
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 added a file

[R] plot: abline() - define line length

2009-01-21 Thread Jörg Groß
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

Re: [R] plot: abline() - define line length *solved*

2009-01-21 Thread Jörg Groß
-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:01 AM, Jörg Groß jo...@licht-malerei.de wrote

[R] easiest way to integrate own functions on startup

2009-01-19 Thread Jörg Groß
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

Re: [R] easiest way to integrate own functions on startup

2009-01-19 Thread Jörg Groß
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 some own

Re: [R] easiest way to integrate own functions on startup

2009-01-19 Thread Jörg Groß
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

[R] converting a factor in numeric values with direct control of the numeric values

2009-01-17 Thread Jörg Groß
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 numeric

[R] changing a range of values

2009-01-17 Thread Jörg Groß
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?

[R] converting multiple variable numbers

2009-01-17 Thread Jörg Groß
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 in one

[R] distance between plot-region and main-title / saving plot as pdf

2009-01-17 Thread Jörg Groß
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

[R] data.frame: how to extract parts

2009-01-16 Thread Jörg Groß
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 depending

[R] splitting a string / finding a numeric value within a string

2009-01-16 Thread Jörg Groß
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]]

[R] summary with variance / sd

2009-01-11 Thread Jörg Groß
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

[R] boxplots: yaxp does not work

2009-01-11 Thread Jörg Groß
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

[R] writing an own function - is.factor

2009-01-11 Thread Jörg Groß
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 f 6

[R] append lines to a created file

2008-12-16 Thread Jörg Groß
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

[R] append string to a string

2008-12-16 Thread Jörg Groß
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-help PLEASE

[R] converting a data-frame by a defined rule

2008-12-15 Thread Jörg Groß
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

[R] renaming factor-labels / add factors etc.

2008-12-15 Thread Jörg Groß
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 xyz1

[R] refer to next line within a data-frame an select cases

2008-12-15 Thread Jörg Groß
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

[R] histogram without bars but with density line

2008-10-16 Thread Jörg Groß
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

Re: [R] histogram without bars but with density line - frequency-lines?

2008-10-16 Thread Jörg Groß
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

[R] counting the frequencies of a vector

2008-10-16 Thread Jörg Groß
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

Re: [R] plot - central limit theorem *solved*

2008-10-16 Thread Jörg Groß
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 -

[R] plot - central limit theorem

2008-10-15 Thread Jörg Groß
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

Re: [R] histogram-like plot - multiple bars side by side *solved*

2008-09-30 Thread Jörg Groß
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 - multiple bars side

[R] histogram-like plot - multiple bars side by side

2008-09-29 Thread Jörg Groß
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

[R] birthday problem (factorial limit)

2008-09-28 Thread Jörg Groß
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

[R] histogram-like plot with two variables

2008-09-28 Thread Jörg Groß
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

[R] lower / upper case letters in a plot

2008-09-24 Thread Jörg Groß
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

Re: [R] lower / upper case letters in a plot

2008-09-24 Thread Jörg Groß
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

Re: [R] *solved* lower / upper case letters in a plot

2008-09-24 Thread Jörg Groß
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

[R] customizing the axis (adding labels)

2008-08-10 Thread Jörg Groß
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.. And how

Re: [R] customizing the axis (adding labels)

2008-08-10 Thread Jörg Groß
No, 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) so that the x-axis

Re: [R] customizing the axis (adding labels)

2008-08-10 Thread Jörg Groß
, 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 like you are trying to label a scatterplot with just two lables - this is your boxplot from yesterday? If so

[R] box-plot without a box surrounding the plot

2008-08-09 Thread Jörg Groß
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? __

Re: [R] box-plot without a box surrounding the plot

2008-08-09 Thread Jörg Groß
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 get rid of the surrounding box. So

[R] mean-plot (add residuals)

2008-08-09 Thread Jörg Groß
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

[R] histogram - freq=FALSE - density computation

2008-08-07 Thread Jörg Groß
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 way

[R] Fwd: histogram - freq=FALSE - density computation

2008-08-07 Thread Jörg Groß
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

[R] defining the distance between axis label and axis

2008-08-06 Thread Jörg Groß
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

[R] placing a text in the corner of a plot

2008-07-29 Thread Jörg Groß
Is there an easy way to add a text into an R-plot and place it in the upper left corner? Like that: | (a) | | | | | |

Re: [R] placing a text in the corner of a plot

2008-07-29 Thread Jörg Groß
=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: Is there an easy way to add a text into an R-plot and place it in the upper left corner? Like

[R] how to get the position of a vector-value

2008-07-29 Thread Jörg Groß
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 number

[R] How to simulate heteroscedasticity (correlation)

2008-07-22 Thread Jörg Groß
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

[R] stem and leaf plot: how to edit the stem-values

2008-07-13 Thread Jörg Groß
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

[R] Sorting / editing a table

2008-07-10 Thread Jörg Groß
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