hard Raubertas
-Original Message- From: R-help
[mailto:r-help-boun...@r-project.org] On Behalf Of JeffNewmiller
Sent: Wednesday, April 27, 2016 3:58 PM To: Gordon, Fabiana;
'r-help@R-project.org' Subject: Re: [R] Create a new variable and
concatenation inside a "for&quo
As pointed out somewhere in the replies to this you can always use the
exists() function.
for(i in 1:5){
if(exists(output)){
output <- c(output, i )
}else{
output <- i
}
}
On Wed, Apr 27, 2016, 11:15 AM Gordon, Fabiana <
fabiana.gor...@imperial.ac.uk> wrote:
> Hello,
>
>
nal Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff Newmiller
Sent: Wednesday, April 27, 2016 3:58 PM
To: Gordon, Fabiana; 'r-help@R-project.org'
Subject: Re: [R] Create a new variable and concatenation inside a "for" loop
"c" an extre
> On Apr 28, 2016, at 4:51 AM, Gordon, Fabiana
> wrote:
>
>
> Maybe I wasn't clear about my query.
>
> I'm very familiar with pre-allocation and vectorization and I had already
> wrote an R code for this problem in this way. My question wasn't about the
> most efficient way to solve the
;From: Bert Gunter [mailto:bgunter.4...@gmail.com]
>Sent: 27 April 2016 21:18
>To: Jeff Newmiller
>Cc: Gordon, Fabiana; r-help@R-project.org
>Subject: Re: [R] Create a new variable and concatenation inside a "for"
>loop
>
>...
>
>"(R is case sensitive, so
ssage-
From: Bert Gunter [mailto:bgunter.4...@gmail.com]
Sent: 27 April 2016 21:18
To: Jeff Newmiller
Cc: Gordon, Fabiana; r-help@R-project.org
Subject: Re: [R] Create a new variable and concatenation inside a "for" loop
...
"(R is case sensitive, so "C" has no such proble
...
"(R is case sensitive, so "C" has no such problem)."
Well, not quite. Try ?C
To add to the previous comments, Dr. Gordon appears to need to do
her/his homework and spend some time with an R tutorial or two before
posting further here. There are many good ones on the web. Some
recommendations
"c" an extremely commonly-used function. Functions are first-class objects that
occupy the same namespaces that variables do, so they can obscure each other.
In short, don't use variables called "c" (R is case sensitive, so "C" has no
such problem).
Wherever possible, avoid incremental concaten
352
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Gordon, Fabiana
Sent: Wednesday, April 27, 2016 9:25 AM
To: 'r-help@R-project.org'
Subject: [R] Create a new variable and concatenation inside a "for" loop
Hello,
Suppose the you need a
Hello,
Suppose the you need a loop to create a new variable , i.e., you are not
reading data from outside the loop. This is a simple example in Matlab code,
for i=1:5
r1=randn
r2=randn
r=[r1 r2]
c(i,:)=r; % creation of each row of c , % the ":" symbol indicates all
columns. In R this would be
Hi
r-help-boun...@r-project.org napsal dne 30.03.2010 18:46:35:
> Hello,
>
> Thomas Jensen wrote:
> > Dear R-list,
> >
> > Sorry for spamming the list lately, I am just learning the more
advanced
> > aspects of R!
> >
> > I have some data that looks like this:
> >
> > Out Country1 Country 2
Easy using rowSums :
> x <- data.frame(X1=c(0,0,1),X2=c(1,1,1),X3=c(0,1,0))
> x$Nulls <- rowSums(x==0)
> x
X1 X2 X3 Nulls
1 0 1 0 2
2 0 1 1 1
3 1 1 0 1
Cheers
On Tue, Mar 30, 2010 at 6:31 PM, Thomas Jensen <
thomas.jen...@eup.gess.ethz.ch> wrote:
> Dear R-list,
>
> Sorr
Hello,
Thomas Jensen wrote:
Dear R-list,
Sorry for spamming the list lately, I am just learning the more advanced
aspects of R!
I have some data that looks like this:
Out Country1 Country 2 Country 3 ... CountryN
1 1 1 1 1
0 1 1 0
Dear R-list,
Sorry for spamming the list lately, I am just learning the more advanced
aspects of R!
I have some data that looks like this:
Out Country1 Country 2 Country 3 ... CountryN
1 1 1 1 1
0 1 1 0 1
1 1 0 1
14 matches
Mail list logo