[R] PCA and gglot2

2013-07-10 Thread ashz
Hi, I was trying as well as looking for an answer without success (a bit strange since it should be an easy problem) and therefore I will appreciate you help: My simple script is: # Loadings data of 5 columns and 100 rows of data data1<-read.csv("C:/…/MyPCA.csv") pairs(data1[,1:4]) pca1 <- princo

Re: [R] PCA and gglot2

2013-07-10 Thread ashz
Hi, Thanks. Fig 4 in the link you provided is what I am looking for. I still do not know how to implement my data1 and pca1 in the script you provided as I think it is only a part of a full script. " data1<-read.csv("C:/…/MyPCA.csv") pca1 <- princomp(data1[,1:4], score=TRUE, cor=TRUE) " Am I ri

Re: [R] PCA and gglot2

2013-07-10 Thread ashz
Dear John, Thanks for the help. I did some minor modifications to your script as I had some problems: ... pca = PCA(data[,1:4], scale.unit=T, graph=F) dat1 <- data.frame(pca$scores) # creates the data.frame dat1$items <- rownames(data$group) # adds item names ggplot(dat1, aes(pca$ind$coord[

Re: [R] PCA and gglot2

2013-07-10 Thread ashz
Hi, Thanks to ssefick for the ggbiplot tip. It works fine so I submit a general script thats works for future users. library(ggbiplot) data<-read.csv("C:/…/MyPCA.csv") data1<-data[,1:4] my.pca <- prcomp(data1, scale. = TRUE) my.class<- data$Group g <- ggbiplot(my.pca, obs.scale = 1, var.scal

[R] What is “Proportion of trace” in lda (MASS)

2013-08-14 Thread ashz
Hi, Is the lda function (R MASS package) “Proportion of trace” is similar to “proportion of variance explained”in the case of PCA? How can I store the LD1 and LD2 in two separate variables? Thanks -- View this message in context: http://r.789695.n4.nabble.com/What-is-Proportion-of-trace-

[R] GUI tools for R

2013-08-16 Thread ashz
Hi, I wish to build a GUI for my R script, what are the best and easiest tools to use and which ones as good documentation or books? Thanks -- View this message in context: http://r.789695.n4.nabble.com/GUI-tools-for-R-tp4673925.html Sent from the R help mailing list archive at Nabble.com.

[R] Image Gray Level Co-occurrence Matrix in R

2013-06-26 Thread ashz
Hi, I've been looking for Image Processing packages without success. I am mainly interested in image Gray Level Co-occurrence Matrix (GLCM) parameters like Contrast, Correlation, Energy, Homogeneity. Is there a package that can do it? Any ideas, comments, etc are welcome. Thanks. -- View

[R] Mark each group centroid in a linear discriminant analysis plot

2013-11-10 Thread ashz
Hi, How can I calculate and mark each group centroid in a linear discriminant analysis plot (using ggplot2)? Script: ## originate from http://r.789695.n4.nabble.com/LDA-and-confidence-ellipse-td4671308.html require(MASS) require(ggplot2) iris.lda<-lda(Species ~ Sepal.Length + Sepal.Width + Peta

[R] Scatterplot matrix - Pearson linear correlation and Density Ellipse

2010-09-30 Thread ashz
Hi, I have modified a known script to generate a scatterplot matrix: panel.cor = function(x, y, digits=2, prefix="Rho=", cex.cor) { usr = par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r = abs(cor(x, y, use="pairwise.complete.obs", method = "pearson")) txt = format(c(r,

Re: [R] Scatterplot matrix - Pearson linear correlation and Density Ellipse

2010-10-03 Thread ashz
Hi, I used the pairs.panels() in pkg:psych and it is helpful. It saves time. but if I use this line: pairs.panels(cfcap[8:11], scale = FALSE, lm=TRUE,ellipses=TRUE, digits = 2 ) The results are: - The upper.panel does not show the pearson r but the lm data. Furthermore, can I use the pairwise

Re: [R] Scatterplot matrix - Pearson linear correlation and Density Ellipse

2010-10-04 Thread ashz
Thanks a lot for the answer -- View this message in context: http://r.789695.n4.nabble.com/Scatterplot-matrix-Pearson-linear-correlation-and-Density-Ellipse-tp2763552p2953909.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pr

Re: [R] Scatterplot matrix - Pearson linear correlation and Density Ellipse

2010-10-04 Thread ashz
Hi, strangely, when I run this script: panel.cor = function(x, y, digits=2, prefix="r=", cex.cor) { usr = par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r = abs(cor(x, y, use="pairwise.complete.obs", method = "pearson")) txt = format(c(r, 0.123456789), digits=digits)[1]

[R] Xlsx and R -read problem

2010-10-16 Thread ashz
r in .jnew("java/io/FileInputStream", file) : java.io.FileNotFoundException: Can someone tell me what is the problem? and how to solve it. Cheers, Ashz -- View this message in context: http://r.789695.n4.nabble.com/Xlsx-and-R-read-problem-tp2998304p2998304.html Sen

[R] Sine function fitting

2010-10-18 Thread ashz
Hi, Is there a package to perform a sine function fitting to XY data? Thx, Ashz -- View this message in context: http://r.789695.n4.nabble.com/Sine-function-fitting-tp3000156p3000156.html Sent from the R help mailing list archive at Nabble.com

[R] points(x,y), mean and standard deviation

2010-10-19 Thread ashz
Hi, I have a data set with 3 rows (X=date, Y1=arithmetic mean and Y2=standard deviation). How can I create a graph(e.g., points) which will show the +-stdev as well (similar to excel). Thanks -- View this message in context: http://r.789695.n4.nabble.com/points-x-y-mean-and-standard-deviatio

Re: [R] points(x,y), mean and standard deviation

2010-10-19 Thread ashz
Hi, Thanks for the tip. I run this script: means.cl <- c(82, 79, 110, 136,103) stderr.cl <- c(8.1,9.2,7.4,1.6,7.6) plotCI(x = means.cl , uiw = stderr.cl, pch=24) But how can I connect the mean triangles with a line? Thanks -- View this message in context: http://r.789695.n4.nabble.com/poin

[R] ggplot - unwanted sorted X values

2010-10-27 Thread ashz
Hi, I have this script: dat <- data.frame(X = halistat$Date,Y1 = halistat$avg,Y2 = halistat$stdev) ggplot(data = dat, aes(x = X, y = Y1, ymin = Y1 - Y2, ymax = Y1 + Y2)) + geom_point() + # points at the means geom_line() + # if you want lines between pints geom_errorbar() # error bars, Y1

[R] ggplot output

2010-11-04 Thread ashz
Dear All, I have this script: dat <- data.frame(Month = hstat$Date,C_avg = hstat$C.avg,C_stdev = hstat$C.stdev) ggplot(data = dat, aes(x = Month, y = C_avg, ymin = C_avg - C_stdev, ymax = C_avg + C_stdev)) + geom_point() + geom_line() + geom_errorbar() dat <- data.frame(Month = hstat$D

Re: [R] ggplot output

2010-11-04 Thread ashz
Dear Thierry, Your solution looks very elgant but I can not find a proper example. Can you provide me one? Thx -- View this message in context: http://r.789695.n4.nabble.com/ggplot-output-tp3027026p3027108.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Matrix Plot and linear regression

2010-08-11 Thread ashz
Hi, Is it possible to do a Matrix Plot and in the cell perform a linear regression also adding to the cell the r2 and the equation. If so, how? Thanks, As hz -- View this message in context: http://r.789695.n4.nabble.com/Matrix-Plot-and-linear-regression-tp2321613p2321613.html Sent from the R

[R] Automated plot and linear regression line/data

2010-08-17 Thread ashz
Hi, I have an excel sheet (already imported to R) with multiple columns and I am looking for a way in R that will allow me to generate a plot for every possible pair and its linear regression line/data. Any tip/idea/script how do to so. Thanks, As hz -- View this message in context: http://

Re: [R] Automated plot and linear regression line/data

2010-08-17 Thread ashz
Hi, I presume the easy way is using plot and lm. Thx, As hz -- View this message in context: http://r.789695.n4.nabble.com/Automated-plot-and-linear-regression-line-data-tp2328027p2328372.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Linear regression equation and coefficient matrix

2010-08-18 Thread ashz
Hi, I have 20*60 data matrix (with some NAs) and I wish to perfom a Pearson correlation coefficient matrix as well as simple linear regression equation and coefficient of determination (R2) for every possible combination. Any tip/idea/library/script how do to so. Thanks, As hz -- View thi

Re: [R] Linear regression equation and coefficient matrix

2010-08-18 Thread ashz
Hi, Thanks, the cor() works. Regarding the simple linear regression equation (mainly, the slope parameter) and r2. I think I was not writing it well. I need to do it just for the columns. If I have a, b, c, d columns I wish to compute the relation of there data, e.g., between a-b, a-c, a-d, b-a

[R] Correlograms and linear regression

2010-08-19 Thread ashz
Dear all, I generated a Correlograms and used the panel.ellipse (confidence ellipse and smoothed line) option. Is there a way to get instead of the smoothed line the linear regression? Thanks, As hz -- View this message in context: http://r.789695.n4.nabble.com/Correlograms-and-linear-regre

Re: [R] Linear regression equation and coefficient matrix

2010-08-19 Thread ashz
Dear Greg, Thanks for the tip. As I am new in R can you please provide me a script how do to so. It will help my learning process. Thanks, Asher -- View this message in context: http://r.789695.n4.nabble.com/Linear-regression-equation-and-coefficient-matrix-tp2329804p2330867.html Sent from the

[R] Scatterplot question

2010-08-27 Thread ashz
Hi, I have two XY datasets (e.g., longitude and concentrations) who share the same X scale. How can I make a simple scatterplot which will combine them both with different colors for the two Y groups? (plot and xyplot solutions are fine with me). Thanks in advance. Cheers -- View this messa

[R] lattice to ggplot2 conversion help

2011-08-22 Thread ashz
tion(x, y, type, ...) { panel.superpose(x, y, type="l", ...) lpoints(x, y, pch=16, col="white", cex=2) panel.superpose(x, y, type="p",...) }, par.settings = sp, auto.key = list(columns = 2, lines = TRUE))) I will be

[R] Time series and ggplot2

2011-08-22 Thread ashz
display all the months in the X axis text/labels? how can I display only January, April, July and October the months in the X axis text/labels? Thanks, Ashz PS axis.text.x = theme_text(angle=90) and scale_x_date(format = "%b-%Y") -- View this message in context: http://r.789695.n4.nabbl

[R] NA in last row while reading xlsx file

2011-08-23 Thread ashz
Hi, I am using this script to read a xlsx file to a data frame: library(xlsx) File <- file.path("d:", "car ", "car95-99.xlsx") B_car <- read.xlsx(File, "raw_data") Car2x <- data.frame(month = B_car$Date,Ch = B_car$Ch.des, lat=B_car$Latitude) The last row in the data.frame is always NA, how can I

[R] Scatter plots, linear regression in ggplot2

2011-08-24 Thread ashz
Hi, Based on some modification that I did to the R Cookbook Graphs Scatterplots code, link:http://wiki.stdout.org/rcookbook/Graphs/Scatterplots%20(ggplot2) I have some questions and I will appreciate a help: - How do I change the legend title? - How can I change the for each linear r

[R] Howto convert Linear Regression data to text

2011-08-24 Thread ashz
Dear all, How can I covert lm data to text in the form of "y=ax+b, r2" and how do I calculate R-squared(r2)? Thanks. Code: x=18:29 y=c(7.1,7,7.7,8.2,8.8,9.7,9.9,7.1,7.2,8.8,8.7,8.5) res=lm(y~x) -- View this message in context: http://r.789695.n4.nabble.com/Howto-convert-Linear-Regression-dat

[R] ggplot2-grid/viewport and PNG

2011-09-05 Thread ashz
Dear All, The following code save my graphs as pdf: pdf("j:/mix.pdf", width = 18, height = 16) grid.newpage() pushViewport(viewport(layout = grid.layout(3,1))) vplayout <- function(x, y) viewport(layout.pos.row = x, layout.pos.col = y) print(Aplot, vp = vplayout(1, 1)) print(Bplot, vp

[R] Simple R graph question

2011-07-08 Thread ashz
Dear All, I have several objects (imported from excel via using “xlsx”) with the field names: Month/Year, X, Y1, Y2, Y3. What is the best library/way to generate a graph which will be consist of multiple plots (Month/Year) that each contain the X, Y1, Y2, Y3 dataset. Thanks a lot. Cheers, Asher

Re: [R] Simple R graph question

2011-07-08 Thread ashz
Dear jholtman, Thanks for the reply & sorry for the been unclear before. My desire graph is to have multiply plots showing Y1,Y2,Y3 with the same X, were each plot is month-year (e.g., 5-2001, 6-2001, etc). It ill be great if each Y can have a different line and point style. The Lattice graph

[R] Fitting a Harmonic Function to Time Series Data

2011-10-13 Thread ashz
Dear All, I have some time series data where X=month and Y=nutrient concentration (I can have several concentration data for one month). Is there a way to fit for it an Harmonic Function. Is there a package, script,etc which I can use? Thx -- View this message in context: http://r.789695.n4.