Re: [R] R loop function in Tableau

2017-07-07 Thread David Winsemius
> On Jul 6, 2017, at 2:19 PM, Dai, Shengyu wrote: > > Hi R helpers, > > > > I hope this email finds you well. > > > > I am having trouble with R loop function in Tableau. > There is no "R loop function". (There is an R `for`-function.) If you are having trouble with code then it should

[R] R loop function in Tableau

2017-07-07 Thread Dai, Shengyu
Hi R helpers, I hope this email finds you well. I am having trouble with R loop function in Tableau. Please see the attachment of a simple dataset. The problem is to test whether the value of columns is match. Because Tableau do not have iteration function, I coded “if statement” in

Re: [R] R [loop statement ]

2016-04-16 Thread Jim Lemon
Hi tan sj, It is by no means easy to figure out what you want without the code, but If I read your message correctly, you can run the loops either way. When you have nested loops producing output, it is often a good idea to include the parameters for each run in the output as well as the result so

[R] R [loop statement ]

2016-04-15 Thread tan sj
hi, i am new in this field. I am now writing a code in robustness simulation study. I have written a brief code "for loop" for the factor (samples sizes d,std deviation ) , i wish to test them in gamma distribution with equal and unequal skewness, with the above for loop in a single code if pos

Re: [R] R loop for applying an equation to each unique category

2013-11-04 Thread arun
Hi,You could use: dat1 <- structure(list(Haplotype = c("H1", "H1", "H1", "H2", "H2", "H2", "H3", "H3", "H3", "H4", "H4", "H4", "H4", "H4", "H4"), Frequency = c(0.8278, 0.02248, 0.1494, 0.8238, 0.02248, 0.1497, 0.1497, 0.02248, 0.8244, 0.628, 0.02248, 0.1483, 0.1637, 0.01081, 0.01798)), .Names =

Re: [R] R loop within a loop

2011-10-12 Thread saliluna
I've also tried to make the function work for one particular group, then apply the same function to the whole data frame with all groups using by() or lapply() as follow. But I'm still receiving error messages. Could someone please explain what is happening here? dfdfdf <- function(localdata){ ord

[R] R loop within a loop

2011-10-12 Thread saliluna
Hi, I'm working on a loop function for a large dataset which contains 1000 different groups. I would like to reconstruct the order of events within each group by using a loop function in R. (Currently the order of events are based on the ascending order of prev_event within the group) A demo dat

Re: [R] R loop problem

2011-08-04 Thread testrider
Worked like a charm! Thanks a lot Jean V Adams -- View this message in context: http://r.789695.n4.nabble.com/R-loop-problem-tp3718449p3718670.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://s

Re: [R] R loop problem

2011-08-04 Thread Jean V Adams
Cell) 715-623-6773 (FAX) http://www.glsc.usgs.gov (GLSC web site) http://profile.usgs.gov/jvadams (My homepage) jvad...@usgs.gov (E-mail) From: testrider To: r-help@r-project.org Date: 08/04/2011 07:21 AM Subject: [R] R loop problem Sent by: r-help-boun...@r-project.org I have run into a spee

Re: [R] R loop problem

2011-08-04 Thread jim holtman
A subset of actual data and what you would expect as a result would be very helpful. All you say is that p.q are vectors, but it would appear that they are character vectors, but the content is unknown. Also will the expression "q[i==p]<-z[i==y]" have the same length on each side; the vectors app

[R] R loop problem

2011-08-04 Thread testrider
I have run into a speed issue, and given the size of the problem it feels like there should be an easy solution. Here is the problem statement with some arbitrary numbers added. #p,q: vector with length(q)==length(p)==1 and length(levels(p))==3000 #y,z: vectors with length(levels(y))=length(y)

Re: [R] R loop.

2010-04-23 Thread mhalsham
Hi Gustaf Thank you for the help, but I have over 1000 records, I can’t write it all in the code I didn’t get the code I’m sorry. Regards Mohamad Al-shammari -- View this message in context: http://r.789695.n4.nabble.com/R-loop-tp1979620p2051726.html Sent from the R help mailing list archive a

Re: [R] R loop.

2010-04-23 Thread Gustaf Rydevik
On Fri, Apr 23, 2010 at 11:14 AM, mhalsham wrote: > > Hi > Yes I have managed to read the file (Table2.txt) > The command I have used > a<- read.table("table3.txt", fill=TRUE, header=FALSE) > If I read the first row the result output will be like that. > a[1,] > > Result would be > >        V1   V

Re: [R] R loop.

2010-04-23 Thread mhalsham
Hi Yes I have managed to read the file (Table2.txt) The command I have used a<- read.table("table3.txt", fill=TRUE, header=FALSE) If I read the first row the result output will be like that. a[1,] Result would be V1 V2 V3V4V5 V6 V7 V8V9 V10 V11 V12 1

Re: [R] R loop.

2010-04-23 Thread Gustaf Rydevik
On Thu, Apr 22, 2010 at 7:20 PM, mhalsham wrote: > > Ok sorry for bad explanation from my side > What I want. I have a txt file name is (table3.txt) this file contains 1293 > rows and some of these row will have 1 column and some of them will have up > to may be 40 column. For example > >        A

Re: [R] R loop.

2010-04-22 Thread mhalsham
Ok sorry for bad explanation from my side What I want. I have a txt file name is (table3.txt) this file contains 1293 rows and some of these row will have 1 column and some of them will have up to may be 40 column. For example

Re: [R] R loop.

2010-04-22 Thread jim holtman
You did not give a good description of your problem, or what you wanted as a solution (what is a 'button'), or a reasonable idea of what you data is. Here is one solution x <- read.table(textConnection("Deafness, EYA4, DIAPH1, MYO7A, TECTA, COL11A2, POU4F3, MYH9, ACTG1, MYO6"), as.is=TRUE, se

Re: [R] R loop.

2010-04-22 Thread mhalsham
Thanks a lot for the help, but it’s not what I needed. -- View this message in context: http://r.789695.n4.nabble.com/R-loop-tp1979620p2020386.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https:/

Re: [R] R loop.

2010-04-16 Thread David Winsemius
On Apr 16, 2010, at 11:52 AM, Thomas Stewart wrote: I'm not sure I completely understand your question, but I think the solution to your problem is the reshape function in the reshape package. Except there is no reshape function in the reshape package. Your code works because the reshape

Re: [R] R loop.

2010-04-16 Thread Thomas Stewart
I'm not sure I completely understand your question, but I think the solution to your problem is the reshape function in the reshape package. Here is a silly example of how it would work: > V<-matrix(rbinom(15,4,.5),nrow=3) > X<-data.frame(A=c("A","B","C"),V=V) > X A V.1 V.2 V.3 V.4 V.5 1 A 1

[R] R loop.

2010-04-16 Thread mhalsham
Hi every one I’m new to R and I cant figure our how to use the loop to do the following task, any help would be very kind of every one. I have a file called (table3.txt) that contains over 1000 row and over 40 columns. So for example first row would look like that Deafness, EYA4, DIAPH1,

Re: [R] r-loop

2010-04-15 Thread David Winsemius
On Apr 15, 2010, at 4:24 PM, Changbin Du wrote: HI, Dear community, I am building the following loop, ww<-function(file) { lossw<-vector() for (x in seq(0.1, 0.9, by=0.1)) { cat('xweight ', x, '\n') lossw[i] <- cross.validation(file, x)$avg } return(los

Re: [R] r-loop

2010-04-15 Thread Changbin Du
Thanks so much, Marius! It works! On Thu, Apr 15, 2010 at 1:35 PM, Marius 't Hart wrote: > lossw[i] <- cross.validation(file, x)$avg > > change to: > > lossw <- append(lossw,cross.validation(file, x)$avg) > > > > > Changbin Du wrote: > >> HI, Dear community, >> >> I am building the following

[R] r-loop

2010-04-15 Thread Changbin Du
HI, Dear community, I am building the following loop, ww<-function(file) { lossw<-vector() for (x in seq(0.1, 0.9, by=0.1)) { cat('xweight ', x, '\n') lossw[i] <- cross.validation(file, x)$avg } return(lossw) } MY question is how to index the lossw[

Re: [R] R loop help

2010-04-06 Thread casperyc
Hi there, That's exactly what I want. I have checked ?combn out, but I could get the following, suppose that I want ALL possible combinations of them, as this == apply( combn(paste('x', 1:4, sep =""), 2), 2, function(v) get(v[1])*get(v[2])

Re: [R] R loop help

2010-03-27 Thread Patrick Burns
An aside to the main question: I don't think that i+1:3 is doing what you think it is. On 26/03/2010 23:01, casperyc wrote: Hi, I am tring to write a loop to compute this, == x1=c( rep(-1,4), rep(1,4) ) x2=c( rep(c(-1,-1,1,1),2)

Re: [R] R loop help

2010-03-26 Thread Jorge Ivan Velez
Hi casperyc, Here is a suggestion: # all at once apply(combn(paste('x', 1:3, sep =""), 2), 2, function(v) get(v[1])*get(v[2]) ) # step by step thex <- paste('x', 1:3, sep ="") thex combs <- combn(thex, 2) combs apply(combs, 2, function(v) get(v[1])*get(v[2]) ) x1, x2 and x3 correspo

[R] R loop help

2010-03-26 Thread casperyc
Hi, I am tring to write a loop to compute this, == x1=c( rep(-1,4), rep(1,4) ) x2=c( rep(c(-1,-1,1,1),2) ) x3=c( rep(c(-1,1),4) ) x1*x2 x1*x3 x2*x3 suppose i have x1,x2,x3

Re: [R] R loop

2008-06-05 Thread Gabor Grothendieck
Note that "%Y-%m-%d" is the default format so you can omit it. Perhaps you want something along these lines (modify formula to get the precise numbering you like): a$wk <- julian(a$date, as.Date("2008-01-01")) %/% 7 Also note %W can be used as a format string. See ?strptime for the codes. R Ne

Re: [R] R loop

2008-06-05 Thread Moshe Olshansky
008-01-01")] doesn't make much sense. But if you do this you will have problem changing the appropriate value of a$wk. --- On Fri, 6/6/08, Andrew McFadden <[EMAIL PROTECTED]> wrote: > From: Andrew McFadden <[EMAIL PROTECTED]> > Subject: [R] R loop > To: r-help@

Re: [R] R loop

2008-06-05 Thread Steven McKinney
ent: Thu 6/5/2008 9:01 PM To: Andrew McFadden; r-help@r-project.org Subject: Re: [R] R loop The bolding is lost in plain-text email, but some things to note: :: for(i in a$date){ - this will make i take on date values, you probably meant i to index the rows of a[] :: you missed inde

Re: [R] R loop

2008-06-05 Thread Steven McKinney
ssage- From: [EMAIL PROTECTED] on behalf of Andrew McFadden Sent: Thu 6/5/2008 8:46 PM To: r-help@r-project.org Subject: [R] R loop I all I am just trying to get the idea of a loop if statement for another purpose. I was going to label a new variable based on date ie first week 1, second wee

[R] R loop

2008-06-05 Thread Andrew McFadden
I all I am just trying to get the idea of a loop if statement for another purpose. I was going to label a new variable based on date ie first week 1, second week 2 etc. My code in bold is wrong but seems logical to me, could someone help. x <- rep(c(2660156,2663703,2658165,2659303,2661531,2660914