[R] Function question

2009-09-25 Thread njhuang86
Hi. I was wondering how I can write a function that generates the outcome values for a user specified equation. For example, function(x^2, 4) will return back 16 and function(x^3 - 10, 2) will give back -2... I've been playing around with various lines of code but somehow, I just cannot get R to

[R] Plotting two qqnorm plots:

2009-09-08 Thread njhuang86
Hi all, Does anyone know how to plot overlapping qqnorm plots on the same window? Suppose I have data in the vector x and y: qqnorm(x) lines(qqnorm(y)) I though these two lines will do the job... However, lines doesn't seem to work. Anyways, thanks in advance! -- View this message in context:

[R] Re moving the numbers of the X/Y axis

2009-08-30 Thread njhuang86
Hi all, Suppose I have some data that I plot using the histogram command - ie. hist(x) Is there an option that will allow me to remove the numbers that appear along the X and Y axis as I'm just interested in the overall distribution of the data and not the actual values? Anyways, any help is grea

[R] Sequence generation

2009-08-29 Thread njhuang86
Hey guys, I was wondering how to create this sequence: 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3... with the '1, 2, 3' repeated over 10 times. Also, is there a simple method to generate 1, 1, 1, 2, 2, 2, 3, 3, 3? Anyways, any help with be greatly appreciated! -- View this message in context: http://

[R] Plotting two overlapping curves

2009-07-30 Thread njhuang86
Hi. Sorry if this question might have already been asked... I'm trying to plot two curves on the same X-Y coordinate. The par(mfrow) command allows me to plot the two curves on the same window however on different coordinate systems. Is there a way to force the two curves into the same coordinate

[R] Loess question

2009-07-30 Thread njhuang86
Hi, suppose I have a vector of values in 'A'. Suppose I use: scatter.smooth(A) to add in a smooth curve. Is there a way to obtain the maximum value of the smoothed curve? Anyways, any help will be greatly appreciated! -- View this message in context: http://www.nabble.com/Loess-question-tp247385

[R] find duplicates... need help!

2009-07-07 Thread njhuang86
Hi all, Suppose I have x = c('a', 't', 'c', 'y', 'g') and also y = c('a', 'a', 'g', 's') If I do something like x%in%y, I obtain a vector like this: [TRUE, FALSE, FALSE, FALSE, TRUE] which I can easily turn into this: [1, 0, 0, 0, 1]. I was wondering is there anyway for me to get a vector back in

[R] Vector of string

2009-06-23 Thread njhuang86
Hi all. Suppose I have a vector of strings ie: ["12384", "TYU123123", "AVC3939", "hhr1919", "TYU0029"] Is there an efficient method that would allow me to return a vector of the position of strings that start with "TYU"? So essentially, I would like to get back in return [2, 5]. Anyways, any help

[R] Any method to speed up this problem?

2009-06-18 Thread njhuang86
Hi all, Suppose I have a vector like this: [1] "STAT1" "STAT1" "STAT1" "STAT1" "GAPDH" "GAPDH" "GAPDH" "ACTB" "ACTB" [10] "ACTB" "DDR1" "RFC2" "HSPA6" "PAX8" "GUCA1A" "UBE1L" "THRA" "PTPN21" [19] "CCL5" "CYP2E1" "STAT1" "THRA" "PAX8" I would like to produce a vector

[R] Question regarding dataframes, matrix, frame, etc...

2009-06-16 Thread njhuang86
Hi all, As of now, I have a 15x8 matrix (name is "asdf"). The first seven columns contain numbers while the last column contains a string. The class of each column is "character". When I use the plot function to display a scatter plot between any of the two columns, ie. plot(asdf[, 1], asdf[, 2])

[R] Creating this vector, any suggetions?

2009-06-12 Thread njhuang86
Suppose I have the first vector: c(1, 6, 8, 9) I will like to create a second vector of size 10 composed of 0 and 1's. The second vector will be composed of four 1's and six 0's. The position of the 1's will be specificed by the first vector. So essentially, I want a second vector in the form: c

[R] need help with strsplit function

2009-06-11 Thread njhuang86
Hi, if I have this string: "a.b.c.d" and I use this function: unlist(strsplit("a.b.c.d", "\\.")), I get this as my output: "a", "b", "c", and "d". Is there a way to just split on the first period so I obtain only two pieces like: "a" and "b.c.d"? Anyways, thanks in advance! -- View this message i