Re: [R] working on a data frame

2014-07-28 Thread PIKAL Petr
Hi I like to use logical values directly in computations if possible. yourData[,10] - yourData[,9]/(yourData[,8]+(yourData[,8]==0)) Logical values are automagicaly considered FALSE=0 and TRUE=1 and can be used in computations. If you really want to change 0 to 1 in column 8 you can use

[R] lattice, latticeExtra: Adding moving averages to double y plot

2014-07-28 Thread Anna Zakrisson Braeunlich
Hi lattice users, I would like to add 5-year moving averages to my double y-plot. I have three factors needs to be plotted with moving averages in the same plot. One of these reads off y-axis 1 and two from y-axis 2. I have tried to use the rollmean function from the zoo-packages, but I fail

[R] Differencing between 2 previous values

2014-07-28 Thread Pavneet Arora
Hello All, I am trying to do a simple thing of calculating the absolute difference between 2 previous values. Since my original data consists of 30 rows, this column where I am storing my absolute difference values only consists of 29 rows (called the ?differ?)! And I am having troubling cbind

Re: [R] Differencing between 2 previous values

2014-07-28 Thread PIKAL Petr
Hi see in line -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Pavneet Arora Sent: Monday, July 28, 2014 11:08 AM To: r-help@r-project.org Subject: [R] Differencing between 2 previous values Hello All, I am trying to do

Re: [R] Differencing between 2 previous values

2014-07-28 Thread peter dalgaard
On 28 Jul 2014, at 11:08 , Pavneet Arora pavneet.ar...@uk.rsagroup.com wrote: Hello All, I am trying to do a simple thing of calculating the absolute difference between 2 previous values. Since my original data consists of 30 rows, this column where I am storing my absolute difference

Re: [R] Differencing between 2 previous values

2014-07-28 Thread Pavneet Arora
Thank you for that simple answer. Really appreciate it. From: PIKAL Petr petr.pi...@precheza.cz To: Pavneet Arora/UK/RoyalSun@RoyalSun, r-help@r-project.org r-help@r-project.org Date: 28/07/2014 10:26 Subject:RE: [R] Differencing between 2 previous values Hi see in line

Re: [R] Determine all specific same dates between two given dates

2014-07-28 Thread Frank S.
Many thanks for you help Uwe! [[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

Re: [R] R and external C library cannot open shared object file while LD_LIBRARY_PATH is set

2014-07-28 Thread Pierre Lindenbaum
Thanks but that doesn't work: R cannot load a simple external library even if the full path to the directory is specified in the LD_LIBRARY_PATH. I posted a minimal example on gist.github: https://gist.github.com/lindenb/7cd766cbb37de01f6cce The simple C file is compiled but I'm not able to

Re: [R] Function assignment

2014-07-28 Thread Florian Ryan
Thank you very much! The idea was to use it with an external reference and kind of to write an constructor for an object which points at this external reference and behaves like an R object. So it would be the same as if I do just name - function(name, someValuesForObjectConstruction) but I

Re: [R] Is there a package for EFA with multiple groups?

2014-07-28 Thread Joshua Wiley
Hi Elizabeth, In confirmatory factor analysis with multiple groups, the reason one needs to estimate the models simultaneously is that, typically, one is interested in applying constraints (e.g., forcing all or some of the factor loadings to be equal across groups). In exploratory factor

[R] using foumula to calculate a column in dataframe

2014-07-28 Thread Pavneet Arora
Hello All, I need to calculate a column (Vupper) using a formula, but I am not sure how to. It will be easier to explain with an example. Again this is my dataset: dput(nd) structure(list(week = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,

[R] Calculate depth from regular xyz grid for any coordinate within the grid

2014-07-28 Thread Kulupp
Dear R-experts, I have a regular grid dataframe (here: the first 50 rows) : # data frame (regular grid) with x, y (UTM-coordinates) and z (depth) # x=UTM coordinates (easting, zone 32) # y=UTM coordinates (northing, zone 32) # z=river-depth (meters) df - data.frame(x=c(3454240, 3454240,

Re: [R] Calculate depth from regular xyz grid for any coordinate within the grid

2014-07-28 Thread Sarah Goslee
Hi, The area of statistics you're looking for is called geostatistics. There are many R packages to conduct such analyses. See the Spatial task view for some good starting points: http://cran.r-project.org/web/views/Spatial.html You'll need to do some homework to understand the various options

[R] Is dataset headsize from MVA or HSAUR2 packages missing or am I missing something ?

2014-07-28 Thread ottorino
Dear R-helpers, I've started the study of An introductionto applied multivariate analysis with R (Everitt and Hothorn) After loading the library, which depends on HSAUR2, it seems that the dataset headsize is not available (as well as measure and exam) Datasets from the same book are

Re: [R] Function assignment

2014-07-28 Thread Jeff Newmiller
I am sorry but I don't follow your description beyond use it with an external reference because external references are external, while the destination of an assignment is an internal reference. If you want the destination to be an object which uses special knowledge (an external reference) to

Re: [R] lattice, latticeExtra: Adding moving averages to double y plot

2014-07-28 Thread Duncan Mackay
Hi Anna Not sure what you want exactly as I do not use themes. Here is one way to get your averages and points # combine averages into mydata mydata$mavg - c(rep(NA,4), madfStuff1[,3], rep(NA,4), subset(madfStuff2_3, Type== stuff2,3, drop = T), rep(NA,4), subset(madfStuff2_3, Type==

Re: [R] lattice, latticeExtra: Adding moving averages to double y plot

2014-07-28 Thread Sarah Goslee
An utterly perfect example of why one shouldn't send HTML mail to this list. On Mon, Jul 28, 2014 at 11:18 AM, Duncan Mackay dulca...@bigpond.com wrote: Hi Anna Not sure what you want exactly as I do not use themes. Here is one way to get your averages and points # combine averages into

Re: [R] working on a data frame

2014-07-28 Thread Matthew
Thank you very much Peter, Bill and Petr for some great and quite elegant solutions. There is a lot I can learn from these. Yes to your question Bill about the raw numbers, they are counts and they can not be negatives. The data is RNA Sequencing data where there are approximately 32,000

Re: [R] Calculate depth from regular xyz grid for any coordinate within the grid

2014-07-28 Thread MacQueen, Don
I believe the interpp() function from the akima package will do what you want. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 7/28/14, 6:07 AM, Kulupp kul...@online.de wrote: Dear R-experts, I have a regular grid

Re: [R] Calculate depth from regular xyz grid for any coordinate within the grid

2014-07-28 Thread Michael Sumner
The raster package can readily provide bilinear interpolation: library(raster) r - rasterFromXY(df) ## due diligence, just a guess here you should check ## projection(r) - +proj=utm +zone=32 +datum=WGS84 ## coordinates to extract m - matrix(c( 3454263, 5970687), ncol = 2) extract(r, m, method =

[R] rgl.postscript doesn't show the colors correctly

2014-07-28 Thread Ferra Xu
I wrote this code in R, in order to plot a density function kernel smoothing and then save the plot as a eps file: library(ks)  library(rgl) kern -read.table(file.choose(),sep=,) hat -kde(kern) plot(hat,drawpoints=TRUE,xlab =x,ylab=y,zlab=z)  rgl.postscript(plot1.eps,eps,drawText=TRUE) The

[R] Split PVClust plot

2014-07-28 Thread Worthington, Thomas A
Dear All I'm using PVClust to perform hierarchical clustering, for the output plot I can control most of the graphical I need, however the plot is large and I would like to split it vertically into two panels one above the other. Is there a way to plot only part of a PVClust plot, I tried to

Re: [R] using foumula to calculate a column in dataframe

2014-07-28 Thread Jeff Newmiller
On Mon, 28 Jul 2014, Pavneet Arora wrote: Hello All, I need to calculate a column (Vupper) using a formula, but I am not sure how to. It will be easier to explain with an example. Again this is my dataset: dput(nd) structure(list(week = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,

Re: [R] using foumula to calculate a column in dataframe

2014-07-28 Thread Jeff Newmiller
On Mon, 28 Jul 2014, Jeff Newmiller wrote: On Mon, 28 Jul 2014, Pavneet Arora wrote: Hello All, I need to calculate a column (Vupper) using a formula, but I am not sure how to. It will be easier to explain with an example. Again this is my dataset: dput(nd) structure(list(week = c(1, 2, 3,

Re: [R] lattice, latticeExtra: Adding moving averages to double y plot

2014-07-28 Thread Duncan Mackay
I do not know what happened to my last email as this are set up as plain text so I am sending the code again so I hope this works I am not sure what you wanted exactly but this will plot the points and lines of the average. I have not worried about the 2nd axis Here is one way of doing things

[R] interactive labeling/highlighting on multiple xy scatter plots

2014-07-28 Thread Shi, Tao
hi list, I'm comparing the changes of ~100 analytes in multiple treatment conditions.  I plotted them in several different xy scattter plots.  It would be nice if I mouse over one point on one scatter plot, the label of the analyte on that scatter plot AS WELL AS on all other scatter plots

[R] Error in validObject(.Object) : while running rqpd package

2014-07-28 Thread Vishal Chari
Hi  I have installed rqpd on r 2.15.1 win 7 os.  after loading rqpd package i get following output Loading required package: quantreg Loading required package: SparseM Attaching package: ‘SparseM’ The following object(s) are masked from ‘package:base’:     backsolve Loading

[R] outputting R loop to a csv file

2014-07-28 Thread Jenny Jiang
Hello, My name is Jenny Jiang and I am a Finance Honours research student from the University of New South Wales. Currently my research project involves the calculating of some network centrality measures in R by using a loop, however I am having some trouble outputting my loop results to a

Re: [R] outputting R loop to a csv file

2014-07-28 Thread David L Carlson
It will be difficult to help since all of the attached files were stripped out of your message. R-help accepts very few formats as attached files and they do not include .R or .csv or .xlsx, but they do include .txt (so you could rename your R and csv files). It will be easier to help if we

Re: [R] outputting R loop to a csv file

2014-07-28 Thread PIKAL Petr
Hi Above what David said, there is chance that you do not need cycle for your computation. From what you describe about your csv files there seems to be some mismatch in your write.csv statement. Make a small example code together with data set, preferably as an output from dput, and try

Re: [R-es] wordcloud y tabla de palabras

2014-07-28 Thread Alfredo David Alvarado Ríos
Buenas tardes, grupo. Agradecido Carlos por tu orientación y Eduardo. Efectivamente, seguí el ejemplo de wordclouds, y al igual que anteriormente logró hacer la nube de texto, pero sólo por cada uno de los textos considerados. Tengo los dos corpus clean por cada uno de los informes que estoy

Re: [R-es] wordcloud y tabla de palabras

2014-07-28 Thread Carlos Ortega
Hola, La referencia (gracias por proporcionarla) que has incluido es bastante clara y se puede seguir. ¿Has podido sobre tus dos discursos utilizar la misma lógica? La forma de salir de dudas, para empezar, es que adjuntaras el código que estás empleando por ver si hay algún error evidente.