similar to: convert factor to numeric

Displaying 20 results from an estimated 1000 matches similar to: "convert factor to numeric"

2003 May 16
2
Axis labels
Hello R-experts! When I produce a plot R takes avoids overlapping axis labels in order to maintain readabilty which is great. But now I have written a little custom plot function in which I set my own labels and label positions after generating the actual plot: axis(..., lables=c('A', 'B', 'F', 'G', 'M'), at=mypositions) As you may have guessed: This is
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
2003 Jul 26
1
bug plotting dates?
Hello R-experts! I am using R Version 1.7.1 (2003-06-16) on a Debian Linux box and I have discovered an odd result when plotting data involving dates. Please try this minimal example: a = seq(ISOdate(2000,1,1), ISOdate(2001,1,1), "months") b = 1:13 plot(a,b, col="red") What I get is a plot that looks as expected except the x-axis is mostly red. Can anyone reproduce this
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
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 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",
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
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
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
2008 Nov 05
3
Efficient way to fill a matrix
Dear R experts, Suppose I have a data frame of three variables: > foo <- data.frame(row=1:5, col=1:3, val=rnorm(15)) > foo row col val 1 1 1 -1.00631642 2 2 2 0.77715344 3 3 3 0.17358793 4 4 1 -1.67226988 5 5 2 1.08218836 6 1 3 1.32961329 7 2 1 -0.51186267 8 3 2 -1.20990127 9 4 3 -0.57786899 10 5 1 0.67102887 11 1 2
2011 Apr 08
3
xyplot, groups and colors
Dear ExpeRts, I am trying to plot a bunch of growth curves and would like to get some more control over groups and line colors than I seem to have. Example: # make some data dat <- Orange dat$group <- ifelse(dat$Tree%in%c('1','4','5'), 'A', 'B') # plot xyplot(circumference~age, dat, groups=group) # now use lines to make the growth curve more
2010 Aug 27
3
predict.loess and NA/NaN values
Hi! In a current project, I am fitting loess models to subsets of data in order to use the loess predicitons for normalization (similar to what is done in many microarray analyses). While working on this I ran into a problem when I tried to predict from the loess models and the data contained NAs or NaNs. I tracked down the problem to the fact that predict.loess will not return a value at all
2008 Sep 29
1
Lattice: don't draw unlabled tick marks
If I only want axis labels on the left and bottom I can set alternating=F like in the following example: Depth <- equal.count(quakes$depth, number=8, overlap=.1) xyplot(lat ~ long | Depth, data = quakes, scales=list(alternating=F) I also would like to get rid of the unlabeled tick marks (top and right). How can I do that? cu Philipp -- Dr. Philipp Pagel Lehrstuhl f?r Genomorientierte
2006 Nov 10
2
mock syntax order
I have the following statement mock_requester.should_receive(:request_with).with ("x").any_number_of_times.and_return(@object) which works fine, but when i do it backwards, which makes the same amount of sense syntactically, it fails mock_requester.should_receive(:request_with).with("x").and_return (@object).any_number_of_times are all of the mock options
2011 Apr 27
1
read.table: fill=T for header?
Dear ExpeRts,t I am trying to read tab delimted data produced by somewhat brain dead software that seems to think it's a good idea to have an extra tab character after the last column - except for the header line. As explained in the help page, read.delim now assumes that the first column contains the row.names (which is not even wrong) but now and all col.names get shiftet by one column.
2006 Dec 14
1
legend/plotmath/substitute problem
Dear R Experts, I am trying to produce a legend for a series of plots which are generated in a loop. The legend is supposed to look like this: 2000: gamma=1.8 where gamma is replaced by the greek letter and both the year and the value of gamma are stored in variables. Everything works fine as long as I have only one data series: year = 2001 g = 1.9 plot(1) legend('top',
2007 Dec 09
2
adjusting "levels" after subset a table
Um texto embutido e sem conjunto de caracteres especificado associado... Nome: n?o dispon?vel Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071208/5409f1a7/attachment.pl
2011 Nov 04
2
Efficiency of factor objects
R factors are the natural way to represent factors -- and should be efficient since they use small integers. But in fact, for many (but not all) operations, R factors are considerably slower than integers, or even character strings. This appears to be because whenever a factor vector is subsetted, the entire levels vector is copied. For example: > i1 <- sample(1e4,1e6,replace=T) > c1