search for: ngokangmin

Displaying 14 results from an estimated 14 matches for "ngokangmin".

2011 Sep 30
2
Overlapping plot in lattice
Hi all, I was wondering if there's an equivalent to par(new=T) of the plot function in lattice. I'm plotting an xyplot, and I would like to highlight one point by plotting that one point again using a different symbol. For example, where 6 is highlighted: plot(1:10, xlim=c(0,10), ylim=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?
2011 Jan 16
2
xyplot: modify axis tick marks
Hi, I would like to plot time against rainfall data (data is at the end) using xyplot. The basic code looks like this: xyplot(rainfall~time, type="a") When I do this, the graph looks ok except that the x-axis has too many values. I would just like to display the years and not the months on the x-axis. I've been fiddling around with 'scales', and read previous posts about
2010 May 31
1
Vegan fisher.alpha error
Hi, I have an error with fisher.alpha from the vegan package. > fisher.alpha(data[[1]]) Error in nlm(Dev.logseries, n.r = n.r, p = p, N = N, hessian = TRUE, ...) : missing value in parameter I am trying to find fisher alpha for a list of 100 data frames, and I tried it on individual data frames in the list, which gave me the error above. I have every data frame in the same format as the
2009 Oct 25
1
rotate levelplot
Hi all, I have a matrix with 5 rows and 10 columns, which represent the grids on a rectangular map. I used the code below to plot, but it gives me the map with the 10 columns as y-axis, and the 5 rows as the x-axis, and the (0,0) point is at the usual bottom left hand corner. My map starts with the (0,0) at the top left hand corner. How can I rotate the map 90 degrees clockwise so the (0,0)
2010 May 15
1
Barchart reorder
Hi fellow R users, I have a dataset that looks something like this. species class abundance K 1 592 K 2 288 G 1 254 G 2 239 C 2 173 D 2 123 E 3 89 F 2 87 B 2 86 H 2 82 I 1 79 J 2 76 B 1 73 D 3 72 A 2 62 L 2 58 I want to plot a stacked barchart. species is the x-axis, abundance is y-axis, and class will appear as the stacks in different colours. I need the species to be displayed in descending
2011 Dec 04
2
Extract last 3 characters from numeric vector
Hi all, I have a numeric vector with 1 decimal place, and I'd like to extract the last 3 characters, including the decimal point. The vector ranges from 0 to 20. x <- round(runif(100)*20, digits=1) Some of numbers have 3 characters, and some have 4. I've read up on the substr() function but that extracts characters based on exact positions. How can I extract just the last 3
2010 May 28
1
Match 2 vectors
Hi, I have 2 dataframes of unequal length, and I would like to match a factor to them so that both dataframes will have the same number of rows. example: # create the 2 dataframes with unequal length data1 <- data.frame(letters, 1:26)[-c(5,10,19:21),] data2 <- data.frame(letters, 1:26)[-c(6,9,15:18),] data2a <- match(data1[,1], data2[,1]) data2b <- data2[data2a,] When I match
2010 May 31
1
Replacing NAs with 0 for a list of data frames
Hi, I have a list of 100 data frames, each data frame has 50 obs of 377 variables. I would like to replace all the NAs with 0 in all the dataframes. Should I have a for loop for every data frame? Below is an extract of how the data looks like. List of 100 $ :'data.frame': 50 obs. of 377 variables: ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ... ..$ ACTEEX: int [1:50] NA
2010 May 23
2
Subsetting with a list of vectors
Hi, I have a dataset that looks like the one below. data plot plantno. species H 31 ABC D 2 DEF Y 54 GFE E 12 ERF Y 98 FVD H 4 JKU J 7 JFG A 55 EGD . . . . . . .
2010 May 23
3
Selecting first 7 elements
Hi, I have a list of 100, each list has 20 elements, and I would like to select the first 7 elements in each list. Let's take the alphabet as an example. x <- lapply(1:100, function(i) sample(LETTERS)) I tried x[[1:7]], but it doesn't work. Can anyone enlighten me on how to do such selections? Thank you. Kang Min
2010 Jul 27
1
xYplot error
Hi, I'm trying to plot a graph with error bars using xYplot in the Hmisc package. My data looks like this. mort stand site type 0.042512776 0.017854525 Plot A ST 0.010459803 0.005573305 PF ST 0.005188321 0.006842107 MSF ST 0.004276068 0.011592129 YSF ST 0.044586495 0.035225266 Plot A LD 0.038810662 0.037355408 PF
2011 Jan 29
1
Subset using grepl
Hi all, I would like to subset a dataframe by using part of the level name. x <- rep(LETTERS[1:20],3) y <- rep(1:3, 20) z <- paste(x,y, sep="") random.data <- rnorm(60) data <- as.data.frame(cbind(z, random.data)) I need rows that contain the letters A to J, so I tried: subset(data, grepl(LETTERS[1:10], z)) # got only rows with A subset(data, z %in% LETTERS[1:10]) #
2011 May 20
1
grep pattern
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
2008 Nov 18
4
Changing the position of the origin
Hi all, Can anyone tell me how I can make 0,0 start at the top left hand corner of a graph, instead of the typical lower left hand corner? I've tried to plot with axes=F and then putting on the axes later, but I want the points to correspond to the axes. Thanks, Kang Min