Re: [R] How to pass variable column name into R function

2014-12-19 Thread Jeff Newmiller
HTML mutilated your email. Please post in plain text. Although you are playing with some tricky stuff, you seem to have difficulty understanding the difference between a symbol and the value the symbol represents. Re-reading section 6.1 of the Introduction to R that comes with the software

Re: [R] R - Aggregate 3-Hourly Block Data into Weekly (Melt)

2014-12-19 Thread Jeff Newmiller
Thank you for attempting to convey your problem clearly using example code... but your use of HTML email has very nearly undone all your efforts. Also, use of dput to make an R-readable block of data is more reliable than read.table to get the data into our R sessions quickly. First

Re: [R] Hash, variable names restriction

2014-12-19 Thread Jeff Newmiller
df is the name of a function in base R. You have not provided a definition of sample data resembling your real data. In this case I suspect that the source of your problems is that df may not be what you think it is. Learning to use the str function may help you. If df is a data frame

Re: [R] Make 2nd col of 2-col df into header row of same df then adjust col1 data display

2014-12-19 Thread Sven E. Templer
Another solution: CaseID - c(1015285, 1005317, 1012281, 1015285, 1015285, 1007183, 1008833, 1015315, 1015322, 1015285) Primary.Viol.Type - c(AS.Age, HS.Hours, HS.Hours, HS.Hours, RK.Records_CL, OT.Overtime, OT.Overtime, OT.Overtime, V.Poster_Other, V.Poster_Other) library(reshape2)

Re: [R] R - Aggregate 3-Hourly Block Data into Weekly (Melt)

2014-12-19 Thread ONKELINX, Thierry
You are looking for the round_date(), floor_date() or ceiling_date() functions from the lubridate package. Those functions can round timestamps to weeks. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team

Re: [R] R - Aggregate 3-Hourly Block Data into Weekly (Melt)

2014-12-19 Thread Shouro Dasgupta
Thank you very much for your reply. I really appreciate it. I apologize for the HTML version, I have made modifications and replied to your questions/comments below. Thanks again tmp1 - structure(list(FIPS = c(1001L, 1003L, 1005L), X2026.01.01.1 = c( 285.5533142, 285.5533142, 286.2481079),

[R] Cox model -missing data.

2014-12-19 Thread aoife doherty
Hi all, I have a data set like this: Test.cox file: V1V2 V3 Survival Event ann 13 WTHomo 41 ben 20 *51 tom 40 Variant 61 where *

Re: [R] Cox model -missing data.

2014-12-19 Thread Shouro Dasgupta
First recode the * in NA: death.dat$v3[death.dat$v1==*] - NA Include this in your model: na.rm=TRUE Or you could create a new dataset: newdata - na.omit(death.dat) Shouro On Fri, Dec 19, 2014 at 11:12 AM, aoife doherty aoife.m.dohe...@gmail.com wrote: Hi all, I have a data set like

Re: [R] Cox model -missing data.

2014-12-19 Thread Ted Harding
Hi Aoife, I think that if you simply replace each * in the data file with NA, then it should work (NA is usually interpreted as missing for those functions for which missingness is relevant). How you subsequently deal with records which have missing values is another question (or many questions

Re: [R] Cox model -missing data.

2014-12-19 Thread aoife doherty
Many thanks, I appreciate the response. When I convert the missing values to NA and run the cox model as described in previous post, the cox model seems to remove all of the rows with a missing value (as the number of rows n in the cox output after I completely remove any row with missing data

Re: [R] Cox model -missing data.

2014-12-19 Thread Ted Harding
Yes, your basic reasoning is correct. In general, the observed variables carry information about the variables with missing values, so (in some way) the missing values can be replaced with estimates (imputations) and the standard regression method will then work as though the replacements were

Re: [R] Cox model -missing data.

2014-12-19 Thread Michael Dewey
Comment inline On 19/12/2014 11:17, aoife doherty wrote: Many thanks, I appreciate the response. When I convert the missing values to NA and run the cox model as described in previous post, the cox model seems to remove all of the rows with a missing value (as the number of rows n in the cox

Re: [R] exclude missing co-variable data in cox model

2014-12-19 Thread Therneau, Terry M., Ph.D.
Three responses to your question 1. Missing values in R are denoted by NA. When reading in your data you want to use the na.strings option so that the internal form of the data has missing values properly denoted. 2. If this is done, then coxme will notice the missings and remove them,

[R] where is XMLRPC for R3.0 for Windows machines

2014-12-19 Thread Diogo André Alagador
I am need to install rneos for R 3.1 under Windows 64bit. However it depends on the package XMLRPC that is not available in conventional repositories. In the CRAN R 3.1 online readme (http://cran.r-project.org/bin/windows/contrib/3.1/ReadMe) there is an information regarding the installation

Re: [R] Make 2nd col of 2-col df into header row of same df then adjust col1 data display

2014-12-19 Thread John Kane
Very pretty. I could have saved myself about 1/2 hour of mucking about if I had thought ot length. John Kane Kingston ON Canada -Original Message- From: sven.temp...@gmail.com Sent: Fri, 19 Dec 2014 10:13:55 +0100 To: chl...@mail.usask.ca Subject: Re: [R] Make 2nd col of 2-col df

Re: [R] lme4 2 factor factorial model with random factors

2014-12-19 Thread Ben Bolker
Jacob Warren (RIT Student jjw3952 at rit.edu writes: Using lme4 how does one define a 2 factor factorial model with both factors being random? Specifically I am just trying to recreate the results from Montgomery's Design of Experiments book (7th edition), example 13.2. In this example

Re: [R] where is XMLRPC for R3.0 for Windows machines

2014-12-19 Thread Pfaff, Bernhard Dr.
Hello Diogo, the package is hosted on Omegahat: http://www.omegahat.org/XMLRPC/ Best wishes, Bernhard -Ursprüngliche Nachricht- Von: R-help [mailto:r-help-boun...@r-project.org] Im Auftrag von Diogo André Alagador Gesendet: Freitag, 19. Dezember 2014 14:03 An:

Re: [R] Your pardon: An article possibly of interest to statisticians

2014-12-19 Thread ce
Nice but as this is R forum, is there an R package related to it ? -Original Message- From: John McKown [john.archie.mck...@gmail.com] Date: 12/18/2014 01:38 PM To: r-help r-help@r-project.org Subject: [R] Your pardon: An article possibly of interest to statisticians I do hope this

[R] We won an award, and didn't even notice...

2014-12-19 Thread Duncan Murdoch
This morning I was reading Jeff Leek's list of awesome things other people did in 2014 at http://simplystatistics.org/?p=3696 (thanks to the Revolution Analytics blog for the pointer). One of the items in his list had a link to a list of awards for open source software in 2014:

Re: [R] Fitting Structural Equation Model with sem package and Summary issues

2014-12-19 Thread John Fox
Dear Guillaume, Please see comments interspersed below: -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Guillaume Souchay Sent: Thursday, December 18, 2014 8:50 AM To: r-help@r-project.org Subject: [R] Fitting Structural Equation Model with sem

Re: [R] Make 2nd col of 2-col df into header row of same df then adjust col1 data display

2014-12-19 Thread Crombie, Burnette N
That is the solution I had tried first (yes, it's nice!), but it doesn't provide the other PViol.Type's that aren't necessarily in my dataset. That's where my problem is. I'm closer to the cure, though, and think I've thought of a solution as soon as I have time. I'll update everyone then.

Re: [R] Calculating mean, median, minimum, and maximum

2014-12-19 Thread mtrang
You can use the apply function which applies a function of your choice, and MARGIN = 2 means you want to do it columnwise: apply(X = df, MARGIN=2, FUN = mean, na.rm = TRUE) Latitude Longitude January February March April May June 26.9380 -109.8125 159.8454 156.4489

Re: [R] We won an award, and didn't even notice...

2014-12-19 Thread Thomas Adams
Duncan, Congratulations to you and all the founders and contributors — very much deserved; thank you!! Tom On Fri, Dec 19, 2014 at 9:24 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: This morning I was reading Jeff Leek's list of awesome things other people did in 2014 at

Re: [R] Calculating mean, median, minimum, and maximum

2014-12-19 Thread Henrik Bengtsson
On Fri, Dec 19, 2014 at 8:48 AM, John Kane jrkrid...@inbox.com wrote: Hi, It looks like you are replying to some phantom. Is your correspondent actully on R-help? This most likely happens because OP posted the message via Nabble

Re: [R] Calculating mean, median, minimum, and maximum

2014-12-19 Thread John Kane
Hi, It looks like you are replying to some phantom. Is your correspondent actully on R-help? John Kane Kingston ON Canada -Original Message- From: mtr...@buffalo.edu Sent: Fri, 19 Dec 2014 08:08:29 -0800 (PST) To: r-help@r-project.org Subject: Re: [R] Calculating mean, median,

Re: [R] where is XMLRPC for R3.0 for Windows machines

2014-12-19 Thread Prof Brian Ripley
On 19/12/2014 15:10, Pfaff, Bernhard Dr. wrote: Hello Diogo, the package is hosted on Omegahat: http://www.omegahat.org/XMLRPC/ And it installs from the sources on Windows as it has no compiled code. Something like options(pkgType = 'source') setRepositories() # choose omegahat

Re: [R] Problems with spatial data for Masterthesis

2014-12-19 Thread MacQueen, Don
The over function in the sp package should be able to do this for you. One of the examples found in ?over says: # return the number of points in each polygon: sapply(over(sr, geometry(meuse), returnList = TRUE), length) In that example, meuse contains the points and sr contains polygons,

Re: [R] where is XMLRPC for R3.0 for Windows machines

2014-12-19 Thread Prof Brian Ripley
On 19/12/2014 17:57, Prof Brian Ripley wrote: On 19/12/2014 15:10, Pfaff, Bernhard Dr. wrote: Hello Diogo, the package is hosted on Omegahat: http://www.omegahat.org/XMLRPC/ And it installs from the sources on Windows as it has no compiled code. Something like options(pkgType =

[R] How to make Pivot table with two variables in R?

2014-12-19 Thread Kristi Glover
Hi R User, Would you suggest me on how I can build a pivot table using two variables? I want to put text in the table instead of value. I have attached an example data and the type of table (FinalTable) I was looking for. I am looking for your suggestions. ThanksKG=dat-structure(list(tag =

Re: [R] How to make Pivot table with two variables in R?

2014-12-19 Thread Chel Hee Lee
x - dat x$time - as.factor(as.Date(x$time, format=%Y-%B%d)) tmp - split(x, x$tag) tmp1 - do.call(rbind, lapply(tmp, function(x){ + tb - table(x$time) + idx - which(tb0) + tb1 - replace(tb, idx, as.character(x$states)) + })) print(tmp1, quote=FALSE) 2010-05-27 2011-06-27 2011-06-28

Re: [R] How to make Pivot table with two variables in R?

2014-12-19 Thread Berend Hasselman
On 20-12-2014, at 05:45, Kristi Glover kristi.glo...@hotmail.com wrote: Hi R User, Would you suggest me on how I can build a pivot table using two variables? I want to put text in the table instead of value. I have attached an example data and the type of table (FinalTable) I was looking