Re: [R] Create Arrays

2010-10-15 Thread Gerrit Eichner
- AOR 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-giessen.de/cms/eichner

Re: [R] Logical vectors

2010-11-04 Thread Gerrit Eichner
than 2, 3, 4, and 5? Regards -- Gerrit - AOR 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] Logical vectors

2010-11-04 Thread Gerrit Eichner
-- Gerrit - AOR 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

Re: [R] newbie question on importing and parsing file by row

2010-11-05 Thread Gerrit Eichner
Hello, Emily, take a look at read.table() for importing (with or without header depending on your file which holds the data). Maybe X - read.table( yourfilename, header = FALSE, row.names = 1) and then pvalues - apply( X, 1, function( x) fisher.test(

Re: [R] About 5.1 Arrays

2010-11-05 Thread Gerrit Eichner
in row i, column j, and layer k (if one wants to think of A as a cuboidal grid). Hth -- Gerrit - AOR Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig

Re: [R] The condition has length 1 and only the first element willbeused

2010-08-03 Thread Gerrit Eichner
, minimal, self-contained, reproducible code. - AOR 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] Create Arrays

2010-10-15 Thread Gerrit . Eichner
Hi, Doug, maybe columns - c( 0, 3, 0, 2, 0, 1) lapply( columns[ columns 0], function( o) array( -1, dim = c( 2, o))) does what you want? Regards -- Gerrit - AOR Dr. Gerrit Eichner Mathematical

[R] Matrix package problem: dsyMatrix %*% vector gives error

2007-11-01 Thread Gerrit Eichner
utils datasets methods [7] base other attached packages: Matrix lattice 0.999375-10.15-11 - AR Dr. Gerrit Eichner Mathematical Institute [EMAIL PROTECTED] Justus-Liebig-University

Re: [R] Row percentages for a table object

2008-02-08 Thread Gerrit Eichner
so far been unable to find something that works. Maybe a look at ?prop.table and/or ?addmargins could help you. Regards -- Gerrit - AR Dr. Gerrit Eichner Mathematical Institute [EMAIL PROTECTED

[R] Evaluation conflict in combination of replicate() and rexp()as variable inside a function

2008-05-23 Thread Gerrit Eichner
] rcompgen_0.1-17 - AR Dr. Gerrit Eichner Mathematical Institute [EMAIL PROTECTED] Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany Fax: +49-(0)641-99-32029

Re: [R] Function to Check Object's Memory Size

2009-01-06 Thread Gerrit Eichner
/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. See ?object.size Regards -- Gerrit - AR Dr. Gerrit Eichner

Re: [R] Help on efficiency/vectorization

2009-08-27 Thread Gerrit Eichner
Hi, Steven, try lapply( x, function( v) rownames(x)[ v == 1]) or lapply( x, function( v, rn) rn[ v == 1], rn = rownames( x))) which is faster. Regards -- Gerrit - AOR Dr. Gerrit Eichner Mathematical

Re: [R] Function for all 2^N subsets of N

2009-09-01 Thread Gerrit Eichner
Maybe expand.grid( rep( list( 0:1), 10)) does what you want. Best regards -- Gerrit - AOR Dr. Gerrit Eichner Mathematical Institute, Room 305 E gerrit.eich...@math.uni-giessen.de Justus-Liebig-University

Re: [R] Polynomial fitting

2011-07-07 Thread Gerrit Eichner
guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de

Re: [R] How to remove the double or single quote from a string(unquote?)?

2011-04-18 Thread Gerrit Eichner
-contained, reproducible code. - 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] Entire part of number

2011-04-19 Thread Gerrit Eichner
What is the function to have the entire part of a number? If entire refers to integer take a look at ?trunc Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni

Re: [R] Question on Import

2011-04-25 Thread Gerrit Eichner
Hi, Georgina, using quotation marks around the file name like in read.delim( ken_data_try_anova) might help. Hth -- Gerrit On Mon, 25 Apr 2011, Georgina Salazar wrote: Hi! I have the data in a tab delimited text file titled ken_data_try_anova. I tried to import it into R entering

Re: [R] Using functions/loops for repetitive commands

2011-05-05 Thread Gerrit Eichner
as data frame) Caveat: 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

Re: [R] Using functions/loops for repetitive commands

2011-05-06 Thread Gerrit Eichner
) ) ) ) Still another possibility is to use xtabs() (with its summary-method) which has a formula argument. Hoping that you know what to do with the results -- Gerrit - Dr. Gerrit Eichner

Re: [R] Running *slow*

2011-10-07 Thread Gerrit Eichner
Hi, Thomas, if I'm not completely mistaken Dat2 - match( t( Dat), ltable) should do what you want. Hth -- Gerrit On Fri, 7 Oct 2011, thomas.chesney wrote: Thank you Michael and Patrick for your responses. Michael - your code ran in under 5 minutes, which I find stunning, and Patrick I

Re: [R] binding all elements of list (character vectors) to a matrixasrows

2011-10-11 Thread Gerrit Eichner
Marion, try rbind( Mymatrix, do.call( rbind, Z)) Hth -- Gerrit On Tue, 11 Oct 2011, Marion Wenty wrote: dear r-users, i have got a problem which i am trying to solve: i have got the following commands: Mymatrix - matrix(1:9,ncol=3) Z - list(V1=c(a,,),V2=c(b,,),V3=c(c,,),V4=c(d,,))

Re: [R] replacing values in Array

2012-03-13 Thread Gerrit Eichner
Hello, uday, e.g., (data - 1) %/% 3 + 1 would do the job in your very specific situation, but take a look at ?findInterval for possibly more interesting (because more general) solutions. Hth -- Gerrit On Tue, 13 Mar 2012, uday wrote: I want to replace some values in my Array e.g data-

Re: [R] anova.lm F test confusion

2012-03-21 Thread Gerrit Eichner
()) to compare model 1 with model 2 using the MSE of model 3 in a sequence of three nested (linear) models? (A short RSiteSearch() and a google search didn't lead me far ...) Thx in advance! Best regards -- Gerrit - Dr. Gerrit Eichner

Re: [R] Supperscript, subscript and double lines in the main/subtitle and using greekletters

2012-03-27 Thread Gerrit Eichner
Hi, HJ, see ?plotmath 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] reading files from two folders

2012-03-28 Thread Gerrit Eichner
Hello, uday, there's presumably a typo in your code because you use path1t in data2 - read.table(paste(path1t, file_wasaux2[i],header=TRUE)) and not path which you defined above. Hth -- Gerrit - Dr. Gerrit Eichner

Re: [R] fast subsetting of lists in lists

2010-12-07 Thread Gerrit Eichner
Hello, Alexander, does utest - unlist(test) utest[ names( utest) == a] come close to what you need? Hth, Gerrit On Tue, 7 Dec 2010, Alexander Senger wrote: Hello, my data is contained in nested lists (which seems not necessarily to be the best approach). What I need is a fast way to

Re: [R] Question about cut()

2010-12-14 Thread Gerrit Eichner
- as.factor(as.numeric(cut(r,c(0,2,4,6,8,10,100 levels(col_no) - c(2%,2-4%,4-6%,6-8%,8-10%,10%) col_no [1] 2%  2%  2-4% 2%  2%  2% Levels: 2% 2-4% 4-6% 6-8% 8-10% 10%Thanks, Tianchan Best regards -- Gerrit Best regards -- Gerrit Eichner Viele Grüße -- Gerrit Viele Grüße -- Gerrit Eichner

Re: [R] Question

2010-12-14 Thread Gerrit Eichner
On Tue, 14 Dec 2010, Matthew Rosett wrote: How do I determine if my data deviate from the normal distribution? The sample size is 1000 (weights of people). See ?qqnorm and/or ?shapiro.test and/or a text book on applied statistics and/or google for testing normality. Hth, Gerrit PS:

Re: [R] Can the by() function return a single column?

2010-12-15 Thread Gerrit Eichner
Hello, Vassilis, maybe with( test.df, ave( vector, factor, FUN = function( x) x - mean( x))) does what you want. -- Gerrit On Wed, 15 Dec 2010, Vassilis wrote: I would like to de-mean the 'vector' column of the following dataframe by factor: set.seed(5444) vector - rnorm(1:10)

Re: [R] How to arrange the data

2010-12-17 Thread Gerrit Eichner
Hello, Amy, take a look at ?reshape In your case, I think, reshape( yourdatafame, varying = c( value1, value2, value3), v.name = amount, times = c( value1, value2, value3), timevar = name, direction = long) should work. Hth -- Gerrit On Fri, 17 Dec 2010, Amy Milano

Re: [R] tabulating 2 factors weighting by a third var

2010-12-19 Thread Gerrit Eichner
Hi, Luca, if V is you data frame, maybe with( V, tapply( v3, list( v1, v2), sum)) does what you want. Hth -- Gerrit On Mon, 20 Dec 2010, Luca Meyer wrote: Hi, This must be an easy one but so far I haven't find a way out... I have a data frame such as: $ v1: Factor w/ 5 levels $

Re: [R] labels and barchart

2010-12-21 Thread Gerrit Eichner
Hello, Robert, see hints below. On Tue, 21 Dec 2010, Robert Ruser wrote: Hello, I'm wondering how to set a value of mar ( par( mar=c(...)) ) in order to allow labels to be visible in barplot. Is there any relation between the number of characters in a label and the second value of mar?

Re: [R] How to integrate a function with additional argument beingavector or matrix?

2010-12-22 Thread Gerrit Eichner
On Wed, 22 Dec 2010, Marius Hofert wrote: Dear expeRts, I somehow don't see why the following does not work: integrand - function(x, vec, mat, val) 1 # dummy return value A - matrix(runif(16), ncol = 4) u - c(0.4, 0.1, 0.2, 0.3) integrand(0.3, u, A, 4) integrate(integrand, lower = 0, upper =

Re: [R] puzzled with plotmath II

2011-01-20 Thread Gerrit Eichner
Try plot (1, 1, ylab = expression (Z[list(i,i)])) Hth -- Gerrit Original Message Subject: puzzled with plotmath Date: Thu, 20 Jan 2011 12:48:18 +0100 From: Claudia Beleites cbelei...@units.it To: R Help r-help@r-project.org Dear all, I'm puzzled with matrix indices in

Re: [R] puzzled with plotmath for matrix indices

2011-01-20 Thread Gerrit Eichner
Claudia, Mittelhessen! ;-) thanks viele Grüße nach Oberhessen :-) plot (1, 1, ylab = expression (Z[list(i,i)])) though that cannot be evaluated, either (due to [ not knowing what to do with an index list) Something is missing; this last sentence of yours appears to be not complete,

Re: [R] Bug in options(digits=n)??

2011-11-18 Thread Gerrit Eichner
No bug. See ?options or ?print.default and note *significant* digits. Hth -- Gerrit On Fri, 18 Nov 2011, Ravi Kulkarni wrote: This is in version 2.10.1 sqrt(3) [1] 1.732051 6/7 [1] 0.8571429 options(digits=3) sqrt(3) [1] 1.73 6/7 [1] 0.857 sqrt(7) [1] 2.65 7/9 [1] 0.778 Ravi

Re: [R] Need to calculate standard deviation by groups

2011-12-09 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] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread Gerrit Eichner
Hello, iliketurtles (?), for whatever strange reasons you want to regress all y-columns on all x-columns, maybe reg - apply( x, 2, function( xx) lm( y ~ xx)) do.call( cbind, lapply( reg, coef)) does what you want. (To understand what the code above does, check the documentation for lm(): If

Re: [R] manipulating data of several columns simultaneously

2012-01-18 Thread Gerrit Eichner
Hello, Nerak, maybe rbind( NA, head( results, -1)) does what you want (for all columns at once)? Hth, Gerrit On Wed, 18 Jan 2012, Nerak wrote: Dear all, I have a question concerning manipulating data of several columns of a dataframe at the same time. I manage to do it for one column

Re: [R] Split values in vector

2012-01-19 Thread Gerrit Eichner
Hi, Johannes, maybe X - unlist( strsplit( as.character( x$ART), split = ;, fixed = TRUE)) X - strsplit( X, split = -, fixed = TRUE) X - sapply( X, function( x) if( length(x) == 2) rep( x[1], as.numeric( x[2])) else x[1] ) table(X, useNA = always)

Re: [R] extracting from data.frames for survival analysis

2012-01-26 Thread Gerrit Eichner
Hi, Philip, counter-questions: 1. Which/where is the grouping variable for the test of differences in survival? 2. Assume the grouping variable is Gend in B27.vec. Then, why aren't you using survdiff( Surv( AgeOn, UV) ~ Gend, rho = 0, data = B27.vec) ? Hth -- Gerrit On Thu, 26 Jan

Re: [R] Inserting a character into a character string XXXX

2012-01-26 Thread Gerrit Eichner
Hello, Dan, you could probably use a combination of nchar(), substr() (or substring()) and paste(). Take a look at their online help pages. Hth -- Gerrit Hello everyone, I have a character vector of 24 hour time values in the format hm without the delimiting :. How can I insert the :

Re: [R] converting a matrix or data.frame into an html table

2011-05-09 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-giessen.de/cms/eichner

Re: [R] Logical operator and lists

2013-01-08 Thread Gerrit Eichner
Hello, Dominic, untested: data - lapply( data, function( x) x[ x == ] - NA Hth -- Gerrit On Tue, 8 Jan 2013, Dominic Roye wrote: Hello R-Helpers, I have a slight problem with the expresion data[data==] - NA which works well for a data.frame. But now i must use the same for a list of

Re: [R] Making an aggregated factor variable from an existing one

2013-01-17 Thread Gerrit Eichner
Hi, Antti, you should look at ?levels (and particular its Examples section) to find out how to use levels( X) - c( new1, ..., newk) to achieve what you want. Regards -- Gerrit On Thu, 17 Jan 2013, Antti Simola wrote: Hi, This is quite simple data manipulation task and I need

Re: [R] How to align group based on the common values of two columnsinr

2013-01-22 Thread Gerrit Eichner
Hi, Tammy, maybe you find something interesting looking at ?interaction and/or try (with df being your data frame) df$Group - as.integer( with( df, interaction( Feature, OS)[, drop = TRUE])) HtH -- Gerrit On Tue, 22 Jan 2013, Tammy Ma wrote: HI, I met this problem: I have the

Re: [R] Simple use of dcast (reshape2 package)

2013-01-22 Thread Gerrit Eichner
Hi, Patrick, I think (with reshape from the stats package) reshape( aa, idvar = ID, v.names = Eaten, timevar = Target, direction = wide) does the trick (followed by renaming the columns of the resulting data frame). Hth -- Gerrit On Tue, 22 Jan 2013, Patrick Connolly wrote:

Re: [R] long format with reshape

2013-01-24 Thread Gerrit Eichner
Hi, Daisy, try dat2 - reshape( dat, varying = c( species1, species2, species3), v.name = presence, timevar = species, times = c( species1, species2, species3), direction=long) dat2[ rev( order( dat2$region)), ] Hth -- Gerrit On Thu, 24

Re: [R] If cycle takes to much time...

2013-01-25 Thread Gerrit Eichner
Hello, Marco, I am not quite sure if understand correctly what you want, but maybe DF - data.frame( Artist, Begin, End, Istitution) AtSameInst - outer( DF$Istitution, DF$Istitution, ==) Simultaneously - with( DF, outer( Begin, End, =) | outer( End, Begin, =))

Re: [R] NA and Character(0) in List Element

2013-01-29 Thread Gerrit Eichner
Hi, Benjamin, have you tried for your list with NA-components to use is.na() as follows (where x is assumed to be your list)? x[ !is.na(x)] Hth -- Gerrit On Tue, 29 Jan 2013, Benjamin Ward (ENV) wrote: Hi, This is probably a small query but one I'm struggling with: I have a list in

Re: [R] appending and merging data frames

2013-02-07 Thread Gerrit Eichner
Hello, John, as a start take a look at ?merge And to (maybe) get a bit overwhelmed at first sight use RSiteSearch( merge) Hth -- Gerrit On Thu, 7 Feb 2013, John Smith wrote: I know that the basic approach to append or merge data frames is using the rbind and merge commands. However,

Re: [R] Error in sort(abs(diff(genomdat)))[1:n.keep] : only 0's maybemixed with negative subscripts

2012-06-12 Thread Gerrit Eichner
Hello, sanshine, maybe you should check the value of n.keep and make sure that it is non-negative. Hth -- Gerrit On Tue, 12 Jun 2012, sanshine wrote: Hello everyone, I`m trying to normalize and analize an illumina SNP array. But when i`m trying to segmentate i`m getting an error: Error

[R] formula version of sunflowerplot() fails when axis label specified

2012-06-27 Thread Gerrit Eichner
in model.frame.default(formula = Sepal.Length ~ Sepal.Width, data = iris, : variable lengths differ (found for '(xlab)') And are you -- the one with the work-around -- willing to share it? :) Best regards -- Gerrit - Dr. Gerrit Eichner

Re: [R] formula version of sunflowerplot() fails when axis labelspecified

2012-06-28 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-giessen.de/cms/eichner

Re: [R] Side by side strip charts

2012-07-13 Thread Gerrit Eichner
Hi, Arnold, looking at the example section of ?stripchart may help you. Hth -- Gerrit On Thu, 12 Jul 2012, darnold wrote: Hi, I'm looking for some ideas on how to reproduce the attached image in R. There are three samples, each of size n = 10. The first is drawn from a normal

Re: [R] Adjusting format of boxplot

2012-07-13 Thread Gerrit Eichner
Hello, Ivan, you'll find argument frame (actually frame.plot) explained in ?plot.default Regards -- Gerrit Hi Peter, I had never heard of this 'frame' argument and it's a breakthrough for me to be finally able to get rid of this frame! But where is this argument explained? I couldn't

Re: [R] Running different Regressions using for loops

2012-09-28 Thread Gerrit Eichner
Hello, Krunal, try summ.list[[2]]$coefficients[2] Note the double square brackets (as summ.list is a list)! Hth, Gerrit On Fri, 28 Sep 2012, Krunal Nanavati wrote: Hi Rui, Excellent!! This is what I was looking for. Thanks for the help. So, now I have stored the result of the 10

Re: [R] R-Help: nparLD Package Non-parametric Repeated Measures

2013-05-16 Thread Gerrit Eichner
Hello, James, see my comments inline. ... Main issue/question: In R the nparLD ANOVA-type Test showed a significant p-value for diel period, no effect of season, and no interaction between diel period and season. But a post-hoc Wilcoxon Signed-Rank Test did NOT find a significant difference

Re: [R] Loop FOR with histogram() from lattice

2013-06-05 Thread Gerrit Eichner
Hi, Xochitl, wrapping the call to histogram() inside your loop in a call to print() should solve your problem: print( histogram( .)) Regards -- Gerrit On Wed, 5 Jun 2013, Xochitl CORMON wrote: Hi all, I'm encountering a problem I do not understand on my data: library (lattice)

Re: [R] regression in 3D space

2013-06-18 Thread Gerrit Eichner
Dear Eliza, the more unspecific a question is formulated, the more is the poster in an urgent need for a statistical consultant nearby and -- at the same time -- the less likely is is to get a useful answer on this list ... I suggest you to read the posting guide, look at CRAN's Task Views

Re: [R] create index for tapply or by

2013-06-27 Thread Gerrit Eichner
Hi, Witold, take a look at ?findIntervals It might give want you need. Hth -- Gerrit On Thu, 27 Jun 2013, Witold E Wolski wrote: Is there a build in function to create an index for tapply or by given a a numeric vector x an a vector of breaks? What I want to do is: x - 1:100 breaks -

[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

[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

Re: [R] transform variables

2013-08-26 Thread Gerrit Eichner
Hello, Catalin, assume your data frame is as simple as A - data.frame( year = years, month01 = values01, , + month12 = values12) then, e.g., reshape( A, varying = c( month01, , month12), + v.names = Values, timevar = Month, direction = long) should do

Re: [R] transform variables

2013-08-26 Thread Gerrit Eichner
2013 14:35, Gerrit Eichner gerrit.eich...@math.uni-giessen.dewrote: Hello, Catalin, assume your data frame is as simple as A - data.frame( year = years, month01 = values01, , + month12 = values12) then, e.g., reshape( A, varying = c( month01, , month12

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

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] 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] 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] 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

[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] 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

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] 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] 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] 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] difference percentile R vs SPSS

2012-11-08 Thread Gerrit Eichner
read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni

Re: [R] General function to substitute values in a data frame

2012-11-09 Thread Gerrit Eichner
read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni

Re: [R] how to enter a string value

2012-11-12 Thread Gerrit Eichner
Alen, look at ?scan and there particularly at the argument 'what'. Hth -- Gerrit On Mon, 12 Nov 2012, alen wrote: hi, I want to know just enter a string value entering a numeric value is make with the function scan () or scan (nmax = ..) but it does not work for string my goal is

Re: [R] column name prefix 'x' after data import via read.delim

2012-11-23 Thread Gerrit Eichner
Hello, e-letter, check ?read.delim and look for the argument check.names and from there you'll should end up reading ?make.names Hth -- Gerrit On Fri, 23 Nov 2012, e-letter wrote: Readers, The function 'read.delim' was used to import data into R: columnnamea columnnameb

Re: [R] Accessing List within a List in a for Loop

2012-11-28 Thread Gerrit Eichner
Hello, Mono, your description of your problem is a bit overwhelming. You might get an answer if you provide (simplified) reproducible code (maybe with example data). I can only guess that -- instead of factor( x[[1]]) -- you maybe should use factor( x[[1]][1]) in some place. Hth --

Re: [R] simple subset question

2012-12-02 Thread Gerrit Eichner
Hi, Felipe, two typos? See below! On Sun, 2 Dec 2012, Felipe Carrillo wrote:  Hi, Consider the small dataset below, I want to subset by two variables in one line but it wont work...it works though if I subset separately. I have to be missing something obvious that I did not realize before

Re: [R] question about sum of (column) elements in R

2012-12-04 Thread Gerrit Eichner
Hi, T. Bal, homework? Take a look at ?tapply Regards -- Gerrit On Tue, 4 Dec 2012, T Bal wrote: Hi, I have the following data: 0 12 1 10 1 4 1 6 1 7 1 13 2 21 2 23 2 20 3 18 3 17 3 16 3 27 3 33 4 11 4 8 4 19 4 16 4 9 In this data file I would

Re: [R] computing marginal values based on multiple columns?

2012-12-04 Thread Gerrit Eichner
Hello, Simon, see below! On Tue, 4 Dec 2012, Simon wrote: Hello all, I have what feels like a simple problem, but I can't find an simple answer. Consider this data frame: x - data.frame(sample1=c(35,176,182,193,124), sample2=c(198,176,190,23,15), sample3=c(12,154,21,191,156),

Re: [R] Help with manipulation of matrix object

2012-12-06 Thread Gerrit Eichner
Hi, Jeremy! ... I have a matrix, measuring m X n. An example matrix will be this: ... [snip] ... What I want to do is actually statistical manipulation of this matrix. To be more precise, I want to calculate the probability of each value, based on the assumption of a normal distribution,

Re: [R] remove NA in df results in NA, NA.1 ... rows

2012-12-13 Thread Gerrit Eichner
producing far too many logical indices for your task (so to say). I assume you should be using na.omit( df2) instead. Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich

Re: [R] In which column and in which row a number is in a matrix

2013-01-02 Thread Gerrit Eichner
Hi, Charles, see ?which and learn about the argument arr.ind. Happy new year -- Gerrit On Wed, 2 Jan 2013, Charles Novaes de Santana wrote: Dear all, Happy New Year for all of you! I hope we have an year of essential freedom for everyone! I am trying to manipulate a matrix in order to

Re: [R] Make a column from columns

2013-01-03 Thread Gerrit Eichner
Hi, Aseem, you may want to look at ?stack or ?reshape (and transform your matrix into a data frame). Hth -- Gerrit On Wed, 2 Jan 2013, Aseem Sharma wrote: Hi, I have a data matrix with 13 columns and 55 rows. First coulmn is year and other are monthly values for 55 years. Now i want

Re: [R] add error bars in a plot

2011-02-08 Thread Gerrit Eichner
Hello, Maria, take a look at ?errbar in the package Hmisc. Hth -- Gerrit Dear all I have a dataset of how metal concentrations change through time. I have made a plot of date versus metal concentration. However I want to add error bars in the plot. Could you help me? Thanks Maria

Re: [R] read a text file with variable number of spaces

2011-03-03 Thread Gerrit Eichner
Hello, Gregory, for your first data set see ?read.table and for you second ?read.fwf may help solving your problem. Hth -- Gerrit On Thu, 3 Mar 2011, Gregory Ryslik wrote: Hi, I seem to be having somewhat of an unusual data input problem with some of the data sets I'm working with

Re: [R] random sampling steps in R with replacement

2011-03-10 Thread Gerrit Eichner
Hello, Taby, for your (first) problem take a look at ?sample and its argument replace. Regards -- Gerrit On Thu, 10 Mar 2011, taby gathoni wrote: Please note is with replacement From: taby gathoni tab...@yahoo.com To: R help r-help@r-project.org Sent: Thursday, March 10, 2011 11:53 AM

Re: [R] Data Frame Variable Names

2011-03-15 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] expression exponent labeling

2013-03-13 Thread Gerrit Eichner
Hi, Berry, I think for(i in -8:-3) axis(1, i, substitute(10^j, list( j = i))) achieves what you want. Regards -- Gerrit On Wed, 13 Mar 2013, Berry Boessenkool wrote: Hi all, I want to label an axis with exponents, but can't get it done with expression. Any hints would be very

Re: [R] how to search a list that contains multiple dissimilarvectors?

2013-03-28 Thread Gerrit Eichner
Hi, Eric, as a quick hack, does spots - sapply( alist, function( listcomp) which( listcomp == value.to.look.for) ) spots[ sapply( spots, length) == 0] - NULL do what you want? Regards -- Gerrit On Thu, 28 Mar 2013, Eric Rupley wrote: Dear All, This

  1   2   >