> 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
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
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 =
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
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
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
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
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
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
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
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
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
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
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:/
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
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
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
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
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])
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)
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
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
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
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
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
25 matches
Mail list logo