Re: [R] Puzzled by results from base::rank()

2023-08-11 Thread Gerrit Eichner
- Dr. Gerrit Eichner Mathematical Institute, Room 215 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany http://www.uni-giessen.de/eichner

Re: [R] Get data from a list of data frames

2022-12-15 Thread Gerrit Eichner
on4 = Station4, Station5 = Station5) select.stat <- paste0("Station", c(1, 4, 5)) select.sens <- "thermometer" sapply(Total[select.stat], function(x, sens) x$code[x$sensor == sens], sens = select.sens) Hth -- Gerrit -

Re: [R] How to create density ellipses with R

2022-01-14 Thread Gerrit Eichner
Hi Paul, take a look at base R's function contour (and the Examples section of its help page), and follow maybe the hints under "See also". Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Insti

Re: [R] Replacing certain rows with values from a different column

2021-08-10 Thread Gerrit Eichner
Hi, James, if I understand you correctly, maybe, with(firstdf, ifelse(Province %in% seconddf$Country, Province, Country) ) does what you want? Hth -- Gerrit - Dr. Gerrit Eichner

Re: [R] Plotting Coxph model with an interaction.

2021-05-20 Thread Gerrit Eichner
xph(Surv(futime, fustat) ~ age+rx+age*rx, data = ovarian) plot(survfit(coxfit, newdata=data.frame(age=60,rx=2))) Or do I missunderstand your question? Hth -- Gerrit --------- Dr. Gerrit Eichner Mathematical Institut

Re: [R] Group by and duplicate a value/dplyr

2021-05-11 Thread Gerrit Eichner
Hello, Elahe, you were, of course, supposed to insert my suggested code-snippet into you code and test it therein ... Regards -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich

Re: [R] Group by and duplicate a value/dplyr

2021-05-11 Thread Gerrit Eichner
Homework? Try maybe mutate(MinValue = min(Value[Value != 0]) ) or mutate(MinValue = sort(unique(Value))[2]) Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni

Re: [R] cox.zph

2021-03-31 Thread Gerrit Eichner
Yes. :-) Best regards -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2

Re: [R] Calculating column differences

2021-03-24 Thread Gerrit Eichner
Dear Jeff, read diff's help page, and you'll find out what is wrong with your expectation. What do think diff(df$Score) should give for the first element in df$Score?? Hth -- Gerrit - Dr. Gerrit Eichner

Re: [R] Color in stripchart

2021-03-10 Thread Gerrit Eichner
using stripchart, but you may want to look at the examples of function beeswarm in package beeswarm. Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de

Re: [R] Fwd: Concatenation?

2021-02-18 Thread Gerrit Eichner
f course, then, e.g., do.call(paste0, data.frame(X)) would work. Best -- Gerrit --------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel:

[R] Fwd: Concatenation?

2021-02-18 Thread Gerrit Eichner
[I forgot to keep it on the list.] Weitergeleitete Nachricht Betreff: Re: [R] Concatenation? Datum: Wed, 17 Feb 2021 22:14:13 +0100 Von: Gerrit Eichner Organisation: JLU Gießen An: Parkhurst, David Hi David, checkout, e. g., base-R's paste0(site, depth) or, if stored

Re: [R] [effects] Wrong xlevels in effects plot for mixed effects model when multiline = TRUE

2020-11-09 Thread Gerrit Eichner
r support and the brilliant effects package in general! :-) Best regards -- Gerrit ----- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104

[R] [effects] Wrong xlevels in effects plot for mixed effects model when multiline = TRUE

2020-11-09 Thread Gerrit Eichner
.4 nloptr_1.2.2.2 [11] Matrix_1.2-18boot_1.3-25 splines_4.0.2statmod_1.4.34 lme4_1.1-23 [16] tools_4.0.2 survival_3.2-3 yaml_2.2.1 compiler_4.0.2 colorspace_1.4-1 [21] mitools_2.4 insight_0.9.5nnet_7.3-14 -----------

Re: [R] how to generate this kind of graph

2020-07-23 Thread Gerrit Eichner
Hi, John, look for the package beeswarm. Regards -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99

Re: [R] nearest lower and higher integers to a multiple of another integer

2020-04-06 Thread Gerrit Eichner
Hi Stefano, maybe floor(x / n) * n and ceiling(x / n) * n does what you want? Best regards -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig

Re: [R] how to find number of unique rows for combination of r columns

2019-11-08 Thread Gerrit Eichner
guess. Regards -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen

Re: [R] how to find number of unique rows for combination of r columns

2019-11-08 Thread Gerrit Eichner
Hi, Ana, doesn't udt <- unique(dt[c("chr", "pos", "gene_id")]) nrow(udt) get close to what you want? Hth -- Gerrit --------- Dr. Gerrit Eichner Mathematical Institute, Room 212 g

Re: [R] [effects] allEffects does not accept integer value for xlevels

2019-09-05 Thread Gerrit Eichner
to xlevels[[name]] <- levs where xlevels is an integer. (But that doesn't matter anymore because my conjecture pointed to the wrong function anyway.) Best regards -- Gerrit ----- Dr. Gerrit Eichner Mathemati

[R] [effects] allEffects does not accept integer value for xlevels

2019-09-04 Thread Gerrit Eichner
s_2.4 nnet_7.3-12 --------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany http://www

Re: [R] Partition a vector into select groups with fixed length

2019-08-18 Thread Gerrit Eichner
Hi, Christofer, try something along len <- 5 split(Vec, rep(seq(ceiling(length(Vec)/len)), each = len)) Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.

Re: [R] Integer Sample with Mean Dependent on Size

2019-08-01 Thread Gerrit Eichner
rit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany http://www.uni-giessen.de/eich

Re: [R] Fwd: How to retain the NA as a value for splitting a dataframe

2019-05-24 Thread Gerrit Eichner
Hello, Jun, try split(df, f = factor(df$C, exclude = NULL)) For more info see ?factor, of course. Regards -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni

Re: [R] Diff'ing 2 strings

2019-01-10 Thread Gerrit Eichner
Don't you mean ?Rdiff ? Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr

Re: [R] summary function does not work with Westfall correction in multcomp with 27 comparisons

2018-11-08 Thread Gerrit Eichner
, or wait/hope for a more knowledgeable list member to "jump in". Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giesse

Re: [R] verInd= and HorInd= arguments to pairs() function

2018-06-08 Thread Gerrit Eichner
Am 08.06.2018 um 12:02 schrieb Martin Maechler: Martin Maechler on Fri, 8 Jun 2018 11:13:24 +0200 writes: [..] >> Thank you, Chris, for the report and >> Gerrit for your proposed fix !! >> >> It looks good to me, but I will test some more (also with >>

Re: [R] verInd= and HorInd= arguments to pairs() function

2018-06-07 Thread Gerrit Eichner
Hi, Chris, had the same problem (and first thought it was my fault), but there seems to be a typo in the code of pairs.default. Below is a workaround. Look for two comments (starting with #) in the code to see what I have changed to make it work at least the way I'd expect it in one of your

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Gerrit Eichner
Why not use as.matrix(Imp) in this case? Regards -- Gerrit Am 24.05.2018 um 17:04 schrieb Bert Gunter: This is one of those instances where a less superficial knowledge of R's technical details comes in really handy. What you need to do is convert the data frame to a single (numeric)

Re: [R] Wired result when I convert from Character to Numeric

2018-05-23 Thread Gerrit Eichner
Hi, Christofer, try print(as.numeric(x), digits = 10) # or another number of digits to increase the printed(!) precision. Hth -- Gerrit Am 23.05.2018 um 12:42 schrieb Christofer Bogaso: Hi, Below is my simple result in R x = "1282553.821000" as.numeric(x) [1] 1282554 Any idea

Re: [R] Further questions

2018-04-20 Thread Gerrit Eichner
. Third, just to be sure: This list is not for home work. Two more remarks see inline below. Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus

Re: [R] Problem with regression line

2018-04-18 Thread Gerrit Eichner
Hi, Anne, assign Age and Bloodpressure in the correct order to the axes in your call to plot as in: plot(y = Age, x = BloodPressure) abline(SimpleLinearReg1) Hth -- Gerrit - Dr. Gerrit Eichner

Re: [R] effects & lme4: error since original dataframenotfoundWASeffects: error when original data frame is missing

2018-01-18 Thread Gerrit Eichner
-checking the intended name and if neccessary changing it (somehow ...) automatically. (Have to think about that ...) Best regards -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich

Re: [R] effects & lme4: error since original data frame notfoundWASeffects: error when original data frame is missing

2018-01-17 Thread Gerrit Eichner
m <- lmer(Reaction ~ Days + (Days | Subject), data = X) Effect("Days", fm) } Hth -- Gerrit --------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Lieb

Re: [R] effects & lme4: error since original data frame not found WASeffects: error when original data frame is missing

2018-01-17 Thread Gerrit Eichner
] colorspace_1.3-2 mgcv_1.8-22nnet_7.3-12 quantreg_5.33 --------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr.

[R] effects: error when original data frame is missing

2018-01-17 Thread Gerrit Eichner
ike fm.plus.origdata <- list(fm, myair = myair)) to be able to restore the original environemt (or at least the needed opriginal data frame) of the time when fm was created? Thx for any hint! Regards -- Gerrit --------- Dr. Gerr

Re: [R] barplot_add=TRUE

2018-01-09 Thread Gerrit Eichner
the cause of your "problem". I suggest you check the structure of m: str(m) I suspect you'll see that the assumption of 52 trapcatch values is somehow wrong. Hth -- Gerrit --------- Dr. Gerrit Eichner Ma

Re: [R] barplot_add=TRUE

2018-01-09 Thread Gerrit Eichner
Hi, Sibylle, since you write '"mathematically" add', does barplot(rbind(m$trapcatch, w$trapcatch)) do what you want (modulo layout details)? Hth -- Gerrit - Dr. Gerrit Eichner Mathematical

Re: [R] Help avoiding setting column type two times

2017-11-30 Thread Gerrit Eichner
t) save(result, file = "folkeafstemning2009.Rdata") Maybe two loops simplify this a little bit for you (not tested): for(v in c("StedType", )) result[[v]] <- factor(result[[v]]) for(v in c("StemmerAntal", )) result[[v]] <- as.integer(result[[v]]) Hth -- Gerrit ---

Re: [R] adding predictor to linear model without changingexistingcoefficients

2017-05-17 Thread Gerrit Eichner
Hello, Urs, you may have seen Wolfgang Viechtbauer's answer already which offers an R-technical solution, but this may leave the mathematical grounds of linear models. See inline below for my concern and a hint. Am 17.05.2017 um 09:12 schrieb Urs Kleinholdermann: Dear list members, I want to

Re: [R] Paired sample t-test with mi.t.test

2017-04-07 Thread Gerrit Eichner
(untested). Hth -- Gerrit --------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany Fax: +49-(0)641-99-32109htt

Re: [R] plot empty when drawing from custom function

2017-03-28 Thread Gerrit Eichner
Hi, Luigi, you are probably missing a call to print() around the call to the latticeExtra plotting function useOuterStrips() you use inside your function printer(). Hth -- Gerrit - Dr. Gerrit Eichner

Re: [R] Arguments imply differing number of rows: 1, 0

2017-03-28 Thread Gerrit Eichner
lp@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Hth -- Gerrit ---

Re: [R] Why is options(digits = 1) displays two digits?

2017-03-21 Thread Gerrit Eichner
Hi, Tal, in print.default it says: digits: a non-null value for digits specifies the __minimum__ number of __significant__ digits to be printed in values. Maybe this clarifies your observation. Hth -- Gerrit - Dr. Gerrit

Re: [R] How to stop as.integer removing dimenions

2017-02-23 Thread Gerrit Eichner
... or: net1 <- array(0L, dim=c(5,5)) Note the difference between 0 and 0L. Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-Univers

Re: [R] How to stop as.integer removing dimenions

2017-02-23 Thread Gerrit Eichner
Hi, Thomas, maybe mode(net1) <- "integer" does what you want? Hth -- Gerrit ----- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-Universit

Re: [R] Power of t test for unequal variances?

2016-12-19 Thread Gerrit Eichner
Hello, Mauricio, maybe pwr.t2n.test() in package pwr or/and n.ttest() in package samplesize do what you need/want. Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich

[R] update of formula with conditional rhs introduces unwantedparentheses

2016-07-19 Thread Gerrit Eichner
how to extract various components of a formula and how to "re-build" formulae from such single components, but I would like to avoid that. Thx for any hint -- Gerrit - Dr. Gerrit Eichner Mathematical

Re: [R] make a right subset!

2016-07-07 Thread Gerrit Eichner
Hello, Elahe, look at ?match and check if df2$Count[ match( Matched, df2$Serial)] does what you want/need. Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni

Re: [R] Where to get quantiles (1st parameter q) for pnorm?(Normalapproximation to binomial distribution)

2016-01-20 Thread Gerrit Eichner
Hi, Matti, use ?pnorm and read about qnorm. Hth -- Gerrit On Wed, 20 Jan 2016, mviljamaa wrote: I'm doing Normal approximation to binomial distribution. My variables are generated by rbinom. Here:

Re: [R] Scaling rows of a large Matrix::sparseMatrix()

2016-01-13 Thread Gerrit Eichner
Hello, Dirk, maybe I'm missing something, but to avoid your for-loop-approach doesn't M <- M/Matrix::rowSums(M) do what you want? Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room

Re: [R] plot several lines programmaticaly

2015-12-15 Thread Gerrit Eichner
Hi, Petr, from your example it's not doubtlessly clear to me sure how the sequence of ifs should really be continued, but couldn't a nested loop help? Something like: for (i in 1:npks) { plot(res[[i]]$x, res[[i]]$y, pch=20) for (j in 1:i) { lines(res[[i]]$x, res[[i]]$fitpk[j,], col=j,

Re: [R] vector of constant values

2015-10-29 Thread Gerrit Eichner
Hi, Thanoon! I want to simulate a vector of constants values with dimention = 200x2 and all values of this vector are 1. You mean "I want to _construct_ a _matrix_ of dimension 200 x 2 with all entries equal to 1", don't you? Homework? Take a look at ?matrix Hth -- Gerrit Any help

Re: [R] rbind - names in dataframe. Beginner Question

2015-10-29 Thread Gerrit Eichner
Hello, Sarah, take a look at the online help page of the function cut() (and apply the function to the Hunger-column). Hth -- Gerrit On Thu, 29 Oct 2015, Dagmar wrote: Dear Sarah, (dear All), Thank you for trying to help! You are right, that I want to add a column to my dataframe with

Re: [R] extract all dataframes from list

2015-10-07 Thread Gerrit Eichner
Hello, Maicel, if you only want to extract info from those data frames, maybe it is enough to attach the list to the search path using attach (and afterwards detach()); see ?attach. Otherwise the online help page of assign() might be a starting point for you. Hth -- Gerrit Hi Or

Re: [R] Fisher's Test 5x4 table

2015-08-31 Thread Gerrit Eichner
values [of] larger than 2 by 2 tables." (Similarly, control and hybrid are not needed either here.) Regards -- Gerrit --------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen

Re: [R] Fisher's Test 5x4 table

2015-08-28 Thread Gerrit Eichner
Dear Paul, quoting the email-footer: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. So, what exactly did you try and what was the actual problem/error message? Besides that, have you noted

Re: [R] Fisher's Test 5x4 table

2015-08-28 Thread Gerrit Eichner
, Paul On Fri, Aug 28, 2015 at 8:56 AM, Gerrit Eichner gerrit.eich...@math.uni-giessen.de wrote: Dear Paul, quoting the email-footer: PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. So, what exactly

Re: [R] replacing then summing by values from another dataframe

2015-08-11 Thread Gerrit Eichner
Hello, Xianming, I have changed your (particular) data structure: use matrices because you have only numeric scores and effects, use NA instead of -1 as missing value (as usual), don't use columns for ids or row/column names (except for the easy of reading the data structures), increase your

Re: [R] Recursive looping of a list in R

2015-08-09 Thread Gerrit Eichner
Hi Evans, not many people (incl. me) are going to guess the building law for your recursive structure from the -- in fact at first sight not so clear -- picture, but I have some comments inline below. Hth -- Gerrit I am trying to creat a list from a loop such that once you loop the

Re: [R] numeric of length 1

2015-06-23 Thread Gerrit Eichner
Hi, Ragia, use names( pr_sub$vector[ 1]) Regards -- Gerrit On Tue, 23 Jun 2015, Ragia Ibrahim wrote: Dear group, I have the following object pr_sub$vector[1] 14 0.07782809 class( pr_sub$vector[1]) [1] numeric length( pr_sub$vector[1]) [1] 1 how can I separate

Re: [R] [FORGED] Re: Dunnett Test in 'multicomp' package

2015-06-05 Thread Gerrit Eichner
Hello, everyone, aside from Rolf's hint (and Richard's warning!) you could also consider relevel(): viagraData$dose - relevel( viagraData$dose, ref = placebo) Hth -- Gerrit On Fri, 5 Jun 2015, Rolf Turner wrote: On 05/06/15 11:08, Jim Lemon wrote: Hi James, You can change the order of

Re: [R] generate a list as follows: 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, . . . . ., n, n, n, n

2015-04-20 Thread Gerrit Eichner
Hi, John, doesn't n - your number lapply( 1:n, rep, each = 4) do what you need? Hth -- Gerrit On Sat, 18 Apr 2015, John Sorkin wrote: Windows 7 64-bit R 3.1.3 RStudio 0.98.1103 I am trying to generate a list of length 4n which consists of the integers 1 to n repeated in groups of

Re: [R] check a list that a sublist exists

2015-03-03 Thread Gerrit Eichner
Hello, Alaios, try is.null( Mylist[[i]]$parameters) It returns TRUE if your list doesn't have a component named parameters or if that component contains NULL. HtH -- Gerrit On Tue, 3 Mar 2015, Alaios via R-help wrote: Hi all,I have a list that has the following fields. $`80` [1]

Re: [R] from expand.grid to a list (lapply)

2015-02-25 Thread Gerrit Eichner
Hie Alaiso, try to simply apply lapply() to your data frame. It should work w/o any further operation since data frames are lists (check with is.list()). Hth -- Gerrit On Wed, 25 Feb 2015, Alaios via R-help wrote: Hi all,I would like to use an expand.grid functionality that would give

Re: [R] i need help for var.test()

2015-01-08 Thread Gerrit Eichner
Hello, Sait, take, for example, a look at bartlett.test(), but keep in mind that Bartlett's test is quite sensitive to deviations from normality. Levene's test (e.g., in leveneTest() in package car) is said to be more robust. Hth -- Gerrit On Thu, 8 Jan 2015, sait k wrote: Dear Sir or

Re: [R] factor levels numeric values

2014-11-12 Thread Gerrit Eichner
Hello, David, take a look at the beginning of the Warning section of ?factor. Hth -- Gerrit Hi everybody, I have another question (to which I could not find an answer in my r-books. I am sure, it's not a great issue, but I simply lack of a good idea how to solve this: One of my variables

Re: [R] qq-plot in R

2014-11-11 Thread Gerrit Eichner
Hello, ron, have you looked at the help page of qqplot and consequently tried, e.g., the following? xy - qqplot( rt(300, df = 5), rt(300, df = 5), xlim = c(-10, 10), ylim = c(0, 10)) str( xy) Hth -- Gerrit On Tue, 11 Nov 2014, Ron Michael wrote: Hi, I am some questions

[R] [survMisc]: error message in examples of comp()

2014-10-17 Thread Gerrit Eichner
- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany Fax: +49-(0)641-99-32109http

Re: [R] Filling in missing values in a column based on previousandfollowing values

2014-08-04 Thread Gerrit Eichner
Hello, Florian, function na.locf() from package zoo mightdo what you want. Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University

Re: [R] Filling in missing values in a column based on previousandfollowingvalues

2014-08-04 Thread Gerrit Eichner
column, not all: Something like yourdataframe$ID - na.locf( yourdataframe$ID) should replace the ID-column with the modified version you want. Regards -- Gerrit Kind regards, Florian Am 04.08.2014 um 11:31 schrieb Gerrit Eichner gerrit.eich...@math.uni-giessen.de: Hello, Florian

Re: [R] Compare data in two rows and replace objects in data frame

2014-08-04 Thread Gerrit Eichner
. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany Fax: +49-(0)641-99-32109http://www.uni-giessen.de/cms/eichner

[R] format of output of residual standard errors of manova()

2014-03-18 Thread Gerrit Eichner
datasets methods base other attached packages: [1] fortunes_1.5-2 loaded via a namespace (and not attached): [1] tools_3.0.2 - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni

[R] Sweave: cat() in a chunk with option results=tex doesn't producelinebreaks at the end of a character string anymore

2014-03-05 Thread Gerrit Eichner
attached packages: [1] fortunes_1.5-2 loaded via a namespace (and not attached): [1] grid_3.0.2 lattice_0.20-27 tools_3.0.2 - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni

Re: [R] Sweave: cat() in a chunk with option results=texdoesn'tproducelinebreaks at the end of a character string anymore

2014-03-05 Thread Gerrit Eichner
/2014 7:32 AM, Gerrit Eichner wrote: Hello, everyone, I am struggling with an Sweave-problem that didn't occur sofar (and I have no clue what I might have changed in my system; see below). The following example *.Rnw file's only task is (for simplicity) to output text with a little bit of TeX-code

Re: [R] Sweave: cat() in a chunk with option results=texdoesn'tproducelinebreaksatthe end of a character string anymore

2014-03-05 Thread Gerrit Eichner
for the respective code chunks (which also have results=tex, and from which I want only linebreaks in the TeX-output). Actually, embarrassingly simple. Thanks again -- Gerrit On Wed, 5 Mar 2014, Duncan Murdoch wrote: On 05/03/2014 9:29 AM, Gerrit Eichner wrote: Thanks, Duncan, but, sorry

Re: [R] calculate an value in dependence of another column

2014-01-17 Thread Gerrit Eichner
Hi, Mat, e. g., try something like ORDER$VALUE * c( NY = 3, BER = 2, FRA = 1, WAS = 4)[ ORDER$DESTINY] Hth -- Gerrit On Fri, 17 Jan 2014, Mat wrote: Hello together, i have a little problem, to create a new column, in a data.frame. I know i can calculate one column with as a example 2

Re: [R] How to verify char variables contain at least one value

2014-01-02 Thread Gerrit Eichner
. Unfortunatedly the line of code you suggest - i.e. apply( subset( d2, subset = V13:V239), 1, function( x) any( x != )) returns the same error. Any other suggestion? Danke schôn und auf wiederhoren Luca 2014/1/2 Gerrit Eichner gerrit.eich...@math.uni-giessen.de Hello, Luca, also a happy new

Re: [R] How to verify char variables contain at least one value

2014-01-01 Thread Gerrit Eichner
Hello, Luca, also a happy new year! It's not quite clear to me what you want to do, but note first that the :-operator is a short-cut for seq() with by = 1 (look at ?seq), and that it usually (!) does not work on columns of data frames. Exception: when used for the argument subset of

Re: [R] how can i write the function into a file c:/mytest.R withcatfunction?

2013-12-13 Thread Gerrit Eichner
Hello, Ë®¾²Á÷Éî! mytest-function(x,f){ sum(x*f)/sum(f) } cat(mytest,file=c:/mytest.R) Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'closure') cannot be handled by 'cat' how can i write the mytest function into a file c:/mytest.R with cat

Re: [R] filter a data.frame

2013-12-13 Thread Gerrit Eichner
Hello, Mat, see below. hello together, i want to filter a data.frame. My problem is, that i want to filter 2 numbers. My data.frame look like this one. No. text 1 abc 2 def 3 ee 4 ff 5 gg I want now to filter No. 2 and 3, so my solution should be look like this

Re: [R] If-statement in for-loop

2013-12-11 Thread Gerrit Eichner
Hello, gncl dzgn, your problem has a flavor of homework which is usually not delt with on this list. However, a few comments: 0. The description of your problem is rather vague, in particular, the meaning of input in the description of your conditions is unclear! (By the way, your main

Re: [R] Splitting a vector

2013-12-11 Thread Gerrit Eichner
Hello, Long Vo, take a look at the help page of split or directly at str(Y) They tell you that Y is a list, and list components are indexed using [[: mean(Y[[4]]) should do what you want. Regards -- Gerrit This does what I needed. However, as the output is a list object, is there

Re: [R] lattice: superposed boxplots with same colors forrectanglesandumbrellas and filled boxes

2013-12-10 Thread Gerrit Eichner
, Gerrit Eichner gerrit.eich...@math.uni-giessen.de wrote: Dear R-list, I've been trying to produce a sort of an interaction plot wherein colored stripplots and boxplots are superposed. In particular, I want the colors of the (transparently) filled boxes to be the same as the colors of the box borders

[R] lattice: superposed boxplots with same colors for rectanglesand umbrellas and filled boxes

2013-12-09 Thread Gerrit Eichner
and would be quite grateful if somebody could give me a hint where to look further. Or is a workaround necessary (and available)? Thanks a lot in advance! Best Regards -- Gerrit - Dr. Gerrit Eichner

Re: [R] interaction plot with SE bar

2013-12-04 Thread Gerrit Eichner
Hi, Kristi, I have adapted the interaction plot example of function panel.average() of the lattice package and modified the code of panel.average() to a new function panel.loc_and_scale(). See below. (There might be a much simpler solution, though.) Remark on the side: I can't resist to

Re: [R] remap values from one vector to the other

2013-10-31 Thread Gerrit Eichner
Alex, it is a bit unclear what you mean by remap etc., but maybe y0 - 880e6; y1 - 1020e6 x0 - 1; x1 - ncol(x) y0 + (x0-1):x1 * (y1 - y0)/(x1 - (x0-1)) gives what you want. Hth -- Gerrit On Thu, 31 Oct 2013, Alaios wrote: Hi everyone, I am plotting some legend and I am using

Re: [R] Select fixed number of elements

2013-10-30 Thread Gerrit Eichner
Hello, Alaois, if x is your vector maybe n - length( x) positions - trunc( quantile( seq( n), prob = 0:5/5)) x[ positions] comes close to what you want. Hth -- Gerrit Hi all, I have in my code some vectors that are not of equal size. I would like to be able for each of these vectors

Re: [R] omitting integer(0) rows from data frame

2013-10-30 Thread Gerrit Eichner
Hi, Jack, well, I disagree: What do you expect to grab out of a bucket (= data frame) if you do not at all grab into it (indexing with an _empty_ index, i.e. with nothing)? And changing the sign of nothing is still nothing ... Hth -- Gerrit On Wed, 30 Oct 2013, Jack Tanner wrote: I'm

Re: [R] Nonparametric k-way ANOVA

2013-10-25 Thread Gerrit Eichner
Hello, Vincent, you may want to take a look at Nonparametric methods in factorial designs by Edgar Brunner and Madan L. Puri in Statistical Papers 42, 1-52 (2001). There is the R-package nparcomp for one-way layouts, but the paper goes further (and mentions another software) and is maybe a

Re: [R] Where is element 30?

2013-10-22 Thread Gerrit Eichner
Hi, Alaios, check out ?which and in particular its Examples and See Also section. Hth -- Gerrit On Tue, 22 Oct 2013, Alaios wrote: Hi I have a vector like that readCsvFile$V1  [1]  30  31  32  33  34  35  36  37  38  39 310 311 312 313 314 315 316 317 318 [20] 319 320 321  20  21  22  23 

Re: [R] bug(?) in str() with strict.width = cut when appliedtodataframe with numeric component AND factor or character component withlongerlevels/strings

2013-10-16 Thread Gerrit Eichner
just forgot to take that possibility into consideration. :( Regards -- Gerrit On Tue, 15 Oct 2013, Duncan Murdoch wrote: On 15/10/2013 7:53 AM, Gerrit Eichner wrote: Dear list subscribers, here is a small artificial example to demonstrate the problem that I encountered when looking

[R] bug(?) in str() with strict.width = cut when applied to dataframe with numeric component AND factor or character component with longerlevels/strings

2013-10-15 Thread Gerrit Eichner
stats4_3.0.2tools_3.0.2 - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen

Re: [R] extract regression coefficients

2013-10-15 Thread Gerrit Eichner
Hello, Catalin, check out ?coef Regards -- Gerrit On Tue, 15 Oct 2013, catalin roibu wrote: Hello all! I have a problem with R. I want to extract regression coefficients from summary and use it for compute the theoretical values. How can I do that in R? thank you! best regards, -- ---

Re: [R] extract regression coefficients

2013-10-15 Thread Gerrit Eichner
to give you any hint. So, PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Regards -- Gerrit On 15 October 2013 14:59, Gerrit Eichner gerrit.eich...@math.uni-giessen.de wrote: Hello, Catalin

Re: [R] How to write a wrapper function which can honor defaultvalues, when the target function has ones?

2013-09-13 Thread Gerrit Eichner
Hello, Adam, I'm rather uncertain about your goal (and consequently even more so about how to reach it), but anyway, maybe the function match.call() with its argument expand.dots is of some help for you. From its help page: match.call is most commonly used in two circumstances: To

Re: [R] substituting string variable in expression with its value

2013-09-12 Thread Gerrit Eichner
Hi, Jannis, maybe plot( 1, 1, main = bquote( paste( .(a), [, .(b), ]))) comes close to what you want, but I think you may even have to use the following to get a varying exponent really printed elevated: a - speed b - m * s cc - -2 plot( 1, 1, main = bquote( paste( .(a), [,

Re: [R] Formula in a model

2013-09-11 Thread Gerrit Eichner
Hello, Paulito, first, I think you haven't received an answer yet because you did not provide commented, minimal, self-contained, reproducible code as the posting guide does request it from you. Second, see inline below. On Wed, 11 Sep 2013, Paulito Palmes wrote: Hi, I have a data.frame

Re: [R] probability of occurrence of an event and the probabilityof anevent upon the occurrence of another event

2013-09-06 Thread Gerrit Eichner
Hello, Francesco, these could be considered as two of the central questions in statistics in general ... but they do not necessarily have anything to do with R. Regards -- Gerrit On Fri, 6 Sep 2013, Francesco Miranda wrote: how can i calculate the probability of occurrence of an event and

Re: [R] Product of certain rows in a matrix without loop

2013-09-03 Thread Gerrit Eichner
- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany Fax: +49-(0)641-99-32109http://www.uni

Re: [R] Product of certain rows in a matrix without loop

2013-09-03 Thread Gerrit Eichner
package just for convenience. Regards -- Gerrit Thank you in advance Edouard Hardy On Tue, Sep 3, 2013 at 11:49 AM, Gerrit Eichner gerrit.eich...@math.uni-giessen.de wrote: Hello, Edouard, taking logs of A's elements (so that * turns into +, so to say), using a left-multiplication

  1   2   >