search for: nlev

Displaying 19 results from an estimated 19 matches for "nlev".

Did you mean: ndev
2009 Mar 06
2
sm.options
Hi, I am doing kernel density plots, and am trying to make the lines thicker. I comparing three groups, in sm.density.compare. I tried changing lwd to make the line sthicker right on the density compare call, but was not able to do it. There is not an option in sm.options to specify line thickness, as well as cex.ylab or cex.xlab- I tried it and it does not change the thickness of the lines.
2008 Jul 03
1
subset function within a function
...t 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 <- vector(mode="list",length=nLev) for (gp in 1:nLev) { cov[[gp]] <- covariate == levels(ff)[gp] } LIS <- vector(mode="list",length=nLev) #if (SINGLE == T ) LIS[[1]] <- LI else {} for (i in 1:nLev) LIS[[i]]<- lapply(LI, subset, select=cov[...
2018 Mar 24
1
Function 'factor' issues
I am trying once again. By just changing f <- match(xlevs[f], nlevs) to f <- match(xlevs, nlevs)[f] , function 'factor' in R devel could be made more consistent and back-compatible. Why not picking it? -------------------------------------------- On Sat, 25/11/17, Suharto Anggono Suharto Anggono <suharto_anggono at yahoo.com> wrote: Subject: Re...
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 <- paste("freq", as.character(nlev), s...
2017 Nov 25
0
Function 'factor' issues
...I saw attempts to speed up subsetting and 'match', and to cache results of conversion of small nonnegative integers to character string. That's good. I am sorry for pushing, still. Is the partial new behavior of function 'factor' with respect to NA really worthy? match(xlevs, nlevs)[f] looks nice, too. - Using f <- match(xlevs, nlevs)[f] instead of f <- match(xlevs[f], nlevs) for remapping - Remapping only if length(nlevs) differs from length(xlevs) Applying changes similar to above to function 'levels<-.factor' will not change 'levels<-.factor'...
2012 Nov 05
1
Another code to drop factor levels
...ver, I am proposing the code below that I wrote. In some occasions, it was faster than applying function 'factor'. In any case, there is no restriction for anyone to use the code below. droplevels2 <- function(x) { if (is.null(levels(x))) stop("no 'levels' attribute") nlev <- length(levels(x)) y <- unclass(x) tb <- tabulate(y, nlev) used <- as.logical(tb) tb[used] <- seq(length=sum(used)) y[] <- tb[y] levels(y) <- levels(x)[used] attr(y, "class") <- attr(x, "class") y } Alternatively, one may use 'levels<-.factor&...
2007 Jan 28
1
plot.lm (PR#9474)
...is not correctly produced. The labels on the x-axis are sorted correctly by magnitude of the fitted value, but the data are plotted in the original factor order. I changed facval[ord] <- facval xx <- facval plot(facval, rs, xlim = c(-1/2, sum((nlev - 1) * to # facval[ord] <- facval xx <- facval[ord] plot(xx, rs, xlim = c(-1/2, sum((nlev - 1) * in the "if (isConst.hat)" section of "show[5]". The data then plotted correctly but the extreme point labels did not move. I...
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
2017 Oct 21
0
Function 'factor' issues
My idea (like in https://bugs.r-project.org/bugzilla/attachment.cgi?id=1540 ): - For remapping, use f <- match(xlevs, nlevs)[f] instead of f <- match(xlevs[f], nlevs) (I have mentioned it). - Remap only if length(nlevs) differs from length(xlevs) . On use of 'order' in function 'factor' in R devel, factor.Rd still says 'sort.list' in "Details" section. My comments on the part of...
2012 Jan 19
1
Legend problem in line charts
Hi all, Small problem in generating the line charts. Question: Legend for the first graph is coming wrong., for second graph correctly. Please fix the legend postion at the down of graph. Plesae give me the solution. Thank you Devarayalu Orange1 <- structure(list(REFID = c(7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9), ARM = c(1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2,
2005 Apr 19
1
controlling the x axis of boxplots
v 2.0.1 (sooooh old!) on Win2k I think I know the answer to this but I can hope ... I have data for continuous variables (measures of residents) by a categorical variable in range (1,22), the units in which they live. I want to plot these data with a pair of boxplots one above another with same x-axis (1,22) using par(mfrow=c(2,1)) and then plotting first for the women then for the men.
2008 May 20
1
contr.treatments query
...0 0 whereas: contr.treatment(3, base=1, contrasts=FALSE) # 1 2 3 # 1 1 0 0 # 2 0 1 0 # 3 0 0 1 contr.treatment(3, base=1, contrasts=TRUE) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 I can follow the last two fine -- they are what is implied by the code for contr.treatment(). Likewise: contrasts(factor(Nlevs <-c(1,2,3))) # 2 3 # 1 0 0 # 2 1 0 # 3 0 1 But why the different result when applied to N? With thanks, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 20-May-08...
2017 Oct 15
2
Function 'factor' issues
...ecause it is unmatched to 'levels' argument or is in 'exclude') is absorbed into NA in "levels" attribute (comes from 'labels' argument), if any. The issue is that it happens only when 'labels' is specified. Function 'factor' could use match(xlevs, nlevs)[f]. It doesn't match NA to NA level. When 'f' is long enough, longer than 'xlevs', it is faster than match(xlevs[f], nlevs). Example 2: With levs <- c("A","A")? , factor(levs, levels=levs) gives error, but factor(levs, levels=levs, labels=levs) doesn...
2006 Jul 27
6
Any interest in "merge" and "by" implementations specifically for sorted data?
Hi Developers, I am looking for another new project to help me get more up to speed on R and to learn something outside of R internals. One recent R issue I have run into is finding a fast implementations of the equivalent to the following SAS code: /* MDPC is an integer sort key made from two integer columns */ MDPC = (MD * 100000) + PCO; /* sort the dataset by the key */ PROC SORT;
2009 Jan 09
2
recursive relevel
Dear list, I'm having second thoughts after solving a very trivial problem: I want to extend the relevel() function to reorder an arbitrary number of levels of a factor in one go. I could not find a trivial way of using the code obtained by getS3method("relevel","factor"). Instead, I thought of solving the problem in a recursive manner (possibly after reading
2017 Oct 18
0
Function 'factor' issues
...noticed that also in June, considered to change it and found that such a changed factor() would be too different from what it has "always been". So, yes, IIRC, this current behavior is on purpose, if only for back compatibility. > Function 'factor' could use match(xlevs, nlevs)[f]. It doesn't match NA to NA level. When 'f' is long enough, longer than 'xlevs', it is faster than match(xlevs[f], nlevs). > Example 2: > With > levs <- c("A","A")? , > factor(levs, levels=levs) > gives error, but...
2003 Dec 17
6
Factor names & levels
When I alter the levels of a factor, why does it alter the names too? f <- factor(c(A="one",B="two",C="one",D="one",E="three"), levels=c("one","two","three")) names(f) -- gives [1] "A" "B" "C" "D" "E" levels(f) <-
2002 May 17
1
Strange R CMD check \usage parse error
...parse(file, n, text, prompt) : parse error Error in checkDocArgs(package = "Hmisc") : cannot source usages in documentation object 'plsmo' Execution halted \usage{ plsmo(x, y, method=c("lowess","supsmu","raw"), xlab, ylab, add=F, lty=1:nlev, col=par("col"), lwd=par("lwd"), iter=ifelse(length(unique(y))>2, 3, 0), bass=0, trim, fun, group, prefix, xlim, ylim, label.curves=T, datadensity=F, lines=T, ...) xyplot(y ~ x | conditioningvars, groups, panel=panel.plsmo, type='b',...
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