similar to: Factor to numeric conversion - as.numeric(levels(f))[f] - Language definition seems to say to not use this.

Displaying 20 results from an estimated 10000 matches similar to: "Factor to numeric conversion - as.numeric(levels(f))[f] - Language definition seems to say to not use this."

2013 Apr 01
2
Factor to numeric conversion - as.numeric(as.character(f))[f] - Language definition seems to say to not use this.
These two seem to be at odds. Is this the case? >From help(factor) - section Warning: To transform a factor f to approximately its original numeric values, as.numeric(levels(f))[f] is recommended and slightly more efficient than as.numeric(as.character(f)). >From the language definition - section 2.3.1: Factors are currently implemented using an integer array to specify the actual
2011 Jan 17
1
median by geometric mean -- are we missing what's important?
Folks: I know this may be overreaching, but are we missing what's important? WHY do the zeros occur? Are they values less then a known or unknown LOD? -- and/or is there positive mass on zero? In either case, using logs to calculate a geometric mean may not make sense. Paraphrasing Greg Snow, what is the scientific question? What is the model? Cheers, Bert On Mon, Jan 17, 2011 at 9:13 AM,
2012 May 12
2
Plotmath bug or my misunderstanding?
This is a followup to a recent post on using atop() to obtain multiline expressions. My reading of the plotmath docs makes it clear that issuing (in base graphics) the specification par(cex = 2) doubles symbols and regular text in subsequent plotmath expressions. However, it is unclear to me what specifying cex _within_ the annotation function using plotmath should do, and the following seems
2010 Feb 12
1
Using seq_len() vs 1:n]
Pat Burns makes a good point. -Peter -------- Original Message -------- Subject: Re: [R] Using seq_len() vs 1:n Date: Fri, 12 Feb 2010 09:01:20 +0000 From: Patrick Burns <pburns at pburns.seanet.com> To: Peter Ehlers <ehlers at ucalgary.ca> References: <4B746AEF.10900 at ucalgary.ca> If you want your code to be compatible with S+, then 'seq_len' isn't going to work.
2011 May 07
2
Convenience-at-the-expense-of-clarity (was: quantmod's addTA plotting functions)
Thanks, Writing plot(addTA()) worked fine. I find myself with such mixed feelings about R. After finding that addTA worked fine at the command line but not in a function, I puzzled for a long time about what kind of virtual machine structure could possibly account for that. I couldn't think of any. It turns out that this isn't due to an R virtual machine structure. The reason addTA adds
2004 Nov 24
2
text() with invalid argument type crashes RGui.exe
Dear Rexperts: (R 2.0.1 on Windows XP Pro) Is the following problem unique to my setup? If it's a known problem, I didn't see it at http://bugs.r-project.org/ nor find discussion in the archives. plot(1:10) loc <- c(5, 6) text(loc, labels = "a") Produces expected results according to ?xy.coords. plot(1:10) loc <- list(x = 5, y = 6) text(loc, labels = "a") No
2011 Apr 10
5
Question about levels/as.numeric
Hi, I am still new to R and this is my first post on this mailing-list. I have two .csv (each one being a column of real numbers) coming from the same database (the first one is just longer than the second) and I read them in R the following way: returns <- read.csv("test.csv", header = FALSE) returns2 <- read.csv("test2.csv", header = FALSE) However, the two
2002 Oct 30
1
typo in p.adjust (PR#2231)
Full_Name: Peter Ehlers Version: 1.6.0 OS: Windows 2000 Pro Submission from: (NULL) (136.159.61.178) In: p.adjust package:base R Documentation In the paragraph: Hochberg's and Hommel's methods are valid when the hypothesis tests are independent or when they are non-negatively associated (Sarkar, 1998; Sarker and Chang, 1997). Hommel's method is
2000 Mar 03
7
[PATCH] Add a Maximum Idle Time (1.2.2)
The attached patch adds an option (off by default to preserve current behavior) to set a timeout on the select() statement that waits for input in clientloop.c. This fixes a timeout issue for me (explained below) and probably also fixes the timeouts mentioned in last month's thread "Idle time out". The patch is also available by http from:
2011 May 18
3
R Style Guide -- Was Post-hoc tests in MASS using glm.nb
Thanks Bill. Do you and others think that a link to this guide (or another)should be included in the Posting Guide and/or R FAQ? -- Bert On Tue, May 17, 2011 at 4:07 PM, <Bill.Venables at csiro.au> wrote: > Amen to all of that, Bert. ?Nicely put. ?The google style guide (not perfect, but a thoughtful contribution on these kinds of issues, has avoiding attach() as its very first line.
2010 Feb 05
2
(Another) Bates fortune?
I vote to 'fortunize' Doug Bates on Hierarchical data sets: which software to use? "The widespread use of spreadsheets or SPSS data sets or SAS data sets which encourage the "single table with a gargantuan number of columns, most of which are missing data in most cases" approach to organization of longitudinal data is regrettable."
2012 Mar 20
3
Graphic legend with mathematical symbol, numeric variable and character variable
Hi, I'd like to make a legend with a mix of mathematical symbol (tau), numeric variable and character variables.I have tried : types<-c("Type 1","Type 2","Type 2") tau<-c(1,3,2) legend(x="topright",legend=paste(types,"tau=",expression(tau))) but it doesn't work: the 'tau' symbol is not written in its 'symbol
2012 Aug 31
3
how to find the index of points selected from a scatter plot?
Hi all, I am using "locator" to select the points from a scatter plot... This is all fine. But the problem is that the locator only returns the axis values of the selected points. Instead, I would like to get the index of these select points... The axis values are real-values so it's a bit hard for me to directly reverse-engineer the index nubmers.. How to do that? Thank you!
2005 Oct 24
3
download problem: Windows binaries - patched/devel versions
Lately, I get a "page cannot be found" error (IE 6.0, Windows XP) when I try to download the following: http://cran.us.r-project.org/R-2.2.0pat-win32.exe http://cran.us.r-project.org/R-2.3.0dev-win32.exe (Same for all other mirrors (about 6) that I've tried. Could someone please check if these files are accessible to them? I'm guessing there's something haywire in my setup.
2012 May 04
2
Off-Topic: Crime Statistics Don't Pay
WARNING: COMPLETELY OFF TOPIC -- Nothing to do with R. I thought readers of this list might enjoy the following. The link to the full article is at the bottom. I hope this is not "too" inappropriate. ------- Overconfidence in crime statistics doesn?t pay. In a new study, a team of criminologists makes the case that reported crime rates should acknowledge uncertainty in the data. The
2011 Dec 12
1
Please delete my e-mail judit.barroso@montana.edu
Please, I am receiving lot of e-mails that I do not want. Please could you delete my e-mail. Thank, Judit -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Thomas Adams Sent: Monday, December 12, 2011 3:22 PM To: Bert Gunter Cc: r-help at r-project.org Subject: Re: [R] Boxplot of multiple vectors with different lengths Bert,
2010 Feb 11
2
Using seq_len() vs 1:n
R-people, Duncan Murdoch's response in https://stat.ethz.ch/pipermail/r-help/2010-February/227869.html reminded me of something I had been meaning to ask. A while ago I started using for(i in seq_len(v)) {....} in preference to for(i in 1:n) {....} Duncan's post shows that if n can be zero, there is an advantage to using seq_len. Is there ever a *dis*advantage? Peter Ehlers
2006 Oct 09
1
dump (PR#9282)
Full_Name: Ricardo Ehlers Version: 2.4.0 OS: Linux Submission from: (NULL) (200.138.34.134) The dump function is outputing something different from previous versions. For example > a <- c(1,2,3); dump('a',file='test') now results in `a` <- c(1,2) instead of "a" <- c(1,2) in the file 'test' This prevents using the bayesmix package and running JAGS
2010 Apr 02
1
packages with DLLs under 2.12.0
I realize that R-core must be busy with the imminent release of 2.11.0, so please consider this not urgent. The NEWS file for 2.12.0 (Windows-specific) says, in part: For now, 32-bit packages with compiled code built under 2.{10,11}.x can be used, but this will be disabled before release. For me, this doesn't work without a tweak. For example, > library(mvtnorm) #Error:
2012 Feb 12
1
readLines vs scan
Folks: Suppose I wish to input a text file with variable length lines and possible whitespace as is and then parse the resulting character vector in R. Each line of text is terminated with "\n" (newline character). Is there any reason to prefer one or the other of: scan (filename, what ="a",sep ="\n") ##or readLines(filename) If it makes a difference, I'm on