Re: [R] Plot a Matrix as an Image with ggplot

2013-02-14 Thread Alaios
Hi, thanks I changed slightly the code to be reproducible from everyone . I have  tried ggplot but I need a bit of help to tweak it a bit So you can run the following in your computer   testData<-matrix(data=round(runif(25)),nrow=5,ncol=5,dimnames=list(1:5,1:5))   p<-ggplot(melt(testData), ae

Re: [R] lm regression query

2013-02-14 Thread Nicole Ford
> > You could also run it and find out. There are many R tutorials free online. I presume crime is continuous, as well...? ~Nicole Ford Graduate Instructor Department of Government and International Affairs University of South Florida office: SOC 012M e: nmhi...@mail.usf.edu http://gi

Re: [R] lm regression query

2013-02-14 Thread Nicole Ford
You will also need to specify/ name your model: Mod <- lm(Crime~. ~Nicole Ford Graduate Instructor Department of Government and International Affairs University of South Florida office: SOC 012M e: nmhi...@mail.usf.edu http://gia.usf.edu/student/nford/ Sent from my iPhone On Feb 14, 201

Re: [R] Using paste on results from tapply?

2013-02-14 Thread arun
HI, You could either get the results by: unlist(lapply(groups,function(x) paste(x,collapse=" ")),use.names=FALSE) #[1] "6" "4 4"   "5 3 2" #or gsub("[c(),]","",paste(groups)) #[1] "6" "4 4"   "5 3 2" str(gsub("[c(),]","",paste(groups))) # chr [1:3] "6" "4 4" "5 3 2"  str(unlist(lapply(gro

Re: [R] Format Integers

2013-02-14 Thread arun
Hi, Try vec1<- c(10, 1000153846, 1000307692, 1000461538, 1000615385) round(vec1/1e6,2) #[1] 1000.00 1000.15 1000.31 1000.46 1000.62 #or as.numeric(sprintf("%.2f",vec1/1e6)) #[1] 1000.00 1000.15 1000.31 1000.46 1000.62 A.K. - Original Message - From: Alaios To: R help Cc: S

[R] Format Integers

2013-02-14 Thread Alaios
Dear all, I would like to format the following numbers xLabel  [1] 10 1000153846 1000307692 1000461538 1000615385 1000769231  [7] 1000923077 1001076923 1001230769 1001384615 1001538462 1001692308 [13] 1001846154 100200 1002153846 1002307692 1002461538 1002615385 [19] 1002769231 1002923

Re: [R] hyper-parameters

2013-02-14 Thread Mark Leeds
Hi: I'm not at all familiar with the r-inla package so I can't help you there. But any arima model can be re-cast into its state space equivalent form. ( I think Jeremy Penzer wrote a paper for showing how this is done in general ) So, one way would be to convert the arima (1,0,1) model for exampl

Re: [R] lm regression query

2013-02-14 Thread Pascal Oettli
Hi, Did you read the help file? Particularly the section "Details". ?lm Regards, Pascal Le 15/02/2013 08:55, email a écrit : Hello: I have a 4-column dataset: Crime, Education, Urbanization, Age. I want to construct a multiple linear regression to find the effect of Education, Urbanization,

[R] file copy to password protected network drive

2013-02-14 Thread Kumar Mainali
I am trying to copy files to a password protected drive which is "Ranch" at TACC from another network drive. I am logged in to the source drive and can run R there. The following code does not even find the destination folder. file.copy("sourcedrive/file.tar", " usern...@ranch.tacc.utexas.edu/uniq

[R] Why no line? (ex. from Andy Filed book)

2013-02-14 Thread Kevin Mc Inerney
The following script is written by the author of a book on R--Andy Field: You can also download the small datafile, hiccups.dat, from this address: http://www.sagepub.com/dsur/study/articles.htm The script: hiccupsData <- read.delim("Hiccups.dat", header = TRUE) hiccups<-stack(hiccupsData) name

[R] Using paste on results from tapply?

2013-02-14 Thread Nikola Janevski
Hi, This is what I'm trying to do: 1. I have a vector split.indexes <- c(1, 3, 3, 6, 6, 6) 2. I have another vector with something like data <- c(6, 4, 4, 5, 3, 2) 3. I use groups <- tapply(data, split.indexes, "c") to create a list of vectors based on the levels in split.indexes. As a result grou

Re: [R] Alternate tick labels in xyplot

2013-02-14 Thread Lisa Daniel
Dear David and Duncan, Thank you for the responses. David: I was able to fix it with grid.text(). Duncan: I would certainly look into ?scale.components in latticeExtra package (xscale.components.default) The code for the figure is below. library(lattice) library(grid) xy <-xyplot(decrease

[R] lm regression query

2013-02-14 Thread email
Hello: I have a 4-column dataset: Crime, Education, Urbanization, Age. I want to construct a multiple linear regression to find the effect of Education, Urbanization, and Age on Crime" lm(Crime ~ Education + Urbanization + Age) If I use + in above statement, does it mean it will build a model to

[R] Building a Package & using gWidgets

2013-02-14 Thread Benjamin Ward (ENV)
Hi, For the past few months I've been building a simulation in R I hope to package. It consists of two usable functions, and many internal ones which one of the two usable functions call while looping, to perform the stages of simulation. A simple conceptual example is: # Abstract representati

[R] hyper-parameters

2013-02-14 Thread Juan Manuel Becerra
I'm searching a method to estimate the hyper-parameters in arima models. I'm reading about r-inla package, but in the examples section only talk about the AR part of the arima, but i need help about the MA part too. I'm beginner in Bayesian methods, I'm reading the documentation about dlm package

Re: [R] 2 setGeneric's, same name, different method signatures

2013-02-14 Thread Greg Minshall
i'm answering my own question: 1. setGeneric's override (wipe out, really) previous ones. (this is pointed out in section 5.3 of "A (Not So) Short Introduction to S4 Object Oriented Programming in R" by Christophe Genolini.) 2. the *names* of the formals are important. 3. one can specify a

Re: [R] appending data to a row

2013-02-14 Thread arun
HI, May be this helps: (assuming that there are only twins) dat1<- read.table(text=" FamilyID  ParticipantID  IQ  Digit_span 1    1  95  6 1    2  93  7 2    3  102 8 2    4  101 9 3    5  106 7 3    6 

Re: [R] plot custom x axis ticks values

2013-02-14 Thread Jim Lemon
On 02/14/2013 09:41 PM, e-letter wrote: Readers, For this data set: testvalues<-c(10,20,30,40) How to amend the plot instruction: plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n') so that x axis ticks labels can be added to existing graph with arbitrary value such as 0,100,200,300)? Hi

Re: [R] 2 setGeneric's, same name, different method signatures

2013-02-14 Thread Martin Morgan
On 2/14/2013 8:57 AM, Greg Minshall wrote: hi. below is a small test case (hopefully minimal, though i'm still a bit confused about initializers). i would have guessed (and maybe i still would have been right) that one could re-use the name of a generic function for functions with different num

Re: [R] How to stack row vector on top of each other?

2013-02-14 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of C W > Sent: Thursday, February 14, 2013 5:08 PM > To: r-help > Subject: [R] How to stack row vector on top of each other? > > Hi list, > How do you actually stack a vector on top

Re: [R] How to stack row vector on top of each other?

2013-02-14 Thread C W
Wow, thanks, I just wasn't thinking right. I also figured this would do cbind(t(a), t(b)), but that's asking for more work. Mike On Thu, Feb 14, 2013 at 8:17 PM, Pascal Oettli wrote: > Hi, > > Actually, ?"c" > > > > a <- rnorm(10) > > b <- rnorm(10) > > d <- c(a,b) > > length(d) > [1] 20 > > H

Re: [R] How to stack row vector on top of each other?

2013-02-14 Thread Pascal Oettli
Hi, Actually, ?"c" > a <- rnorm(10) > b <- rnorm(10) > d <- c(a,b) > length(d) [1] 20 HTH, Pascal Le 15/02/2013 10:08, C W a écrit : Hi list, How do you actually stack a vector on top of each other? Say, I want everything in a row vector. Neither rbind(), nor cbind() will do the job. It

[R] How to stack row vector on top of each other?

2013-02-14 Thread C W
Hi list, How do you actually stack a vector on top of each other? Say, I want everything in a row vector. Neither rbind(), nor cbind() will do the job. It gives me 2 dimension. Here's my reproducible example: > a <- rnorm(10) > b <- rnorm(10) > c <- cbind(a,b) > dim(c) [1] 10 2 > d <- rbind(a

Re: [R] sweave question

2013-02-14 Thread Duncan Mackay
Hi Mark I need pdfs for Sweave etc, my colleagues want wmfs or the ilk and for publishing eps/tiff so I just add a section for each with in the 'print' chunk Duncan At 02:49 15/02/2013, you wrote: Hi Dan, Duncan and Yihui: I apologize for my late response. Dan: Your backslash explanation

Re: [R] appending data to a row

2013-02-14 Thread Rui Barradas
Hello, Maybe something like the following. dat <- read.table(text = " FamilyID ParticipantID IQ Digit_span 1 1 95 6 1 2 93 7 2 3 102 8 2 4 101 9 3 5 106 7 3 6 108 9

Re: [R] appending data to a row

2013-02-14 Thread David Winsemius
On Feb 14, 2013, at 1:07 PM, Jamie wrote: > For an analysis of data from twins, I'd like to do some rearranging in my > dataframe. Currently, each twin has his or her own row. I'd like to add > several columns of the co-twin's data to each row. In other words, this is > the current situation: >

Re: [R] Rcmdr, RODBC and XLConnect conflict cause R to crash

2013-02-14 Thread John Fox
Dear Jeremy, I'm not sure why loading all three packages creates a problem, but I can explain how the Rcmdr uses each of the other two. RODBC is more general than XLConnect, in that it allows the Rcmdr to read dBase and Access files in addition to Excel files. On the other hand, RODBC cannot

Re: [R] Alternate tick labels in xyplot

2013-02-14 Thread David Winsemius
On Feb 14, 2013, at 10:52 AM, Lisa Daniel wrote: > Dear Rhelp, > I was able to solve the tick labels part. If somebody can help me in > creating title for each row of figures above the individual headings, it will > be great. I think you need to be looking at grid.text() in package grid. > l

Re: [R] stratified analysis

2013-02-14 Thread John Kane
Nothing got through. You need to send everything in text format. John Kane Kingston ON Canada > -Original Message- > From: 98sa...@gmail.com > Sent: Thu, 14 Feb 2013 15:04:24 -0500 > To: r-help@r-project.org > Subject: [R] stratified analysis > > I am having trouble doing a stratified

[R] appending data to a row

2013-02-14 Thread Jamie
For an analysis of data from twins, I'd like to do some rearranging in my dataframe. Currently, each twin has his or her own row. I'd like to add several columns of the co-twin's data to each row. In other words, this is the current situation: FamilyID ParticipantID IQ Digit_span 1

[R] stratified analysis

2013-02-14 Thread Samir Navare
I am having trouble doing a stratified analysis while obtaining the mean,median, and standard deviation of each group. I have copied and pasted the console below. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://

Re: [R] Alternate tick labels in xyplot

2013-02-14 Thread Lisa Daniel
Dear Rhelp, I was able to solve the tick labels part.  If somebody can help me in creating title for each row of figures above the individual headings, it will be great. library(grid) library(lattice) xy <-xyplot(decrease ~ treatment, OrchardSprays,     main= "Some plot",     groups = rowpos,

Re: [R] match in dependence of 2 columns

2013-02-14 Thread arun
HI, If the dataset is similar to this: dat1<- read.table(text="   cu.nr. name  value  A 1 Evo 100 B 1 Mer 80  C 2 Ford

[R] Rcmdr, RODBC and XLConnect conflict cause R to crash

2013-02-14 Thread Jeremy MAZET
Dear all, Since I upgraded R to the version 2.15.2, I have a strange problem which implies XLConnect, RODBC and Rcmdr packages. - If the three packages are loaded in the same R session, the use of RodbcConnect functions cause R to crash. - This crash occur only if Rcmdr is loaded. - If only

[R] Clip a contour with shapefile while using contourplot

2013-02-14 Thread Janesh Devkota
Hi, I have done the interpolation for my data and I was able to create the contours in multipanel with the help of Pascal. Now, I want to clip the contour with the shapefile. I want only the portion of contour to be displayed which falls inside the boundary of the shapefile. The data mydata.csv ca

[R] party::cforest - predict?

2013-02-14 Thread James Jong
What is the function call interface for predict in the package party for cforest? I am looking at the documentation (the vignette) and ?cforest and from the examples I see that one can call the function predict on a cforest classifier. The method predict seems to be a method of the class RandomFor

Re: [R] CARET: Any way to access other tuning parameters?

2013-02-14 Thread James Jong
Got it. Thank you Max. James On Wed, Feb 13, 2013 at 1:30 PM, Max Kuhn wrote: > > > @Max - Thanks a lot for your help. I have already been using that website >> as a reference, and it's incredibly helpful. I have also been experimenting >> with tuneGrid already. My question was specifically if

Re: [R] plot custom x axis ticks values

2013-02-14 Thread MacQueen, Don
> plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n') > par()$usr [1] 0.88 4.12 8.80 41.20 The x axis range is from 0.88 to 4.12, so tick labels at 0, 100, 200, 300 makes no sense. Any axis() command where the 'at' values are within the range of the x axis will work. Even, for example, ax

Re: [R] An extended Hodgkin-Huxley model that doesn't want to work.

2013-02-14 Thread Berend Hasselman
Forgot Reply to All. On 13-02-2013, at 23:30, Jannetta Steyn wrote: > Hi All > > I have been struggling with this model for some time now and I just can't > get it to work correctly. The messages I get when running the code is: > > DLSODA- Warning..Internal T (=R1) and H (=R2) are > such

[R] Install package "ROpenOffice"

2013-02-14 Thread Earl Brown
Has anyone had trouble installing the package "ROpenOffice" from omegahat: http://www.omegahat.org/ROpenOffice/ I downloaded the .tar.gz file to my local hard drive and tried to install it with the following code, but got an error message: > install.packages("/Users/earlbrown/Desktop/ROpenOffic

[R] Alternate tick labels in xyplot

2013-02-14 Thread Lisa Daniel
Dear Rhelp, I would like to get alternate tick labels for the xyplot: library(lattice) library(grid) xy <-xyplot(decrease ~ treatment, OrchardSprays,     main= "Some plot",     groups = rowpos, type = "a",         page = function(n){ grid.text(LETTERS[j],

[R] 2 setGeneric's, same name, different method signatures

2013-02-14 Thread Greg Minshall
hi. below is a small test case (hopefully minimal, though i'm still a bit confused about initializers). i would have guessed (and maybe i still would have been right) that one could re-use the name of a generic function for functions with different numbers of arguments. in the case below, class

[R] IWSM 2013: LAST call for papers

2013-02-14 Thread Vito M.R. Muggeo
dear all, apologizes for this OT === 28th International Workshop on Statistical Modelling (IWSM), Palermo (Italy) 8-12 July 2013. http://iwsm2013.unipa.it Dear friend, For your information, I would like to bring to your attention that deadline for submission of abstr

Re: [R] 3D-plots of 2D-grids

2013-02-14 Thread David Winsemius
On Feb 14, 2013, at 8:05 AM, jas wrote: calc_ext3.asc I supplied a small extent of the grid, that I am trying to visualize. It s a ascii-grid with 800 cells. My goal is to display the Grid-Values as the z-variable. The point th

[R] Center a raster on the Pacific in a plot

2013-02-14 Thread Sophie MONSARRAT
Hello all, I am currently working with environmental data at a global scale for modeling marine species distribution. These environmental data are provided as ASCII files and I convert them into raster for the analyzes, using the raster package. All of these raster are centered around the Green

Re: [R] sweave question

2013-02-14 Thread Mark Leeds
Hi Dan, Duncan and Yihui: I apologize for my late response. Dan: Your backslash explanation was great but yes, I think there was a transmission problem in the link I sent. I made the changes and everything compiled without a glitch but the actual tex file ends up with many begin{Schunk} and end{Sc

Re: [R] 3D-plots of 2D-grids

2013-02-14 Thread jas
calc_ext3.asc I supplied a small extent of the grid, that I am trying to visualize. It s a ascii-grid with 800 cells. My goal is to display the Grid-Values as the z-variable. The point that I dont understand, is what is my input as x a

Re: [R] spearman correlation and p-value as a matrix

2013-02-14 Thread arun
Hi Ozgul, Try this: #Here I used the "pearson correlation" as `spearman` was not significant resr<-do.call(rbind,lapply(split(bg_ag,1:nrow(bg_ag)),function(x) {res<-rcorr(cbind(bg[,x[,1]],ag[,x[,2]]),type="pearson")$r; row.names(res)<- rep(paste(x[1],x[2],sep="_"),2);res})) #p-values resP<-do

Re: [R] spearman correlation and p-value as a matrix

2013-02-14 Thread Ozgul Inceoglu
you are right! I was so happy to find out the p-value criteria, I totally forgot about the spearman correlation, no I dont think there is an option of spearman correlation. Thank you for pointing that out! Cheers, Ö >Dear Ozgul, > >I made a comment in the previous email, which I didn't check

Re: [R] spearman correlation and p-value as a matrix

2013-02-14 Thread arun
Dear Ozgul, I made a comment in the previous email, which I didn't check it. Thank you for the ?cor2m(). I checked the results of the example dataset with cor2m().  Does it have an option for spearman correlation?  The values below seem to be pearson #cor2m  cor2m(bg,ag,trim=TRUE,alpha=0.05) ##

[R] R script .bat file from Python

2013-02-14 Thread Fabio Veronesi
Hello, I would like to start running a script from Python with the Rscript command. I tested several ways of invoking R from Python and I finally I succeeded. The problem is that the script starts but R does not recognize the installed packages. I tried simplifying the matter and I created a scrip

Re: [R] Plot a Matrix as an Image with ggplot

2013-02-14 Thread John Kane
The R-help list is rather picky about what attached. None of your attachments arrived. The str() info is useful but please supply some sample data The easiest way to supply data is to use the dput() function. Example with your file named "testfile": dput(testfile) Then copy the output a

Re: [R] execute an external program in R

2013-02-14 Thread Greg Snow
?sprintf On Thu, Feb 14, 2013 at 6:59 AM, Esam Tolba wrote: > Dear all > I am using r (2.15.2) under windows 7 32bit. > I want to use system command to execute an external program inside a > for loop. this program needs the input and output names. > since the names will change in the for loop

Re: [R] Need Help Plotting "Line" for multiple linear regression

2013-02-14 Thread Greg Snow
The abline function works fine for simple linear regression because there is only 1 line, but with multiple linear regression there are an infinite number of lines and you need to decide which to plot (or find a way to plot t he plane/hyperplane/surface/etc.). One option is to use the Predict.Plot

[R] Plot a Matrix as an Image with ggplot

2013-02-14 Thread Alaios
Dear all, I am trying to plot a matrix I have  as an image str(matrixToPlot)  num [1:21, 1:66] 0 0 0 0 0 0 0 0 0 0 .  that contains only 0s and 1s, where the xlabel will be Labeled as str(xLabel)  num [1:66] 1e+09 1e+09 1e+09 1e+09 1e+09 ... and the yLabels will be labeled as str(yLabel)  nu

[R] pearson's correlation and cross-correlation issue

2013-02-14 Thread Pierre Antoine DuBoDeNa
Hello, I want to compute the pearson's correlation, but even for signals that are shifted. For example having two signals like: 1 1 2 1 1 and 1 2 1 1 1 the correlation is very low.. but if we shift them in the right we get much better correlation. I know that cross-correlation is used to find

Re: [R] NA/NaN/Inf in foreign function call (arg 6) error from coxph function

2013-02-14 Thread Terry Therneau
The NaN/Inf message is almost certainly from a singular fit. I would be interested in a copy of the data set to test it: data sets that cause this are rare, and help me to tune the convergence/signularity criteria in the program. Note: it is much easier to use coxph(survobj ~ therapy + Recep

Re: [R] R question

2013-02-14 Thread Adams, Jean
Pedro, I only skimmed your question on stackoverflow, but since I had just seen a related post on R-bloggers (http://www.r-bloggers.com), I thought you might be interested. "Out-of-sample one-step forecasts "It is common to fit a model using training data, and then to eval­u­ate its per­for­mance

[R] Plotting survival curves after multiple imputation

2013-02-14 Thread Robert Long
I am working with some survival data with missing values. I am using the mice package to do multiple imputation. I have found code in this thread which handles pooling of the MI results: https://stat.ethz.ch/pipermail/r-help/2007-May/132180.html Now I would like to plot a survival curve using th

Re: [R] Looking for an easy way to change the names of a vector

2013-02-14 Thread arun
Hi, names(Data)[-grep(".*\\s+.*",names(Data))]<-paste(names(Data)[-grep(".*\\s+.*",names(Data))],"-XXX",sep="") names(Data)[grep(".*\\s+.*",names(Data))]<-gsub("[ ]","-",names(Data)[grep(".*\\s+.*",names(Data))])  names(Data) #[1] "ada-XXX"    "fsdfs-XXX"  "asd-fd" "asdsa-XXX"  "dsada-XXX"

Re: [R] spearman correlation and p-value as a matrix

2013-02-14 Thread arun
Dear Ozgul, You could use ?table() or ?count from library(plyr) I assume that you wanted to count only from the first column.  data2<- read.csv("cor3.csv",sep="\t",stringsAsFactors=FALSE)  res1<-as.data.frame(table(data2[,1])) res2<-count(data2[,1]) colnames(res1)<- colnames(res2)  identical(res1,r

[R] Test if mysql connection is alive

2013-02-14 Thread Frans Marcelissen
Hi fellows, I use RMySQL. I want to reconnect, if the connections is not alive anymore. if (!connected()) con<-dbConnect(MySQL(),user=.., password=..,host=..,db=..) But how can I do the test connected()? I thought the way to do this was, connected()<-function(

[R] network connectivity is *not* symmetric -- library(parallel)

2013-02-14 Thread Greg Minshall
hi. i've been very happy using multicore functionality, but felt the need to get more horsepower, so have been trying to use parallel (after realizing it is the "new snow") to access an amazon EC2 cluster, but have had no success. in the internet today, if machine M (the master) can open a connec

[R] execute an external program in R

2013-02-14 Thread Esam Tolba
Dear all I am using r (2.15.2) under windows 7 32bit. I want to use system command to execute an external program inside a for loop. this program needs the input and output names. since the names will change in the for loop I am not able to use the programs on all the files for (k in 1:10){

Re: [R] Nomogram after Cox Random Effect (frailty) model

2013-02-14 Thread Frank Harrell
This can't be done directly, but if you can output predicted values from coxme and fit an rms ols model that predicts these predicted values with an R^2 of 1.0 you can use nomogram() on the ols fit to get what you want. Frank george boul wrote > Dear R-users, > I am a novice R-user with some exper

[R] Nomogram after Cox Random Effect (frailty) model

2013-02-14 Thread george boul
Dear R-users, I am a novice R-user with some experience in using the RMS package for taking nomograms after various survival models. This time, I am trying to plot a nomogram after a Random Effects Cox, implemented by the "coxme" package. My questions are: 1. Is it possible to take a nomogram di

Re: [R] Problems plotting and regression w.r.t. date data type on x axis

2013-02-14 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Kategoricus > Sent: Thursday, February 14, 2013 12:25 PM > To: r-help@r-project.org > Subject: Re: [R] Problems plotting and regression w.r.t. date data type > on x axis > >

Re: [R] plot custom x axis ticks values

2013-02-14 Thread PIKAL Petr
Hi when I tried your code the labels were positioned at correct positions. Please send some reproducible example. Regards Petr > -Original Message- > From: e-letter [mailto:inp...@gmail.com] > Sent: Thursday, February 14, 2013 11:58 AM > To: PIKAL Petr > Cc: r-help@r-project.org > Subje

Re: [R] [lattice] display a projected map on a layerplot

2013-02-14 Thread Felix Andrews
Hi I'm a bit lost in the labyrinthine world of map projections, but clearly something is mismatched between the two coordinate systems being plotted: 1. the raster - the plot scale here seems to be cell numbers starting from cell (1,1). > summary(coordinates(o3.raster)) xy

[R] How write raster files after manipulation?

2013-02-14 Thread Jonsson
I have 12 binary (raster) files https://echange-fichiers.inra.fr/get?k=k3M2jatJyHy65Cs99G4 . I would like to calculate the moving average for the 12 values for each pixel in the 12 files. For a simple vector we can get a moving average by using this : x <- c(1,2,3,NA

Re: [R] Problems plotting and regression w.r.t. date data type on x axis

2013-02-14 Thread Kategoricus
as.POSIXct() works fine (finally!) Thanks a lot David&Petr for your help! -- View this message in context: http://r.789695.n4.nabble.com/Problems-plotting-and-regression-w-r-t-date-data-type-on-x-axis-tp4658518p4658537.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] approxfun values

2013-02-14 Thread Keith Jewell
Alternatively, with approx() use xout to specify which interpolated values you want returned: approx(dat, xout=dat$V1[is.na(dat$V2)]) KJ On 14/02/2013 11:43, Rui Barradas wrote: Hello, In what follows I've changed your df name to 'dat', to save some keystrokes. approxfun returns a function,

Re: [R] Looking for an easy way to change the names of a vector

2013-02-14 Thread Rui Barradas
Hello, Use ifelse, and assign its values to names(Data) ifelse(grepl(" ", names(Data)), gsub(" ", "-", names(Data)), paste0(names(Data), "-XXX")) Hope this helps, Rui Barradas Em 14-02-2013 11:43, Christofer Bogaso escreveu: Hello again, Let say I have following vector (this is basically

Re: [R] approxfun values

2013-02-14 Thread Rui Barradas
Hello, In what follows I've changed your df name to 'dat', to save some keystrokes. approxfun returns a function, so if you want just the interpolated values, apply that function to the x values where y is NA. dat <- read.table(text = " V1 V2 1 10 2 2 20 NA 3 30 5 4 40 7 5 50 N

[R] Looking for an easy way to change the names of a vector

2013-02-14 Thread Christofer Bogaso
Hello again, Let say I have following vector (this is basically a snap of very large vector): Data <- 1:8 names(Data) <- c("ada", "fsdfs", "asd fd", "asdsa", "dsada", "asasad", "adas asdad", "aasaa") Data Now I want to change the names according to following rule: 1. If there is any space then

Re: [R] Problems plotting and regression w.r.t. date data type on x axis

2013-02-14 Thread Kategoricus
Hello Petr! thanks a lot for your help. The plot command plots well, but the abline returns without error and does nothing. > str(tabelle) 'data.frame': 4 obs. of 3 variables: $ date : Factor w/ 4 levels "2009-01-1","2009-12-1",..: 1 2 3 4 $ number: int 1673 2111 2487 4301 $ date2 : POSIX

Re: [R] match in dependence of 2 columns

2013-02-14 Thread Rui Barradas
Hello, You can do something like this: join(dat1, dat2[, c("cu.nr", "name", "value")], by=c("cu.nr.","name"),type="right") Hope this helps, Rui Barradas Em 14-02-2013 07:03, Mat escreveu: thank you, this code works: library(plyr) join(dat1,dat2,by=c("cu.nr.","name"),type="right") but my

Re: [R] Problems plotting and regression w.r.t. date data type on x axis

2013-02-14 Thread David Winsemius
On Feb 14, 2013, at 1:10 AM, Kategoricus wrote: Hello, probably a newbie question, but i didnt find any information on plotting/regressing w.r.t. a date data type. My trials were unfruitful. Can anyone help ? Thanks in advance! Here is my interaction with R: tabelle date number date2 1

Re: [R] 3D-plots of 2D-grids

2013-02-14 Thread David Winsemius
On Feb 14, 2013, at 1:10 AM, jas wrote: Hello everybody, I have an Ascii-grid (100x100m) with population density over Switzerland (local coordinations system, CH LV03). Now I would like to have a nice graphic to present the data. I would like to make a plot that will show the density as

Re: [R] list of matrices --> array

2013-02-14 Thread David Winsemius
On Feb 13, 2013, at 10:03 PM, Murat Tasan wrote: i'm somehow embarrassed to even ask this, but is there any built-in method for doing this: my_list <- list() my_list[[1]] <- matrix(1:20, ncol = 5) my_list[[2]] <- matrix(20:1, ncol = 5) now, knowing that these matrices are identical in dimensi

Re: [R] Plotting multiple xyplots in same page

2013-02-14 Thread Duncan Mackay
Hi Lisa I did something like what you want several months ago but cannot find it. I think I used viewport in the grid package and it was a case of using several viewports withing a tree akin to what you have been doing with print. Paul Murrell's book R Graphics 2nd edition may be of use Sor

Re: [R] plot custom x axis ticks values

2013-02-14 Thread e-letter
On 14/02/2013, PIKAL Petr wrote: > Hi > > much quicker and better for you is to inspect help pages. > > ?axis > > axis(1, at=1:4, labels=c(letters[1:4])) Had tried, but noticed that the labels created were not positioned equally across the entire axis, but occupied about 50 % (the left half) of t

Re: [R] plot custom x axis ticks values

2013-02-14 Thread PIKAL Petr
Hi much quicker and better for you is to inspect help pages. ?axis axis(1, at=1:4, labels=c(letters[1:4])) Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of e-letter > Sent: Thursday, February 14, 2013 11:41 A

[R] plot custom x axis ticks values

2013-02-14 Thread e-letter
Readers, For this data set: testvalues<-c(10,20,30,40) How to amend the plot instruction: plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n') so that x axis ticks labels can be added to existing graph with arbitrary value such as 0,100,200,300)? Thanks in advance. -- r2151 ___

Re: [R] Problems plotting and regression w.r.t. date data type on x axis

2013-02-14 Thread PIKAL Petr
Hi most probably your dates are not what you expect. Eg. they look like a date but they are not treated as date. You can check yourself by str(tabelle) which will result probably in factor, numeric, factor. You need to change variables date and date2 into Date class. ?strptime or ?as.Date da

[R] Problems plotting and regression w.r.t. date data type on x axis

2013-02-14 Thread Kategoricus
Hello, probably a newbie question, but i didnt find any information on plotting/regressing w.r.t. a date data type. My trials were unfruitful. Can anyone help ? Thanks in advance! Here is my interaction with R: > tabelle date number date2 1 2009-01-1 1673 2009-01-01 2 2009-12-1 2111 2009-12-01

[R] 3D-plots of 2D-grids

2013-02-14 Thread jas
Hello everybody, I have an Ascii-grid (100x100m) with population density over Switzerland (local coordinations system, CH LV03). Now I would like to have a nice graphic to present the data. I would like to make a plot that will show the density as the z-variable and raise for example a stacking p

Re: [R] Kernel Density estimation at specific points

2013-02-14 Thread Robert Duval
Dear Bert, Thanks for the pointer. I had been looking for quite some time on the r-mailing list and didn't stumble upon the right approach. But you were right, a broader search would have led me to the right place. My apologies for that. Just to close this post and give an answer to future person

Re: [R] R CMD in batch mode/trycatch() keeps hold on resources

2013-02-14 Thread guillaume Le Ray
Problem fixed. http://stackoverflow.com/questions/7103429/all-the-connections-are-in-use-execution-halted/7108799#7108799 It can happen when the error handling is not properlly done. trycatch enter in finally and get stuck. 2013/2/13 guillaume Le Ray > HI all, > > I am using R (version 2.13.1)

Re: [R] list of matrices --> array

2013-02-14 Thread Rolf Turner
require(abind) do.call(abind,c(my_list,list(along=0))) # Gives 2 x 4 x 5 do.call(abind,c(my_list,list(along=3))) # Gives 4 x 5 x 2 The latter seems more natural to me. cheers, Rolf Turner On 02/14/2013 07:03 PM, Murat Tasan wrote: i'm somehow embarrassed to even ask this, but is

[R] approxfun values

2013-02-14 Thread e-letter
Readers, According to the help '?approxfun', the function can be used to obtain the interpolated values. The following test was tried: > testinterpolation<-read.csv('test.csv',header=FALSE) > testinterpolation V1 V2 1 10 2 2 20 NA 3 30 5 4 40 7 5 50 NA 6 60 NA 7 70 2 8 80

Re: [R] Need Help Plotting "Line" for multiple linear regression

2013-02-14 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Craig O'Connell > Sent: Wednesday, February 13, 2013 11:03 PM > To: r-help@r-project.org > Subject: [R] Need Help Plotting "Line" for multiple linear regression > > Hello, >