[R] plotting decision tree from Mapreduce output

2014-02-18 Thread R Novice
Respect R veterans, I am just starting with R and I am having a difficulty in plotting a rule based decision tree in R. The problem is, I already have an output from hadoop MapReduce and it is in the form of a simple text file. Now I want to use this output from Hadoop and represent it

[R] converting time data in R

2014-02-18 Thread R Novice
Respected R veterans and experts, I have a column representing time in a data frame in R. when I call the str() function on the column it says something like this str(df2$Time) Factor w/ 1441 levels ,00:01,00:02,00:03,..: 1086 1096 and so on The thing is I want to conver this column

[R] TS: Calculating the mean by month

2014-02-18 Thread Victor
I have the following (monthly) ts time-series: t Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 2002 5.3 9.4 12.1 14.4 17.9 23.5 24.3 23.6 19.3 16.3 13.9 9.0 2003 7.5 5.4 10.4 13.3 19.9 25.6 26.2 27.6 20.6 15.5 12.5 8.0 2004 6.3 7.8 9.6 13.6 16.5 22.0 24.3 24.6 21.3

Re: [R] TS: Calculating the mean by month

2014-02-18 Thread PIKAL Petr
Hi tt-ts((1:(4*12)), frequency=12) tapply(tt,cycle(tt), mean) However you could find it yourself more quickly just browsing docs as I did. Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Victor Sent: Tuesday,

[R] association of multiple variables

2014-02-18 Thread INCOMA GfK
Dear all, Please, is there a way in R to calculate association statistics over more than 2 categorical (binary) variables? I mean something similar what cor(my.dataframe) does for continuous variables, i.e. to have a matrix of statistics and/or p-values as an output. Many thanks! Zdenek -

Re: [R] converting time data in R

2014-02-18 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of R Novice Sent: Tuesday, February 18, 2014 9:44 AM To: r-help@r-project.org Subject: [R] converting time data in R Respected R veterans and experts, I have a column

Re: [R] plot a list of trellis objects

2014-02-18 Thread Duncan Mackay
Hi Santosh for more control on size and position ?lattice::print.trellis Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: r-help-boun...@r-project.org

Re: [R] association of multiple variables

2014-02-18 Thread David Carlson
You might modify this function which computes Cramer's V using the assocstats() function in package vcd: catcor - function(x) { require(vcd) nc - ncol(x) v - expand.grid(1:nc, 1:nc) matrix(mapply(function(i1, i2) assocstats(table(x[,i1],

Re: [R] count and sum simultaneously in R pivot table

2014-02-18 Thread Crombie, Burnette N
A.K., thanks for your reply. I'm getting an error at res2: Error: unexpected symbol in res2 - within(as.data.frame(res1),`Count of Case ID` - dcast(FLSAdata_melt, ViolationDesc + ReasonDesc ~ variable, length, margins=TRUE)[,3])[,c(4,1:3)] colnames I've tried a couple of modifications, but

Re: [R] How to calculate moving average without using filter()?

2014-02-18 Thread C W
Thanks everyone. For 5 point moving average, filter(x, side=2, filter=rep(1/5, 5)), versus, filter(x, side=2, filter=rep(1, 5) Do they have the same effect, since the total needs to be 1. Gabor Rui: I am aware of the zoo package, I did not want to install a package for one function. Same

Re: [R] minor version upgrade requires library refresh?

2014-02-18 Thread Ross Boylan
On Fri, 2014-02-14 at 17:47 -0800, David Winsemius wrote: On Feb 13, 2014, at 11:36 AM, Ross Boylan wrote: If R changes from 3.0.1 to 3.0.2, or more generally from m.n.p to m.n.q, is it necessary to refresh libraries to match the version, e.g., with update.packages(checkBuilt=TRUE,

[R] Updating a data frame based on if condition

2014-02-18 Thread Jeff Johnson
I have a subset of data that I have identified as suspect (for example, the first name has excessive spaces, is longer than 35 characters or has a number). What I want to do is update the FNAME_SUSPECT field in mydata to TRUE if any of those conditions are met. Here's my data: dput(mydata)

Re: [R] plot a list of trellis objects

2014-02-18 Thread Santosh
Thanks for all your suggestions.. santosh On Tue, Feb 18, 2014 at 4:11 AM, Duncan Mackay dulca...@bigpond.com wrote: Hi Santosh for more control on size and position ?lattice::print.trellis Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England

[R] party::ctree

2014-02-18 Thread Karki, Amrit B
Would you mind to help me how to extract coefficients of significant variables using ctree model? How to implement the model like logistic and others. Thank you. Amrit This electronic message may contain information that is confidential and/or legally

[R] Errorbar

2014-02-18 Thread Alzahrani, Ahmad K A
Hi All, Can anyone show me how to add a error bar to my graphs. I am currently using this code g-ggplot(means,aes(x=variable,y=value)) g-g+geom_bar(stat=identity)+facet_wrap(~Site+Season) g Thanks, Akaalz [[alternative HTML version deleted]]

Re: [R] count and sum simultaneously in R pivot table

2014-02-18 Thread Crombie, Burnette N
The script works nicely, Arun. You were right, I pasted code from email instead of Rhelp and didn't reformat properly in R. I appreciate your time with this! -Original Message- It seems like part of the next line is also being run (in the end 'colnames'). For e.g. res2 -

[R] Convergence problem

2014-02-18 Thread Amanuel Tekleab
Hi all, I am a facing a convergence problem when I test for variability of a slope among groups in lme. a) How do I know how many iterations the program is running? b) How do I increase the # of iterations c) Do I include the command to increase iterations in my equation? Thanks for your help!

Re: [R] Convergence problem

2014-02-18 Thread David Winsemius
On Feb 18, 2014, at 9:47 AM, Amanuel Tekleab wrote: Hi all, I am a facing a convergence problem when I test for variability of a slope among groups in lme. a) How do I know how many iterations the program is running? b) How do I increase the # of iterations c) Do I include the command to

Re: [R] party::ctree

2014-02-18 Thread Achim Zeileis
On Tue, 18 Feb 2014, Karki, Amrit B wrote: Would you mind to help me how to extract coefficients of significant variables using ctree model? How to implement the model like logistic and others. Thank you. ctree() is a nonparametric model and there are no significant coefficients. Some

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread David Carlson
Not always true, but it is in this case: ?ifelse David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff Johnson Sent: Tuesday, February 18, 2014 11:24 AM To: R help Subject: [R] Updating a data frame based on if condition I

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread Jeff Johnson
This is my first time with ifelse, but I've tried: mydata$FNAME_SUSPECT - ifelse(mydata$FNAME_TOKEN_COUNT 3, TRUE, FALSE, ifelse(mydata$FNAME_LENGTH 35, TRUE, FALSE, ifelse(regexpr(9, mydata$FNAME_PATTERN) 0, TRUE, FALSE )

Re: [R] Errorbar

2014-02-18 Thread R. Michael Weylandt michael.weyla...@gmail.com
Have you seen the examples at docs.ggplot2.org/0.9.3.1/geom_errorbar.html ? On Feb 18, 2014, at 10:57, Alzahrani, Ahmad K A aka...@essex.ac.uk wrote: Hi All, Can anyone show me how to add a error bar to my graphs. I am currently using this code g-ggplot(means,aes(x=variable,y=value))

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread Jeff Johnson
Ahh, I was specifying the second argument FALSE incorrectly. Works now as: mydata$FNAME_SUSPECT - ifelse(mydata$FNAME_TOKEN_COUNT 3, TRUE, ifelse(mydata$FNAME_LENGTH 55, TRUE, ifelse(regexpr(9, mydata$FNAME_PATTERN) == 0, TRUE, FALSE )

[R] 3D graphics

2014-02-18 Thread Louis Schreierlc
Hi I have a large data set that consists of a time series of data captured from a device that has three dimensions. I'd like to plot the data such that I have a time series of a point, say, in 3 space. So far the documentation I've seen on 3d graphics (wireframes, topos, etc) don't seem to be

Re: [R] plot a list of trellis objects

2014-02-18 Thread Santosh
Thanks for the suggestion.. Is there a way I can include arguments to the *grid.arrange* function? I tried in your example something like... gridar - function(x,ncol=2,...) grid.arrange(x,...) do.call(gridar, lattice.plots); I could not make it work when I try to control number of columns/rows

Re: [R] plot a list of trellis objects

2014-02-18 Thread Santosh
I forgot to add.. printltrellis seems to take in only one trellis object at a time.. so.. I think I would need to use a loop for varying the column/row indices, etc... Is that the only way (other than grid.arrange)? Is column/row/page control possible through grid.arrange..? On Tue, Feb 18,

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread arun
Hi, I don't know whether the 'mydata object was updated or not before you run the table. mydata - within(mydata,FNAME_SUSPECT - FNAME_TOKEN_COUNT 10|FNAME_LENGTH45|regexpr(9,FNAME_PATTERN)==0) table(mydata$FNAME_SUSPECT) # #FALSE #   50 Now, your second condition (reply to David).  

Re: [R] plot a list of trellis objects

2014-02-18 Thread Frede Aakmann Tøgersen
Yes of course (why didn't you yourself read the man/help pages? That's the way I learned R). If you see the help to grid.arrange: arrangeGrob package:gridExtra R Documentation arrangeGrob Description: arrange ggplot2, lattice, and grobs on a page Usage:

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread David Carlson
What you have can work, but it will be hard to maintain and debug. Easier to follow is cond1 - mydata$FNAME_TOKEN_COUNT 3 cond2 - mydata$FNAME_LENGTH 55 cond3 - regexpr(9, mydata$FNAME_PATTERN) == 0 mydata$FNAME_SUSPECT - apply(cbind(cond1, cond2, cond3), 1, any) mydata$FNAME_SUSPECT [1]

Re: [R] plot a list of trellis objects

2014-02-18 Thread Frede Aakmann Tøgersen
Well to be in control: Please read carefully the help to grid.layout Create a Grid Layout Description: This function returns a Grid layout, which describes a subdivision of a rectangular region. Usage: grid.layout(nrow = 1, ncol = 1, widths = unit(rep(1, ncol),

Re: [R] plot a list of trellis objects

2014-02-18 Thread Frede Aakmann Tøgersen
Sorry this should of course be for all on R-help. Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling Technology Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com http://www.vestas.com Company reg. name: Vestas Wind

Re: [R] 3D graphics

2014-02-18 Thread Frede Aakmann Tøgersen
Perhaps this in package: scatterplot3d package:scatterplot3d R Documentation 3D Scatter Plot Description: Plots a three dimensional (3D) point cloud. Usage: scatterplot3d(x, y=NULL, z=NULL, color=par(col), pch=par(pch), main=NULL, sub=NULL, xlim=NULL,

Re: [R] plot a list of trellis objects

2014-02-18 Thread Santosh
Thanks for suggestions! I am just getting familiarized with these grid and extra businesses! Now I understand a bit better to find and scour through man/help pages :) santosh On Tue, Feb 18, 2014 at 1:00 PM, Frede Aakmann Tøgersen fr...@vestas.comwrote: Sorry this should of course be for all

Re: [R] 3D graphics

2014-02-18 Thread Yvan Richard
For an exploratory look at the data, the package rgl (that uses OpenGL) is great. On 19 February 2014 05:20, Louis Schreierlc schreie...@gmail.com wrote: Hi I have a large data set that consists of a time series of data captured from a device that has three dimensions. I'd like to plot the

Re: [R] Updating a data frame based on if condition

2014-02-18 Thread Jeff Johnson
Thanks David, that's a great improvement. On Tue, Feb 18, 2014 at 12:36 PM, David Carlson dcarl...@tamu.edu wrote: What you have can work, but it will be hard to maintain and debug. Easier to follow is cond1 - mydata$FNAME_TOKEN_COUNT 3 cond2 - mydata$FNAME_LENGTH 55 cond3 -

Re: [R] plot a list of trellis objects

2014-02-18 Thread Frede Aakmann Tøgersen
Hopefully good suggestions from our side. Well, is it not feasible to point people to man pages that thinks _list_ is the same as _c_ , so tomorrow I will file a bug (what is that called for instructions) report (if I can remember). Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen

[R] calculate probability of union of independent events

2014-02-18 Thread Meinfelder, Florian
Dear all, I am looking for a way to calculate the probability of the union of k independent events in R. Is there a function that takes a k-dimensional probability vector as input and returns p(A_1 U A_2 U...U A_k)? Thanks, Florian ___ Dr.

Re: [R] 3D graphics

2014-02-18 Thread Louis Schreierlc
Frede thanks for the help. I'll give it a try best Lou Schreier On Feb 18, 2014, at 1:22 PM, Frede Aakmann Tøgersen fr...@vestas.com wrote: Perhaps this in package: scatterplot3d package:scatterplot3d R Documentation 3D Scatter Plot Description: Plots

Re: [R] plot a list of trellis objects

2014-02-18 Thread Duncan Mackay
Hi for print.trellis you could make a function and supply the plots as arguments ?list and then print them There are various ways of doing it and you could have a matrix as an argument with the proportions and access them Regards Duncan -Original Message- From:

Re: [R] calculate probability of union of independent events

2014-02-18 Thread Ted Harding
On 18-Feb-2014 22:08:38 Meinfelder, Florian wrote: Dear all, I am looking for a way to calculate the probability of the union of k independent events in R. Is there a function that takes a k-dimensional probability vector as input and returns p(A_1 U A_2 U...U A_k)? Thanks, Florian I

Re: [R] Aggregation

2014-02-18 Thread arun
Hi, May be this helps: DataA - read.table(text=ID,Var1,Var2 1,A,100 1,B,50 2,A,200 2,B,100 2,B,50,sep=,,header=TRUE,stringsAsFactors=FALSE) dcast(DataA,ID~Var1,value.var=Var2)  ## I guess this is what you mentioned #Aggregation function missing: defaulting to length #  ID A B #1  1 1 1 #2  2 1 2  

Re: [R] Writing Unicode Text into Text File from R (in Windows)

2014-02-18 Thread Majid Einian
On Tue, Feb 4, 2014 at 4:18 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 14-02-04 5:49 AM, Majid Einian wrote: Dear R Helpers, See the Code: a - intToUtf8(1777) show(a) zz - file(description=test.txt,open=w,encoding=UTF-8) cat(a, file = zz) close(zz) in a Unicode aware