Re: [R] Separating a Complicated String Vector

2015-01-03 Thread David Winsemius
On Jan 3, 2015, at 9:20 PM, npretnar wrote: > Sorry. Bad example on my part. Try this. V1 is ... > > V1 > alabama > bates > tuscaloosa > smith > arkansas > fayette > little rock > alaska > juneau > nome > > And I want: > > V1V2 > alabama bates > alabama tuscaloo

Re: [R] tried half-precision but "size 2 is unknown on this machine"

2015-01-03 Thread Mike Miller
Thanks for the pedantic insult, but no thanks. I'd rather just hear if anyone reading this is able to make something like this work on any architecture: vec <- 1:10/10 con <- file( "test.bin16", "wb" ) writeBin( vec , con, size=2 ) close(con) If they can do it, they can tell me about it. Tha

Re: [R] tried half-precision but "size 2 is unknown on this machine"

2015-01-03 Thread Jeff Newmiller
Your message is missing either a reproducible example or an indication of your R environment (such as the output of sessionInfo()). Yes, the machine architecture can prevent certain types of operations. This is however a poor venue for discussing such issues. I suggest that you investigate the

[R] tried half-precision but "size 2 is unknown on this machine"

2015-01-03 Thread Mike Miller
It's an IEEE standard format: http://en.wikipedia.org/wiki/Half-precision_floating-point_format#IEEE_754_half-precision_binary_floating-point_format:_binary16 This is what I see: writeBin(vec , con, size=2 ) Error in writeBin(vec, con, size = 2) : size 2 is unknown on this machine I'm not su

Re: [R] Separating a Complicated String Vector

2015-01-03 Thread npretnar
Sorry. Bad example on my part. Try this. V1 is ... V1 alabama bates tuscaloosa smith arkansas fayette little rock alaska juneau nome And I want: V1 V2 alabama bates alabama tuscaloosa alabama smith arkansasfayette arkansaslittle rock alaska juneau al

Re: [R] rle with data.table - is it possible?

2015-01-03 Thread Kate Ignatius
Ahh ... you may have missed this: Larger example below. So for the below example it will be: Dad Mum Child Group sumdad summum sumchild childseg 1: AA RRRA A 2 200 2: AA RRRR A 2 211 3: AA AAAA B 4

Re: [R] Separating a Complicated String Vector

2015-01-03 Thread Ista Zahn
I'm not sure what's so complicated about that (am I missing something?). You can search using grep, and replace using gsub, so tmpDF <- read.table(text="V1 V2 A 5 a1 1 a2 1 a3 1 a4 1 a5 1 B 4 b1 1 b2 1 b3 1 b4 1", he

[R] Predicting random effects in GAM using mgcv

2015-01-03 Thread Meagan Dunphy-Daly
Hi all, I am interested in modeling total fish catch using gam in mgcv to model simple random effects for individual vessels (that make repeated trips over time in the fishery). I have 98 subjects, so I thought I would use gam instead of gamm to model the random effects. My model is: modelGOM

Re: [R] Export chaid decision tree rules

2015-01-03 Thread Rodica Coderie via R-help
Thanks! It answered my question. Rodica - Original Message - From: Achim Zeileis To: David Winsemius Cc: Rodica Coderie ; "r-help@r-project.org" Sent: Saturday, January 3, 2015 10:58 PM Subject: Re: [R] Export chaid decision tree rules On Sat, 3 Jan 2015, David Winsemius wrote: > O

[R] Separating a Complicated String Vector

2015-01-03 Thread npretnar
I have a string variable (V1) in a data frame structured as follows: V1 V2 A 5 a1 1 a2 1 a3 1 a4 1 a5 1 B 4 b1 1 b2 1 b3 1 b4 1 I want the following: V1 V2 V3 a1 1 A a2 1 A a3

Re: [R] sapply function and poisson distribution

2015-01-03 Thread Pete Brecknock
dimnik wrote > i want to find a functionthattakes in two vectors of numbers > thathave > the same > length.The output should be a listof vectors, where each vector > is a > sequence of > randomly generated Poisson variableswher

Re: [R] Probability distribution of fitted gaussian distribution.

2015-01-03 Thread David Winsemius
On Jan 3, 2015, at 9:27 AM, Jacob Varughese wrote: > Hi, > > I have a discrete set of data on the returns for 3 indices with 206 data > points. Since the number of points is less it doesnt exact look like a > gaussian distribution. > > I wanted to fit the data to a gaussian distribution and hav

[R] (no subject)

2015-01-03 Thread Noha Osman
Hello everyone, I try to use edge R package to analysis my data as following This is my data frame called subdata AB C D E 1 13707 13866 12193 12671

Re: [R] Export chaid decision tree rules

2015-01-03 Thread Achim Zeileis
On Sat, 3 Jan 2015, David Winsemius wrote: On Jan 3, 2015, at 1:21 AM, Rodica Coderie via R-help wrote: Hello, Can the decisions tree rules be exported? Along with the probabilities associated with each node?For example, I've created a CHAID decision with a target variable RESPONSE (YES/NO).

[R] Probability distribution of fitted gaussian distribution.

2015-01-03 Thread Jacob Varughese
Hi, I have a discrete set of data on the returns for 3 indices with 206 data points. Since the number of points is less it doesnt exact look like a gaussian distribution. I wanted to fit the data to a gaussian distribution and have used the fitdist function and have gotten the plots and the mean

Re: [R] Export chaid decision tree rules

2015-01-03 Thread David Winsemius
On Jan 3, 2015, at 1:21 AM, Rodica Coderie via R-help wrote: > Hello, > Can the decisions tree rules be exported? Along with the probabilities > associated with each node?For example, I've created a CHAID decision with a > target variable RESPONSE (YES/NO). I have 17 inner nodes with 19 termina

[R] Export chaid decision tree rules

2015-01-03 Thread Rodica Coderie via R-help
Hello, Can the decisions tree rules be exported? Along with the probabilities associated with each node?For example, I've created a CHAID decision with a target variable RESPONSE (YES/NO). I have 17 inner nodes with 19 terminal nodes. How which terminal node has the highest probability of YES an

Re: [R] R function to convert person-level observations to person-period observations

2015-01-03 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello David, Thank you so much for your advice.The revision of the code as "reve <- data[, event]" in the function (but with no changing of the example data) seems to provide the desired results (shown below). These 3 subjects are followed for 5 years. Subject A experienced the event in

Re: [R] R function to convert person-level observations to person-period observations

2015-01-03 Thread David Barron
Your data are wrong. The 'event' variable (dead in your example) needs to be 1 for cases that end in an event and 0 for spells that are censored: yours is the other way around. If you change the 'dead' variable to c(1,0,1) you will get the desired result. If you really need to reverse the behavio

[R] R function to convert person-level observations to person-period observations

2015-01-03 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello, I was trying to convert person-level observations to person-period observations using an R custom function obtained from the UCLA web site (http://www.ats.ucla.edu/stat/r/faq/person_period.htm). Please see my reproducible example below. The function (PLPP) in the R script takes five a