[R] draw borders of bars inside of the rectangles in a barplot

2018-05-21 Thread Martin Batholdy via R-help
Dear R-users, I want to draw a barplot with beside=TRUE. One halve of the bars are drawn with a border, while the other halve are drawn without a border (i.e. filled bars vs. non-filled bars next to each other). Because borders are drawn around the bars, doing this leads to one halve of the

[R] copy/paste of large amount of code to terminal leads to scrambled/missing characters

2018-02-03 Thread Martin Batholdy via R-help
Dear R-users, This question might not be restricted to R, but I hope that some might have experienced similar problems and could help me. When using R, I usually work with a text-editor (textmate2) in which I prepare the script. To execute code, I then copy and paste it to an R-session running

[R] plot 2D matrix of RGB values

2016-01-08 Thread Martin Batholdy via R-help
Hi, I have a 2 dimensional matrix with RGB values and would like to plot it as a two dimensional surface. I am aware of functions like image() that plot a matrix of values as a grid of coloured rectangles. But I can not directly feed in the specific color value for each of these rectangles,

[R] best way to globally set parameters for base graphics

2015-07-20 Thread Martin Batholdy via R-help
Hi, I am looking for a way to modify the basic setup for any kind of plot. (everything that is set with the par function – like margins, cex, las etc.) I want to do this once – preferably across R sessions and not individually before every plot. My first attempt was to add a par() with all my

Re: [R] best way to globally set parameters for base graphics

2015-07-20 Thread Martin Batholdy via R-help
), tcl=-0.4 ) ) layout(matrix(1:2, 1, 2, byrow=T)) plot(c(1,2,3)) plot(c(3,2,1)) On 20 Jul 2015, at 17:48 , Duncan Murdoch murdoch.dun...@gmail.com wrote: On 20/07/2015 11:27 AM, Martin Batholdy via R-help wrote: Hi, I am looking for a way to modify the basic

Re: [R] define absolute size in plots ... possible?

2015-06-24 Thread Martin Batholdy via R-help
or more of either rows or columns, the reduction factor is 0.66.” On 24 Jun 2015, at 13:17 , Duncan Murdoch murdoch.dun...@gmail.com wrote: On 24/06/2015 7:08 AM, Martin Batholdy via R-help wrote: Hi, I would like to define the size for tick-marks, axis-titles, legends, drawing symbols etc

[R] define absolute size in plots ... possible?

2015-06-24 Thread Martin Batholdy via R-help
Hi, I would like to define the size for tick-marks, axis-titles, legends, drawing symbols etc. absolute, meaning that regardless of the size of the plot device, the font-size / character size is the same. Thus if I output my plot with pdf(width=5, height=5) or pdf(width=15, height=15), the

[R] set par options once for entire R session

2015-06-23 Thread Martin Batholdy via R-help
Hi, I would like to set plot-options via par() and keep them for all plots that are created thereafter. Currently after each plot device the parameters I can set with par() are reseted to their default value, at least on a Mac (R 3.2.1). Is there a way to define the parameters for plotting

[R] export vector with write() introduces line breaks

2013-11-16 Thread Martin Batholdy
Hi, I have a long vector which I want to export as a simple ascii text file via write(1:600, file='test.txt', sep=',') When I open the text file with my text editor I see that the data is structured in columns. So it seems that line breaks are introduced. How can I prevent this? Thank you!

[R] colour code areas of a plot

2013-10-22 Thread Martin Batholdy
Hi, I would like to colour different areas of a plot. But I don't know how to do this efficiently. As an example; lets say three stimuli were presented in an experiment, alternating, one at a time. Now I want to plot time on the x-axis and the plot-area should colour code the stimulus that

[R] cluster option in stata for random intercept model in the R language?

2013-10-15 Thread Martin Batholdy
Dear R-list, I am currently working on a dataset with a colleague who uses stata. We fit a random intercept model to the data (decisions clustered in participants) and get closely the same results in stata (using xtreg re) and R (using the lme4 or multilevel package). Now in stata, there is

[R] sequentially aggregating elements of a vector

2013-10-14 Thread Martin Batholdy
Hi, for labelling the stacked bars in a barplot, I need to sequentially sum up the elements of a vector. Suppose I have; x - c(1,2,3,4) (which correspond to the bar-width of stacked bars) I need; y - c(1,3,6,11) (which corresponds to the upper y-values for each bar). What is the

Re: [R] sequentially aggregating elements of a vector

2013-10-14 Thread Martin Batholdy
, Martin Batholdy batho...@googlemail.com wrote: Hi, for labelling the stacked bars in a barplot, I need to sequentially sum up the elements of a vector. Suppose I have; x - c(1,2,3,4) (which correspond to the bar-width of stacked bars) I need; y - c(1,3,6,11) (which

[R] convert string to date format

2013-09-18 Thread Martin Batholdy
Hi, I have a vector that looks like this; (imported from another file) dates - c(Tue Sep 17 2013 16:25:17, Wed Sep 18 2013 16:35:17, Thu Sep 19 2013 16:55:17) now I need a data frame with two columns; datetime 2013.09.17 16:25:17 2013.09.18

[R] add diagonal to matrix

2013-08-03 Thread Martin Batholdy
Hi, I have a 5 columns x 4 rows matrix and would like to add a diagonal of zeros so that I end up with a 5x5 matrix. x - matrix(1:20, 4,5) what is the easiest way to accomplish this in R? thanks for any suggestions! __ R-help@r-project.org mailing

[R] import function without overwriting function with the same name

2013-08-03 Thread Martin Batholdy
Hi, I have to import multiple R-files. Each file consists of several functions with the same function name across the R-files. When I import all files one by one (with source()) I overwrite the function definition of the previous file until only the very last function definition lasts.

Re: [R] import function without overwriting function with the same name

2013-08-03 Thread Martin Batholdy
env.lst - lapply(1:5, new.env) seems to work just fine ok, as far as I understand I would create 5 new environments by this. But how do I access and change the environment? What is the name of the environment? Here is a more concrete example and the general problem: source('functions1.R')

[R] update an array of plots in 'real-time' without drawing lags

2013-05-17 Thread Martin Batholdy
Hi, I know R is not made for this, but I still wanted to ask if there are possibilities to do this; I repeatedly collect data from a database for a given time interval. Now I would like to monitor the change of this data with some nice plots. I actually have to draw 15 plots to get the whole

[R] connect to local mySQL database

2013-05-16 Thread Martin Batholdy
Hi, I would like to access a local mysql database. In python using the sqlite3 library it is quite straightforward. I just have to pass the path to the sqlite-file; sqlite3.connect('.../xy.sqlite') Is there something similar in R (or specifically in the RMySQL package)? It seems like I have

Re: [R] connect to local mySQL database

2013-05-16 Thread Martin Batholdy
tell from your question which you're after. You need either RMySQL, or if you actually want an sqlite database, RSQLite or sqldf. Sarah On Thursday, May 16, 2013, Martin Batholdy wrote: Hi, I would like to access a local mysql database. In python using the sqlite3 library

[R] dispersion indicator for clustered data

2013-03-15 Thread Martin Batholdy
Hi, I have a dataset with clustered data (observations within groups) and would like to make some descriptive plots. Now, I am a little bit lost on how to present the dispersion of the data (what kind of residuals to plot). I could compute the standard error of the mean (SEM) ignoring the

[R] cut a vector in equal parts

2013-02-26 Thread Martin Batholdy
Hi, I would like to cut a vector of values in parts. Each part should have an equal number of elements. for example: x - (rnorm(500)^2) now I want 5 vectors each with 100 elements. The first vector should include the 100 lowest values of x and so on (so that the fifth vector contains the 100

[R] understanding cex (R plots)

2013-02-26 Thread Martin Batholdy
Hi, I try to make multiple plots look as similar as possible. I create each plot with pdf(), using the same height but different width in inch. For some plots I use the layout() function to draw multiple subplots side by side in one pdf. For each plot I use the same cex values for the

Re: [R] understanding cex (R plots)

2013-02-26 Thread Martin Batholdy
to par('cex') to see what R thinks the parameter is at the time of the different plots. That may answer your question, or if not at least give up more information to work with. On Tue, Feb 26, 2013 at 3:46 PM, Martin Batholdy batho...@googlemail.com wrote: Hi, I try to make multiple

[R] compute p/t value from pearson r and n

2013-02-24 Thread Martin Batholdy
Hi, is there a predefined function that computes the p- or t-value based on a correlation coefficient and its sample size? thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] compute p/t value from pearson r and n

2013-02-24 Thread Martin Batholdy
Martin, See ?cor.test example(cor.test) Regards, - Jon On Mon, Feb 25, 2013 at 5:06 AM, Martin Batholdy batho...@googlemail.com wrote: Hi, is there a predefined function that computes the p- or t-value based on a correlation coefficient and its sample size? thanks

[R] change confidence interval line length in barplot2 (plotrix package)

2013-01-22 Thread Martin Batholdy
Hi, is there any way to change the width of the horizontal line of confidence intervals in the barplot2 function in the plotrix package (independent of the width of the bars)? example code: library(plotrix) # Example with confidence intervals and grid hh - t(VADeaths)[, 1] mybarcol - gray20

Re: [R] change confidence interval line length in barplot2 (plotrix package)

2013-01-22 Thread Martin Batholdy
the thickness of the line but not the horizontal width. On Jan 22, 2013, at 21:24 , David Winsemius dwinsem...@comcast.net wrote: On Jan 22, 2013, at 10:28 AM, Martin Batholdy wrote: Hi, is there any way to change the width of the horizontal line of confidence intervals in the barplot2

[R] aggregate data.frame based on column class

2013-01-11 Thread Martin Batholdy
Hi, When using the aggregate function to aggregate a data.frame by one or more grouping variables I often have the problem, that I want the mean for some numeric variables but the unique value for factor variables. So for example in this data-frame: data - data.frame(x = rnorm(10,1,2), group

[R] R and SSH / exchange R objects between client and server

2013-01-01 Thread Martin Batholdy
Hi, I have a laptop (Mac OS) and a remote PC (Ubuntu) and would like to do the heavy work on the remote machine but control it via the laptop. I managed to install ssh server and can now remotely connect to my PC via ssh and can start an R session in the terminal. However, I still don't quite

[R] aggregate / collapse big data frame efficiently

2012-12-25 Thread Martin Batholdy
Hi, I need to aggregate rows of a data.frame by computing the mean for rows with the same factor-level on one factor-variable; here is the sample code: x - data.frame(rep(letters,2), rnorm(52), rnorm(52), rnorm(52)) aggregate(x, list(x[,1]), mean) Now my problem is, that the actual

[R] create stratified splits

2012-12-19 Thread Martin Batholdy
Hi, I have a vector like: r - runif(100) Now I would like to split r into 10 pieces (each with 10 elements) – but the 'pieces' should be roughly similar with regard to mean and sd. what is an efficient way to do this in R? thanks! __

[R] winBUGS with R2WinBUGS on a mac – path issue

2012-12-14 Thread Martin Batholdy
Hi, I try to execute a winBUGS model within R on a Mac. I use wine and the R2WinBUGS package. Now I have a small problem with the path variables; the path to the bugs directory include paranthesis and because of that it won't run. error message: sh: -c: line 0: syntax error near unexpected

[R] mean-aggregate – but use unique for factor variables

2012-09-25 Thread Martin Batholdy
Hi, I have a data.frame which I want to aggregate. There are some grouping variables and some continuous variables for which I would like to have the mean. However there are also some factor-variables in the data-frame that are not grouping variables and I actually would like to aggregate

[R] compare different data-formats

2012-09-14 Thread Martin Batholdy
Hi, I have two data-frames which I want to match by a date-variable. The problem now is, that the date-variable has a different format in this two data-frames. So simply matching by this variable wouldn't work. In the one data-frame the date-variable contains strings that look like this:

[R] use R remotely (ssh / shell / emacs)

2012-07-28 Thread Martin Batholdy
Hi, I have a laptop and a desktop PC. Now I was wondering, if it is possible to create a setup in which you can use the laptop (where ever you are) to remotely access the PC, open an R-instance and let the PC do the heavy computation. I have no idea about remote control, wake-on-lan, ssh and

[R] extract weighting values from a relevance vector machine (kernlab package)

2012-02-16 Thread Martin Batholdy
Dear R-users, How can I extract the weighting values (w-values) for each feature from a rvm-object of the kernlab package? I can access the relevance vectors but how can I get the weighting values of each feature? example code: # create data x1 - rnorm(401,sd=1.10) x2 - rnorm(401,sd=1.10) x3

[R] cross validation in rvm not working? (kernlab package)

2012-02-14 Thread Martin Batholdy
Hi, according to ?rvm the relevance vector machine function as implemented in the kernlab-package has an argument 'cross' with which you can perform k-fold cross validation. However, when I try to add a 10-fold cross validation I get the following error message: Error in match.arg(type,

[R] kernlab - rvm error message: Error in if (length(data) != vl)

2012-02-13 Thread Martin Batholdy
Hi, I am trying to perform relevance vector machines with the rvm-function from kernlab. On one dataset I get this message: Setting default kernel parameters Error in if (length(data) != vl) { : RMate stopped at line 0 of selection missing value where TRUE/FALSE needed Calls: rvm ...

[R] kernlab - error message: array(0, c(n, p)) : 'dim' specifies too large an array

2012-02-13 Thread Martin Batholdy
Hi, For another trainingset I get this error message, which again is rather cryptic to me: Setting default kernel parameters Error in array(0, c(n, p)) : 'dim' specifies too large an array RMate stopped at line 0 of selection Calls: rvm ... .local - backsolve - as.matrix - chol - diag -

Re: [R] kernlab - error message: array(0, c(n, p)) : 'dim' specifies too large an array

2012-02-13 Thread Martin Batholdy
I am using a linear kernel (vanilladot). By switching the kernel, I actually get rid of the error message, but I would like to stick to the linear one ... On 13.02.2012, at 16:23, Martin Batholdy wrote: Hi, For another trainingset I get this error message, which again is rather cryptic

Re: [R] kernlab - error message: array(0, c(n, p)) : 'dim' specifies too large an array

2012-02-13 Thread Martin Batholdy
, kernel = vanilladot) On 13.02.2012, at 16:40, David Winsemius wrote: On Feb 13, 2012, at 10:23 AM, Martin Batholdy wrote: Hi, For another trainingset I get this error message, which again is rather cryptic to me: Just imagine how it seems to us! Setting default kernel

[R] check for nearest value in a vector

2012-02-08 Thread Martin Batholdy
Hi, Is there a way to check which value in a vector is nearest to a given value? so for example I have vector x: x - c(1, 6, 12, 28, 33) and I would like to get the position of the element of x that is nearest to 14 (in this case the third element). thanks!

Re: [R] check for nearest value in a vector

2012-02-08 Thread Martin Batholdy
great, thanks! On 08.02.2012, at 14:00, Dimitris Rizopoulos wrote: How about this: x - c(1, 6, 12, 28, 33) which.min(abs(x - 14)) I hope it helps. Best, Dimitris On 2/8/2012 1:56 PM, Martin Batholdy wrote: Hi, Is there a way to check which value in a vector is nearest

[R] get mean of same elements in a data.frame

2012-02-02 Thread Martin Batholdy
Hi, I have the following data.frame: data.frame(x = c(1:10), y = rnorm(10,2,1), label = rep(c('a', 'b', 'c', 'd', 'e'),2)) in this data.frame there is a label-variable containing strings. Each string is represented two times. Now I would like to have the mean of the corresponding x (and

[R] apply lm() to each row of a matrix

2012-01-29 Thread Martin Batholdy
Hi, I would like to fit lm-models to a matrix with 'samples' of a dependent variable (each row represents one sample of the dependent variable). The independent variable is a vector that stays the same: y - c(1:10) x - matrix(rnorm(5*10,0,1), 5, 10) now I would like to avoid looping over

[R] sequentially summing up a elements of a vector

2012-01-21 Thread Martin Batholdy
Hi, I have a somewhat abstract and tricky problem (at least for me). Perhaps someone here can help me: I would like to convert: x - c(0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0) into x - c(0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4) every 1 in

[R] z-transform each column of a data.frame

2012-01-20 Thread Martin Batholdy
Hi, I am currently trying to z-transform (that is subtracting the mean and divide by the standard deviation) multiple columns of a data.frame at the same time. My first approach was: x - data.frame(c(0:10), c(10:20)) (x - colMeans(x)) / apply(x, 2, sd) This is obviously not working. Is

Re: [R] z-transform each column of a data.frame

2012-01-20 Thread Martin Batholdy
great, thank you! On 20.01.2012, at 18:10, R. Michael Weylandt wrote: ? scale apply(x, 2, scale) Michael On Fri, Jan 20, 2012 at 12:04 PM, Martin Batholdy batho...@googlemail.com wrote: Hi, I am currently trying to z-transform (that is subtracting the mean and divide

[R] get the percentage rank of a value based on an empirical data vector

2012-01-11 Thread Martin Batholdy
Hi, I have a vector with values: x - rnorm(1000, 5, 2) and one single value: y - 6.2 now I would like to know the percent rank of y based on the 'population'-vector x. Is there a convenient function that calculates the percent rank of a y for the given vector x? thanks!

Re: [R] get the percentage rank of a value based on an empirical data vector

2012-01-11 Thread Martin Batholdy
findInterval(6.2, sort(x)) [1] 704 xecdf - ecdf(x) xecdf(6.2) [1] 0.704 thanks, that helped a lot! On 11.01.2012, at 14:58, David Winsemius wrote: On Jan 11, 2012, at 8:12 AM, Martin Batholdy wrote: Hi, I have a vector with values: x - rnorm(1000, 5, 2) and one

[R] modeling a haemodynamic response function in R

2012-01-09 Thread Martin Batholdy
Hi, I have time-series data and I would like to fit a 2-gamma HRF to the data (http://en.wikibooks.org/wiki/SPM/Haemodynamic_Response_Function) in order to get the explained variance and the maximum of the fitted data. Is there a straightforward function for that or a package that provides

[R] algorithm that iteratively drops columns of a data-frame

2011-11-09 Thread Martin Batholdy
Dear R-Users, I have a problem with an algorithm that iteratively goes over a data.frame and exclude n-columns each step based on a statistical criterion. So that the 'column-space' gets smaller and smaller with each iteration (like when you do stepwise regression). The problem is that in

Re: [R] algorithm that iteratively drops columns of a data-frame

2011-11-09 Thread Martin Batholdy
great, thank you both! On 09.11.2011, at 17:27, Jeff Newmiller wrote: Try data[,!names(data) %in% names(col_means)] On Wed, 9 Nov 2011, Martin Batholdy wrote: Dear R-Users, I have a problem with an algorithm that iteratively goes over a data.frame and exclude n-columns each

[R] control the conversion of factor to numeric

2011-10-18 Thread Martin Batholdy
Dear R-list, I currently have to convert a data.frame with several factor-variables to a numeric matrix. Now the problem is, that the order of the factor-labels don't match the order I would like to use. for example, let's assume I have this factor-variable in my data-frame: x -

Re: [R] control the conversion of factor to numeric

2011-10-18 Thread Martin Batholdy
AM, Martin Batholdy batho...@googlemail.com wrote: Dear R-list, I currently have to convert a data.frame with several factor-variables to a numeric matrix. Now the problem is, that the order of the factor-labels don't match the order I would like to use. for example, let's

[R] replicate data.frame n times

2011-10-11 Thread Martin Batholdy
Hi, is there a way to replicate a data.frame like you can replicate the entries of a vector (with the repeat-function)? I want to do this: x - data.frame(x, x) (where x is a data.frame). but n times. And it should be as cpu / memory efficient as possible, since n is pretty big in my

[R] calculate multiple means of one vector

2011-10-10 Thread Martin Batholdy
Dear R-Users, I have the following two vectors: data - rnorm(40, 0, 2) positions - c(3, 4, 5, 8, 9, 10, 20, 21, 22, 30, 31, 32) now I would like to calculate the mean of every chunk of data-points (of the data-vector) as defined by the positions-vector. So I would

[R] generate sequences for every element of a vector

2011-10-07 Thread Martin Batholdy
Dear R-List, I have the following problem: I have a vector that looks like this: x - c(3, 8, 14, 24, 34, 40) And I would like to make a sequence out of every element, starting at the value of this element. So that I get a vector just like this: x - c(3, 4, 5, 8, 9, 10, 14, 15,

Re: [R] generate sequences for every element of a vector

2011-10-07 Thread Martin Batholdy
great, thank you! On 07.10.2011, at 15:54, Jean-Christophe BOUËTTÉ wrote: Hi, this should work: as.vector(rbind(x,x+1,x+2)) 2011/10/7 Martin Batholdy batho...@googlemail.com: Dear R-List, I have the following problem: I have a vector that looks like this: x - c(3, 8, 14, 24

[R] mean of 3D arrays

2011-10-05 Thread Martin Batholdy
Hi, I have multiple three dimensional arrays. Like this: x1 - array(rnorm(1000, 1, 2), dim=c(10, 10, 10)) x2 - array(rnorm(1000, 1, 2), dim=c(10, 10, 10)) x3 - array(rnorm(1000, 1, 2), dim=c(10, 10, 10)) Now I would like to compute the mean for each corresponding cell. As a result I want to

[R] converting 3D array to a data-frame (with coordinate-columns x, y, z)

2011-10-05 Thread Martin Batholdy
Hi, I am still struggling with three dimensional arrays. Now I would like to convert a three dimensional array into a data-frame with the coordinate-columns: x, y, z and a value-column. And I definitely don't want to loop over every element, since this would be very resource intensive for

[R] speed up this algorithm (apply-fuction / 4D array)

2011-10-05 Thread Martin Batholdy
Hi, I have this sample-code (see above) and I was wondering wether it is possible to speed things up. What this code does is the following: x is 4D array (you can imagine it as x, y, z-coordinates and a time-coordinate). So x contains 50x50x50 data-arrays for 91 time-points. Now I want to

[R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread Martin Batholdy
Dear R-group, is there a way to perform calculations that are defined in a string format? for example I have different variables: x1 - 3 x2 - 1 x4 - 1 and a string-variable: do - 'x1 + x2 + x3' Is there any way to perform what the variable 'do'-describes (just like the formula-element but

Re: [R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread Martin Batholdy
- result + x[,,,i] } result - result / dim(x)[4] 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 Martin Batholdy Sent: Wednesday, October 05, 2011 1:14 PM To: R

[R] intensity map / plot

2011-10-03 Thread Martin Batholdy
Dear R-list, I would like to generate an intensity map based on a x * y matrix. Each point in the matrix should get plotted at the coordinate: x = column / y = row with a color-intensity (for example gray-value) based on the actual value of this point. Is there a convenient package /

Re: [R] intensity map / plot

2011-10-03 Thread Martin Batholdy
thanks! On 03.10.2011, at 19:11, Uwe Ligges wrote: See ?image Uwe Ligges On 03.10.2011 19:05, Martin Batholdy wrote: Dear R-list, I would like to generate an intensity map based on a x * y matrix. Each point in the matrix should get plotted at the coordinate: x = column / y

[R] different results aov vs. lm

2011-09-30 Thread Martin Batholdy
Hi, I currently running regression models on an experimental dataset. The model contains one independent continuous variable and two independent experimental conditions (one with two factors, the other with three factors) and several covariates. Now I get different results for a covariate in

[R] split variable / create categories

2011-09-09 Thread Martin Batholdy
Hi, is there a function or an easy way to convert a variable with continuous values into a categorial variable (with x levels)? here is what I mean: I want to transform x: x - c(3.2, 1.5, 6.8, 6.9, 8.5, 9.6, 1.1, 0.6) into a 'categorial'-variable with four levels so that I get: [1]

Re: [R] split variable / create categories

2011-09-09 Thread Martin Batholdy
– I get factor-borders that overlap. And I really have to prevent this. On 09.09.2011, at 17:49, Andrea Spano wrote: cut ( x , c(0, 1.4 ,6, 8, Inf ), labels = 1:4, include.lowest = T) On 9 September 2011 17:34, Martin Batholdy batho...@googlemail.com wrote: Hi, is there a function

[R] show equal entries in data.frame

2011-09-07 Thread Martin Batholdy
Hi, I have the following data-frame: x - data.frame(first = c('a','c','k','b'), second = c('b','k','a','j'), third = c('f','a','h','b')) first second third 1 a b f 2 c k a 3 k a h 4 b j b Now I would like to see wether there are entries

[R] algorithm to merge same entries in a matrix

2011-08-30 Thread Martin Batholdy
Hi, I have the following, rather unorthodox problem: I have a matrix that looks like this: m1 - matrix(c('a','b','d',NA,'c','c'), 2,3, byrow=TRUE) [,1] [,2] [,3] [1,] a b d [2,] NA c c now I would like to transform this matrix into this matrix: [,1] [,2] [,3] [,4]

[R] control line break behavior of R output

2011-08-27 Thread Martin Batholdy
Hi, Is it possible to define at which point a line-break is happening in R-output? I for example would rather like to scroll horizontally in a data-frame with a lot of columns instead of having a lot of breakpoints in the data.frame (to fit the screen). Can you control that? Can you tell R

[R] test if vector contains elements of another vector (disregarding the position)

2011-08-22 Thread Martin Batholdy
Hi, I have the following problem: I have two vectors: i - c('a','c','g','h','b','d','f','k','l','e','i') j - c('a', 'b', 'c') now I would like to generate a vector with the length of i that has zeros where i[x] != any element of j and 1 where i[x] == any element of j. So for the

[R] compute the mean of two (or more) correlations

2011-07-25 Thread Martin Batholdy
Hi, is there a function in R that computes the mean of two (or more) correlations? (that is doing the z-transformation of the correlations, computing the mean of the z-values and then retransform it to a correlation). Or is there a fisher-table implemented? I have not found anything via

[R] best way to aggregate / rearrange data.frame with different data types

2011-07-11 Thread Martin Batholdy
Hi, I have a data.frame that looks like this: Subject - c(rep(1,4), rep(2,4), rep(3,4)) y - rnorm(12, 3, 2) gender - c(rep(w,4), rep(m,4), rep(w,4)) comment - c(rep(comment A,4), rep(comment B,4), rep(comment C,4)) data - data.frame(Subject,y,gender,comment) data Subject y

[R] predict.lm with NAs

2010-04-14 Thread Martin Batholdy
Hi, I wanted to use the predict.lm() function to compare the empirical data with the predicted values. The problem is that I have NAs in my data. I wanted to cbind my data.frame with the empirical values with the vector I get from predict.lm. But they don't have the same length because

[R] open help files in browser

2010-03-30 Thread Martin Batholdy
Hi, Is there a way to open help files in the default web browser instead of a new R-window when I use the help-functions (like ?, help.search() etc.)? thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] open help files in browser

2010-03-30 Thread Martin Batholdy
)? With internal you mean On 30.03.2010, at 19:59, Duncan Murdoch wrote: On 30/03/2010 1:46 PM, Martin Batholdy wrote: Hi, Is there a way to open help files in the default web browser instead of a new R-window when I use the help-functions (like ?, help.search() etc.)? You don't say what

[R] plots: gap between x- and y-axis

2010-03-26 Thread Martin Batholdy
Hi, I was wondering why the gap between the x- and the y-axis gets bigger with a wider plot window. see this example; quartz(1,10,3) par(bty=n) plot(1:9, xaxt=n) axis(1, 1:9) quartz(2,30,3) par(bty=n) plot(1:9, xaxt=n) axis(1, 1:9) quartz(3,80,3) par(bty=n) plot(1:9, xaxt=n) axis(1, 1:9)

[R] add information above bars of a barplot()

2010-03-22 Thread Martin Batholdy
hi, I have a barplot with six clusters of four bars each. Now I would like to add the exact value of each bar as a number above the bar. I hoped to get some tips here. I could simply add text at the different positions, but I don't understand how the margins on the x-axis are calculated (how

[R] multiple logical comparisons

2010-03-21 Thread Martin Batholdy
Hi, I would like to compare a column of data with a vector. I have this data.frame for example; x - data.frame(A = c(1:5), B = c(1,1,2,2,2)) Now I have a search vector: search - c(1,3,5) when I now try to get all the data-rows which have a 1, a 3, or a 5 in column A and a 2 in column B, I

Re: [R] multiple logical comparisons

2010-03-21 Thread Martin Batholdy
thanks! Now I have one more question; How can I do the reverse? when %in% is == (for two vectors of different lengths); what is the equivalent to != ? On 21.03.2010, at 22:33, Erik Iverson wrote: Martin Batholdy wrote: Hi, I would like to compare a column of data with a vector. I

[R] add euro sign to a plot

2010-03-21 Thread Martin Batholdy
hi, Is it possible to add special characters like the euro sign to a plot? 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

[R] trend test for frequencies

2010-02-28 Thread Martin Batholdy
Hi, which test do I have to use if I want to test if the following data follow a monotone trend; 0min5min10min 20min 30min 5 20 55 70 90 ... where the dependent variable contains frequencies. And how is that implemented in R?

[R] split strings in a vector and convert it to a data.frame

2010-02-09 Thread Martin Batholdy
hi, I have a vector full of strings like; xy_100_ab xy_101_ab xy_102_ab xy_103_ab I want to seperate each string in three pieces and the separator should be the _ at the end I want a data.frame like: column1 column2 column3 xy 100 ab xy

[R] error message; ylim + log=y

2009-11-18 Thread Martin Batholdy
Hi, I get a lot of error messages with this command, but I don't understand why; plot(c(),c(), xlim=c(1,10), ylim=c(0,1), log=y) thanks for any help! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] error message; ylim + log=y

2009-11-18 Thread Martin Batholdy
to plot. What were you expecting it to do? When you say lot of error messages, please include them and also follow the posting guide. On Wed, Nov 18, 2009 at 4:52 PM, Martin Batholdy batho...@googlemail.com wrote: Hi, I get a lot of error messages with this command, but I don't understand

[R] how to merge two data.frames – only comp lete observations

2009-11-17 Thread Martin Batholdy
Hi, I have two data-frames like: A: USA 3.2 Canada 4.7 Austria 1.5 Iran0.3 China 3.8 Japan 3.0 B: Austria 17 Iran22 Angola 29 Japan 32 England 11 Now I want to merge this two data.frames to one - but I only want entries for the countries I have complete

[R] plot an arrow / add arrow to a line

2009-10-06 Thread Martin Batholdy
hi, is it possible to end a line plotted with lines() with an arrow? Or are there any other functions to add an arrow to plot? thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] gsub - replace multiple occurences with different strings

2009-10-05 Thread Martin Batholdy
Hi, I search a way to replace multiple occurrences of a string with different strings depending on the place where it occurs. I tried the following; x - c(xx y e d xx e t f xx e f xx) x - gsub(xx, c(x1, x2, x3, x4), x) what I want to get is; x = x1 y y e d x2 e t f x3 e f x4 but what I

[R] start a script directly under windows

2009-09-30 Thread Martin Batholdy
hi, I try to configure my system so when I click on an .R script, the script is executed in the R GUI. I tried to open .R files with different .exe files that I found in the bin-folder of the R folder (R.exe, Rcmd.exe, Rgui.exe ...). But I always get the message; ARGUMENT 'c:\...\...'

Re: [R] Rounding error in seq(...)

2009-09-30 Thread Martin Batholdy
hum, can you explain that a little more detailed? Perhaps I miss the background knowledge - but it seems just absurd to me. 0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there? why is x - 0.1 + 0.1 +0.1 not equal to y - 0.3 ? Am 30.09.2009 um 21:04 schrieb Duncan Murdoch: On

[R] (windows xp) start script on startup / double clicking on the script

2009-09-30 Thread Martin Batholdy
hi, I am still trying to figure out how it is possible to start an R- script via the R-GUI directly by double-clicking on the script file in windows xp. On Mac OS I have the option start script in the editor in the preferences. But on windows XP I always get the ARGUMENT 'c:\...\...'

[R] start scripts directly in the console on windows machines

2009-09-29 Thread Martin Batholdy
hi, on the mac you have the opportunity to start a script directly instead of opening it in the script editor. So when I doubleclick on an .R - file the code is executed immediately. I haven't found such an option in the preferences of the R program for windows. Is there also a way to do

[R] xtable - print - suppress output

2009-09-21 Thread Martin Batholdy
hi, I use xtable to convert data.frames to html tables. But when I use the print-command I always get the whole output printed even if I just want to save the html table into a variable; table - print(xtable(CERAT), type=html) How can I suppress that output is printed? thanks!

Re: [R] xtable - print - suppress output

2009-09-21 Thread Martin Batholdy
Am 21.09.2009 um 23:59 schrieb Rolf Turner: On 22/09/2009, at 9:52 AM, Martin Batholdy wrote: hi, I use xtable to convert data.frames to html tables. But when I use the print-command I always get the whole output printed even if I just want to save the html table into a variable

[R] xtable + print (html)

2009-09-20 Thread Martin Batholdy
hi, I want html code via the xtable package. I have a data.frame and tried to use the print()-function. But I only get the data.frame printed - no html arround it. what do I have to change? thanks! __ R-help@r-project.org mailing list

[R] latex code in R - convert to pdf

2009-09-17 Thread Martin Batholdy
hi, is it possible to convert latex code to pdf in R (like a latex-program would do it)? Is there a package that comes with this capabilities? My problem is that I want to generate tables automatically - and I can't use a latex editor at that computer ... Besides latex ... are there

[R] call for input

2009-09-14 Thread Martin Batholdy
Hi, is there a way to make a call for an input at some point of a process ..? I don't know how to describe it well ... like; please enter your first name: and then, what is typed in should be saved into a variable. __ R-help@r-project.org

  1   2   >