similar to: Factor levels.

Displaying 20 results from an estimated 20000 matches similar to: "Factor levels."

2002 Nov 08
1
Using the ``...'' argument.
Suppose that I have a function fff which calls a couple of functions foo and bar, and that foo takes optional arguments a and b, and bar takes optional arguments u and v. Is there an elegant way of passing ***both*** sets of optional arguments via a ``...'' argument for fff? I'd like to be able to have a structure like: fff(x,y,z,...) { . a1 <- foo(x,y,...) b1
2006 Mar 23
3
Intercepts in linear models.
A colleague asked me if there is a way to specify with a ***variable*** (say ``cflag'') whether there is an intercept in a linear model. She had in mind something like lm(y ~ x - cflag) where cflag could be 0 or 1; if it's 0 an intercept should be fitted, if it's 1 then no intercept. This doesn't work ``of course''. The cflag just gets treated as another predictor
2012 Oct 05
1
Format of numbers in plotmath expressions.
I want to do something like: TH <- sprintf("%1.1f",c(0.3,0.5,0.7,0.9,1)) plot(1:10) legend("bottomright",pch=1:5,legend=parse(text=paste("theta ==",TH))) Notice that the final "1" comes out in the legend as just plain "1" and NOT as "1.0" although TH is [1] "0.3" "0.5" "0.7" "0.9"
2012 Oct 30
5
Swap rows and columns in a matrix
Dear R users, I want a help to write an algorithm for swapping rows and columns in a matrix thanks in advance [[alternative HTML version deleted]]
2011 Aug 15
2
area under the curve
HI there, I have been trying to use a code posted on R help to be able to calculate area under the curve for complicated data points and there seems to be an issue with the code: no "b" object found. I am not a good R user and can''t find were the problem is. Any help? Thanks!! This is the code ( as a test run I gave it this info because I know the answer: x<-seq(1:50)
2010 Mar 01
1
Fwd: Erika DeBenedictis-Recommendation
---------- Forwarded message ---------- From: Celia Einhorn <celia.einhorn at gmail.com> Date: Wed, Feb 17, 2010 at 8:15 PM Subject: Fwd: Erika DeBenedictis-Recommendation To: drew einhorn <drew.einhorn at gmail.com> ---------- Forwarded message ---------- From: David H. Kratzer <dhk at lanl.gov> Date: Tue, Feb 16, 2010 at 9:24 AM Subject: Fwd: Erika
2024 Sep 27
7
Is there a sexy way ...?
I have (toy example): x <- list(`1` = c(7, 13, 1, 4, 10), `2` = c(2, 5, 14, 8, 11), `3` = c(6, 9, 15, 12, 3)) and f <- factor(rep(1:3,5)) I want to create a vector v of length 15 such that the entries of v, corresponding to level l of f are the entries of x[[l]]. I.e. I want v to equal c(7, 2, 6, 13, 5, 9, 1, 14, 15, 4, 8, 12, 10, 11, 3) I can create v
2006 May 15
2
RFC 3501 compliance issue: body-type-msg incorrect
Hi, I am using Dovecot 1.0 beta 7, moving to beta8 probably tomorrow. I am seeing a few RFC compliance issues with IMAP responses. I have an in-house IMAP client that caches IMAP data for a web mail system (it parses millions of IMAP interactions a day), and it reports whenever it gets a line that does not look RFC compliant. Unfortunately, users modify their mailboxes before I can get a copy
2008 Feb 20
2
Data frame with 0 rows.
For reasons best known only to myself ( :-) ) I wish to create a data frame with 0 rows and 9 columns. The best I've been able to come up with is: junk <- as.data.frame(matrix(0,nrow=0,ncol=9)) Is there a sexier way? cheers, Rolf ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
2004 Jan 09
1
degree-min-sec data
Hello - Have both astronomic and geodetic data sets with values in the form "ddd:mm:ss.sssss", where dd is an integer between -180 and 180, mm is an integer between 0 and 60, and ss is a floating-point number between 0 and 60.0. In order to do anything useful with these values they need to be turned into their "decimal degree" equivalent. Assuming the data is a vector y, the
2024 Sep 28
1
Is there a sexy way ...?
Hi Rolf, this topic is probably already saturated, but here is a tidyverse solution: ``` library(purrr) x <- list( ? `1` = c(7, 13, 1, 4, 10), ? `2` = c(2, 5,? 14, 8, 11), ? `3` = c(6, 9, 15, 12, 3) ) x |> ? pmap(~ c(..1, ..2, ..3)) |> ? reduce(c) #> [1]? 7? 2? 6 13? 5? 9? 1 14 15? 4? 8 12 10 11? 3 ``` Here, we map over the elements of the list in parallel (hence pmap),
2009 Mar 25
3
Converting a Matrix to a Vector
Say I have: > set.seed( 1 ) > m <- matrix( runif(5^2), nrow=5, dimnames = list( c("A","B","C","D","E"), > c("O","P","Q","R","S") ) ) > m O P Q R S A 0.2655087 0.89838968 0.2059746 0.4976992 0.9347052 B 0.3721239 0.94467527 0.1765568
2008 Jul 01
2
Area Under a Curve
I would like to integrate the area under a curve without any smoothing or the like- just on the raw numbers. I looked at integrate() but it requires a function which I assume means something like x+x^2+x^3 is there a built in function in R for this? #let's say x <- seq(1:50) y <- seq(1:50) plot(y~x) # the are would be 1250 # I would like to be able to do this but on more complicated
2007 Aug 30
3
piecewise linear approximation
Dear list, I have a series of data points which I want to approximate with exactly two linear functions. I would like to choose the intervals so that the total deviation from my fitted lines is minimal. How do I best do this? Thanks! Kamila The information transmitted in this electronic communication...{{dropped}}
2024 Sep 28
1
Is there a sexy way ...?
Sorry to append, but I just realised that of course ``` x |> ? pmap(c) |> ? reduce(c) |> ? unname() ``` also works and is a general solution in case your list has more than three elements. Here, we map in parallel over all elements of the list, always combining the current set of elements into a vector, and then reduce the resulting list into a vector by combining the elements
2010 Aug 10
4
(Dreaded) STI, belongs_to
Having problems with STI. Names below have been changed to protect the innocent. Imagine a system that allows someone to apply for one of two different types of school scholarships. Each scholarship goes through a different review process, represented by a state machine (this is not a state machine question). So there are two state machine classes that differ slightly and subclass a generic
2024 Sep 28
1
Is there a sexy way ...?
I see a book coming: "666 ways to do the same thing in R ranked by sexiness." Kidding aside, if you look under the covers of some of the functions we are using, we may find we are taking steps back as some of them use others and perhaps more functionality than we need. But for a new reader , looking at many approaches may open up other ways and ideas and see the problem space as quite
2024 Sep 28
2
Is there a sexy way ...?
Avi I fear this was all a huge social experiment. Testing if a post titled "sexy way" would increase engagement... On Sat, 28 Sep 2024, 07:21 , <avi.e.gross at gmail.com> wrote: > I see a book coming: > "666 ways to do the same thing in R ranked by sexiness." > > Kidding aside, if you look under the covers of some of the functions we > are
2010 Nov 10
2
Centring titles for pairs of plots.
I would like to centre titles for pairs of plots in a 3-x-2 array. Each row of the array corresponds to a calendar year and I would like to have the year value centred between the two plots in the row, and just above their upper edges. I have attached an example in "demo.pdf" showing roughly what I want. I managed to produce the example using
2002 Sep 19
5
how to use if statement in function correctly
Dear all I try to persuade if statement in my function to work as I want (but I am not very successful:( My question is why my function with if statement is evaluated correctly in case of atomic variables and incorrectly in case of vector variables. Here is an example: #function with if statement fff <- function(otac,sklon) { test <- (otac *