[R] distribute variance

2011-06-22 Thread phoebe kong
Hi All, I would like to use R to do some computation. However, before I proceed to write an R script, I have difficulty to find out a solution for the question below. Please note that the question below is not relating to question in R. I have a table below, 2009 2010 2011 2012 2013 2014 Alber

[R] test proportion

2011-02-09 Thread phoebe kong
Hi all, I have a hypothesis test of proportion question without using R. I hope you could help to answer my question. Here is the statement. * Preliminary data from a feasibility study showed a potential failure level of 1%. A sample size was calculated to detect a potential

Re: [R] draw categorical histogram

2010-12-01 Thread phoebe kong
This would not draw a histogram. On Wed, Dec 1, 2010 at 11:54 AM, Andrew Miles wrote: > Try: > > plot (myCatVariable) > > Andrew Miles > Department of Sociology > Duke University > > > On Dec 1, 2010, at 2:51 PM, phoebe kong wrote: > > Hi, >> >>

[R] draw categorical histogram

2010-12-01 Thread phoebe kong
Hi, Can someone tell me how to draw a histogram for the following summary? Richard Minnie Albert Helen Joe Kingston 1233 56 6715 66 The summary tell that Richard has occurrence 12, Minnie has occurrence 33, and so on. I would like to view this summ

[R] scatter.smooth() fitted by loess

2010-10-19 Thread phoebe kong
Hi there, I would like to draw a scatter plot and fit a smooth line by loess. Below is the data. However, the curve line started from 0, which my "resid" list doesn't consist of 0 value. It returned some warnings which I don't know if this is the reason affecting such problem. Here I also attached

[R] concatenate values in the vector

2010-08-03 Thread phoebe kong
Hi all, Is there a function that allow me to concatenate each value in a vector to a string? x<-c("a","b","c","d") output string = a+b+c+d Thanks, phoebe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.

[R] ordering data frame

2010-05-05 Thread phoebe kong
Hi all, I have problem in ordering data frame. Could anyone help me? > x [,1] [,2] [,3] [1,] "A" "1" "2" [2,] "G" "3" "2" [3,] "E" "2" "3" > y [,1] [,2] [,3] [1,] "G" "3" "3" [2,] "A" "3" "3" [3,] "E" "3" "3" I would like to order data frame x by the order of column 1 of d

[R] PCA scores

2010-04-16 Thread phoebe kong
Hi all, I have a difficulty to calculate the PCA scores. The PCA scores I calculated doesn't match with the scores generated by R, mypca<-princomp(mymatrix, cor=T) myscore<-as.matrix(mymatrix)%*%as.matrix(mypca$loadings) Does anybody know how the mypca$scores were calculated? Is my formula not

[R] splitting word

2010-03-24 Thread phoebe kong
Hi all, Could someone tell me how to split a word. c("AA") to c("A","A") Thanks! Phoebe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] draw circle on PCA plot

2009-11-25 Thread phoebe kong
Hi, I have a hard time in drawing circle on PCA. I have 60 samples. The corresponding PC1 scores and PC2 scores were stored as "mergedata". Here are the summary of PCs scores. > range(mergedata[,"PC1"]) [1] 0.0085 0.0100 > range(mergedata[,"PC2"]) [1] 0.0032 0.0075 > mean(mergedata[,"PC1"]) [1] 0

[R] center of cluster of points in PCA

2009-11-24 Thread phoebe kong
Hi, Can someone tell me how to find the center of cluster points in PCA (PC1 vs PC2)? Can R find that out? If yes, how it's generated by R? Is the coordinate of center point equals (mean score of PC1, mean score of PC2)? Thanks bunch! Phoebe [[alternative HTML version deleted]] ___

Re: [R] 11 distinguishable colors

2009-11-24 Thread phoebe kong
of.colors<-100 > colors.list<-colors.list[1:Number.of.colors] > plot(0:1,0:1, type="n") > for (i in colors.list) > { > x<-runif(1) > y<-runif(1) > text(x,y, i, col=i) > } > > cheers > > miltinho > > On Tue, Nov 24, 2009 at 6:0

Re: [R] 11 distinguishable colors

2009-11-24 Thread phoebe kong
It should be 11 different groups, not 8. On Tue, Nov 24, 2009 at 3:00 PM, phoebe kong wrote: > Hi, > > I want to draw a plot where the data set has 8 different groups. Could you > suggest 8 combination of colors and symbols that are distinguishable? If the > colors are too clo

[R] 11 distinguishable colors

2009-11-24 Thread phoebe kong
Hi, I want to draw a plot where the data set has 8 different groups. Could you suggest 8 combination of colors and symbols that are distinguishable? If the colors are too close, it would be hard to differentiate from the plot. Thanks, [[alternative HTML version deleted]] ___

[R] jpg file

2009-11-09 Thread phoebe kong
Hi all, I'm creating a jpg file with width=1500, height=1000. it is a graph showing 24 boxplots horizontally. The x coordinates in the graph was not displayed in the jpg file, but it DOES displayed in a pdf file. Does any one know what setting I should pay attention to in order to have the x coo

[R] categorization

2009-11-09 Thread phoebe kong
Hi All, I have a dataset with a column named "Condition", Sample Condition 1c20 2c20 3c10 4c10 5c9 6c9 7c5 8c5 9c20 10 c10 Could you let me know the fastest way to change c20->

[R] generate random number without repetition

2009-09-23 Thread phoebe kong
Hi all, I would like to generate ~18K random number from range 1 to ~33K. I was thinking to use round(runif(18000,1,33000)), however the some random numbers generated are repeated. Do you know a better way? thanks, phoebe [[alternative HTML version deleted]] __

[R] rotate texts

2009-05-04 Thread phoebe kong
Hi all, I'm hoping to add texts into a plot. I'm using text() to do it. I wonder if the text() allow me to make the text vertically printed? Thanks in advance for help, phoebe [[alternative HTML version deleted]] __ R-help@r-project.org mailin

[R] factor level

2009-05-01 Thread phoebe kong
Hi All, I have problem about the factor features. I read in a .cvs file, a column which is supposed to be numeric, but it becomes factor level data after reading in. mydata[,"newXaxis"] [1] 0 0.430010601 11.23198508 25.00940297 37.75338045 45.98289639 [7] 48.92328133 52.51142822 61

[R] matrix output

2009-02-17 Thread phoebe kong
Hi friends, I have questions about printing a pretty big size matrix. As you could see from below, the matrix wasn't showed in R at full size (11X11), but it was cut partly into three smaller matrices (11X4,11X4,11X3). I'm wondering if there is a way to show the whole matrix with dimension 11X11,

[R] bar plot/ histogram

2009-02-11 Thread phoebe kong
Hi all, I would like to construct plot of the distribution of N, where N range from 1 to 10. I couldn't just use the hist(), as I want the categories for the bars are: 1, 2, 3, 4, >=5. So this will be a bar plot with 5 bars, and the height of the bar will be the frequency of N. (eg bar#1 will be t

Re: [R] summary statistics

2009-02-11 Thread phoebe kong
13 6552 >> 1.64 2.42 0.36 >> ACT 4 700 28.55 4.82 29 28.84 4.45 3 3633 >> -0.66 0.53 0.18 >> SATV5 700 612.23 112.90620 619.45 118.61 200 800 600 >> -0.64 0.33 4.27 >> SATQ6 687 610.22 115.6462

[R] summary statistics

2009-02-09 Thread phoebe kong
Hi all, I'm wondering if there is a function that can return summary statistics: N=total number of observation, # missing, mean, median, range, standard deviation. As I know, summary() returns some of info I've mentioned above. Thanks, SY [[alternative HTML version deleted]] __

[R] scanning text file to extract particular word

2008-11-11 Thread phoebe kong
Hi all, I'm wondering if you know a function that allow me to scan through a whole text file, extracting words start with "rs". For example, below is format of the text file, I would like to extract those words start with "rs" ORDINARY REGRESSION: BEST LASSO PREDICTORS PREDICTORMA

[R] data which has different size of elements in each row

2008-11-11 Thread phoebe kong
Hi all, I have problem reading in a text file as follow. The following data has not column header. I tried the following command but failed, temp<-read.table("data.txt",header=F) An error message stated that line 3 did not have 4 elements. 0.293290E-05 0.117772E-05 -0.645205 rs22

[R] par(mfrow=c(2,4))

2008-10-20 Thread phoebe kong
Hi All, I'm going to draw 8 plots in one page. I want the plots to be arranged in two rows, each row has 4 plots. So, I set the it par(mfrow=c(2,4)). However, there might be too many plots in a page, all the 8 plots were drawn in triangular shape, which makes the x-y coordinate scale not in same

[R] Looking for position of character in a string

2008-10-01 Thread phoebe kong
Hi all, I would like to check if a string contains "." in it. If yes, I would like to know the position of "." in the string. Eg: X<-"NM1236.3" In above example, "." is at position 7. I tried functions grep() and match(). It seems they couldn't detect ".". Thanks in advance for your help, Sit

[R] read.table problem

2008-07-09 Thread phoebe kong
Dear all, I have problem when reading a table into R. The total row of read in table has is much less than the original saved table. I built a 1,273,230 by 6 data set named "mydata2", it was saved in the following command, write.table(mydata2, "mydata2.txt", row.name=F,col.name=T,quote=F,sep="\t

[R] Read.table - Less rows than original data

2008-07-09 Thread phoebe kong
Dear all, I have problem when reading a table into R. The total row of read in table has is much less than the original saved table. I built a 1,273,230 by 6 data set named "mydata2", it was saved in the following command, write.table(mydata2, "mydata2.txt", row.name=F,col.name=T,quote=F,sep="\t