similar to: why data frame's logical index isnt working

Displaying 20 results from an estimated 1600 matches similar to: "why data frame's logical index isnt working"

2016 Apr 08
1
why data frame's logical index isnt working
I don't get it, I thought the double index was to indicate and individual element within a column(vector)? I will stop using data.frame, thanks a lot! On Thu, Apr 7, 2016 at 9:29 PM, David Winsemius <dwinsemius at comcast.net> wrote: > > > On Apr 7, 2016, at 6:46 PM, Michael Artz <michaeleartz at gmail.com> wrote: > > > >
2016 Apr 08
0
why data frame's logical index isnt working
> On Apr 7, 2016, at 6:46 PM, Michael Artz <michaeleartz at gmail.com> wrote: > > data.frame.$columnToAdd["CurrentColumnName" == "ConditionMet"] <- 1 > > Can someone please explain to me why the above command gives all NAs to > columnToAdd? I thought this was possible in R to do logical expression in > the index of a data frame It is possible,
2016 Apr 19
5
Interquartile Range
That didn't work Jim! Thanks anyway On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon <drjimlemon at gmail.com> wrote: > Hi Michael, > At a guess, try this: > > iqr<-function(x) { > return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > } > > .col3_Range=iqr(datat$tenure) > > Jim > > > > On Tue, Apr 19, 2016 at
2016 Apr 15
1
Decision Tree and Random Forrest
I need the output to have groups and the probability any given record in that group then has of being in the response class. Just like my email in the beginning i need the output that looks like if A and if B and if C then %77 it will be D. The examples you provided are just simply not similar. They are different and would take interpretation to get what i need. On Apr 14, 2016 1:26 AM,
2016 Apr 14
3
Decision Tree and Random Forrest
I still need the output to match my requiremnt in my original post. With decision rules "clusters" and probability attached to them. The examples are sort of similar. You just provided links to general info about trees. Sent from my Verizon, Samsung Galaxy smartphone<div> </div><div> </div><!-- originalMessage --><div>-------- Original message
2016 Apr 13
3
Decision Tree and Random Forrest
Ok is there a way to do it with decision tree? I just need to make the decision rules. Perhaps I can pick one of the trees used with Random Forrest. I am somewhat familiar already with Random Forrest with respective to bagging and feature sampling and getting the mode from the leaf nodes and it being an ensemble technique of many trees. I am just working from the perspective that I need
2016 Apr 07
2
simple question on data frames assignment
If you are not using an anonymous function and say you had written the function out The below gives me the error > 'f(colordata2$color1)' is not a function, character or symbol' But then how is the anonymous function working? f <- function(col){ ifelse(col == 'blue', 1, 0) } responses <- lapply(colordata2[ -1 ], f(colordata2$color1) )
2016 Apr 15
0
Decision Tree and Random Forrest
Since you only have 3 predictors, each categorical with a small number of categories, you can use expand.grid to make a data.frame containing all possible combinations and give that the predict method for your model to get all possible predictions. Something like the following untested code. newdata <- expand.grid( Humidity = levels(Humidity), #(High, Medium,Low)
2016 Apr 19
2
Interquartile Range
If you show us, not just tell us about, a self-contained example someone might show you a non-hacky way of getting the job done. (I don't see an argument to plyr::ddply called 'transform'.) Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Apr 19, 2016 at 12:18 PM, Michael Artz <michaeleartz at gmail.com> wrote: > Oh thanks for that clarification Bert! Hope you enjoyed
2016 Apr 13
0
Decision Tree and Random Forrest
Tjats great that you are familiar and thanks for responding. Have you ever done what I am referring to? I have alteady spent time going through links and tutorials about decision trees and random forrests and have even used them both before. Mike On Apr 13, 2016 5:32 PM, "Sarah Goslee" <sarah.goslee at gmail.com> wrote: It sounds like you want classification or regression trees.
2016 Apr 20
2
Interquartile Range
Again, IQR returns two both a .25 and a .75 value and it failed, which is why I didn't use it before. Also, the first function just returns tha same value repeating. Since they are the same, before the second call, using the mode function is just a way to grab one value. I could have used average, min, max, they all would have returned the same thing. Mike On Tue, Apr 19, 2016 at 7:24 PM,
2016 Apr 20
2
Interquartile Range
Well, instead of your functions try: Mode <- function(x) { tabx <- table(x) tabx[which.max(tabx)] } and use R's IQR function instead of yours. ... so I still don't get why you want to return a character string instead of a value for the IQR; and the mode of a sample defined as above is generally a bad estimator of the mode of the distribution. To say more than that would
2016 Apr 07
4
simple question on data frames assignment
Hi I'm not sure how to ask this, but its a very easy question to answer for an R person. What is an easy way to check for a column value and then assigne a new column a value based on that old column value? For example, Im doing colordata <- data.frame(id = c(1,2,3,4,5), color = c("blue", "red", "green", "blue", "orange")) for (i in
2016 Apr 19
0
Interquartile Range
> That didn't work Jim! It always helps to say how the suggestion did not work. Jim's function had a typo in it - was that the problem? Or did you not change the call to ddply to use that function. Here is something that might "work" for you: library(plyr) data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) myIqr <- function(x) {
2016 Apr 19
1
Interquartile Range
HI that did not work for me either. The value I got returned from that function was "<rounded mean> - <rounded mean>" :(. thanks for the reply through On Tue, Apr 19, 2016 at 10:34 AM, William Dunlap <wdunlap at tibco.com> wrote: > > That didn't work Jim! > > It always helps to say how the suggestion did not work. Jim's > function had a typo
2016 Apr 07
4
simple question on data frames assignment
Thaks so much! And how would you incorporate lapply() here? On Thu, Apr 7, 2016 at 6:52 AM, David Barron <dnbarron at gmail.com> wrote: > ifelse is vectorised, so just use that without the loop. > > colordata$response <- ifelse(colordata$color == 'blue', 1, 0) > > David > > On 7 April 2016 at 12:41, Michael Artz <michaeleartz at gmail.com> wrote: >
2016 Apr 13
4
Decision Tree and Random Forrest
Ah yes I will have to use the predict function. But the predict function will not get me there really. If I can take the example that I have a model predicting whether or not I will play golf (this is the dependent value), and there are three independent variables Humidity(High, Medium, Low), Pending_Chores(Taxes, None, Laundry, Car Maintenance) and Wind (High, Low). I would like rules like
2016 Apr 07
2
simple question on data frames assignment
Hello, Or even simpler, without ifelse, colordata$response <- colordata$color == 'blue' + 0 Hope this helps, Rui Barradas ? Citando David Barron <dnbarron at gmail.com>: > ifelse is vectorised, so just use that without the loop. > > colordata$response <- ifelse(colordata$color == 'blue', 1, 0) > > David > > On 7 April 2016 at 12:41, Michael
2016 Apr 07
0
simple question on data frames assignment
lapply(colordata2[ -1 ], f ) When you put the parentheses on, you are calling the function yourself before lapply gets a chance. The error pops up because you are giving a vector of numbers (the answer f gave you) to the second argument of lapply instead of a function. -- Sent from my phone. Please excuse my brevity. On April 7, 2016 7:31:18 AM PDT, Michael Artz <michaeleartz at
2016 Apr 07
0
simple question on data frames assignment
ifelse is vectorised, so just use that without the loop. colordata$response <- ifelse(colordata$color == 'blue', 1, 0) David On 7 April 2016 at 12:41, Michael Artz <michaeleartz at gmail.com> wrote: > Hi I'm not sure how to ask this, but its a very easy question to answer for > an R person. > > What is an easy way to check for a column value and then assigne a