similar to: coercing "numeric" components of data frame to "factor" or "ordered"?

Displaying 20 results from an estimated 2000 matches similar to: "coercing "numeric" components of data frame to "factor" or "ordered"?"

2002 Jun 05
5
hairy indexing problem
I've got a data frame that looks like this: subject foo bar 2 1.7 3.2 2 2.3 4.1 3 7.6 2.3 3 7.1 3.3 3 7.3 2.3 3 7.4 1.3 5 6.2 6.1 5 3.4 6.9 ... That is, I've got multiple rows per subject. I need to compute summaries within categories where the subject has the same number
2002 Jul 06
2
cross-platform code: windows or gnu/linux?
I am writing some R code that generates some figures. I am primarily developing on GNU/Linux, but will ultimately run the code on Windows in order to get WMF files I can integrate in an existing document. The win.metafile() function, of course, doesn't exist in the GNU/Linux version of R. I am contemplating writing an abstraction layer that runs the right thing, but I need to know how the
2002 May 07
3
good procedure for creating plots for PowerPoint
I am generating some graphs (on GNU/Linux using R 1.5.x) for a PowerPoint presentation my boss is giving next week. He just tried cut/pasted a plot off of a PDF file I had created, but he complained that the fonts were too small and fuzzy, and that he couldn't change the background. I have been playing with png(bg=transparent), but I am not sure what appropriate height,width parameters and
2002 Apr 04
2
summary on predict with arima0
Here is the summary on predict when using an arima0 object: The arima0 object must be based on a time series vector. That is; x <- ts(xm1, frequency=12, start=c(1975,1)) x.ar <- arima0(x,order=c(1,1,1)) predict(x.ar,n.ahead=3) Thanks so much to Prof. Brian Ripley and David Brahm and other! Sincerely, Erin Hodgess
2002 May 01
1
"normal probability plot" with a percentile scale?
I'd like to generate some plots like you'd see on the old "normal probability graph paper", like the first plot in: <http://www.itl.nist.gov/div898/handbook/eda/section3/normprpl.htm> except the horizontal scale would have 1%, 5%, 25%, 50%, 75%, 95%, 99%, or similar quantiles, with associated tick/grid lines. [still hunting around for a good example...] something like
2002 May 06
3
Spearman rank-order correlation matrix
I"ve got a data frame with a selection of columns I want to compute a rank-order correlation matrix from without disturbing the original data frame. foo[,c("a","b","d","f","g")] What I wanted to do, intuitively, was: > cor(rank(foo[,c("a","b","d","f","g")])) but rank in that context
2002 May 10
1
qqnorm() with weighted data?
I've got a set of data that are weighted by a largish integer (ranging from about 50K to 1.5 million). I'd like to plot CDF's for this data taking into account the weighting. What do you recommend? Thanks! -- Russell Senior ``The two chiefs turned to each other. seniorr at aracnet.com Bellison uncorked a flood of horrible
2006 Dec 14
3
sapply problem
I have encountered the following problem: I need to extract from a list of lists equally named compenents who happen to be 'one row' data frames. a trivial example would be: a <- list(list( df = data.frame(A = 1, B = 2, C = 3)), list(df = data.frame(A = 4,B = 5,C = 6))) I want the extracted compenents to fill up a matrix or data frame row by row. the obvious thing to do seems: b
2002 Jul 09
3
building formula objects
I want to write a function to take an argument as the response variable of a linear model, e.g. to do anova's across a list of variables, something like the following (except, of course, this doesn't work): function(x) { anova(lm(x ~ my.factor,data=my.data)) } The x in lm() above is getting evaluated at the wrong level. How can I make this work? -- Russell Senior ``The two
2000 Feb 02
0
Factor Analysis?
Hello. I have been browsing the R- manual and not seen any direct implementation of Factor analysis. Is there anyone out there who has run Factor Analysis with R? Thanks Michael -- Michael Preminger Forsker / Research Scientist Avdeling for journalistikk, bibliotek- og informasjonsfag / Faculty of Journalism, Library and Information Science H?gskolen i Oslo / Oslo College
2003 Oct 28
2
formula parsing, using parts ...
I am writing a little abstraction for a series of tests. For example, I am running an anova and kruskal.test on a one-factor model. That isn't a particular problem, I have an interface like: my.function <- function(model,data) { print(deparse(substitute(data))) a <- anova(lm(formula,data)) print(a) if(a$"Pr(>F)"[1] < 0.05) { pairwise.t.test(???) }
2011 Jul 20
3
Coercing Logical array to Numeric array
Dear all, Coercing a logical vector to a numeric one is easy. The as.numeric function is used. However what do we use when we have a matrix or an array? Sumona
2013 Jan 23
1
problems with coercing a factor to be numeric
Dear R listers, I am trying to compute the mean of a dummy variable that is encoded as a factor. However, even though the levels of my factor are 0 - 1, when I compute the mean (after coercing the factor to be numeric), R changes 0 into 1 and 1 into yes, thus altering my expected result. Please, consider the following working example: pp <- rep(0:1, 10) pp <- factor(pp, levels=(0:1),
2011 Sep 27
2
Coercing a character zoo to a numeric
Dear R-helpers, It seems to me that a character zoo cannot be coerced to a numeric zoo. Below is a minimal example. Can someone tell me what I have done wrong? > z<-zoo(1:4,order.by=1:4) > coredata(z)<-as.character(coredata(z)) > str(z) ‘zoo’ series from 1 to 4 Data: chr [1:4] "1" "2" "3" "4" Index: int [1:4] 1 2 3 4 >
2004 Nov 10
1
Basic Q on coercing factors in data frames to numeric
Hi there, I'm running R 2.0.0 on Windows 95. I'm trying to coerce a column of factors within a data frame to numeric. This is not a problem with a vector, but I can't find a way to index a column within a data frame to achieve this. All the examples from 'An introduction to R', 'S-plus 6 programmers guide', etc, use simple vectors. I'm sure I'm missing
2003 Oct 27
2
variance component analysis for nested model
Given a set of data: > names(data) [1] "city" "house" "visit" "value" I am looking for a way to compute the variance components of the nested model (ie, visit 1 at house 2 at city 3 isn't related to visit 1 and house 2 at city 4), but different houses in the same city may be related, and different visits to the same house are probably
2002 Dec 31
3
Probit Analysis
Hello all, I have a very simple set of data and I would like to analyze them with probit analysis. The data are: X Event Trial 100 8 8 75 8 8 50 6 8 25 4 8 10 2 8 0 0 8 I want to estimate the value of X that will give a 95% hit rate (Event/Trial) and the corresponding 95% CI. Anyone can offer some help? Thanks!! -
2001 Dec 19
2
readline with R-1.4.0
Hi, I am not sure if this is a bug, so I am posting it here. I also searched the FAQ file for the readline string and did not find anything about the behavior below. I just successfully rsync'ed, compiled and tested R-1.4.0 on my RH 7.2 Linux machine. I encountered one problem though. When running ./configure I noticed that I was getting errors from the readline library. Although
2001 Jul 24
3
strange slowness of plot
I just ran into this strange behavior. y <- rnorm(1000) x <- seq(0, length=length(y)) plot(x, y, type='l', lty=1) - instantaneous plot(x, y, type='l', lty=2) - 18s plotting lines + 15s plotting axes = 33s plot(x, y, type='l', lty=3) - 76s ,, + 75s ,, = 151s plot(x, y, type='l', lty=4) -
2007 Feb 23
3
mixture of 2 normals - starting values
Hi, I have a problem of estimating a mixture of two normal distributions. I need to find the starting points automatically, since this is a part of a larger piece of image processing code. I found the mix2normal1 function in VGAM package that mentions a method of finding starting values for mu1 and mu2 but refers the reader to a book by Everitt and Hand. Unfortunately, I do not have an easy