Re: [R] sampling design runs with no errors but returns empty data set

2011-03-30 Thread Thomas Lumley
On Thu, Mar 31, 2011 at 4:01 AM, Simon Kiss wrote: > Dear colleagues, > I'm working with the 2008 Canada Election Studies > (http://www.queensu.ca/cora/_files/_CES/CES2008.sav.zip), trying to construct > a weighted national sample using the survey package. > Three weights are included in the nat

Re: [R] How can we modify attributes of files in Windows Systems using R?

2011-03-30 Thread Henrique Dallazuanna
You've tried: shell("ATTRIB +H C:\\your_file_name") ? On Wed, Mar 30, 2011 at 12:59 PM, Chuanlong Du wrote: > Hello! > > Does any one know how to modify attributes of files (hide, read only and > etc) in Windows Systems using R? I tried to use shell to call system > command, but it seems that

Re: [R] How to define new operator in R?

2011-03-30 Thread Henrique Dallazuanna
Try this: `%a%` <- function(x, y)paste(x, y, sep = ',') 2 %a% 3 On Wed, Mar 30, 2011 at 1:04 PM, Chuanlong Du wrote: > Hello, everyone! > > Does anyone know how make some symbols have special means in R? For example, > we know that "+" in R means the sum of the two operand on its left and > ri

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread Dimitri Liakhovitski
Henrique, this is great, thank you! It's almost what I was looking for! Only one small thing - it doesn't "merge" the results for weeks that "straddle" 2 years. In my example - last week of year 2008 and the very first week of 2009 are one week. Any way to "join them"? Asking because in reality I'

Re: [R] fonts in mosaic

2011-03-30 Thread Prof Brian Ripley
On Wed, 30 Mar 2011, Achim Zeileis wrote: On Wed, 30 Mar 2011, Erich Neuwirth wrote: Achim I simply want to replace the font R uses on mosaic (whatever it is) by a font of my choice (say Calibri or Arial) because I need to embed the R charts in a PowerPoint presentation and want the fonts to m

[R] [R-pkgs] Package FuncMap Now Available on CRAN

2011-03-30 Thread Bryan Hanson
I'm pleased to announce that the FuncMap (v 1.0) package is available on CRAN. This is a single function package that makes hive plots of function calls for a specified package. Hive plots are a powerful concept developed by Martin Krzywinski at the Genome Sciences Center (mkweb.bcgsc.ca/

[R] [R-pkgs] Package ChemoSpec 1.46 Now Available on CRAN

2011-03-30 Thread Bryan Hanson
I'm pleased to announce that the ChemoSpec package is available on CRAN for the first time (as version 1.46-4). ChemoSpec is a collection of functions for plotting spectra (NMR, IR etc) and carrying out various forms of top-down exploratory data analysis, such as HCA, PCA and model-based clu

[R] Package XML: Parse Garmin *.tcx file problems

2011-03-30 Thread Folkes, Michael
I'm struggling with package XML to parse a Garmin file (named *.tcx). I wonder if it's form is incomplete, but appreciably reluctant to paste even a shortened version. The output below shows I can get nodes, but an attempt at value of a single node comes up empty (even though there is data there.

Re: [R] Using graphics straight from R into published articles

2011-03-30 Thread baptiste auguie
Hi, For most purposes, I find that R graphics get 95% of the work done towards final publication. A couple of personal comments, - lattice, ggplot2, RColorBrewer, evidently. ggplot2, in particular, makes really good aesthetic decisions by default. - whilst R devices are really good, I find there

Re: [R] How to define new operator in R?

2011-03-30 Thread baptiste auguie
Hi, Also, try this and rm() it immediately, `+` <- function(x, y) x - y 1+1 rm(`+`) 1+1 baptiste On 31 March 2011 05:04, Chuanlong Du wrote: > Hello, everyone! > > Does anyone know how make some symbols have special means in R? For example, > we know that "+" in R means the sum of the two ope

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread jim holtman
Here is a way of taking a sequence of dates and breaking them into weeks that start on Monday (you can change it) and it will span across years: > # create a couple of years of dates > x <- seq(as.Date('2009-7-8'), as.Date('2012-3-7'), by = '1 day') > # determine when the Monday for the first date

Re: [R] Is there a function to save the content in R console to some file?

2011-03-30 Thread David Winsemius
On Mar 30, 2011, at 11:02 AM, Chuanlong Du wrote: Hello, everyone! Does anyone know whether there's a function in R which can save the content in R console to some file? I'm using Windows system and the usual R console instead of Rstudio. You might want to look at : ?capture.output ?si

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread Henrique Dallazuanna
Try this: library(zoo) wk <- as.numeric(format(myframe$dates, '%W')) is.na(wk) <- wk == 0 aggregate(value ~ group + na.locf(wk), myframe, FUN = sum) On Wed, Mar 30, 2011 at 4:35 PM, Dimitri Liakhovitski wrote: > Henrique, this is great, thank you! > > It's almost what I was looking for! Only o

Re: [R] fonts in mosaic

2011-03-30 Thread Erich Neuwirth
Here is a more complete solution to my problem. The fact that the parameters are called gp_varnames, gp_labels, and gp_text on one hand, but main_gp and and sub_gp on the other hand comes as a surprise when one tries to find a solution. windowsFonts(calibri = windowsFont("Calibri")) mosaic(UCBAdm

Re: [R] How to define new operator in R?

2011-03-30 Thread Spencer Graves
'+' is a generic function, so different methods can be defined for different classes of objects. Consider the following: methods('+') [1] +.Date +.POSIXt # Methods defined for 'Date' and 'POSIXt' objects > args('+.Date') # standard argument names are e1 and e2 function (e1, e2) NULL

Re: [R] Package XML: Parse Garmin *.tcx file problems

2011-03-30 Thread Duncan Temple Lang
Hi Michael Almost certainly, the problem is that the document has a default namespace. You need to identify the namespace in the XPath query. xpathApply() endeavors to make this simple: xpathApply(doc2, "//x:TotalTimeSeconds", xmlValue, namespaces = "x") I suspect that will give you back some

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread Dimitri Liakhovitski
Yes, zoo! That's what I forgot. It's great. Henrique, thanks a lot! One question: if the data are as I originally posted - then week numbered 52 is actually the very first week (it straddles 2008-2009). What if the data much longer (like in the code below - same as before, but more dates) so that

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread Henrique Dallazuanna
You're right: wk <- as.numeric(format(myframe$dates, "%Y.%W")) is.na(wk) <- wk %% 1 == 0 solution<-aggregate(value ~ group + na.locf(wk), myframe, FUN = sum) On Wed, Mar 30, 2011 at 6:10 PM, Dimitri Liakhovitski wrote: > Yes, zoo! That's what I forgot. It's great. > Henrique, thanks a lot! One

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread Dimitri Liakhovitski
Henrique, this is beautiful, thank you so much. This is a great and correct solution. A stupid question: what does the line is.na(wk) <- wk %% 1 == 0 do? Thank you! Dimitri On Wed, Mar 30, 2011 at 5:25 PM, Henrique Dallazuanna wrote: > You're right: > > wk <- as.numeric(format(myframe$dates, "%Y

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread Henrique Dallazuanna
This puts 'NA' in the first week of the year. Take a look on the code below: 2009.52 %% 1 On Wed, Mar 30, 2011 at 6:35 PM, Dimitri Liakhovitski wrote: > Henrique, this is beautiful, thank you so much. > This is a great and correct solution. > > A stupid question: what does the line is.na(wk) <

Re: [R] lattice: wireframe "eats up" points; how to make points on wireframe visible?

2011-03-30 Thread Marius Hofert
Dear Deepayan, thanks for answering. It's never too late to be useful. I see your point in the minimal example. I checked the z-axis limits in my original problem for the point to be inside and it wasn't there. I can't easily reproduce it from the minimal example though. I'll get back to you if I

[R] Creating error bars in scatterplot() function (cars-Package)

2011-03-30 Thread philsen
Dear list, I am new to R and trying to create a grouped (four groups) scatter plot with error bars (only in y-direction) using the scatterplot() function from the car package. The code I am using for plotting the scatter plot is: scatterplot(a$s_profile~a$s_plot | a$group, data=a) which gives

Re: [R] How to put line linking two plots

2011-03-30 Thread Paul Murrell
Hi On 30/03/2011 10:54 p.m., Mario Valle wrote: Hello! Suppose I have three charts like below. The top chart is a general overview and the bottom charts are related so some point of this chart. To make clear this relationship I want to draw a line between (4,0.9) in the top chart and (10,1) in t

Re: [R] Creating error bars in scatterplot() function (cars-Package)

2011-03-30 Thread David Winsemius
On Mar 30, 2011, at 5:10 PM, philsen wrote: Dear list, I am new to R and trying to create a grouped (four groups) scatter plot with error bars (only in y-direction) using the scatterplot() function from the car package. The code I am using for plotting the scatter plot is: scatterplot(a$s

Re: [R] Multiple area plots to share the same x-axis

2011-03-30 Thread jovian
Thank you Ista. On Wed, Mar 30, 2011 at 5:42 PM, Ista Zahn-2 [via R] wrote: > Use facetting: > > sets <- rbind(cbind(set="set1", set), cbind(set="set2", set2)) > ggplot(sets, aes(x = time, y = hours)) + >   geom_area(colour = 'red', fill = 'red', alpha = 0.5) + >   geom_area(stat = 'smooth', sp

Re: [R] How to define new operator in R?

2011-03-30 Thread Frank Schwidom
Hi, you may overwrite existing opreators in the current environment for example: > `+` <- `*` > 2+3 [1] 6 Regards! On Wed, Mar 30, 2011 at 10:04:19AM -0600, Chuanlong Du wrote: > Hello, everyone! > > Does anyone know how make some symbols have special means in R? For example, > we know that

Re: [R] Is there a function to save the content in R console to some file?

2011-03-30 Thread ep
You can use "Save history..." from the R-Console. Greetings ep -- View this message in context: http://r.789695.n4.nabble.com/Is-there-a-function-to-save-the-content-in-R-console-to-some-file-tp3419138p3419499.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread David Winsemius
On Mar 30, 2011, at 2:35 PM, Dimitri Liakhovitski wrote: Henrique, this is great, thank you! It's almost what I was looking for! Only one small thing - it doesn't "merge" the results for weeks that "straddle" 2 years. In my example - last week of year 2008 and the very first week of 2009 are o

[R] calculating the mode in R...

2011-03-30 Thread Carl Witthoft
Here's my modest contribution: smode<-function(x){ xtab<-table(x) modes<-xtab[max(xtab)==xtab] mag<-as.numeric(modes[1]) #in case mult. modes, this is safer themodes<-names(modes) mout<-list(themodes=themodes,modeval=mag) return(mout) } (I

[R] Lists of tables and conditional statements

2011-03-30 Thread Herbert, Alan G
Hi R-users, I have a list containing numeric tables of differing row length. I want to make a new list that contains only rows from tables with a "Sum" greater than 3, plus the names of each table. I was wondering whether there is an elegant way to do this using apply of related functions as th

[R] how about a "

2011-03-30 Thread Carl Witthoft
I was cursing Matlab again today (what else is new) because the default action for every Matlab command is to spew the result to the console, and one must remember to put that darn ";" at the end of every line. So I just wondered: was there ever a discussion as to providing some modified ver

Re: [R] Lists of tables and conditional statements

2011-03-30 Thread David Winsemius
On Mar 30, 2011, at 5:38 PM, Herbert, Alan G wrote: Hi R-users, I have a list containing numeric tables of differing row length. I want to make a new list that contains only rows from tables with a "Sum" greater than 3, plus the names of each table. I was wondering whether there is an el

Re: [R] how about a "

2011-03-30 Thread Ista Zahn
Hi Carl, Well, we already have (newobject <- somefunction()), so wrote: > I was cursing Matlab again today (what else is new) because the default > action for every Matlab command is to spew the result to the console, and > one must remember to put that darn ";"  at the end of every line. > > So

Re: [R] summing values by week - based on daily dates - but with some dates missing

2011-03-30 Thread Gabor Grothendieck
On Wed, Mar 30, 2011 at 5:10 PM, Dimitri Liakhovitski wrote: > Yes, zoo! That's what I forgot. It's great. > Henrique, thanks a lot! One question: > > if the data are as I originally posted - then week numbered 52 is > actually the very first week (it straddles 2008-2009). > What if the data much

Re: [R] how about a "

2011-03-30 Thread John Fox
Dear Carl, I think that the following does what you want: > `%<-%` <- function(e1, e2){ + e1 <- deparse(substitute(e1)) + env <- parent.frame() + assign(e1, e2, envir=env) + e2 + } > x %<-% 10 [1] 10 > x [1] 10 But, as has been pointed out, it's probably easier just to parenthesize the

Re: [R] how about a "

2011-03-30 Thread William Dunlap
The %...% operators are not a panacea. they have the same precedence as `*` and `/` (I think) so you get things like: > x %<-% 10 - 8 # %<-% has higher precedence than - [1] 2 > x # not what you thought it would be [1] 10 > x %<-% 10 ^3 # but lower than ^ [1] 1000 > x # this is wha

Re: [R] Lists of tables and conditional statements

2011-03-30 Thread Henrique Dallazuanna
Try this: lapply(l, function(x)x[x[,'Sum'] == 3,]) On Wed, Mar 30, 2011 at 7:38 PM, Herbert, Alan G wrote: > Hi R-users, > > I have a list containing numeric tables of differing row length. I want to > make a new list that contains only rows from tables with a "Sum" greater than > 3, plus the

[R] Help: creating owin{spatstat} objects from GIS data

2011-03-30 Thread Axel Urbiz
Dear R list, I'm trying to create an object of class "owin" (observation window) in the package spatstat from GIS mapping data. Here's an example of my problem. Everything goes well until the last line of code. I get the error message shown at the bottom: library(spatstat) library(sp) library(mapt

Re: [R] Lists of tables and conditional statements

2011-03-30 Thread David Winsemius
On Mar 30, 2011, at 7:27 PM, Henrique Dallazuanna wrote: Try this: lapply(l, function(x)x[x[,'Sum'] == 3,]) If this is the right answer, you should send a "solved" message. The dput extract was incomplete. -- David. On Wed, Mar 30, 2011 at 7:38 PM, Herbert, Alan G wrote: Hi R-users

Re: [R] svg malformed on CentOS (epel R)

2011-03-30 Thread Jeroen Ooms
The problem has been resolved thanks to Tom Callaway from Redhat: Tom Callaway wrote: > > Looking at the R source code, it uses Cairo to do the SVG creation, and > the Cairo in RHEL-5 is very (very) old (1.2.4). > > Digging through Cairo's changelogs post 1.2.4, I came across this: > > "SVG: F

[R] Problems reading excel file with RODBC connect

2011-03-30 Thread Luis Felipe Parra
Hello, I am trying to read an Excel file using RODBC connect (its attached) using the following code: Data<-odbcConnectExcel2007('acciones_col.xlsx',readOnly=T,) datos<-sqlFetch(Data,'Bloomberg') odbcClose(Data) The file contains stock data downloaded from bloomberg, and it contains five va

Re: [R] Poisson Regression

2011-03-30 Thread Jim Silverton
Is there R code that can do a Poisson Regression and plot the density of the fitted values? -- Thanks, Jim. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

Re: [R] Poisson Regression

2011-03-30 Thread Ben Bolker
Jim Silverton gmail.com> writes: > > Is there R code that can do a Poisson Regression and plot the density of the > fitted values? > ?glm glm(...,family=poisson) ?predict.glm __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listi

[R] Italicized title from index

2011-03-30 Thread Jeremy Newman
Hi all! I've written a handy script that uses a for loop to allow me to generate a large number of figures and statistical outputs for a large dataset. I am using indexing to retrieve a species name for the title of my graphs- which worked fine. However, I need to italicize these species names.

[R] Graph many points without hiding some

2011-03-30 Thread Samuel Dennis
I have a very large dataset with three variables that I need to graph using a scatterplot. However I find that the first variable gets masked by the other two, so the graph looks entirely different depending on the order of variables. Does anyone have any suggestions how to manage this? This code

[R] Assign Names of columns in data.frame dinamically

2011-03-30 Thread Marcos Amaris Gonzalez
Hello List. I have many files of ECG, each one with 7 column and I need only the second column and the name of each ECG. I am doing this but althought I have various days trying this i haven't gotten, so I ask help with this, if somebody cans help me I'll be so thankfully. ---

<    1   2