[R] counting characters starting point

2012-02-20 Thread Juliet Ndukum
I have three character strings represented below as seq1, seq2, and seq3. Each string has a reference character different from the other. Thus, for seq1, the reference character is U, seq2, S (3rd S from left where A is leftmost character) and for seq3 Y. seq1 = PQRTUWXYseq2 = AQSDSSDHRSseq3 = E

[R] Plot numeric and categorical variable

2011-12-05 Thread Juliet Ndukum
My data consists of numeric (yy) and categorical (xx) variables, as shown below.  > xx = c(rep("C", 5), rep("D",5))> xx [1] "C" "C" "C" "C" "C" "D" "D" "D" "D" > "D"> yy = rnorm(10, 0, 4)> yy [1]  2.7219346 -3.7142481  6.8716534 -0.9352463 >  0.4901249  3.8113247 [7] -2.6602041  1.7714471  4.729

[R] plot mixed variables

2011-12-05 Thread Juliet Ndukum
My data consists of a numeric (yy) variable and a categorical (xx) variable, as shown below. xx = c(rep("C", 5), rep("D",5)) yy = rnorm(10, 0, 4) xx1 = as.integer(as.factor(xx))   plot(xx1, yy, ylim = c(-13.5, 4), col="blue")   I wish to generate a scatter plot of the data su

[R] Convert full matrix back to lower triangular matrix

2011-11-15 Thread Juliet Ndukum
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0 The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 = dist(ab,"euclidean")> dd1    1   2   3   4   52 0.1                3 0.2 0.1            4 0.3 0.2 0.1        5 0.4 0.3 0.2 0.

[R] Convert back to lower triangular matrix

2011-11-15 Thread Juliet Ndukum
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0 The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 = dist(ab,"euclidean")> dd1    1   2   3   4   52 0.1                3 0.2 0.1            4 0.3 0.2 0.1        5 0.4 0.3 0.2 0.1

[R] Chunk of code

2011-10-14 Thread Juliet Ndukum
MATLAB chunk of code for jj = 1:numOfAA            curAAPosInSeqIndex = aaPosInSeqIndex{1,jj};            for kk = 1:K                p_c_a_z_given_x_contribution(1,jj,kk) = sum(sum(p_c_a_z_given_m_x_permuted(:,:,kk) .* curAAPosInSeqIndex, 1),2); % 1 by numOfAA by K            end        end aaP

[R] Split a list

2011-10-14 Thread Juliet Ndukum
I have a list of dataframes i.e. each list element is a dataframe with three columns and differing number of rows. The third column takes on only two values. I wish to split the list into two sublists based on the value of the third column of the list element.  Second issue with lists as well. I

[R] bootstrapping nonlinear mixed effects models

2010-10-20 Thread Juliet Ndukum
In order to bootstrap nonlinear regression, the following code works. library(nlme) data(Soybean) fm1.nls <- nls(weight ~ SSlogis(Time, a, b, c), data=Soybean) summary(fm1.nls) bstat <- function(A, indices) { mboot <- nls(weight ~ SSlogis(Time, a, b, c), data=Soybean[indices, ]) return(coef(mb

[R] Moving non-zero matrix entries to different locations on the matrix

2010-09-15 Thread Juliet Ndukum
I have a matrix: C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 R1 0 0 0 0 0 5 0 0 0 0 0 0 R2 0 0 0 0 0 3 0 0 0 0 0 0 R3 0 0 0 0 0 0 4 0 0 0 0 0 R4 0 0 0 0 0 0 2 0 0 0 0 0 R5 1 0 0 0 0 0 0 0 0 0 0 0 R6 8 0 0 0 0 0 0

[R] How to get "mypkg-manual.pdf"

2010-09-06 Thread Juliet Ndukum
I am building a package say mypkg. Five months ago, when I built the package I got the mypkg manual in pdf format. Today, after making updates, I build the same package, same name, and steps; unfortunately I do not get the manual in pdf format. Rather I get the following message: cd: can't cd

[R] Handling repeated values differently

2010-03-12 Thread Juliet Ndukum
mat is a matrix with X and Y values. > mat X Y [1,] 56 20 [2,] 56 21 [3,] 2 50 [4,] 3 46 [5,] 18 77 [6,] 57 12 [7,] 57 36 [8,] 95 45 [9,] 65 23 [10,] 33 25 [11,] 33 98 [12,] 63 96 [13,] 66 75 [14,] 99 54 [15,] 78 65 [16,] 75 69 [17,] 54 68 [18,] 54 67 [19,] 0 22 [20,] 14 74 [21

[R] Selecting rows of a matrix based on some condition on the columns

2010-03-04 Thread Juliet Ndukum
The data set consists of two sets of matrices, as labelled by the columns, T's and C's. > xy xT1T2T3T4T5C1C2C3C4C5 [1,] 50 0.00 0.00 33.75 0.00 0.00 0.00 36.76 0.00 35.26 0.00 [2,] 13 34.41 0.00 0.00 36.64 32.86 34.11 35.80 37.74 0.00 0

[R] Reducing a matrix

2010-02-27 Thread Juliet Ndukum
I wish to rearrange the matrix, df, such that all there are not repeated x values. Particularly, for each value of x that is reated, the corresponded y value should fall under the appropriate column. For example, the x value 3 appears 4 times under the different columns of y, i.e. y1,y2,y3,y4.

[R] Rearranging entries in a matrix

2010-02-25 Thread Juliet Ndukum
I have a matrix, called data. I used the code below to rearrange the data such that the first column remains the same, but the y value falls under either columns 2, 3 or 4, depending on the value of z. If z=1 for example, then the value of y will fall under column 2, if z=2, the value of y falls

[R] R CMD check in Vista

2009-12-15 Thread Juliet Ndukum
I used R CMD check in windows vista, and it gives me the message 'sh' is not recognized as an internal or external command. How do I get around this, your help would be highly appreciated. [[alternative HTML version deleted]] __ R-help

[R] Bootstrap pvalues

2009-12-06 Thread Juliet Ndukum
Hi, How do I generate bootstrap p-values for goodness of fit test. Thank you in advance for your help, Juliet [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE