Re: [R] Extracting elements out of list in list in list

2015-01-16 Thread Brian Diggs
On 1/16/15 9:34 AM, Bert Gunter wrote: Chee Hee's approach is both simpler and almost surely more efficient, but I wanted to show another that walks the tree (i.e. the list) directly using recursion at the R level to pull out the desired components. This is in keeping with R's functional

Re: [R] ddply question

2014-09-02 Thread Brian Diggs
On 8/30/2014 2:11 PM, Felipe Carrillo wrote: library(plyr) b - structure(list(SampleDate = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = 5/8/1996, class = factor), TotalCount = c(1L, 2L, 1L, 1L, 4L, 3L, 1L, 10L, 3L), ForkLength = c(61L, 22L, NA, NA, 72L, 34L, 100L, 23L, 25L),

Re: [R] Preventing loading of user packages

2014-08-25 Thread Brian Diggs
On 8/25/2014 2:08 PM, Jonathon Love wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 hey, i was able to solve the problem by explicitly putting R_LIBS_USER='' in the /etc/Renviron file (it isn't enough simply to comment the entry out, because it has a default value that magically comes

Re: [R] roxygen2

2014-07-21 Thread Brian Diggs
On 7/20/2014 12:50 AM, Kevin Kunzmann wrote: Hi, I have developed a package and would like to switch documentation to roxygen2 from manual :) However roxygen2::roxygenize() First time using roxygen2 4.0. Upgrading automatically... Loading required package: nleqnslv Error in

Re: [R] ggplot2: using coord_trans for logit - probability

2014-04-17 Thread Brian Diggs
On 4/17/2014 5:44 AM, Michael Friendly wrote: I know I can do that. My example was just a toy version of a more complex graph I generate on the logit scale, and save as gg. I wanted to know if there was a way to transform it to the probability scale by using gg + coord_trans() with some

Re: [R] Data Frame to list?

2014-03-10 Thread Brian Diggs
On 3/7/2014 7:41 PM, Keith S Weintraub wrote: Folks, I have a data frame as follows: foo-structure(list(name = c(A, B, C), num = c(3L, 2L, 1L)), .Names = c(name, num), row.names = c(NA, -3L), class = data.frame) str(foo) 'data.frame': 3 obs. of 2 variables: $ name: chr A B C $

Re: [R] Problems with xtable?

2013-12-13 Thread Brian Diggs
On 12/13/2013 1:14 PM, Silvano Cesar da Costa wrote: Hi, I'm using Sweave to create some tables. My code is: label=Q1, echo=FALSE, results=tex= tab1 = table(DISCIPLINA, Q1) tab1.prop = round(addmargins(100*prop.table(tab1, 1), FUN=list(Total=sum)), 2) tab1.txt = xtable(tab1.prop,

Re: [R] Hide return values

2013-11-19 Thread Brian Diggs
On 11/17/2013 5:28 AM, David Winsemius wrote: On Nov 17, 2013, at 3:21 AM, Chris89 wrote: Hi everyone! I am in the process of writing an R-package and while writing a summary function, I have come across a problem. I am able to print a summary table (as in a standard glm() summary) by using

Re: [R] Newb: How I find random vector index?

2013-10-17 Thread Brian Diggs
On 10/17/2013 11:54 AM, Stock Beaver wrote: # Suppose I have a vector: myvec = c(1,0,3,0,77,9,0,1,2,0) # I want to randomly pick an element from myvec # where element == 0 # and print the value of the corresponding index. # So, for example I might randomly pick the 3rd 0 # and I would

Re: [R] Constructing a graph with ggplot2.

2013-09-26 Thread Brian Diggs
On 9/26/2013 1:45 PM, Caitlin wrote: Hi all. I am attempting to graph data from three lab teams with milligrams of maltose shown on the y-axis and 5 pH values (5 to 9) on the x-axis as labels. Unfortunately, I can't seem to construct the graph in this manner using the following code: ph1 =

Re: [R] Changing string to date

2013-08-30 Thread Brian Diggs
On 8/30/2013 3:36 AM, Uwe Ligges wrote: On 30.08.2013 11:59, Christofer Bogaso wrote: Hello again, I have a string which I need to put in some legitimate date format. My string is: MAY-14 And output format would be 05/01/2014, this should be of Date class, so that I can make some

Re: [R] transform dataframe with look-up table

2013-07-25 Thread Brian Diggs
On 7/25/2013 8:13 AM, Juan Antonio Balbuena wrote: Hello I hope that there is a simple solution to this apparently complex problem. Any help will be much appreciated: I have a dataframe with Left and Right readings (that is, elements in each row are paired). For instance,

Re: [R] ggplot2: further query about back to back bar plots

2013-07-25 Thread Brian Diggs
On 7/25/2013 11:34 AM, Rui Barradas wrote: Hello, I'm not an expert in ggplot2 graphics but I can (partly) answer to your first question. Inline. Em 25-07-2013 18:30, Gavin Rudge escreveu: Further to my recent post on this topic and thanks to help received already (thanks BTW), I've got

Re: [R] Adding List Elements To A Data Frame

2013-07-19 Thread Brian Diggs
On 7/19/2013 12:54 PM, Pete Brecknock wrote: Hi I am trying to add the contents of the list myList to a new column z in the data frame myDataframe myList - list(c(A1,B1), c(A2,B2,C2), c(A3,B3)) myDataframe - data.frame(x=c(1,2,3), y=c(R,S,T)) Would like to produce x y z 1 R A1,B1

Re: [R] Changing legend to fill colour in ggplot

2013-06-28 Thread Brian Diggs
On 6/27/2013 12:34 AM, Suparna Mitra wrote: Hello R experts, I am having a problem to edit legend in ggplot using four variables. My data structure is : str(df) 'data.frame': 10 obs. of 6 variables: $ id: Factor w/ 2 levels 639A,640: 1 1 1 1 1 2 2 2 2 2 $

Re: [R] resizing data

2013-01-25 Thread Brian Diggs
On 1/25/2013 2:29 PM, emorway wrote: I played around with your example on the smaller dataset, and it seemed like it was doing what I wanted. However, applying it to the larger problem, I didn't get a resized 2D dataset that preserved the order I was hoping for. Hopefully the following

Re: [R] Recommendation for website to format R code

2013-01-24 Thread Brian Diggs
On 1/23/2013 6:40 PM, C W wrote: Hey Mark, I am aware of this package. The situation is, 1. I am emailing my code from my machine to a public machine. Installation is a hassle. 2. Copy pasting for a website. For your second use case, there is the Pretty R syntax highlighter at

Re: [R] Is function(x){x}(5) a valid expression?

2012-11-13 Thread Brian Diggs
On 11/13/2012 11:19 AM, Duncan Murdoch wrote: On 13/11/2012 1:33 PM, Jamie Olson wrote: I was surprised to notice that statements like: h = function(...){list(...)}(x=4) do not throw syntax errors. R claims that 'h' is now a function, but I can't seem to call it. h =

Re: [R] change colour of geom_step by scale_colour_manual

2012-11-12 Thread Brian Diggs
On 11/6/2012 11:11 PM, ChangLH wrote: Hi, Color of my step plot is now by default. Now I'd like to change the color as the grey scale I specified. I don't know why I got three black plot. Here I attach two version of codes. The first one produces a step plot with color by default. The second

Re: [R] Question about cut()

2012-11-06 Thread Brian Diggs
On 11/2/2012 11:11 AM, Ni, Shenghua wrote: r-c(1,1,9,1,1,1) col_no-cut(r,c(0,2,3,6,8,10,100)) levels(col_no)-c(2%,2-4%,4-6%,6-8%,8-10%,10%) col_no [1] 2% 2% 8-10% 2% 2% 2% Levels: 2% 2-4% 4-6% 6-8% 8-10% 10% Yes. (Or, I get the same output from this code. What is the question?)

Re: [R] Reduce(paste, x) question

2012-11-06 Thread Brian Diggs
On 11/1/2012 1:06 PM, mdvaan wrote: I should have been more specific: y - list() a - c(A, K) b - c(B, L) c - c(C, M) d - c(D, N) e - c(E, O) y[[1]] - a y[[2]] - b y[[3]] - c y[[4]] - d y[[5]] - e y [[1]] [1] A K [[2]] [1] B L [[3]] [1] C M [[4]] [1] D N [[5]] [1] E O How do I get a list

Re: [R] Violin plot of categorical/binned data

2012-11-06 Thread Brian Diggs
On 11/3/2012 5:47 PM, Jim Lemon wrote: On 11/04/2012 06:27 AM, Nathan Miller wrote: Hi, I'm trying to create a plot showing the density distribution of some shipping data. I like the look of violin plots, but my data is not continuous but rather binned and I want to make sure its binned nature

Re: [R] Export summary from regression output

2012-10-23 Thread Brian Diggs
On 10/23/2012 5:59 AM, PIKAL Petr wrote: Hi section Arguments of write.table help page clearly says x the object to be written, preferably a matrix or data frame. If not, it is attempted to coerce x to a data frame. summary object from lm is highly structured list an AFAIK can not be easily

Re: [R] ggplot specify line type

2012-10-19 Thread Brian Diggs
On 10/19/2012 11:42 AM, autumnlin wrote: http://r.789695.n4.nabble.com/file/n4646789/1.bmp hi is it possible to draw a graph like the attached one using ggplot? Yes how should i code it in r? Use a geom_point() where the shape aesthetic is mapped to the grouping variable and also add a

Re: [R] Proposal: Package update log

2012-10-02 Thread Brian Diggs
On 10/2/2012 10:01 AM, Starkweather, Jonathan wrote: I'm relatively new to R and would first like to sincerely thank all those who contribute to its development. Thank you. I would humbly like to propose a rule which creates a standard (i.e., strongly encouraged, mandatory, etc.) for authors to

Re: [R] adjust font in ggplot2 to LaTeX document

2012-10-01 Thread Brian Diggs
On 9/30/2012 11:38 AM, Jonas Stein wrote: Hi, how can i adjust the font in a ggplot2 qplot so that it will look similar to the LaTeX font? Computer Modern Sans Serif in the same size would be nice. My output device is ggsave(filename=test.pdf, width=5.5, height=3, dpi=300) and i will include

Re: [R] label_wrap_gen question

2012-08-08 Thread Brian Diggs
Light and\nheavy good\nvehicles\n(diesel) - GVX On 8/7/2012 8:17 AM, Brian Diggs wrote: On 8/6/2012 9:07 PM, vd3000 wrote: Hi, all I am trying to use the label_wrap_gen function in this website. https://github.com/hadley/ggplot2/wiki/labeller I tried to make a long name like this Light

Re: [R] label_wrap_gen question

2012-08-07 Thread Brian Diggs
On 8/6/2012 9:07 PM, vd3000 wrote: Hi, all I am trying to use the label_wrap_gen function in this website. https://github.com/hadley/ggplot2/wiki/labeller I tried to make a long name like this Light and heavy good vehicles (diesel) -\nGVX f2 = facet_grid(vehicle ~ .,

Re: [R] Error using ddply inside user-defined function

2012-08-07 Thread Brian Diggs
A few comments in-line below On 8/7/2012 1:53 PM, Jennifer Sabatier wrote: PROV.PM.FBCTS - c(0.00 ,0.00, 33205.19, 25994.56, 23351.37, 26959.56 ,27632.58, 26076.24, 0.00, 0.00 , 6741.42, 18665.09 ,18129.59 ,21468.39 ,21294.60 ,22764.82, 26076.73) FBCTS.INV.TOT - c(0 , 0, 958612,

Re: [R] Arrange two columns into a five variable dataframe

2012-07-13 Thread Brian Diggs
On 7/13/2012 8:37 PM, darnold wrote: Hi, I hope that folks can give me some simple approaches to taking the data set below, which is accumulated in two columns called long and group, then arrange the data is the long column into a data frame containing five variables: Group 1, Group 2, Group 3,

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-10 Thread Brian Diggs
On 7/10/2012 7:53 AM, Peter Ehlers wrote: On 2012-07-10 06:57, Rui Barradas wrote: Hello, If you write a function, it becomes less convoluted... empty - function(x){ if(NROW(x) == 0){ y - rep(NA, NCOL(x)) names(y) - names(x) y }else x } (.xb - iris[

Re: [R] Why do I have a column called row.names?

2012-06-04 Thread Brian Diggs
On 6/4/2012 12:12 PM, Marc Schwartz wrote: To jump into the fray, he really needs to read the Details section of ?read.table and arguably, the source code for read.table(). It is not that the resultant data frame has row names, but that an additional first *column name* called 'row.names' is

Re: [R] ggplot2 - geom_bar

2012-04-23 Thread Brian Diggs
On 4/23/2012 9:24 AM, Matthias Rieber wrote: Hello, I've some problem with the ggplot2. Here's a small example: --8-- library(ggplot2) molten- data.frame(date=c('01','01','01','01', '02','02','02','02'), channel=c('red','red','blue','blue',

Re: [R] ggplot2: scale_shape_manual

2012-04-20 Thread Brian Diggs
On 4/19/2012 5:20 AM, Brian Smith wrote: Thanks Brian. That worked. I also wanted to increase the size of the 'points' on the graph. Is there any way I can get rid of the 'legend' (in this case '3') appearing on the plot? === code library(ggplot2) leaves- letters[1:8]

Re: [R] ggplot2: Legend title

2012-04-20 Thread Brian Diggs
On 4/20/2012 12:11 PM, Bush, Daniel P. DPI wrote: I'm designing a set of plots intended for a general audience; here's the code for one of them, using the latest version of ggplot: plot.enr.all- ggplot(data=df1, aes(x=HS_GRAD_YEAR, y=Percentage, group=Enrolled_by,

Re: [R] ggplot2: scale_shape_manual

2012-04-16 Thread Brian Diggs
On 4/16/2012 7:31 AM, Brian Smith wrote: Hi, I was trying to replicate one of the graphs given on the ggplot2 website. I have given a sample code below. I would like to combine the legends, since each color is uniquely mapped to a shape. ### library(ggplot2) leaves- letters[1:8]

Re: [R] Simple Merge

2012-04-16 Thread Brian Diggs
On 4/16/2012 1:23 PM, Jeff wrote: I'm new to R. I have two data frames I need to merge. One has an ID column the other does not, but both have the same number of rows that are ordered in the same way - e.g., row 1 is the same person in both data frames. For this reason, there is no need to

Re: [R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-19 Thread Brian Diggs
corresponding non-NA element in the ##' given vectors in the order they are specified ##' @author Brian Diggs coalesce - function(...) { dots - list(...) ret - Reduce(function (x,y) ifelse(!is.na(x),x,y), dots) class(ret) - class(dots[[1]]) ret } And using your example data

Re: [R] ggplot2: goem_smooth and suppress messages

2012-03-16 Thread Brian Diggs
On 3/15/2012 4:11 PM, tibaker wrote: Hi When I run my script using ggplot and geom_smooth I get messages that I would like to suppress: p- ggplot(dataSubset) p- p + aes(x = as.Date(factor(key),format=%Y%m%d)) + geom_line() p- p + geom_smooth(span=0.2,se=FALSE,size=0.7) The messages look like

Re: [R] ggplot axis limit

2012-03-16 Thread Brian Diggs
On 3/16/2012 10:29 AM, mdvaan wrote: Hi, This is probably an easy one, but I am new to ggplot2 and cannot find an answer online. Just so you know, there is a mailing list devoted to ggplot2. You can subscribe and view messages at https://groups.google.com/forum/?fromgroups#!forum/ggplot2

Re: [R] mapply assign to generate functions

2012-03-12 Thread Brian Diggs
On 3/12/2012 10:47 AM, J Toll wrote: Hi, I have a problem that I'm finding a bit tricky. I'm trying to use mapply and assign to generate curried functions. For example, if I have the function divide divide- function(x, y) { x / y } And I want the end result to be functionally equivalent

Re: [R] Using R to read Nortek Aquadopp Profiler

2012-02-23 Thread Brian Diggs
On 2/22/2012 4:53 PM, Vinny Moriarty wrote: Hello, I have current data from a nortek ADP, which is basically current speed and direction data in a 3 dimensional X Y Z format http://www.nortekusa.com/usa/products/current-profilers/aquadopp-profiler-1 The instrument logs data in a complex

Re: [R] perform t.test by rows and columns in data frame

2012-02-23 Thread Brian Diggs
See comments inline On 2/23/2012 3:27 PM, Kara Przeczek wrote: Sorry. I forgot to note that I am using R version 2.8.0. That's a rather old version; 2.8.0 came out in October 2008; maybe you don't have control over that, though. From:

Re: [R] List to Array: How to establish the dimension of the array

2012-01-26 Thread Brian Diggs
Please include the context of the discussion in your responses. See inline below. On 1/24/2012 11:33 PM, Ajay Askoolum wrote: Thanks you, I can get the length of aa with length(unlist(aa)). If aa has 4 dimensions, I imagine I'd need to do max(sapply(aa,sapply,sapply,length) Correct. How

Re: [R] aplpy recursive function on a list

2012-01-26 Thread Brian Diggs
On 1/25/2012 10:09 AM, patzoul wrote: I have 2 series of data a,b and I would like to calculate a new series which is z[t] = z[t-1]*a[t] + b[t] , z[1] = b[1]. How can I do that without using a loop? A combination of Reduce and Map will work. Map to stitch together the a and b vectors, Reduce

Re: [R] aplpy recursive function on a list

2012-01-26 Thread Brian Diggs
On 1/26/2012 10:33 AM, Berend Hasselman wrote: On 26-01-2012, at 19:10, Berend Hasselman wrote: On 26-01-2012, at 17:58, Brian Diggs wrote: On 1/25/2012 10:09 AM, patzoul wrote: I have 2 series of data a,b and I would like to calculate a new series which is z[t] = z[t-1]*a[t] + b[t] , z[1

Re: [R] List to Array: How to establish the dimension of the array

2012-01-24 Thread Brian Diggs
On 1/24/2012 2:47 PM, Ajay Askoolum wrote: Given a variable aa in the workspace, some of its attributes are: typeof(aa) [1] list mode(aa) [1] list length(aa) [1] 2 How do I retrieve the maximum indices, in this case 2,3,4? The variable itself is: aa [[1]] [[1]][[1]] [[1]][[1]][[1]]

Re: [R] Date seq question

2012-01-20 Thread Brian Diggs
On 1/20/2012 9:12 AM, cameron wrote: Can anyone please help me with this? I have a list of business dates. What I want is to have last day of last month and paste them on next month. What i haveWhat i want 5725 2011-09-22 5726 2011-09-23 5727 2011-09-26 5728 2011-09-27

Re: [R] The Future of R | API to Public Databases

2012-01-13 Thread Brian Diggs
On 1/13/2012 2:26 PM, MacQueen, Don wrote: It's a nice idea, but I wouldn't be optimistic about it happening: Each of these public databases no doubt has its own more or less unique API, and the people likely to know the API well enough to write R code to access any particular database will be

Re: [R] Fwd: xtable and sweave: caption placement problem

2011-11-22 Thread Brian Diggs
On 11/18/2011 1:22 AM, ren...@vannieuwkoop.ch wrote: \documentclass[11pt,a4paper]{article} \usepackage{Sweave} \begin{document} = x = runif(100, 1, 10) y = 2 + 3 * x + rnorm(100) @ echo=FALSE,results=tex= library(xtable) print(xtable(summary(lm(y~x)), align=r, caption=Summary

Re: [R] unable to load Hmisc in R 2.14.0

2011-11-10 Thread Brian Diggs
On 11/10/2011 11:32 AM, Jacob Wegelin wrote: On my MacBook Pro (OS 10.6.8), after updating to R version 2.14.0 (2011-10-31) and reinstalling the Hmisc package, I am unable to load the Hmisc library. Hmisc was working *before* I updated R. Any idea what's wrong? Likely the same problem as

Re: [R] Problem with R CMD check and the inconsolata font business.

2011-11-03 Thread Brian Diggs
On 11/3/2011 12:37 AM, Rolf Turner wrote: I have just installed R version 2.14.0 and tried to re-build and re-check some of the packages that I maintain. I'm getting a warning (in the process of running R CMD check on my deldir package): * checking PDF version of manual ... WARNING LaTeX

Re: [R] Problem with R CMD check and the inconsolata font business.

2011-11-03 Thread Brian Diggs
to the list. The gist of the off-line replies was ``you need to install some fonts'', and (unusually, and very kindly! :-) ) the responders told me *how* to do so. SNIP (descriptions of how to install on various Linux distributions) The third message (which *was* posted to the list) was from Brian

Re: [R] Problem with R CMD check and the inconsolata font business.

2011-11-03 Thread Brian Diggs
On 11/3/2011 3:30 PM, Brian Diggs wrote: SNIP The error on R CMD check I get is: * checking PDF version of manual ... WARNING LaTeX errors when creating PDF version. This typically indicates Rd problems. LaTeX errors found: !pdfTeX error: pdflatex.EXE (file ec-inconsolata): Font ec-inconsolata

Re: [R] inconsistent behavior of summary function

2011-10-04 Thread Brian Diggs
I'm going to put on my fire suit and wade in (see inline) On 10/4/2011 8:11 AM, Bert Gunter wrote: On Tue, Oct 4, 2011 at 7:42 AM, Jeanne M. Spicerxn8spi...@gmail.comwrote: I'm not sure how returning an incorrect result is ever a 'positive' feature It is **not** incorrect; perhaps

Re: [R] Returning vector of values shared across 3 vectors?

2011-10-03 Thread Brian Diggs
On 10/1/2011 3:03 AM, jim holtman wrote: try this: vec1- c(4,5,6,7,8,9,10,11,12,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81) vec2- c

Re: [R] need help on forest plot with ggplot

2011-09-30 Thread Brian Diggs
On 9/29/2011 8:11 PM, wirichada wrote: Dear R users, I am trying to do the forest plot follow the function given on web. However, the order of the tests has been sorted alphabetically. I would prefer keeping the order as data frame input so that I can group and compare (from the graph) the

Re: [R] trouble in installing package matching.

2011-09-30 Thread Brian Diggs
On 9/29/2011 8:14 PM, Jp zhu wrote: I am a new R user. I trying to install a package all Matching but failed. Here is the error msg. install.packages(Matching, dependencies=TRUE) Installing package(s) into ‘C:/Users/jzhu/Documents/R/win-library/2.13’ (as ‘lib’ is unspecified) --- Please select

Re: [R] isotope superscripts ggplot2

2011-09-30 Thread Brian Diggs
On 9/30/2011 8:31 AM, Durant, James T. (ATSDR/DTEM/PRMSB) wrote: Happy Friday fellow R users. I need some help - I am trying to make a graph using ggplot 2 of some lead isotope ratios. Normally, the isotope mass number appears as a superscript before the chemical symbol. However, I cannot

Re: [R] xtable with conditional formatting using \textcolor

2011-09-06 Thread Brian Diggs
On 9/6/2011 4:01 AM, eldor ado wrote: I have a related question: dataframe df contains values like df .. \\textbf{ 0.644 } .. and the line print( xtable(df , sanitize.text.function = function(x){x})) sanitize.text.function is an argument of print.xtable, not xtable. Try print(

Re: [R] Using require() vs. library()

2011-08-18 Thread Brian Diggs
On 8/17/2011 11:13 AM, Uwe Ligges wrote: Actually require() is a wrapper around library() with more error handling to be used inside other functions. Just type require(), you can read the few lines of code quickly. I think the unstated corollary is that library() is preferred when not inside

Re: [R] dotchart vs. dotplot ... groups

2011-08-18 Thread Brian Diggs
On 8/17/2011 11:29 AM, mkzo...@comcast.net wrote: I'm trying to create a dotplot with some grouping. I've been able to create what I want using dotchart (basic graphics), but can't quite get it using dotplot (lattice). I prefer to use lattice (or ggplot2) because I think it's a bit easier to

Re: [R] odd behavior of data.matrix()

2011-08-18 Thread Brian Diggs
On 8/18/2011 1:40 PM, Alexander Schwall wrote: Hi R community, I have been trying to figure out why R is reversing the order of rows after I run data.matrix() Here is my data: df-structure(list(itmID = c(1L, 2L, 1L, 2L, 1L, 2L), variable = structure(c(1L, 1L, 2L, 2L, 3L, 3L), .Label = c(3,

Re: [R] monthly boxplot

2011-08-09 Thread Brian Diggs
On 8/9/2011 10:32 AM, Fernando Andreacci wrote: Hi, I got what I want using lines(varmeasure ~ vardates) but, as I'm using as.Date(vardates) in my boxplot code boxplot(varmeasure ~ as.Date(vardate)) I want to change how vardate is displayed I used strftime(as.Date(vardate), format=%m/%Y)

Re: [R] a question on list manipulation

2011-08-08 Thread Brian Diggs
On 8/6/2011 9:21 AM, zhenjiang xu wrote: Unfortunately the list names of my real data are irregular with mixed digit and letters at the end. This is good idea though. It inspired me to give another solution based on that: x- list(A=c(d, e, f), B=c(d, e), C=c(d,g)) tmp- unlist(x, use.names=F) a

Re: [R] 3D Bar Graphs in ggplot2?

2011-08-03 Thread Brian Diggs
On 8/3/2011 6:07 AM, wwreith wrote: So I take it 3D pie charts are out? At least with ggplot, yes. 2D pie charts are somewhat tricky with ggplot, even. They can be gone with stacked, normalized bar charts projected into polar coordinates, if I recall properly. Not limited to ggplot,

Re: [R] 3D Bar Graphs in ggplot2?

2011-08-02 Thread Brian Diggs
On 8/2/2011 11:39 AM, wwreith wrote: Does anyone know how to create a 3D Bargraph using ggplot2/qplot. I don't mean 3D as in x,y,z coordinates. Just a 2D bar graph with a 3D shaped bard. See attached excel file for an example. It is not possible. Before anyone asks I know that 3D looking

Re: [R] example package for devel newcomers

2011-08-01 Thread Brian Diggs
On 7/31/2011 6:24 PM, Alexandre Aguiar wrote: Em Domingo 31 Julho 2011, você escreveu: My memory is that this question gets asked every few months and one of the stock answers is to use the function 'package.skeleton' in the utils package as a starting point. Got that from docs. And actually

Re: [R] grey colored lines and overwriting labels i qqplot2

2011-07-28 Thread Brian Diggs
On 7/25/2011 8:27 PM, Sigrid wrote: Thank you Brian. Sorry for being such a noob. I am not a programmer and just learning R by myself. This is was I typed, but ended up with a couple error messages. df-structure(list(year = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, + 1L, 1L, 1L, 1L, 1L, 1L,

Re: [R] grey colored lines and overwriting labels i qqplot2

2011-07-19 Thread Brian Diggs
On 7/18/2011 9:23 PM, Sigrid wrote: Hi I apologize for not providing reproducible codes more clearly, and I hope this will be more understandable. I have 14 lines (7 per facet that I would like to add). I will provide you with six of the lines from the data as that should enough data to work

Re: [R] elimination duplicate elements sampling!

2011-07-12 Thread Brian Diggs
On 7/7/2011 3:23 PM, elephann wrote: Hi everyone! I have a data frame with 1112 time series and I am going to randomly sampling r samples for z times to compose different portfolio size(r securities portfolio). As for r=2 and z=1,that's: z=1 A=seq(1:1112) x1=sample(A,z,replace =TRUE)

Re: [R] grey colored lines and overwriting labels i qqplot2

2011-07-12 Thread Brian Diggs
Merging two posts (data and questions); see inline below. On 7/11/2011 7:55 PM, Sigrid wrote: Thank you, Dennis. This is my regenerated dput codes. They should be correct as I closed off R and re-ran them based on the dput output. NB, this is the test dataset used later

Re: [R] Fw: volcano plot.r

2011-07-05 Thread Brian Diggs
See inline below, On 7/4/2011 8:00 PM, Ungku Akashah wrote: Hello. My name is Akashah. i work at metabolic laboratory. From my study, i found that volcano plot can help a lot in my section. i already studied about the volcano plot and get the coding to run in R software, unfortunately, there

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-24 Thread Brian Diggs
On 6/22/2011 2:28 PM, Alexander Shenkin wrote: On 6/22/2011 4:09 PM, Brian Diggs wrote: On 6/22/2011 1:37 PM, Alexander Shenkin wrote: On 6/22/2011 3:34 PM, Brian Diggs wrote: On 6/22/2011 12:09 PM, Luke Miller wrote: For what it's worth, I cannot reproduce this problem under a nearly

Re: [R] ddply to count frequency of combinations

2011-06-23 Thread Brian Diggs
On 6/22/2011 11:02 PM, Idris Raja wrote: Brian, I'm a bit confused about how the following line works, specifically, what is happening in freq=length(x)? Is it just taking the length of x after it has been summarized by different combinations x y? I guess that must be the case, because that

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-22 Thread Brian Diggs
On 6/22/2011 12:09 PM, Luke Miller wrote: For what it's worth, I cannot reproduce this problem under a nearly identical instance of R (R 2.12.1, Win 7 Pro 64-bit). I also can't reproduce the problem with R 2.13.0. You've got something truly weird going on with your particular instance of R.

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-22 Thread Brian Diggs
On 6/22/2011 1:23 PM, William Dunlap wrote: The isdst value -1 doesn't seem right. Shouldn't it be either 0 (not daylight savings time) or 1 (yes dst)? I've only seen isdst==-1 when all the other entries were NA (that happens when the string doesn't match the format). A isdst of -1 indicates

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-22 Thread Brian Diggs
On 6/22/2011 1:37 PM, Alexander Shenkin wrote: On 6/22/2011 3:34 PM, Brian Diggs wrote: On 6/22/2011 12:09 PM, Luke Miller wrote: For what it's worth, I cannot reproduce this problem under a nearly identical instance of R (R 2.12.1, Win 7 Pro 64-bit). I also can't reproduce the problem with R

Re: [R] ddply to count frequency of combinations

2011-06-21 Thread Brian Diggs
On 6/21/2011 11:30 AM, Idris Raja wrote: I have a dataframe df with two columns x and y. I want to count the number of times a unique x, y combination occurs. For example x- c(1,2,3,4,5,1,2,3,4) y- c(1,2,3,4,5,1,2,4,1) df-as.data.frame(cbind(x, y)) #what is the correct way to use ddply for

Re: [R] profile plot in R

2011-06-20 Thread Brian Diggs
On 6/20/2011 11:25 AM, Vickie S wrote: Hi Dennis, It looks like something is wrong about configuration of ggplot dependency with plyr.Since i saw some threads about this particular error message. I tried several times by installing different versions of plyr but it did not work.

Re: [R] for loop and linear models

2011-06-20 Thread Brian Diggs
On 6/20/2011 12:23 PM, ivan wrote: Hi, I have two datasets, x and y. Simplified x and y denote: X Y A B C A B C . . . . . . . . . . . . . . . . . . I want to implement all possible models such as lm(X$A~Y$A), lm(X$B~Y$B), lm(X$C~Y$C)... I have tried the following: fun- function(x,y){

Re: [R] is this a bug?

2011-06-17 Thread Brian Diggs
On 6/17/2011 2:24 PM, (Ted Harding) wrote: And the extra twist in the tale is exemplified by this mini-version of Albert-Jan's first example: DF- data.frame(A=c(1,2,3)) DF$B- c(4,5,6) DF$C- c(7,8,9) DF # A B C # 1 1 4 7 # 2 2 5 8 # 3 3 6 9 DF$D- DF[A]/DF[B] DF

Re: [R] Trying to make code more efficient

2011-06-13 Thread Brian Diggs
On 6/9/2011 12:27 PM, Abraham Mathew wrote: I have a repetative task in R and i'm trying to find a more efficient way to perform the following task. lst- list(roots = c(car insurance, auto insurance), roots2 = c(insurance), prefix = c(cheap, budget), prefix2 = c(low

Re: [R] ggplot2 Histogram with density curve

2011-06-09 Thread Brian Diggs
On 6/7/2011 8:08 AM, wwreith wrote: I am learning ggplot2 commands and I have figured out how to create histograms and density curves but I am not sure how to add a density curve on top of a histogram. Here are the two graphs that I created. ## Histogram t-rnorm(500) w-qplot(t, main=Normal

Re: [R] How to convert an ftable object to a matrix including the row names?

2011-05-27 Thread Brian Diggs
On 5/26/2011 11:54 PM, Marius Hofert wrote: Dear Prof. Ripley, many thanks for your quick reply. A character matrix (although clearly not very elegant) would be no problem, xtable deals with that. I tried as.data.frame() before, but if one wants to have the same rows as in ft, one has to use

Re: [R] Question about ggplot2

2011-05-26 Thread Brian Diggs
On 5/26/2011 12:29 PM, Julian TszKin Chan wrote: Hi all, Is there any way for me to to string in the argument of qplot or ggplot? for example qplot(x='carat',y='price',data=diamonds,geom=c('point','smooth')) instead of qplot(x=carat,y=price,data=diamonds,geom=c('point','smooth')) I don't

Re: [R] Question about ggplot2

2011-05-26 Thread Brian Diggs
-help-boun...@r-project.org] On Behalf Of Brian Diggs Sent: Thursday, May 26, 2011 2:07 PM To: Julian TszKin Chan Cc: r-help@r-project.org Subject: Re: [R] Question about ggplot2 On 5/26/2011 12:29 PM, Julian TszKin Chan wrote: Hi all, Is there any way for me to to string in the argument of qplot

Re: [R] Problem with ddply in the plyr-package: surprising output of a date-column

2011-04-25 Thread Brian Diggs
On 4/25/2011 10:19 AM, Christoph Jäckel wrote: Hi Together, I have a problem with the plyr package - more precisely with the ddply function - and would be very grateful for any help. I hope the example here is precise enough for someone to identify the problem. Basically, in this step I want to

Re: [R] Problem with ddply in the plyr-package: surprising output of a date-column

2011-04-25 Thread Brian Diggs
On 4/25/2011 11:55 AM, William Dunlap wrote: Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Brian Diggs Sent: Monday, April 25, 2011 11:05 AM To: christoph.jaec

Re: [R] Problem with ddply in the plyr-package: surprising output of a date-column

2011-04-25 Thread Brian Diggs
On 4/25/2011 1:07 PM, Hadley Wickham wrote: If you need plyr for other tasks you ought to use a different class for your date data (or wait until plyr can deal with POSIXlt objects). How do you get POSIXlt objects into a data frame? df- data.frame(x = as.POSIXlt(as.Date(c(2008-01-01

Re: [R] Parametrized object name in Save statement

2011-04-22 Thread Brian Diggs
On 4/22/2011 12:42 PM, John Dennison wrote: Greetings All, I am looking to write a parametrized Rscript that will accept a variable name(that also is the name of the flat file), transform the data into a data frame and preform various modeling on the structure and save the output and plot of

Re: [R] Creating a dataframe from a vector of character strings

2011-04-14 Thread Brian Diggs
On 4/14/2011 2:04 PM, Cliff Clive wrote: I have a vector of character strings that I would like to split in two, and place in columns of a dataframe. So for example, I start with this: beatles- c(John Lennon, Paul McCartney, George Harrison, Ringo Starr) and I want to end up with a data frame

Re: [R] Problem with facet_grid in ggplot2

2011-04-11 Thread Brian Diggs
On 4/11/2011 9:33 AM, Simon Hayward wrote: Hi all, I am practising a bit with ggplot2 but I have a problem when I try to use facet_grid. The following code:- p- ggplot(diamonds, aes(carat, ..density..)) + + geom_histogram(binwidth = 1) p + facet_grid(cut ~ clarity, margins=TRUE) produce the

Re: [R] glm predict on new data

2011-04-06 Thread Brian Diggs
On 4/6/2011 2:17 PM, dirknbr wrote: I am aware this has been asked before but I could not find a resolution. I am doing a logit lg- glm(y[1:200] ~ x[1:200,1],family=binomial) glm (and most modeling functions) are designed to work with data frames, not raw vectors. Then I want to predict

Re: [R] plotting several ROC curves on the same graph

2011-03-29 Thread Brian Diggs
On 3/29/2011 2:48 AM, meytar wrote: Hello I am trying to make a graph of 10 different lines built each from 4 different segments and to add a darker line that will represent the average of all graphs - all in the same plot.Actually each line is a ROC plot The code I'm using for plotting one line

Re: [R] two plots in qplot

2011-03-28 Thread Brian Diggs
On 3/25/2011 3:13 AM, Denis Kazakiewicz wrote: Hello I simply want to plot two variables against one 'year' variable in qplot. Is any way of doing this without reshaping data in long format and using facet function afterwards? Yes, its is possible. But it is harder and more convoluted than

Re: [R] Convert Sweave document to a function

2011-03-21 Thread Brian Diggs
On 3/20/2011 12:19 PM, David.Epstein wrote: I like Sweave, which I consider to be a great contribution. I have just written a .Rnw document that comes to about 6 pages of mixed code and mathematical explanation. Now I want to turn the R code into a function. My R code currently contains

Re: [R] calculating AUCs for each of the 1000 boot strap samples

2011-03-17 Thread Brian Diggs
Taby, First, it is better to reply to the whole list (which I have included on this reply); there is a better chance of someone helping you. Just because I could help with one aspect does not mean I necessarily can (or have the time to) help with more. Further comments are inline below.

Re: [R] calculating AUCs for each of the 1000 boot strap samples

2011-03-16 Thread Brian Diggs
On 3/16/2011 8:04 AM, taby gathoni wrote: data-data.frame(id=1:(165+42),main_samp$SCORE, x=rep(c(BAD,GOOD),c(42,165))) f-function(x) { + str.sample-list() + for (i in 1:length(levels(x$x))) + { + str.sample[[i]]-x[x$x==levels(x$x)[i] ,][sample(tapply(x$x,x$x,length)[i],20,rep=T),] + } +

Re: [R] Plotting symbols and colors based upon data values

2011-03-14 Thread Brian Diggs
On 3/13/2011 6:46 PM, David Winsemius wrote: On Mar 13, 2011, at 8:51 PM, Mark Linderman wrote: David, thank you for your quick reply. I spent a few minutes getting your command to work with some sparse synthetic data, and then spent several hours trying to figure out why my data didn't work

  1   2   >