[R] Extract latitude and longitude from several geottaged jpeg files
Hi all, I have several jpeg files with lat long information. I want to make a lat long table whit this info. Anyone knows how to do it? Can't find anything in google. Thanks a lot in advance A. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Convert color hex code to color names
Hi all, I want to convert the output of: > rainbow(6) > [1] "#FFFF" "#00FF" "#00FF00FF" "#00FF" "#" "#FF00" To a vector of color names. Any tip? Thanks in advance C. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to match text string ith spaces
Ok, an extra blank space at the end was the problem. I missed it. Cheers, 2014-05-07 9:05 GMT-03:00 Alejo C.S. : > Hi all, I have a data frame with names that in some cases have blank > spaces: > > > TABLE$place > [1] La Blanqueada La Blanqueada La Blanqueada La Blanqueada La > Blanqueada > [6] La Blanqueada La Blanqueada Sargento Ponce Sargento Ponce La > Blanqueada > [11] La Blanqueada Sargento Ponce La Blanqueada Sargento Ponce La > Blanqueada > [16] Sargento Ponce Sargento Ponce La Blanqueada La Blanqueada Sargento > Ponce > > > > summary(TABLE$place) >HerediaLa Blanqueada Sargento Ponce > 7 29 22 > > > when I try to subsetting using: > > TABLE$place=="La Blanqueada" > > [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > FALSE FALSE > [14] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > FALSE FALSE > [27] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > FALSE FALSE > [40] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > FALSE FALSE > > > Some tip on this? > > Thanks in advance > > [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to match text string ith spaces
Hi all, I have a data frame with names that in some cases have blank spaces: > TABLE$place [1] La Blanqueada La Blanqueada La Blanqueada La Blanqueada La Blanqueada [6] La Blanqueada La Blanqueada Sargento Ponce Sargento Ponce La Blanqueada [11] La Blanqueada Sargento Ponce La Blanqueada Sargento Ponce La Blanqueada [16] Sargento Ponce Sargento Ponce La Blanqueada La Blanqueada Sargento Ponce > summary(TABLE$place) HerediaLa Blanqueada Sargento Ponce 7 29 22 when I try to subsetting using: TABLE$place=="La Blanqueada" [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [14] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [27] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [40] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE Some tip on this? Thanks in advance [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] About lm(y~1)
Dear list, Reading a function I found this: lm ( y ~ 1 ) I know that Y ~ -1 + A is a straight-line with no y-intercept; that is, a fit forced through (0,0). But I never saw the first example. Any tip? Thanks in advance! C. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Geomorph package: gpagen coordinates in tangent space?
Hi all, first thanks for a so useful package! I have a question about "gpagen". I understand that the resulting coordinates of this command are in shape space, so for statistical analisys one must project them to tangent space. But the command "plotTangetSpace" runs "prcomp" directly over gpagen's coordinates. The gpagen's resulting coordinates are already on tangent space? Thanks a lot in advance Alejo [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Vegan: how to plot sites labes in diversity plot
Dear List, I can'f figure how to add point labels in the next plot (example from ?taxondive help page, from vegan package): library(vegan) data(dune) data(dune.taxon) taxdis <- taxa2dist(dune.taxon, varstep=TRUE) mod <- taxondive(dune, taxdis) plot(mod) The points in this plot are diversity values of single sites, and I'd like to add a label to each one. The plot command don't accept a "label" argument. Any tip? Thanks in advance. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Vegan: Diversity Plot, label points
Dear List, I can'f figure how to add point labels in the next plot (example from ?taxondive help page): library(vegan) data(dune) data(dune.taxon) taxdis <- taxa2dist(dune.taxon, varstep=TRUE) mod <- taxondive(dune, taxdis) plot(mod) The points in this plot are diversity values of single sites, and I'd like to add a label to each one. The plot command don't accept a "label" argument. Any tip? Thanks in advance. Alejo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] wind rose (oz.windrose) scale
Dear list, I trying to make a wind rose plot whit the command oz.windrose, from plotrix package. My data, a matrix of percentages with the rows representing speed ranges and the columns indicating wind directions was generated using bin.wind.records command from same package: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.4405286 0.000 0.1468429 0.4405286 0.4405286 0.00 0.00 [2,] 30.5433186 3.2305433 3.2305433 4.2584435 3.2305433 1.321586 5.873715 [3,] 23.9353891 2.0558003 0.4405286 1.0279001 0.4405286 0.00 1.321586 [4,] 2.0558003 0.2936858 0.000 0.000 0.000 0.00 0.00 [5,] 0.000 0.000 0.000 0.000 0.000 0.00 0.00 [,8] [1,] 0.1468429 [2,] 12.9221733 [3,] 2.2026432 [4,] 0.000 [5,] 0.000 The problem is when plotting the wind rose, it is always scaled to 30%. In my case, the north limb is out of scale in the graph since it represent the 59% of winds. The command does't have and scale argument, So I can't change the default scale settings. Any tip? Thanks in advance A. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Plotting factors in biplots
Dear list, I'm trying to make a biplot, but instead of plotting the row numbers for each observation, I'd like to plot a group factor. Example: prcomp(iris[,1:4]) -> PCA biplot(PCA) #this makes a nice biplot but with row names Instead of row numbers I want to plot iris[,5], which is a factor. I can do this: plot(PCA$x[,1], PCA$x[,2], type="n") text(PCA$x[,1], PCA$x[,2], labels=iris[,5], col=palette()[iris[,5]]) Here I have a nice colored plot, but without the variable vectors. Any tip? Thanks a lot in advance. A. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Biplot: plot group name instead of row number
Dear list, I'm trying to make a biplot, but instead of plotting the row number for each observation, plot a group factor. Example: prcomp(iris[,1:4]) -> PCA biplot(PCA) #this makes a nice biplot but with row names Instead of row numbers I want to plot iris[,5], which is a factor. I can do this: plot(PCA$x[,1], PCA$x[,2], type="n") text(PCA$x[,1], PCA$x[,2], labels=iris[,5], col=palette()[iris[,5]]) Here I have a nice colored plot, but without the variable vectors. Any tip? Thanks a lot in advance. Alejo [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Lattice: arbitrary abline in multiple histograms
Thanks all, works perfect. Alejo 2010/10/13 Dennis Murphy > Hi: > > David was on the right track... > > library(reshape) # for the melt() function below > > rnorm(100,5,3) -> A > rnorm(100,7,3) -> B > rnorm(100,4,1) -> C > df <- melt(data.frame(A, B, C)) > names(df)[1] <- 'gp' > > histogram(~ value | gp, data=df, layout=c(3,1), nint=50, >panel=function(x, ..., groups){ >panel.histogram(x, ...) >panel.abline(v=c(5.5, 6.5, 4.5)[groups = panel.number()], > col = 'red', lwd = 2) > }) > > It took several iterations, but persistence sometimes pays off :) > > HTH, > Dennis > > > On Tue, Oct 12, 2010 at 6:13 PM, David Winsemius > wrote: > >> >> On Oct 12, 2010, at 8:21 PM, Alejo C.S. wrote: >> >> Dear list. >>> >>> I have three histograms and I want to add a vertical abline in a >>> different >>> place in each plot. The next example will plot a vertical line at x=5.5 >>> in >>> the three plots: >>> >>> rnorm(100,5,3) -> A >>> rnorm(100,7,3) -> B >>> rnorm(100,4,1) -> C >>> rep(c("A","B","C"),each=100) -> grp >>> data.frame(G=grp,D=c(A,B,C)) -> data >>> histogram(~ D | G, data=data, layout=c(3,1), nint=50, >>> panel=function(x,...){ >>> panel.histogram(x,...) >>> panel.abline(v=5.5) >>> }) >>> But I'd like to plot a vertical line at 5.5 in plot A, 6.5 in plot B and >>> 4.5 in plot C. How can I do that? >>> >> >> histogram(~ D | G, data=data, layout=c(3,1), nint=50, >> panel=function(x,subscripts,groups,...){ >> panel.histogram(x,...) >> panel.abline(v=c(5.5, 6.5, 4.5)[packet.number()]) >> >> }) >> >>> >>> Thanks in advance.. >>> >>> A. >>> >>>[[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 >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >> David Winsemius, MD >> West Hartford, CT >> >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Lattice: arbitrary abline in multiple histograms
Dear list. I have three histograms and I want to add a vertical abline in a different place in each plot. The next example will plot a vertical line at x=5.5 in the three plots: rnorm(100,5,3) -> A rnorm(100,7,3) -> B rnorm(100,4,1) -> C rep(c("A","B","C"),each=100) -> grp data.frame(G=grp,D=c(A,B,C)) -> data histogram(~ D | G, data=data, layout=c(3,1), nint=50, panel=function(x,...){ panel.histogram(x,...) panel.abline(v=5.5) }) But I'd like to plot a vertical line at 5.5 in plot A, 6.5 in plot B and 4.5 in plot C. How can I do that? Thanks in advance.. A. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Lattice: Histogram in splom diagonals
Dear David, it works just perfect. Thanks a lot for the help Sincerely, Alejo 2010/10/7 David Winsemius > > On Oct 7, 2010, at 9:04 AM, Alejo C.S. wrote: > > Dear list, I want to plot several variables with splom and in the main >> diagonal, instead of the variable names, I'd like to plot an histogram of >> corresponding variables. Searching I did not find the correct syntax, only >> some tips in an old post in the list, but this comments help to plot only >> density lines instead of histograms. I had some code, but it fails to plot >> (I've commented the problematic lines): >> >> >> splom(iris[,1:4], panel = function(x, y, ...) { >>panel.xyplot(x, y, ...) >> panel.lmline(x,y,...) >> } >> #, diag.panel=function(x,...){ >> # panel.histogram(x,...) >> #} >> >> ) >> >> Thanks a lot in advance! >> >> > From 2007 posting by Barnes (only return from RSiteSearch with modified > Targets for "splom diag.panel histogram": > > panel.hist.splom<-function(x, ...) > { > yrng <- current.panel.limits()$ylim > h <- hist(x, plot = FALSE) > breaks <- h$breaks; nB <- length(breaks) > y <- h$counts; y <- yrng[1] + 0.95 * diff(yrng) * y / max(y) > panel.rect(breaks[-nB], yrng[1], breaks[-1], y, col="cyan", ...) > } > my.plot = function(data) { > splom( ~data, > lower.panel=function(x, y, ...) { > panel.xyplot(x, y, ...) > panel.lmline(x,y,...)}, > upper.panel=function(x, y, ...) { > > panel.xyplot(x, y, ...) > panel.lmline(x,y,...)}, > diag.panel = panel.hist.splom) > } > > my.plot(iris[,1:4]) > > > David Winsemius, MD > West Hartford, CT > > [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Lattice: Histogram in splom diagonals
Dear list, I want to plot several variables with splom and in the main diagonal, instead of the variable names, I'd like to plot an histogram of corresponding variables. Searching I did not find the correct syntax, only some tips in an old post in the list, but this comments help to plot only density lines instead of histograms. I had some code, but it fails to plot (I've commented the problematic lines): splom(iris[,1:4], panel = function(x, y, ...) { panel.xyplot(x, y, ...) panel.lmline(x,y,...) } #, diag.panel=function(x,...){ # panel.histogram(x,...) #} ) Thanks a lot in advance! Regards, Alejo [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice: Set x-axis in italics only
Thanks all for the excellent help! Kind regards, Alej 2010/9/13 Dennis Murphy : > Hi: > > demo(graphics) has a lot of nice examples of how to use various features - > one of them is font selection. > > font = 3 => italic font = 4 => bold italic > > You need to select the correct aspect of the plot, however: font.main, > font.sub, font.lab or font.axis (from par()). > > HTH, > Dennis > > On Mon, Sep 13, 2010 at 5:50 AM, Alejo C.S. wrote: >> >> Dear list, I making some box-and-whisker plots in R with vertebrate >> data. The x axis are species names that must be in italics. I tried >> with the "axis" function but no luck, and it seems that affects both >> axes. >> Any tip? >> >> Thanks a lot in Advance. >> >> Alej >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lattice: Set x-axis in italics only
Dear list, I making some box-and-whisker plots in R with vertebrate data. The x axis are species names that must be in italics. I tried with the "axis" function but no luck, and it seems that affects both axes. Any tip? Thanks a lot in Advance. Alej __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot discriminant analysis
Hi Alain, thanks for the fast response. I've the same results with iris data, but when I use my data (mentioned in the first message), I have different results. Regards, Alejo 2009/10/14 Alain Guillet > Hi, > > I did it with > > Iris <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]), Sp = > rep(c("s","c","v"), rep(50,3))) > train <- sample(1:150, 75) table(Iris$Sp[train]) > z <- lda(Sp ~ ., Iris, prior = c(1,1,1)/3, subset = train) > > Then I did plot(z,xlim=c(-10,10),ylim=c(-10,10)) before drawing > points(predict(z)$x, > col=palette()[predict(z)$class],xlim=c(-10,10),ylim=c(-10,10)) and all the > points are superimposed. The only difference I found was the different x- > and y-axis when I drew them separately, i.e. > plot(z) > plot(predict(z)$x, col=palette()[predict(z)$class]) > > > Alain > > > > Alejo C.S. wrote: > >> I'm confused on how is the right way to plot a discriminant analysis made >> by >> lda function (MASS package). >> (I had attached my data fro reproduction). When I plot a lda object : >> >> X <- read.table("data", header=T) >> >> lda_analysis <- lda(formula(X), data=X) >> >> plot(lda_analysis) >> >> #the above plot is completely different to: >> >> plot(predict(lda_analysis)$x, col=palette()[predict(lda_analysis)$class]) >> >> that should be the same graph than the first? >> >> In the second case, I use predict function to obtain the LD1 and LD2 >> coordinates of lda_analysis (predict(lda_analysis)$x) and it's respective >> class (predict(lda_analysis)$class), but it seems that the classes are >> different: >> >> table(X$G3, predict(lda_analysis)$class) >> >>BG M >> B 2903 >> G0 26 2 >> M 40 46 >> >> >> any clues? >> Regards, >> >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> > > -- > Alain Guillet > Statistician and Computer Scientist > > SMCS - Institut de statistique - Université catholique de Louvain > Bureau c.316 > Voie du Roman Pays, 20 > B-1348 Louvain-la-Neuve > Belgium > > tel: +32 10 47 30 50 > > [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plot discriminant analysis
I'm confused on how is the right way to plot a discriminant analysis made by lda function (MASS package). (I had attached my data fro reproduction). When I plot a lda object : X <- read.table("data", header=T) lda_analysis <- lda(formula(X), data=X) plot(lda_analysis) #the above plot is completely different to: plot(predict(lda_analysis)$x, col=palette()[predict(lda_analysis)$class]) that should be the same graph than the first? In the second case, I use predict function to obtain the LD1 and LD2 coordinates of lda_analysis (predict(lda_analysis)$x) and it's respective class (predict(lda_analysis)$class), but it seems that the classes are different: table(X$G3, predict(lda_analysis)$class) BG M B 2903 G0 26 2 M 40 46 any clues? Regards, __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] wrong plot with fda or lda?
Hi, I have a strange behavior of plot function when trying to plot a discriminant analysis obtained by fda. I'd attached the data for reproduction. I made the same analysis (linear discriminant analysis) but using lda and fda (default args, using "polyreg"). The resulting coefficients and trace proportions for the two analysis are the same, that's good, but if you plot the two analysis the graphs are very different. Plotting the results of lda function gives much more overlapping of points from different groups than using fda. If you make: libray(MASS) library(mda) read.table("data", header=T) -> data data[,1] -> grp data[,2:24] -> X #Linear discriminant analysis using fda fda(grp ~ ., data=X) -> FDA plot(FDA) #Linear discriminant analysis using lda lda(grp ~ ., data=X) -> LDA plot(LDA, col=palette()[grp])# Very different results #Same coefficients coef(FDA) coef(LDA) Regards, __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.