On 10/09/15 06:30, Frank Schwidom wrote:
c( as.factor( VAS))
On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote:
# your data
VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow",
"Black","Green","Black")
Better:
as.numeric(factor(VAS))
See fortune(185).
cheers
Just for fun:
> colSums( outer( VAS, VAS, '<'))
[1] 3 3 0 3 7 8 8 0 3 0
On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote:
> # your data
> VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black")
>
> # declare the new vector
> New_Vector<-numeric(length(V
VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black")
c(factor(VAS)) # to give integer indexing to the colors
---
This is very nice, Frank. And it can be easily adjusted to match the
original criterion that the numbers match the order of appearance of the
colors
c( as.factor( VAS))
On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote:
> # your data
> VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black")
>
> # declare the new vector
> New_Vector<-numeric(length(VAS))
>
> # brute force:
> New_Vector[VAS=="White"]<-1
>
how about this:
match(VAS,unique(VAS))
#or, preserving given order
match(VAS,c("White","Yellow","Green","Black"))
Cheers.
Am 05.09.2015 um 23:14 schrieb Dan D:
> # your data
> VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black")
>
> # declare the new vecto
# my last one:
xtfrm( VAS)
On Tue, Sep 08, 2015 at 11:55:51AM -0700, Dan D wrote:
> Great!
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Help-with-vectors-tp4711801p4712023.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
Great!
--
View this message in context:
http://r.789695.n4.nabble.com/Help-with-vectors-tp4711801p4712023.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.
On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote:
> # your data
> VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black")
>
> # declare the new vector
> New_Vector<-numeric(length(VAS))
>
> # brute force:
> New_Vector[VAS=="White"]<-1
> New_Vector[VAS=="Yell
# your data
VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black")
# declare the new vector
New_Vector<-numeric(length(VAS))
# brute force:
New_Vector[VAS=="White"]<-1
New_Vector[VAS=="Yellow"]<-2
New_Vector[VAS=="Green"]<-3
New_Vector[VAS=="Black"]<-4
# a litt
Hi Bill
Many thanks for your help.
Cheers
R
-Original Message-
From: William Dunlap [mailto:wdun...@tibco.com]
Sent: 10 July 2012 17:22
To: Raghuraman Ramachandran; r-help@r-project.org
Subject: RE: Help with vectors and rollapply
It looks like you already have the zoo package loaded so
It looks like you already have the zoo package loaded so you can use its
na.locf(),
which replaces NA's with the last non-NA value. Convert the 0s to NAs with
replace() and feed the result into na.locf():
a <- c(-2,0,0,0,1,0,0,3,0,0,-4)
aOut <- c(-2,-2,-2,-2,1,1,1,3,3,3,-4)
na.locf(replace
In additiion to Ivan's comment, in this case, you are just plotting
Yes or No. I think thats not what you want.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug 19, 2010, at 3:42 AM, Ivan Calandra wrote:
Hi,
I haven't spent
Hi,
I haven't spent too much time on it, but that might help:
if (coint_tests[[i]]=="YES")...
Note the double "=" which is the operator for equality. The single "="
is the assignment operator, especially with arguments.
HTH, Ivan
Le 8/19/2010 09:03, Ferreira, Thiago Alves a écrit :
> Good mor
Good morning,
I have something like this: names(coint_tests) <- apply(b,2,paste,
collapse="_") which prints 15 names like: A_B, C_D, E_F, ...
AA,B,C,D.. Are time series. Then there is a vector called coint_tests of length
15 which yields "yes" or "no".
I need to add a function to plot the time
14 matches
Mail list logo