Hi Rui and Ivan,Thank you explain of the code for me in detail. This is very
helpful. And the code works well now.Happy Holiday,Kai
On Wednesday, December 22, 2021, 02:30:49 PM PST, Rui Barradas
wrote:
Hello,
y[i] and c[i] are character strings, they are not variables of data set mpg.
Hello,
There's a stupid typo in my previous post. Inline
Às 22:30 de 22/12/21, Rui Barradas escreveu:
Hello,
y[i] and c[i] are character strings, they are not variables of data set
mpg.
To get the variables, use, well, help("get").
Note that I have changed the temp dir to mine. So I created
Hello,
y[i] and c[i] are character strings, they are not variables of data set mpg.
To get the variables, use, well, help("get").
Note that I have changed the temp dir to mine. So I created a variable
to hold the value
tmpdir <- "c:/temp/"
for (i in seq(nrow(mac))){
mpg %>%
filter(hwy
strange, I got error message when I run again:
Error: unexpected symbol in:
" geom_point()
ggsave"
> }
Error: unexpected '}' in "}"
On Wednesday, December 22, 2021, 10:18:56 AM PST, Kai Yang
wrote:
Hello Eric, Jim and Ivan,
Many thanks all of your help. I'm a new one in R area. I
Hello Eric, Jim and Ivan,
Many thanks all of your help. I'm a new one in R area. I may not fully
understand the idea from you. I modified my code below, I can get the plots
out with correct file name, but plots are not using correct fields' name. it
use y[i], and c[i] as variables' name, does
On Wed, 22 Dec 2021 16:58:18 + (UTC)
Kai Yang via R-help wrote:
> mpg %>% filter(hwy <35) %>% ggplot(aes(x = displ, y = y[i],
> color = c[i])) + geom_point()
Your code relies on R's auto-printing, where each line of code executed
at the top level (not in loops or functions) is run
You may have to add an explicit 'print' to ggplot
library(ggplot2)
library(tidyverse)
y <- c("hwy","cty")
c <- c("cyl","class")
f <- c("hwy_cyl","cty_class")
mac <- data.frame(y,c,f)
for (i in nrow(mac)){
mpg %>%filter(hwy <35) %>%
print(ggplot(aes(x = displ, y = y[i], color = c[i])) +
Try replacing
"c:/temp/f[i].jpg"
with
paste0("c:/temp/",f[i],".jpg")
On Wed, Dec 22, 2021 at 7:08 PM Kai Yang via R-help
wrote:
> Hello R team,I want to use for loop to generate multiple plots with 3
> parameter, (y is for y axis, c is for color and f is for file name in
> output). I created a
nrow() is just the numbers of rows in your data frame, use seq_len(nrow())
or seq(nrow()) to loop through all row numbers
On Wed, Dec 22, 2021, 12:08 Kai Yang via R-help
wrote:
> Hello R team,I want to use for loop to generate multiple plots with 3
> parameter, (y is for y axis, c is for color a
Hello R team,I want to use for loop to generate multiple plots with 3
parameter, (y is for y axis, c is for color and f is for file name in output).
I created a data frame to save the information and use the information in for
loop. I use y[i], c[i] and f[i] in the loop, but it seems doesn't wor
Tmoy.png",
> > paste("C:/MONOGRAPHIE/Resultats/Evolution Tmoy_",CPM[i],".png",sep="")
> >
> >
> >
> > *Lähettäjä: *Rachida El Ouaraini
> > *Lähetetty: *maanantai 29. maaliskuuta 2021 18.15
> > *Vastaanottaja: *r-help@r-
Lähetetty Samsung Galaxy -älypuhelimesta.
Alkuperäinen viesti
Lähettäjä: Rachida El Ouaraini
Päivämäärä: 30.3.2021 12.25 (GMT+02:00)
Saaja: Mika Hamari
Kopio: r-help@r-project.org
Aihe: Re: [R] "for" loop does not work with my plot_ly command
Hi Mika,
and thank you very
Hi Jim,
Many thanks for your answer !
I tried what you suggested but it doesn't work.
I've got NO error message, but nothing happens at the end : no graphs !
It seems to me that the command "plot_ly" and the "for" loop DO NOT
coexist, that's why I ask you how to overcome this problem?
Thank you aga
> *Lähettäjä: *Rachida El Ouaraini
> *Lähetetty: *maanantai 29. maaliskuuta 2021 18.15
> *Vastaanottaja: *r-help@r-project.org
> *Aihe: *[R] "for" loop does not work with my plot_ly command
>
>
>
> Hi everyone,
> I am new to R programming, and I am having diff
Hi Rachida,
My guess is that you create a vector of filenames:
filenames<-list.files(path="FicConfig",pattern="*.txt")
then use the filenames in the loop:
for(filename in filenames) {
nextfile<- read.table(filename, header = TRUE, sep = "\t" , dec =
",", skip = 0)
# do whatever you want with
anottaja: r-help@r-project.org<mailto:r-help@r-project.org>
Aihe: [R] "for" loop does not work with my plot_ly command
Hi everyone,
I am new to R programming, and I am having difficulties modifying an R
script to introduce the "for" loop in the code.
While searching I found t
Hi everyone,
I am new to R programming, and I am having difficulties modifying an R
script to introduce the "for" loop in the code.
While searching I found that this issue has already been raised, but I did
not know what to do to fix mine !
*The code that works (without for command):*
CPM <- read
No, I am confounded, It does return the value of the expressions
within the respective braces, just like ifelse. Learn something every
day.
Jim
On Mon, Mar 22, 2021 at 9:35 PM Jim Lemon wrote:
>
> If he's setting PRE to the return value of "if", that is the logical
> value of the expression in t
If he's setting PRE to the return value of "if", that is the logical
value of the expression in the if statement as far as I know. I think
that the expression within the else clause would be evaluated but not
assigned to anything and since it is within the loop, would just be
lost.
PRE<-ifelse(mis
On 22/03/2021 1:59 a.m., Jim Lemon wrote:
Hi Goyani,
You are setting "PRE" to the return value of "if" which is one of TRUE
(1), FALSE(0) or NULL.
That's not true at all. The statement was
PRE<- if(missing(GAY)){
(GA/GA) * 100
} else {
(GA/GAY) * 100
}
so the result
Hi Goyani,
You are setting "PRE" to the return value of "if" which is one of TRUE
(1), FALSE(0) or NULL. Because GAY is always missing in your example,
"PRE" is always set to 1. Then you always want to pass 1 in the sample
list, and that will not assign anything to PRE. By correcting the "if"
claus
Hi Goyani,
In its present form, the function stalls because you haven't defined
pmat before trying to pass it to the function. gmat and wmat suffered
the same fate. Even if I define these matrices as I think you have,
"solve" fails because at least one is singular. First, put the
function in order
I created custom function according to my requirement which is given below:
*selection.index<- function(ID, phen_mat, gen_mat, weight_mat, GAY){ ID =
toString(ID) p<- as.matrix(phen_mat) g<- as.matrix(gen_mat) w<-
as.matrix(weight_mat) bmat<- solve(phen_mat) %*% gen_mat %*% weigh
Awesome, thanks!
On Wed, Oct 28, 2020 at 7:00 AM Deepayan Sarkar
wrote:
>
> On Tue, Oct 27, 2020 at 6:04 PM Luigi Marongiu
> wrote:
> >
> > Hello,
> > I am using e1071 to run support vector machine. I would like to plot
> > the data with lattice and specifically show the hyperplanes created by
On Tue, Oct 27, 2020 at 6:04 PM Luigi Marongiu wrote:
>
> Hello,
> I am using e1071 to run support vector machine. I would like to plot
> the data with lattice and specifically show the hyperplanes created by
> the system.
> I can store the hyperplane as a contour in an object, and I can plot
> on
Hi: I think you're writing over the plots so only the last one exists.
Maybe try P = P + whatever but
I'm not sure if that's allowed with plots.
On Tue, Oct 27, 2020 at 8:34 AM Luigi Marongiu
wrote:
> Hello,
> I am using e1071 to run support vector machine. I would like to plot
> the data with
Hello,
I am using e1071 to run support vector machine. I would like to plot
the data with lattice and specifically show the hyperplanes created by
the system.
I can store the hyperplane as a contour in an object, and I can plot
one object at a time. Since there will be thousands of elements to
plot
> Wensui Liu
> on Sun, 23 Sep 2018 13:26:32 -0500 writes:
> what you measures is the "elapsed" time in the default
> setting. you might need to take a closer look at the
> beautiful benchmark() function and see what time I am
> talking about.
> I just provided ten
One issue I haven't seen mentioned (and apologize if I've missed it) is that
of making programs readable for long-term use. In the histoRicalg project to
try to document and test some of the codes from long ago that are the
underpinnings
of some important R computations, things like the negative i
In my opinion this is a pretty reasonable question for someone new to R.
Yes, it can be written without a for loop, and it would be better. Rich
Heiberger gave a good solution early on, but I'd like to add an outline of the
reasoning that leads to the solution.
You are taking the log of a ratio
"... I learned to say "try it and see" in many different ways. "
Version 2: *Never* parallelize your computations except when you
should.
;-)
-- Bert
On Sun, Sep 23, 2018 at 1:20 PM Duncan Murdoch
wrote:
> On 23/09/2018 4:00 PM, Wensui Liu wrote:
> > Very insightful. Thanks, Duncan
>
On 23/09/2018 4:00 PM, Wensui Liu wrote:
Very insightful. Thanks, Duncan
Based on your opinion, is there any benefit to use the parallelism in
the corporate computing environment where the size of data is far more
than million rows and there are multiple cores in the server.
I would say "try
Very insightful. Thanks, Duncan
Based on your opinion, is there any benefit to use the parallelism in the
corporate computing environment where the size of data is far more than
million rows and there are multiple cores in the server.
Actually the practice of going concurrency or not is more rela
On Sun, 23 Sep 2018, Duncan Murdoch wrote:
On 23/09/2018 3:31 PM, Jeff Newmiller wrote:
[lots of good stuff deleted]
Vectorize is
syntactic sugar with a performance penalty.
[More deletions.]
I would say Vectorize isn't just "syntactic sugar". When I use that term, I
mean something that
On 23/09/2018 3:31 PM, Jeff Newmiller wrote:
[lots of good stuff deleted]
Vectorize is
syntactic sugar with a performance penalty.
[More deletions.]
I would say Vectorize isn't just "syntactic sugar". When I use that
term, I mean something that looks nice but is functionally equivalent.
On Sun, 23 Sep 2018, Wensui Liu wrote:
what you measures is the "elapsed" time in the default setting. you
might need to take a closer look at the beautiful benchmark() function
and see what time I am talking about.
When I am waiting for the answer, elapsed time is what matters to me.
Also, s
On Sun, Sep 23, 2018 at 2:26 PM Wensui Liu wrote:
>
> what you measures is the "elapsed" time in the default setting. you
> might need to take a closer look at the beautiful benchmark() function
> and see what time I am talking about.
I'm pretty sure you do not know what you are talking about.
>
tember 23, 2018 2:26 PM
To: Ista Zahn
Cc: r-help@r-project.org
Subject: Re: [R] For Loop
CAUTION: This message originated from a non UMB, UMSOM, FPI, or UMMS email
system. Whether the sender is known or not known, hover over any links before
clicking and use caution opening attachments.
what
ove prior to faxing)
From: R-help on behalf of Wensui Liu
Sent: Sunday, September 23, 2018 2:26 PM
To: Ista Zahn
Cc: r-help@r-project.org
Subject: Re: [R] For Loop
CAUTION: This message originated from a non UMB, UMSOM, FPI, or UMMS email
system. Whether
Subject: Re: [R] For Loop
CAUTION: This message originated from a non UMB, UMSOM, FPI, or UMMS email
system. Whether the sender is known or not known, hover over any links before
clicking and use caution opening attachments.
what you measures is the "elapsed" time in the default se
what you measures is the "elapsed" time in the default setting. you
might need to take a closer look at the beautiful benchmark() function
and see what time I am talking about.
I just provided tentative solution for the person asking for it and
believe he has enough wisdom to decide what's best.
On Sun, Sep 23, 2018 at 1:46 PM Wensui Liu wrote:
>
> actually, by the parallel pvec, the user time is a lot shorter. or did
> I somewhere miss your invaluable insight?
>
> > c1 <- 1:100
> > len <- length(c1)
> > rbenchmark::benchmark(log(c1[-1]/c1[-len]), replications = 100)
>
actually, by the parallel pvec, the user time is a lot shorter. or did
I somewhere miss your invaluable insight?
> c1 <- 1:100
> len <- length(c1)
> rbenchmark::benchmark(log(c1[-1]/c1[-len]), replications = 100)
test replications elapsed relative user.self sys.self
1 log(c1[
On Sun, Sep 23, 2018 at 10:09 AM Wensui Liu wrote:
>
> Why?
The operations required for this algorithm are vectorized, as are most
operations in R. There is no need to iterate through each element.
Using Vectorize to achieve the iteration is no better than using
*apply or a for-loop, and betrays
On Sat, Sep 22, 2018 at 9:06 PM Wensui Liu wrote:
>
> or this one:
>
> (Vectorize(function(i) log(c1[i + 1] / c1[i])) (1:len))
Oh dear god no.
>
> On Sat, Sep 22, 2018 at 4:16 PM rsherry8 wrote:
> >
> >
> > It is my impression that good R programmers make very little use of the
> > for statemen
I do use for loops a few times per month, but only wrapped around large chunks
of vectorized calculations, not for this kind of use case. In those cases I
also pre-allocate output vectors/lists (e.g. vector( "list", len )) to avoid
memory thrashing as you grow lists or other vectors one element
or this one:
(Vectorize(function(i) log(c1[i + 1] / c1[i])) (1:len))
On Sat, Sep 22, 2018 at 4:16 PM rsherry8 wrote:
>
>
> It is my impression that good R programmers make very little use of the
> for statement. Please consider the following
> R statement:
> for( i in 1:(len-1) ) s[i]
another version just for fun
s <- parallel::pvec(1:len, function(i) log(c1[i + 1] / c1[i]))
On Sat, Sep 22, 2018 at 4:16 PM rsherry8 wrote:
>
>
> It is my impression that good R programmers make very little use of the
> for statement. Please consider the following
> R statement:
> for(
c1 <- 1:100
len <- 100
system.time(
s1 <- log(c1[-1]/c1[-len])
)
s <- c1[-len]
system.time(
for (i in 1:(len-1)) s[i] <- log(c1[i+1]/c1[i])
)
all.equal(s,s1)
>
> c1 <- 1:100
> len <- 100
> system.time(
+ s1 <- log(c1[-1]/c1[-len])
+ )
user system elapsed
0.032 0.005 0.03
Bob:
Please, please spend some time with an R tutorial or two before you post
here. This list can help, but I think we assume that you have already made
an effort to learn basic R on your own. Your question is about as basic as
it gets, so it appears to me that you have not done this. There are ma
It is my impression that good R programmers make very little use of the
for statement. Please consider the following
R statement:
for( i in 1:(len-1) ) s[i] = log(c1[i+1]/c1[i], base = exp(1) )
One problem I have found with this statement is that s must exist before
the statement is
Sent: Monday, September 10, 2018 8:33 PM
To: r-help@r-project.org
Subject: Re: [R] For loop with multiple iteration indexes
Thank you everyone. After thinking about each response, I realized a fairly
simple solution is available (obviously, other suggested approaches work as
well):
stopifnot(leng
Thank you everyone. After thinking about each response, I realized a fairly
simple solution is available (obviously, other suggested approaches work as
well):
stopifnot(length(x) == length(y); stopifnot(length(x) > 0)
r <- list()
for (i in 1:length(x) ) {
r[[i]] <- cor(x = dat[, x[i] ], y = dat
I have a sense of deja vu:
https://www.mail-archive.com/r-help@r-project.org/msg250494.html
There is some good advice there.
> On Sep 9, 2018, at 3:49 PM, David Disabato wrote:
>
> Hi R-help,
>
> I am trying to create a for loop with multiple iteration indexes. I don't
> want to use two diffe
Hi,
this simple example is very similarly, and it works in R:
r <- list()
n <- 0
x <- c("a","b","c")#x,y: Data from a dataframe
y <- c("A","B","C")
for (k in 1:3) {
n <- n+1
r[[n]] <- paste0(x[k],y[k])#or any other function using x[k] and y[k] as
arguments
}
print(r)
Is it this what you
Hi David,
If you mean that you have two data frames named x and y and want the
correlations between the columns that would be on the diagonal of a
correlation matrix:
r<-list()
for(i in 1:n) r[[i]]<-cor(x[,i],y[,i])
If I'm wrong, let me know.
Jim
On Mon, Sep 10, 2018 at 3:06 PM David Disabato
Hi R-help,
I am trying to create a for loop with multiple iteration indexes. I don't
want to use two different for loops nested together because I don't need
the full matrix of the two indexes, just the diagonal elements (e.g., i[1]
& j[1] and i[2] & j[2], but not i[1] & j[2]). Is there a way to s
t of Social and Health Services
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ahmed
> Attia
> Sent: Thursday, June 22, 2017 9:50 AM
> To: r-help
> Subject: [R] For loop
>
> Hello R users,
>
> The code below is for loop i
Hello,
Without correcting your code, it's obvious that the expressions like
leafbiom97$Date == "i" and all others with"i" and "i - 1" are wrong.
leafbiom97$Date is of class Date, not character. And, besides,
for(i in ...) makes of i a numeric variable that has nothing to do with
"i". This "i"
Hello R users,
The code below is for loop in R that I want to do to following
calculation at each time i and i-1 in 2:75 dataset
(Litterfall_Ahmed97).
ac = ((LeafBiog at date i
-LeafBiog at date i-1, dataset = leafbiom97) + (littperiod at date i,
dataset= Litterfall_Ahmed97))/(sum (GPP from date
That is right, Bob. Only one loop for now, since I do not know how to set up
the 2nd loop. Any advice from the community? Thank you!
Sent from my iPhone
> On Jan 12, 2017, at 4:49 PM, Robert Sherry wrote:
>
> I only see one for loop in your code. I am wondering if you want a second for
> l
I only see one for loop in your code. I am wondering if you want a
second for loop based upon the length of newdata.
I would also think that you do not need the second call to set.seed.
Bob
On 1/12/2017 4:44 PM, Jennifer Sheng wrote:
Dear friends, I am working on a double loop using for. On
Dear friends, I am working on a double loop using for. One level of loop
is to predict N times for each subject, and the second level is to predict
M times for the every subject, one subject after one subject. Please note
every subject have different N or M rows of data. Any advice? Thank yo
On 17/11/2016 6:26 AM, Ulrik Stervbo wrote:
Hi Georg,
Your for loop iterates over just one value, to get it to work as you intend
use for(item in 1:length(kpis)){}
That usually works, but fails often enough that we recommend using
for (item in seq_along(kpis)) {}
(The failures happen if leng
Hi Georg,
Your for loop iterates over just one value, to get it to work as you intend
use for(item in 1:length(kpis)){}
HTH
Ulrik
On Thu, 17 Nov 2016 at 12:18 wrote:
> Hi All,
>
> I need to execute a loop on variables to compute several KPIs.
> Unfortunately the for loop is executed only once
Hi All,
I need to execute a loop on variables to compute several KPIs.
Unfortunately the for loop is executed only once for the last KPI given.
The code below illustrates my current solution but is not completely
necessary to spot the problem. I just give an idea what I am doing
overall. Looks
Hi maryam (firoozi),
Apart from the fact that you are overworking your sires (or the more
realistic scenario of differential mating success) you can achieve the
700:30 ratio in this simple way:
sires<-paste("Sire",1:30,sep="")
dams<-paste("Dam",1:700,sep="")
ped<-data.frame(offspring=1:700,sire=sa
Dear Maryam
Please keep the list cc'ed in as others will have better answers than me.
If dam has 700 members then sample (dam) gives you a random permutation
of dams, each once.
I did not understand the second part as i do not think you can have 30
sires each occurring 20 times. Did you mean
Dear Maryam
sample(dam) would give you a random permutation of dams
sample(c(sire, sire)) would give you a random permutation of sires, each
twice.
Does that help?
On 12/01/2016 05:53, maryam firoozi via R-help wrote:
Dear mr/madam
I want to mak a matrix with 10 row and 3 column . this matr
Dear mr/madam
I want to mak a matrix with 10 row and 3 column . this matrix is pedigree. my
input
sire<- c(1,2,3,4,5)
count<- 0
sire<- cbind(sire,count)
dam<- c(1,2,3,4,5,6,7,8,9,10)
ped<-mstrix(NA,nrow=10,ncol=3)
for(i in 1:10){
Sire<- sample(sire[,1],1)
a<- which(sire[,1]==Sire)
if(a){sire[a,2]
Hi
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Saba
> Sehrish via R-help
> Sent: Friday, December 04, 2015 11:21 AM
> To: r-help@r-project.org
> Subject: [R] For loop coding
>
> Hi
>
> I will be grateful if someone
Hi
I will be grateful if someone please tell me the programming to run regression
on time series data through "For Loop".
Regards.
Saba
Sent from Yahoo Mail on Android
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing lis
Thank you for your comments. I guess what I need is to store movements and
then loop through that matrix. Here is a snippet of the 'movement' code. I
am trying to fill the matrix below with data from this loop. Is there
something else my matrix (bottom) requires? Or its positioning?
Many thanks,
versity
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jim Lemon
Sent: Saturday, October 10, 2015 6:04 AM
To: mnw
Cc: r-help mailing list
Subject: Re: [R] for loop not working
Hi mnw,
It looks to me as though you are testing the entire "holder&quo
Hi mnw,
It looks to me as though you are testing the entire "holder" list each time
you go through the function. First, I'm not sure that a simple "==" is the
test you want. "movement" seems to be more than a single value and so you
might want to write a function that tests whether all of the compo
Hi. I have some code which loops through raw GPS data. This initial loop
calculates distance, angle, speed etc between successive coordinates as well
as type of movement e.g.left, right, forward. I want to construct a second
loop that goes through the movements and records 'Changes' as either '0' o
roubleshooting just a bit
difficult. And which method I use can be a crap shoot.
John Kane
Kingston ON Canada
> -Original Message-
> From: dwinsem...@comcast.net
> Sent: Thu, 11 Jun 2015 16:48:40 -0700
> To: k.kowit...@icloud.com
> Subject: Re: [R] for loop incorrect row co
Oh, Swami, gazing into the crystal ball one can see ...
;-}
Cheers,
Bert
Bert Gunter
"Data is not information. Information is not knowledge. And knowledge is
certainly not wisdom."
-- Clifford Stoll
On Thu, Jun 11, 2015 at 4:48 PM, David Winsemius
wrote:
>
> On Jun 11, 2015, at 12:25 PM,
On Jun 11, 2015, at 12:25 PM, Kevin Kowitski wrote:
> Hey,
>
> I am having an issue with a for loop that is intended to read index values
> by row and column so that it can pull out the valuable information. My issue
> is that I am using a data.frame(which(df==1, arr.ind=TRUE))
That would
Hey,
I am having an issue with a for loop that is intended to read index values by row and
column so that it can pull out the valuable information. My issue is that I am using a
data.frame(which(df==1, arr.ind=TRUE)) to find the index of the values in my data frame
that are equal to 1. Th
Hi,
Not sure I understand correctly. May be this helps:
##If the blocks are created as a list
set.seed(475)
lst1 <- setNames(lapply(1:10, function(i) {rowN <- sample(20,1)*15;
matrix(sample(40,10*rowN, replace=TRUE), nrow=rowN)}),1:10)
sapply(lst1,nrow)>100
# 1 2 3 4 5
contact the sender.
From: David Gwenzi [mailto:dgwe...@gmail.com]
Sent: 15. maj 2014 07:43
To: Frede Aakmann Tøgersen
Subject: Re: [R] for loop using index values
Hi Frede,
Thanks for your reple. I guess I am not making my question very clear. Sorry
about that. Let me re-phrase it this w
; -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of David Winsemius
> Sent: 15. maj 2014 06:49
> To: David Gwenzi
> Cc: r-help@r-project.org
> Subject: Re: [R] for loop using index values
>
>
> On May 14, 2014,
On May 14, 2014, at 9:23 PM, David Gwenzi wrote:
Hi all
I have point data along a transect and I want to divide the transect
into
small blocks of 10m length each. I have named the blocks as a list i.e
subset[[i]]. Now the issue is I want to process only those blocks
that have
at least 10
Hi all
I have point data along a transect and I want to divide the transect into
small blocks of 10m length each. I have named the blocks as a list i.e
subset[[i]]. Now the issue is I want to process only those blocks that have
at least 100 data points and keep the original index values of those
s
Hi,
I am bootstrapping, but my loops are taking way too long & I need to make it
faster. Looking on the R-help archive I suspect it may be due to not
specifying the size of my data.frame, mainly because I don't know in advance
how large it has to be. Can anyone help?
My data looks like this (firs
You seem overly intent on getting a for loop into your code. Jorge's solution
has the same effect as your for loop.
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#.
Hi Jorge,
Thanks so much! Exactly what I wanted. Finally I wrote:
for(i in 1976:1981){
PE.files_01_7681 <- paste("val_mapped_petpe_", 1976:i, "01.txt", sep="")
}
Cheers,
Bea
On 21/04/2014 10:46, Jorge I Velez wrote:
> Hi Beatriz,
>
> Try
>
> paste("val_mapped_petpe_", 1976:1981, "01.txt", s
Hi Beatriz,
Try
paste("val_mapped_petpe_", 1976:1981, "01.txt", sep="")
Best,
Jorge.-
On Mon, Apr 21, 2014 at 6:43 PM, Beatriz R. Gonzalez Dominguez <
aguitatie...@hotmail.com> wrote:
> Dear all,
>
> I'm trying to create a loop to select a series of files into my computer
> but I haven't been
Dear all,
I'm trying to create a loop to select a series of files into my computer
but I haven't been successful until now. I've looked into different
possibilities but none has worked. I'd appretiate if you could help me
by providing me with some ideas.
Basically what I'd like to do is to
Hi,
May be this helps:
res.i <- NULL
for(i in seq_along(x)){ res.i <- c(res.i,x[i]-y[i])}
#or using your nested loop:
res.ij <- NULL
for(i in seq_along(x)){
for(j in seq_along(y)){
if(i==j){
res.ij <- c(res.ij,x[i]-y[j])
}
}}
identical(x-y,res.i)
#[1] TRUE
identical(res.i,res.ij)
#[1] TR
-project.org
Subject: [R] "for" loop in R - strange behaviour
Hi, I notice the following from a "for" loop in R, which seems strange to
me:
When I do this:
---
first <- 0
nstep <- 10
N <- 14
while(first < N)
{
print("---> ")
last <- f
On 29/01/2014 11:32 AM, Supriya Jain wrote:
Hi, I notice the following from a "for" loop in R, which seems strange to
me:
When I do this:
---
first <- 0
nstep <- 10
N <- 14
while(first < N)
{
print("---> ")
last <- first + nstep
if(last > N)
last <- N
#start <- first+2
f
Hi, I notice the following from a "for" loop in R, which seems strange to
me:
When I do this:
---
first <- 0
nstep <- 10
N <- 14
while(first < N)
{
print("---> ")
last <- first + nstep
if(last > N)
last <- N
#start <- first+2
for(i in (first+2):last)#
s(mydf))
> print((percent(length(is.null(mydf [, cname]) / lines))
>
> Br. Frede
>
>
> Oprindelig meddelelse ----
> Fra: Jeff Johnson
> Dato:18/01/2014 02.10 (GMT+01:00)
> Til: R help
> Emne: [R] For loop on column names
>
> I'm trying to
Hi
Try
for (cname in colnames(mydf))
print((percent(length(is.null(mydf [, cname]) / lines))
Br. Frede
Oprindelig meddelelse
Fra: Jeff Johnson
Dato:18/01/2014 02.10 (GMT+01:00)
Til: R help
Emne: [R] For loop on column names
I'm trying to find a more efficient to calc
I'm trying to find a more efficient to calculate the percent a field is
populated and repeat it for each field (column).
First, I'm counting the number of lines:
lines <- as.integer(countLines(extract) - 1)
dput(lines)
10L
extract <- 'C:/Users/jeffjohn/Desktop/batchextract_100k_sample.csv'
my
Hi,
I guess you need to change the parentheses from:
ts=sum(t(m.sham),pick.a[count])
#to
ts=sum(t(m.sham,pick.a[count]))
#similarly for tc:
for(count in 1:length(pick.a)){
ts=sum(t(m.sham,pick.a[count]))
tc=sum(t(m.control,pick.a[count]))
output[count,2] <- (ts-tc)/ts
}
A.K.
On Sunday, J
On 14-01-05 3:47 PM, Mathew Nagendran wrote:
I'm relatively new to R. I'm trying to for loop but I keep getting an error
message. Can anyone hint at what I am doing wrong please?
Nothing to do with the for loop. You have a call to your t function in
which you don't specify a value for the a
I'm relatively new to R. I'm trying to for loop but I keep getting an error
message. Can anyone hint at what I am doing wrong please?
> m.control=c(1.45,9.40,9.96,4.2,1.86,0.2)
> m.sham=c(3.39,23.94,23.62,10.08,2.99,1.09)
>
> t=function(m, a){(1-exp(-a*m))} #t function defined
>
> d=function(ts,
1 - 100 of 472 matches
Mail list logo