similar to: adjusting "levels" after subset a table

Displaying 20 results from an estimated 500 matches similar to: "adjusting "levels" after subset a table"

2007 Nov 21
3
How can I save a plot ?
I recently installed R 2.6 on Linux/SuSE When I was running the previous version on Windows I was able to save my plots from a script. There was a command "savePlot" that is no more retrieved in the last version. In this scenario, how can I tell R to save the currently displayed plot to a file ? The "save" command is generic and do not know how to tell R that the plot is to be
2008 Aug 15
1
Strange error message from geoR´s likfit () lik. max. func.
ComRades: I am geeting the error message Error in ldots[[which(MET)]] : attempt to select less than one element when I try to fit the geostatistical model with the likfit() function of geoR. I have tried with old data for which likfit() successfully maximised the likelihood in previous versions of geoR, and yet the current version fails. I have tried in Windows Vista and Windows XP (I haven't
2011 Apr 07
1
Assigning a larger number of levels to a factor that has fewer levels
Hello! I have larger and a smaller data frame with 1 factor in each - it's the same factor: large.frame<-data.frame(myfactor=LETTERS[1:10]) small.frame<-data.frame(myfactor=LETTERS[c(9,7,5,3,1)]) levels(large.frame$myfactor) levels(small.frame$myfactor) table(large.frame$myfactor) table(small.frame$myfactor) myfactor has 10 levels in large.frame and 5 levels in small.frame. All 5
2009 May 06
4
tapply changing order of factor levels?
Hi, Does tapply change the order when applied on a factor? Below is the code I tried. > mylevels<-c("IN0020020155","IN0019800021","IN0020020064") >
2012 Jan 18
1
drop rare factors
I have a data frame with some factor columns. I want to drop the rows with rare factor values (and remove the factor values from the factors). E.g., frame$MyFactor takes values A 1,000 times, B 2,000 times, C 30 times and D 4 times. I want to remove all rows which assume rare values (<1%), i.e., C and D. i.e., frame <- frame[[! (frame$MyFactor %in% c("A","B"))]] except
2010 Jul 05
2
repeated measures with missing data
Dear R help group, I am teaching myself linear mixed models with missing data since I would like to analyze a stats design with these kind of models. The textbook example is for the procedure "proc MIXED" in SAS, but I would like to know if there is an equivalent in R. This example only includes two time-measurements across subjects (a t-test "with missing values"), but I
2012 Mar 28
1
discrepancy between paired t test and glht on lme models
Hi folks, I am working with repeated measures data and I ran into issues where the paired t-test results did not match those obtained by employing glht() contrasts on a lme model. While the lme model itself appears to be fine, there seems to be some discrepancy with using glht() on the lme model (unless I am missing something here). I was wondering if someone could help identify the issue. On
2012 Nov 24
1
Adding a new variable to each element of a list
Hello, I have a list of data with multiple elements, and each element in the list has multiple variables in it. Here's an example: ### Make the fake data dv <- c(1,3,4,2,2,3,2,5,6,3,4,4,3,5,6) subject <- factor(c("s1","s1","s1","s2","s2","s2","s3","s3","s3",
2011 Jul 01
2
Initiating in BNArray
Hi, I'm trying to understand some details about an example maintened in [1]. According that link, I have total.data as a data set (am I right?). But I don't understand how is built that table. I saved the dataset in a file, with dput(), and had something like this: structure(list(df.all = structure(list(V1 = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L,
2006 Apr 29
1
splitting and saving a large dataframe
Hi, I searched for this in the mailing list, but found no results. I have a large dataframe ( dim(mydata)= 1297059 16, object.size(mydata= 145280576) ) , and I want to perform some calculations which can be done by a factor's levels, say, mydata$myfactor. So what I want is to split this dataframe into nlevels(mydata$myfactor) = 80 levels. But I must do this efficiently, that is, I
2009 Jun 30
3
Matrix with random number
Hello! I have a program in Fortran and would like to build a matrix with random numbers, I have a function in C. However, I have problems with the use of function in R. Code to compile: R CMD SHLIB mat.f myrbeta.c -o func.so Code in C. #include <R.h> #include <Rmath.h> void F77_SUB(fseedi)(void){   GetRNGstate(); } void F77_SUB(fseedo)(void){   PutRNGstate(); } void
2011 Mar 30
2
summing values by week - based on daily dates - but with some dates missing
Dear everybody, I have the following challenge. I have a data set with 2 subgroups, dates (days), and corresponding values (see example code below). Within each subgroup: I need to aggregate (sum) the values by week - for weeks that start on a Monday (for example, 2008-12-29 was a Monday). I find it difficult because I have missing dates in my data - so that sometimes I don't even have the
2006 May 24
3
How to make attributes persist after indexing?
Dear All! For descriptive purposes I would like to add attributes to objects. These attributes should be kept, even if by indexing only part of the object is used. I noted that some attributes like levels and class of a factor exist also after indexing, while others, like comment or label vanish. Is there a way to make an arbitrary attribute to be kept after indexing? This would be especially
2005 May 06
4
Change class factor to numeric
I am attempting to develop a multiple regression model using selected model variables that should all be treated as numeric (mostly real) values. However, R considers one specific variable "mass" automatically to be of class "factor", probably because "mass" consists of integer values that are repeated. I now want to force R to treat "mass" as a numeric
2009 Aug 12
2
Problem with function in fortran 95
I am writing a function in fortran 95, but the intrinsic function MATMUL is not working properly. Here's an example. SUBROUTINE mymult(x,y,res,m,n) IMPLICIT NONE INTEGER :: m,n REAL :: x, y, res DIMENSION :: x(m,n), y(n,m), res(m,m) res = MATMUL(x,y) END SUBROUTINE mymult R CMD SHLIB mat.f95 In R: dyn.load("mat.so") x <-
2011 Nov 10
1
Errors in SIAR
Help! model1 <- siarmcmcdirichletv4(data, source, tef, concdep=0, 500000, 50000) Error in matrix(1, ncol = (numsources + numiso) * numgroups, nrow = (siardata$iterations - : invalid 'ncol' value (too large or NA) In addition: Warning message: In Ops.ordered((numsources + numiso), numgroups) : '*' is not meaningful for ordered factors Previous message, but more
2005 Oct 31
3
Applying a function to a vector
I have defined a function to compute the value of a beta distribution of the second kind (the existing beta distribution of th stats package is the beta distribution of the first kind). It works perfectly for a single value, but I want to apply it to a vector of 22 000 values. I can use a loop for the calculation of each value but it runs very very slowly. So, what can I change ? Hers's the
2009 May 04
1
how to change nlme() contrast parametrization?
How to set the nlme() function to return the answer without the intercept parametrization? #========================================================================================= library(nlme) Soybean[1:3, ] (fm1Soy.lis <- nlsList(weight ~ SSlogis(Time, Asym, xmid, scal),                        data = Soybean)) (fm1Soy.nlme <- nlme(fm1Soy.lis)) fm2Soy.nlme <- update(fm1Soy.nlme,
2005 Dec 13
1
bug in geoR (?)
I've enconuntered this problem with the last cran version of geoR: > library(geoR) > day <- rep(1:2, each=5) > coords <- matrix(rep(runif(10),2), 10, 2) > data <- rnorm(10) > data[1] <- NA > as.geodata(cbind(coords, data, day), realisations=4) as.geodata: 1 points removed due to NA in the data Errore in as.geodata(cbind(coords, data, day), realisations = 4) :
2009 Mar 03
1
repeated measures anova, sphericity, epsilon, etc
I have 3 questions (below). Background: I am teaching an introductory statistics course in which we are covering (among other things) repeated measures anova. This time around teaching it, we are using R for all of our computations. We are starting by covering the univariate approach to repeated measures anova. Doing a basic repeated measures anova (univariate approach) using aov() seems