Re: [R] Extract last 3 characters from numeric vector

2011-12-04 Thread Kang Min
Thanks Sarah, but I discovered that numbers like 3.0 only have 1 character, so I had a range of character lengths from 1 to 4 (e.g. 17.0 has 2 characters, 3.4 has 3 and 12.4 has 4). Uwe's method worked well. Thanks again. Kang Min On Dec 4, 11:42 pm, Uwe Ligges wrote: > On 04.12.20

[R] Extract last 3 characters from numeric vector

2011-12-04 Thread Kang Min
function but that extracts characters based on exact positions. How can I extract just the last 3 characters no matter the length of the number? e.g. from 16.7 I want 6.7, from 3.5 I want 3.5 as it is. Thanks, Kang Min __ R-help@r-project.org maili

Re: [R] Overlapping plot in lattice

2011-10-02 Thread Kang Min
Thanks Gabor, that was exactly what I needed. On Sep 30, 9:00 pm, Gabor Grothendieck wrote: > On Fri, Sep 30, 2011 at 3:01 AM, Kang Min wrote: > > Hi all, > > > I was wondering if there's an equivalent to par(new=T) of the plot > > function in lattice. I'm pl

[R] Overlapping plot in lattice

2011-09-30 Thread Kang Min
lim=c(0,10)) par(new=T) plot(6,6, xlim=c(0,10), ylim=c(0,10), pch=16) Is there a way to do this in lattice? Thanks, Kang Min __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-p

Re: [R] Extracting day of month from Date objects

2011-05-24 Thread Kang Min
                            - Phil Spector >                                          Statistical Computing Facility >                                          Department of Statistics >                                          UC Berkeley > > On May 24, 2011, at 10:19 AM, Kang Min wrote: > > > I have another q

Re: [R] grep pattern

2011-05-24 Thread Kang Min
I just need to tweak it a little, but haven't been able to figure it out. y[grep("[[:digit:]]{2}$", y)] Thanks. Kang Min On May 23, 7:22 am, jim holtman wrote: > If you want to only match names of length 6, you will have to use thispattern: > > > x <- c("ZFHSJK

Re: [R] grep pattern

2011-05-22 Thread Kang Min
Thanks! On May 21, 7:09 am, David Winsemius wrote: > On May 20, 2011, at 11:57 AM, Kang Min wrote: > > > Hi all, > > > I'm trying to subset a pattern in a vector. Each argument has 6 > > letters, and I need those that start with Z and end with Z. > > > e

[R] grep pattern

2011-05-20 Thread Kang Min
Hi all, I'm trying to subset a pattern in a vector. Each argument has 6 letters, and I need those that start with Z and end with Z. e.g. x <- c("ZFHSJK", "ZFHJKZ","ZIOPWE","ZLKJSD","ZKFLPZ") I've looked up other discussions but still can't seem to find the answer. Thanks. Kangmin

[R] Axis label colour

2011-05-02 Thread Kang Min
Hi all, Is there an argument in the axis() function to change the colour of the tick labels? I only found col.ticks, and col.lab, but they're not doing what I want. Thanks, KM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] Subset using grepl

2011-03-17 Thread Kang Min
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Kang Min > Sent: Thursday, 17 March 2011 1:29 PM > To: r-h...@r-project.org > Subject: Re: [R]Subsetusinggrepl > > I have a new question, also regardinggrepl. > I would like tosubsetrows wi

Re: [R] Subset using grepl

2011-03-16 Thread Kang Min
NA NA 6j NA NA NA On Jan 29, 10:43 pm, Prof Brian Ripley wrote: > On Sat, 29 Jan 2011, Kang Min wrote: > > Thanks Prof Ripley, the condition worked! > > Btw I tried to search ?repl but I don't have documentation for it. Is > > it in a non-basic pa

Re: [R] Subset using grepl

2011-01-29 Thread Kang Min
and not needed in this example) in general the > effect of "[A-Z]" depends on the locale, so you could write out > "[ABCDEFIJK]" or create it by > > cond <- paste("[", paste(LETTERS[1:10], collapse=""), "]", sep="") >

[R] Subset using grepl

2011-01-29 Thread Kang Min
ried: subset(data, grepl(LETTERS[1:10], z)) # got only rows with A subset(data, z %in% LETTERS[1:10]) # got no rows I think I'm getting close to the solution but need a little bit of help here, thanks in advance. Kang Min __ R-help@r-project.org mai

Re: [R] xyplot: modify axis tick marks

2011-01-17 Thread Kang Min
Thanks for all your great suggestions! I've learnt a lot about graphics now.. Kang Min On Jan 17, 1:46 am, Hugo Mildenberger wrote: > Using lattice and the rainfall$Time series as proposed below by Dennis > gives also a nice result: > > rainfall$Time <- seq(from =

[R] xyplot: modify axis tick marks

2011-01-16 Thread Kang Min
s on the x-axis. I've been fiddling around with 'scales', and read previous posts about axis problems but I still can't find the solution. Thanks in advance. Kang Min timerainfall Jan1993 176.4 Feb1993 69.2 Mar1993 250.5 Apr1993 283.9 May1993 129.9 Jun1993 115.5 Jul1993

Re: [R] xYplot error

2010-07-27 Thread Kang Min
Thanks for your help. KM On Jul 27, 9:58 pm, Frank Harrell wrote: > If the x-axis variable is really a factor, xYplot will not handle it. > You probably need a dot chart instead (see Hmisc's Dotplot). > > Note that it is unlikely that the confidence intervals are really > sy

[R] xYplot error

2010-07-27 Thread Kang Min
Hi, I'm trying to plot a graph with error bars using xYplot in the Hmisc package. My data looks like this. mortstand sitetype 0.042512776 0.017854525 Plot A ST 0.010459803 0.005573305 PF ST 0.005188321 0.006842107MSFST 0.004276068 0.01

Re: [R] Replacing NAs with 0 for a list of data frames

2010-05-31 Thread Kang Min
Thanks, it works except that I had to add xx <- as.data.frame(xx) into func. I am trying to calculate diversity indices using the vegan package, and the functions require zeroes instead of NAs. Thanks. Kang Min On May 31, 5:09 pm, Tal Galili wrote: > I would consider trying the plyr p

[R] Vegan fisher.alpha error

2010-05-31 Thread Kang Min
ata frames in the list, which gave me the error above. I have every data frame in the same format as the example data BCI, species as column names and quadrats as row names. Can anyone explain what the error is about? Thanks a lot. Kang Min __ R-hel

[R] Replacing NAs with 0 for a list of data frames

2010-05-31 Thread Kang Min
s. of 377 variables: ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ... ..$ ACTEEX: int [1:50] NA NA NA NA 2 NA NA NA NA NA ... ..$ ACTIML: int [1:50] NA NA NA NA 1 NA NA NA NA NA ... ..$ ADENMA: int [1:50] NA NA NA NA NA NA NA NA NA NA .

Re: [R] Selecting first 7 elements

2010-05-30 Thread Kang Min
Sorry I made a mistake in my code, lapply(x, "[", 8:14) works fine now. Thanks. On May 30, 10:55 pm, Jorge Ivan Velez wrote: > HiKang, > > Try either > > lapply(x, "[", 8:14)   # Erik Iverson's method > > or > > lapply(x, function(x) x[8:14]) > > HTH, > Jorge > > > > > > On Sun, May 30, 2010 at 9

Re: [R] Selecting first 7 elements

2010-05-30 Thread Kang Min
Hmm x[8:14] didn't work. Yes Iverson's method worked, I wanted the whole list, with 7 elements in each vector. Now I want the whole list as well, but with the 8th to 14th element. On May 30, 7:47 pm, David Winsemius wrote: > On May 29, 2010, at 11:37 PM, Kang Min wrote: > >

Re: [R] Selecting first 7 elements

2010-05-29 Thread Kang Min
What if I want to select the 8th to 14th element of the list? I tried to use "[" again, but it doesn't work. > > > > > "[" is a function, and you want to use it on each element of the list, > > > so... > > > > lapply(x, "[", c(1:7)) > > > and the call to c() is of course not necessary, since ":" w

Re: [R] Match 2 vectors

2010-05-28 Thread Kang Min
That's what I wanted, thanks!! On May 28, 5:13 pm, Dennis Murphy wrote: > Hi: > > On Thu, May 27, 2010 at 10:26 PM, Kang Min wrote: > > Hi, > > > I have 2 dataframes of unequal length, and I would like to match a > > factor to them so that both dataframes wi

[R] Match 2 vectors

2010-05-27 Thread Kang Min
2b the mismatches show up as NA in the whole row. Thanks. Kang Min __ R-help@r-project.org 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, minima

Re: [R] Subsetting with a list of vectors

2010-05-23 Thread Kang Min
; > +     x[sample(nrow(x),3),] > + }) > > > choice > > [[1]] >   plot plantno. species > 3    Y       54     GFE > 8    A       55     EGD > 4    E       12     ERF > > [[2]] >   plot plantno. species > 8    A       55     EGD > 2    D      

[R] Subsetting with a list of vectors

2010-05-23 Thread Kang Min
[[1]]) # this works as well, but I used a for loop to get it to select 7 plots 100 times. for (i in nrow(samp2)) { samp6 <- subset(data, plot %in% samp2[[i]]) } # this doesn't work Am I missing something, or is there a better solution? Thanks. Kang Min ___

Re: [R] Selecting first 7 elements

2010-05-23 Thread Kang Min
Thanks a lot, it works! On May 23, 3:10 pm, Erik Iverson wrote: > > "[" is a function, and you want to use it on each element of the list, > > so... > > > lapply(x, "[", c(1:7)) > > and the call to c() is of course not necessary, since ":" will generate a > vector. > > __

[R] Selecting first 7 elements

2010-05-22 Thread Kang Min
ch selections? Thank you. Kang Min __ R-help@r-project.org 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] Barchart reorder

2010-05-15 Thread Kang Min
It works! Thanks! On May 15, 10:46 pm, Gabor Grothendieck wrote: > Reorder it based on the negative of abundance to reverse it: > reorder(table$species, - table$abundance) > > > > On Sat, May 15, 2010 at 6:40 AM, Kang Min wrote: > > Hi fellow R users, > > > I ha

[R] Barchart reorder

2010-05-15 Thread Kang Min
ies, table$abundance), groups = table$class, stack = T, scales = list(x = list(draw = F)), auto.key = list(adj = 1)) Is there anything wrong with my code? Thanks. Kang Min __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

Re: [R] rotate levelplot

2009-10-25 Thread Kang Min
Hi David, Thanks a lot for the simple but effective solution. I got what I wanted by doing a levelplot(t(q2)). Kang Min On Oct 25, 8:46 pm, David Winsemius wrote: > On Oct 25, 2009, at 1:51 AM, Kang Min wrote: > > > Hi Milton, > > > The matrix can be generated using > &

Re: [R] rotate levelplot

2009-10-24 Thread Kang Min
data will flip the map upside down laterally. Thanks, Kang Min On Oct 25, 12:40 pm, milton ruser wrote: > Hi Kang, > > Could you send a reproducible sample-code? > > Bests > > miltinho > > > > On Sat, Oct 24, 2009 at 11:32 PM, Kang Min wrote: > > Hi all, &

[R] rotate levelplot

2009-10-24 Thread Kang Min
ottom"), scales=list (tick.number=10), aspect=c("iso")) Thanks, I'm ready to give more information if needed. Kang Min __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Changing the position of the origin

2008-11-17 Thread Kang Min
the lower left hand corner, but how can I plot the map with 0,0 starting from the top left hand? If possible I don't want to have to make all my y-values negative. Thanks, Kang Min Daniel Malter wrote: Hi, I don't understand the question. If your data is in the fourth quadrant (all pos