Displaying 20 results from an estimated 10000 matches similar to: "recursive relevel"
2018 Oct 02
1
Relevel confusing with numeric value
Something that bit me:
The function relevel takes a factor, and a reference level to be promoted to the first place.
If ?ref? is a character this level is promoted, if it?s a numeric the ?ref?-th level is promoted.
Which turns out to be very confusing if you have factor with numeric values (e.g. when reading in a csv with some dirty numeric columns and stringsAsFactors TRUE)
For example:
2009 Jun 16
4
confusion on levels() function, and how to assign a wanted order to factor levels, intentionally?
Dear R-helpers,
I want to make a series of boxplots on several numeric univariates with two
group variables (species and population, population nested in species, and
with population as the X-axis). In order to get a proper order of the
individual populations in X-axis, I need to assign a wanted order to the
factor (population). I used the levels() function to do this assignment, but
it seemed
2017 Oct 28
2
HELP relevel INTERCEPT-COMPARISONS
Dear colleagues,
How can I do to "relevel" the intercept?
I need that the treatment "Db" be the intercept, and have p-values for the comparisons with the others treatments.
I used the function "relevel" but it did not work out to have what I want.
Thanks for your help,
Xavier
T1 <- read.table(file.choose(), h=T)
> head(T1)
treatment replicate Time
2017 Oct 28
2
Function Relevel DOE NOT FOUND
Dear Forum,
Which functions and packages should be installed to make work the function "relevel"?
treatment<-revel(treatment,ref="Db")
Error: no se pudo encontrar la funci?n "revel"
Thank you very much for your help,
Xavier Chiriboga M.
PhD Candidate
Fundamental and Applied Research in Chemical Ecology Lab.
Institute of Biology
University of Neuchatel
2010 Aug 03
1
releveling a numeric by factor interaction
Can anyone help me with the necessary code to relevel a numeric*factor
interaction term in a linear model? I would like to report the estimate,
std. error and t-value for the reference factor.
First, I estimated a linear model with dummy variables and was able to
retrieve model estimates for the reference factor using relevel.
for example:
> summary(update(mod.mod, . ~ . - dummy +
+
2012 Jan 16
2
Relevel dynamically
Dear list,
I am running R code which produces a data.frame with variable rows. For
plotting purposes I need to relevel
the column called "names" but since the dimension of the data.frame can vary
I do not know how to dynamically
revel the data.frame.
Here is an example data.frame called df to illustrate what I try to achieve:
> df <-
2009 Apr 17
1
cast function in package reshape
Hello R useRs,
I have a function which returns a list of functions :
freq1 <- function(x) {
lev <- unique(x[!is.na(x)])
nlev <- length(lev)
args <- alist(x=)
if (nlev == 1) {
body <- c("{", "sum(!is.na(x))", "}")
f <- function() {}
formals(f) <- as.pairlist(args)
body(f) <- parse(text = body)
namef <-
2006 Jun 29
2
Biobass, SAGx, and Jonckheere-Terpstra test
Hi list,
I tried to load the package SAGx and failed because it complains it's
looking for the Biobass which is not there. Then I looked up the package
list and Biobass is not found.
I'm trying to run the Jonckheere-Terpstra test and from what I see in
the R archive, SAGx is the only place it's been implemented.
> library(SAGx)
Loading required package: multtest
Loading required
2004 Dec 22
0
relevel expansion suggestion
To the R developers,
The discussion below reminded me that I think it might be a good idea
to take the Relevel function from the Lexis package and replace relevel
in stats with it. This is really nothing special for epidemiology.
It is fully compatible with the existing relevel (it actually contains
the
relevel code almost verbatim as a subset), but it has the extra
functionality
of combining
2013 Jan 16
1
equivalent code that doesn't return same results?
I need to automate changing the reference value for factors in analysis, and
it is my understanding that the following two sets of code should produce
identical results, but they do not:
1)dataset$method
2)eval(parse(text=paste("dataset",IVcat[k],sep="$"))) (in this case I
have IVcat[k]=method, which is why they are equal)
I even tested them in R, which says that these
2017 Jul 05
2
Svyglm Error
Greetings,
I am revisiting code from several different files I have saved from the past and all used to run flawlessly; now when I run any of the svyglm related functions, I am coming up with an error:
Error in model.frame.default(formula = F3ATTAINB ~ F1PARED, data = data, :
the ... list does not contain 4 elements
The following is a minimal reproducible example:
library(RCurl)
2006 Dec 15
1
Switching labels on a factor
Hi All,
I'm perplexed by the way the unclass function displays a factor whose
labels have been swapped with the relevel function. I realize it won't
affect any results and that the relevel did nothing useful in this
particular case. I'm just doing it to learn ways to manipulate factors.
The display of unclass leaves me feeling that the relevel had failed.
I've checked three books
2008 Jul 03
1
subset function within a function
Hi,
I am using this subset statement and it works
outside a function.
LIS[[i]]<- lapply(LI, subset, select=cov[[i]])
However, wrapped inside a function this statement
produces the same values for every LIS[[1]] which
is only the first subset of LI.
Does anyone know why is not working correctly inside
a function?
ff = factor(covariate)
nLev <- nlevels(ff)
cov <-
2017 Jul 05
0
Svyglm Error
hi, i am not hitting an error when i copy and paste your code into a fresh
console. maybe compare your sessionInfo() to mine?
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2008 R2 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
2008 Aug 07
1
recursive root finding
Dear list,
I've had this problem for a while and I'm looking for a more general
and robust technique than I've been able to imagine myself. I need to
find N (typically N= 3 to 5) zeros in a function that is not a
polynomial in a specified interval.
The code below illustrates this, by creating a noisy curve with three
peaks of different position, magnitude, width and
2009 Mar 25
2
"[.data.frame" and lapply
Dear all,
Trying to extract a few rows for each element of a list of
data.frames, I'm puzzled by the following behaviour,
> d <- lapply(1:4, function(i) data.frame(x=rnorm(5), y=rnorm(5)))
> str(d)
>
> lapply(d, "[", i= c(1)) # fine, this extracts the first columns
> lapply(d, "[", j= c(1, 3)) # doesn't do nothing ?!
>
> library(plyr)
2009 Mar 25
2
"[.data.frame" and lapply
Dear all,
Trying to extract a few rows for each element of a list of
data.frames, I'm puzzled by the following behaviour,
> d <- lapply(1:4, function(i) data.frame(x=rnorm(5), y=rnorm(5)))
> str(d)
>
> lapply(d, "[", i= c(1)) # fine, this extracts the first columns
> lapply(d, "[", j= c(1, 3)) # doesn't do nothing ?!
>
> library(plyr)
2009 Sep 02
2
combining grid.text, expression and variables
Dear R-users,
I am trying to use the grid.text and expression functions to display
several character strings and plotmath text on a viewport. Some strings
can include a variable portion (PI.limits in the following example),
which I thought could be implemented by combining the bquote and the
expression functions. Unfortunately, my expressions do not seem to be
evaluated. I would greatly
2008 Jun 18
2
highest eigenvalues of a matrix
DeaR list,
I happily use eigen() to compute the eigenvalues and eigenvectors of
a fairly large matrix (200x200, say), but it seems over-killed as its
rank is limited to typically 2 or 3. I sort of remember being taught
that numerical techniques can find iteratively decreasing eigenvalues
and corresponding orthogonal eigenvectors, which would provide a nice
alternative (once I have the
2010 Nov 08
1
R help: reorder columns in an xyplot
Hello. First post, though I have read scores. Mostly i can solve my
problems reading the archives, but I lack the vocabulary to ask this one
right. Any social faux pais, I apologize.
I am sure this is a very basic question and I am embarrassed to ask, but I
spent several hours scouring the archives and trying various suggestions,
but I am too new to get any of them to work.
I am trying to