Re: [R] REPLACE and REMOVE fns

2007-04-04 Thread jim holtman
Does this do it?

> x <- readLines("/temp/Giambi_03_post.txt")
> x.in  <- c("S", "D", "T", "HR", "O", "K", "E", "FL")
> x.out <- c( 1,   1,   1,   1,0,   0,   0,   0)
> # map the characters.  Assume that missing will be deleted
> x <- x.out[match(x, x.in)]
> x <- x[!is.na(x)]
>
> x
 [1] 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 1 1 0 0 0 0
0 1 1 0 0 0 1 0 0 0 1 0 0 0
[51] 1 0 0 0 1 1 0 0



On 4/4/07, Tina Robles <[EMAIL PROTECTED]> wrote:
>
> See attached...sorry
>
> On 4/4/07, Uwe Ligges <[EMAIL PROTECTED]> wrote:
> >
> >
> > Tina Robles wrote:
> > > I want to use the replace function on "R_Jeter_04_post" (see attached)
> > > so that S=1, D=1, T=1, HR=1, O=0, K=0, E=0, FC=0, and W,IW,and HP are
> > > removed, so that i have a simple list of 1's and 0's.
> >
> >
> > There are just 0's and 1's in your attachment ...
> >
> > Uwe Ligges
> >
> >
> >
> > > I understand that I need to use the command "replace(x,list,values)"
> > > and "rm()" but I'm having trouble using them. (syntax errors and
> > > whatnot)
> > >
> > > Any help would be appreciated.
> > >
> > >
> > >
> 
> > >
> > > __
> > > R-help@stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
> --
> Tina Robles
> [EMAIL PROTECTED]
> 305-710-5839
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] REPLACE and REMOVE fns

2007-04-04 Thread Tina Robles

See attached...sorry

On 4/4/07, Uwe Ligges <[EMAIL PROTECTED]> wrote:



Tina Robles wrote:
> I want to use the replace function on "R_Jeter_04_post" (see attached)
> so that S=1, D=1, T=1, HR=1, O=0, K=0, E=0, FC=0, and W,IW,and HP are
> removed, so that i have a simple list of 1's and 0's.


There are just 0's and 1's in your attachment ...

Uwe Ligges



> I understand that I need to use the command "replace(x,list,values)"
> and "rm()" but I'm having trouble using them. (syntax errors and
> whatnot)
>
> Any help would be appreciated.
>
>
> 
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




--
Tina Robles
[EMAIL PROTECTED]
305-710-5839
O
K
O
K
S
O
K
S
K
O
O
O
W
O
D
W
D
K
O
O
W
K
W
S
O
S
FC
K
O
O
S
O
O
W
O
K
S
W
HR
O
K
K
K
K
HR
HR
O
O
K
S
O
W
HP
O
O
D
O
W
K
W
W
O
S
O
O
K
S
HR
W
O
O




































































































































































































































































































































































































































































































































































































































































































__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] REPLACE and REMOVE fns

2007-04-04 Thread Uwe Ligges


Tina Robles wrote:
> I want to use the replace function on "R_Jeter_04_post" (see attached)
> so that S=1, D=1, T=1, HR=1, O=0, K=0, E=0, FC=0, and W,IW,and HP are
> removed, so that i have a simple list of 1's and 0's.


There are just 0's and 1's in your attachment ...

Uwe Ligges



> I understand that I need to use the command "replace(x,list,values)"
> and "rm()" but I'm having trouble using them. (syntax errors and
> whatnot)
> 
> Any help would be appreciated.
> 
> 
> 
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.