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

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

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

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
Try this: q <- z[match(p, y)] Jean `·.,, ><(((º> `·.,, ><(((º> `·.,, ><(((º> Jean V. Adams Statistician U.S. Geological Survey Great Lakes Science Center 223 East Steinfest Road Antigo, WI 54409 USA 715-627-4317, ext. 3125 (Office) 715-216-8014 (Cell) 715-623-6773 (FAX) http://www.g

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

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

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

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

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
Hi Andy, I see two problems: First of all, it must be a$wk[i] <- 1 and not a$wk <- 1, since this way it makes all 10 entries of a$wk to be 1. But R won't complain about this! What R should complain about is your loop. If you write for (i in a$date) it means that i loops between all the VALUES

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
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 indexing in your replacements in the then and else clauses :: you probably want some equalities in your