Re: [R] Loop Function to Create Multiple Scatterplots

2018-05-21 Thread MacQueen, Don
Here is a simplified example: dat <- data.frame(x=1:4, y1=runif(4), y2=runif(4), y3=4:1) for (icol in 2:4) plot(dat[,1] , dat[,icol] ) (not tested, so hopefully all my parentheses are balanced, no typos, etc.) This shows the basic principle. An alternative is to construct each column name as a

Re: [R] Loop Function to Create Multiple Scatterplots

2018-05-21 Thread John Kane via R-help
As Jim says, "No data". R-help is very fussy about what files it will accept.  You might try changing the extention to txt.  However the preferred way here is to use the dput() command and paste the results into the post.  See ?dput for details. On Monday, May 21, 2018, 1:40:59 a.m. EDT

Re: [R] Loop Function to Create Multiple Scatterplots

2018-05-21 Thread Jim Lemon
Hi Steven, Sad to say that your CSV file didn't make it to the list and I can't access the data via your Dropbox account. Therefore we don't know the structure of "mydata". If you are able to plot the data as in your example, this might help: genexp<-matrix(runif(360,1,2),ncol=18) colnames(genexp)

[R] Loop Function to Create Multiple Scatterplots

2018-05-20 Thread STEVEN MANCINI
Hello, I am trying to create multiple scatter plot graphs. I have 1 independent variable (Age - weeks post conception) and 18 dependent variables ("Gene n" Expression) in one csv file. Is there a way to set up a looped function to produce 18 individual scatterplots? At the moment, I am writing the

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 yo

[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] loop function

2016-08-18 Thread Adams, Jean
You seemed to have re-written over the "b" object in your code. This might work for you. library(MASS) for (i in 58:1){ for(j in 58:i){ str.temp <- paste("y1 ~ x", i, "* x", j, sep = "") univar <- glm.nb(as.formula(str.temp), data=df) b <- summary(univar)$coeffients[4, 4] if(b <

[R] loop function

2016-08-18 Thread fatimah soleimany
Hi Dear users, for an interactive use, i am trying to write a loop that looks for all variables in the conditions which i introduced, this is what I'm trying: library(MASS)> i=1> for (i in 58:1){+ for(j in 58:i){+ + str.temp <- paste("y1 ~ x", i, "* x", j, sep = "")+ univar<-glm.nb(as.formula(str.

Re: [R] loop function and integrate?

2012-11-30 Thread faeriewhisper
hello guys! thank u for the help, but u didnt understood what i need. 1st, it is a[i] cuz i want to sum 1 + x[i], for all i's not j. but i've solved it! :) like i said, my code is more complex, but, if you need to integrate several functions in a loop, thats what you should do: w2 = seq(-1,-1/3,l

Re: [R] loop function and integrate?

2012-11-30 Thread Berend Hasselman
On 30-11-2012, at 19:34, Berend Hasselman wrote: > > On 30-11-2012, at 16:08, faeriewhisper wrote: > >> Hi guys! >> I have to compute something and i don't know what i'm doing wrong. my code >> is a bit complex, but imagine that is something like this: >> >> a = c(1,2,3,4) >> ia = length(a)

Re: [R] loop function and integrate?

2012-11-30 Thread Berend Hasselman
On 30-11-2012, at 16:08, faeriewhisper wrote: > Hi guys! > I have to compute something and i don't know what i'm doing wrong. my code > is a bit complex, but imagine that is something like this: > > a = c(1,2,3,4) > ia = length(a) > > x = seq(1,100,length=0.1) > ib = length(x) > > int1 =

Re: [R] loop function and integrate?

2012-11-30 Thread Rui Barradas
Hello, Your code doesn't run without initializing 'ss' to something. And I've made some changes, but I don't understand what you are trying to do. See comments inline. a = c(1,2,3,4) ia = length(a) x = seq(1, 100, by=0.1) # It was 'length = 0.1' (!) ib = length(x) ss <- numeric(ia) # Ne

Re: [R] loop function and integrate?

2012-11-30 Thread faeriewhisper
Now i've managed to do this: funcs <- list() funcs[] # loop through to define functions for(i in 1:ib-1){ # Make function name funcName <- paste( 'func', i, sep = '' ) # make function func = paste('function(x){sin(x + a[', i,'])))}',sep = '') funcs[[funcName]] = eval(parse(

[R] loop function and integrate?

2012-11-30 Thread faeriewhisper
Hi guys! I have to compute something and i don't know what i'm doing wrong. my code is a bit complex, but imagine that is something like this: a = c(1,2,3,4) ia = length(a) x = seq(1,100,length=0.1) ib = length(x) int1 = numeric(ib) b = numeric(ib) for(j in 1:ia) { H = function(x) {

Re: [R] loop function within a loop

2011-10-12 Thread William Dunlap
roject.org] On > Behalf Of Sally Zhen > Sent: Wednesday, October 12, 2011 7:56 AM > To: r-help@r-project.org > Subject: [R] loop function within a loop > > Hi all, > > I'm working on a loop function for a large dataset which contains 1000 > different groups. I would

Re: [R] loop function within a loop

2011-10-12 Thread David Winsemius
On Oct 12, 2011, at 10:55 AM, Sally Zhen wrote: Hi all, 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. Not generally a good first strategy in R. (Cu

Re: [R] loop function within a loop

2011-10-12 Thread Weidong Gu
It's better to avoid loop in this situation. If you want to reorder subsets of the data based on event, the follow works df<-read.table('clipboard',header=TRUE) sp.or<-lapply(split(df,df$group),function(ldf) ldf[order(ldf$event),]) new.df<-do.call('rbind',sp.or) Weidong Gu On Wed, Oct 12, 2011 a

[R] loop function within a loop

2011-10-12 Thread Sally Zhen
Hi all, 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

Re: [R] Loop function/comparison operator problem

2009-10-05 Thread David Winsemius
On Oct 5, 2009, at 7:56 PM, Duncan Murdoch wrote: On 05/10/2009 7:47 PM, jimdare wrote: Hi There, I have created the following function format<- function(){ repeat { form<-readline(paste("\nIn what format do you want to save these plots?\nChoose from: wmf, emf, png, jpg, jpeg, bmp, tif, tiff,

Re: [R] Loop function/comparison operator problem

2009-10-05 Thread Duncan Murdoch
On 05/10/2009 7:47 PM, jimdare wrote: Hi There, I have created the following function format<- function(){ repeat { form<-readline(paste("\nIn what format do you want to save these plots?\nChoose from: wmf, emf, png, jpg, jpeg, bmp, tif, tiff, ps, eps, or pdf.\nNote: eps is the suggested format

Re: [R] Loop function/comparison operator problem

2009-10-05 Thread jim holtman
use %in% instead of '==' On Mon, Oct 5, 2009 at 7:47 PM, jimdare wrote: > > Hi There, > > I have created the following function > > format<- function(){ > repeat { > form<-readline(paste("\nIn what format do you want to save these > plots?\nChoose from: wmf, emf, png, jpg, jpeg, bmp, tif, tiff, p

[R] Loop function/comparison operator problem

2009-10-05 Thread jimdare
Hi There, I have created the following function format<- function(){ repeat { form<-readline(paste("\nIn what format do you want to save these plots?\nChoose from: wmf, emf, png, jpg, jpeg, bmp, tif, tiff, ps, eps, or pdf.\nNote: eps is the suggested format for publication quality plots.\nPlot f

Re: [R] loop function

2007-09-13 Thread Peter Dalgaard
Alfredo Alessandrini wrote: > Hi, > > If I have this values: > > 21 > 23 > 14 > 58 > 26 > > > How can I sum the values by a progression like this: > > (21) > (21 + 23) > (21 + 23 + 14) > (21 + 23 + 14 + 58) > (21 + 23 + 14 + 58 + 26) > (21 + 23 + 14 + 58 + 26) > > I've try with the functio

Re: [R] loop function

2007-09-13 Thread jim holtman
Is this what you want: > x [1] 21 23 14 58 26 > cumsum(x) [1] 21 44 58 116 142 On 9/13/07, Alfredo Alessandrini <[EMAIL PROTECTED]> wrote: > Hi, > > If I have this values: > > 21 > 23 > 14 > 58 > 26 > > > How can I sum the values by a progression like this: > > (21) > (21 + 23) > (21 + 2

[R] loop function

2007-09-13 Thread Alfredo Alessandrini
Hi, If I have this values: 21 23 14 58 26 How can I sum the values by a progression like this: (21) (21 + 23) (21 + 23 + 14) (21 + 23 + 14 + 58) (21 + 23 + 14 + 58 + 26) (21 + 23 + 14 + 58 + 26) I've try with the function "loop" Best Wishes, Alfredo [[alternative HTML v