Re: [R] Geocode Conversion

2013-10-23 Thread Peter Maclean
I have this kind od  data x - read.table(text=   Log     lat 3025.264 901.331 3039.237 810.811 3137.760 806.040 3141.190 806.557 3141.229 806.622 3138.891 806.281,                 header=TRUE, stringsAsFactors=FALSE) I what to insert “:” after every first two numbers in

Re: [R] Geocode Conversion

2013-10-23 Thread Jim Lemon
On 10/23/2013 08:05 PM, Peter Maclean wrote: I have this kind od data x- read.table(text=  Log    lat 3025.264 901.331 3039.237 810.811 3137.760 806.040 3141.190 806.557 3141.229 806.622 3138.891 806.281,                header=TRUE, stringsAsFactors=FALSE) I what to

Re: [R] Depends and Imports in DESCRIPTION file

2013-10-23 Thread Duncan Murdoch
On 13-10-23 12:34 AM, Marc Girondot wrote: Le 23/10/13 05:03, Marc Girondot a écrit : Dear list members: I try to check my updated package to include a new version in CRAN (phenology) but a new error is indicated and I don't find the logic. First my system: * using R version 3.0.2 Patched

Re: [R] Geocode Conversion

2013-10-23 Thread arun
Hi, Try: x$Log -  gsub(^(\\d{2})(\\d{2})\\.(\\d{3}),\\1:\\2:\\3E,sprintf(%.3f,x$Log)) x$lat - gsub(^(\\d{1})(\\d{2})\\.(\\d{3}),\\1:\\2:\\3S,sprintf(%.3f,x$lat))  x # Log   lat #1 30:25:264E 9:01:331S #2 30:39:237E 8:10:811S #3 31:37:760E 8:06:040S #4 31:41:190E 8:06:557S #5

Re: [R] Help parsing from .txt

2013-10-23 Thread arun
Hi, You may try: ?list.files() nm1 - list.files(pattern=.txt) res - lapply(nm1,function(x) {                                 ln1 - readLines(x) indx1 - grep(DATE PROCESSED,ln1) indx2 - grep([A-Z],ln1)    

Re: [R] nls model definition help

2013-10-23 Thread Prof J C Nash (U30A)
Because you have y on both sides, and at different times, I think you are going to have to bite the bullet and write down a residual function. Suggestion: write it as res[t+1] = (th1*x1 + R1*x2) * exp(a1*x3) + (1-th1*x1 + R1*x2)*y(t) - y[t+1] (cleaning up the indices -- they are surely needed

Re: [R] matrix of mean values

2013-10-23 Thread arun
Hi Nico, Try: dat-read.table(pollShed.txt, header = T, sep = \t,dec=,)  as.vector(sapply(split(dat,dat$name1),nrow))  #[1]  86  10  43   3  20   7  25  12  18   3   7  12  12  14   3  14  25 175  59 #[20]  49  16   3  16  14  25  14  19   3  18   7   4   3  45  14  16   3  12 238 #[39]  12   3 

[R] changing model matrix restriction in lm()

2013-10-23 Thread Rafael Moral
Dear useRs, I was wondering if there was a way of changing the model matrix restriction automatically in the formula statement when fitting a model using, for example, lm(). When we do set.seed(100) y - rnorm(12) A - gl(3, 4) summary(lm(y ~ A)) we obtain A1=0 as a baseline and A2 and A3 as

Re: [R] changing model matrix restriction in lm()

2013-10-23 Thread Bert Gunter
?contrasts ?C Cheers, Bert On Wed, Oct 23, 2013 at 6:00 AM, Rafael Moral rafa_moral2...@yahoo.com.br wrote: Dear useRs, I was wondering if there was a way of changing the model matrix restriction automatically in the formula statement when fitting a model using, for example, lm(). When we

[R] Loop for R

2013-10-23 Thread THIRU MANIAM
Hi, I need kind help from you. I'm doing my assignment in IR and need to do script in R programming and using R studio tool.I don't have any knowledge in R but learning by Youtube. After so long,i successfully came out with below script for precision 10(P@) But i don know how to do loop for 105

[R] gplot

2013-10-23 Thread Priyanka Nannapaneni
Hi all, I couldn't install gplots package. install.packages(gplot) Warning message: package 'gplot' is not available (for R version 3.0.2) i want to use heat maps.2 function. can you please tell me how to install this package or are there any alternatives. Thanks in advance :)

Re: [R] changing model matrix restriction in lm()

2013-10-23 Thread Rafael Moral
Thank you very much! Best, Rafael. Em qua, 23/10/13, Bert Gunter gunter.ber...@gene.com escreveu: Assunto: Re: [R] changing model matrix restriction in lm() Cc: r-help@r-project.org r-help@r-project.org Data: Quarta-feira, 23 de Outubro de 2013,

Re: [R] Hey guys I have one slight problem with my code

2013-10-23 Thread Carl Witthoft
What's the range of data you are trying to plot? The error message is pretty clear: you've selected a set of breaks which don't span the data range. Maybe try breaks = c(min(x),seq(4,30,2),max(x)) -- View this message in context:

Re: [R] gplot

2013-10-23 Thread David Winsemius
On Oct 23, 2013, at 3:17 AM, Priyanka Nannapaneni wrote: Hi all, I couldn't install gplots package. install.packages(gplot) Warning message: package 'gplot' is not available (for R version 3.0.2) i want to use heat maps.2 function. can you please tell me how to install this package

Re: [R] Loop for R

2013-10-23 Thread Jeff Newmiller
As the Posting Guide ( http://www.R-project.org/posting-guide.html) indicates, this is not a homework help forum. Please use the resources provided by your educational institution for assistance. --- Jeff Newmiller

[R] ARIMA model and xreg with R

2013-10-23 Thread Thibaut Vernay
Dear all, I am struggling in order to use successively in R the functions arima and forecast.Arima with an external regressor vector xreg. Could anyone provide me with a quick example of forecasts with external regressors using these two functions? Many thanks in advance, Thibaut

Re: [R] Loop for R

2013-10-23 Thread PIKAL Petr
Hi I am a little bit curious how efficient can Youtube be in learning statistics. My understanding was that it is mainly for entertainment. However statistics can be also entertainment, especially considering R. Anyway R-intro and help pages for functions are probably better source for

[R] garchFit

2013-10-23 Thread Filippo Monari
Hi, I'm using garchFit function from packages fGarch, to fit some nose. The weird thing is that in some cases the estimate for the alpha1 coefficient is equal to 1, which can't be otherwise the model is not stable. Even more alpha1 = 1 makes impossible to simulate the model. My model is an

[R] garchFit updating

2013-10-23 Thread Filippo Monari
Hi, a little update...I tryed also to change the distribution of the reisduals from normal to t, but no success alpha1 is always equal to 1. And also reducing the model to a arma(0,4) and arma(0,3), doesn't change anything. Here there is also the data set I'm trying to fit. Regards and thanks

[R] Function not working as I'd like

2013-10-23 Thread smugg55
Hey all, So I wrote/borrowed some code (no, I'm not trying to claim all of the work I've done below as my own). Ideally what I'd like the code to do is calculate ep for each iteration of q. Here's the code: gpdriskmeasures = function(x , prob = c(0,.1,.2,.25,.3,.4,.5,.6,.7,.75,.8,.9,.95,.99))

[R] SUR and less observation than parameters

2013-10-23 Thread Linus Holtermann
Hello, i like to incorporate a SUR (Seemingly Unrelated Regression) in a multilevel-model. My panel-dataset includes variables for 400 regions from 1990-2010. In case of SUR-models i found the following econometric requirement that time observations need to exceed unit

[R] raster package: merge/mosaic

2013-10-23 Thread Nora Ernst
Hi all, I'm working with raster data (satellite imagery) and the raster package. The idea is to merge two raster files that are partially overlaping, do have the same coordinate system and resolution but not the same origin. As expected, the functions mosaic(r1,r2) as well as

[R] Scripting call to R-Studio compile PDF

2013-10-23 Thread Adam Hughes
Hey everyone, I have several RStudio (.rnw) files that I am using a script to assemble into a composite document. For this purpose, it would be helpful if the script could automatcially make a call to whatever is called when a user opens up one of these files and manually clicks Compile PDF.

Re: [R] Scripting call to R-Studio compile PDF

2013-10-23 Thread Adam Hughes
Sorry, just to clarify: When I ask how to do this, I mean what does the RStudio compiler actually do? Are there a series of commands that are sent to the shell, similar to how compiling a .tex file is a call to the command line using pdflatex foofile.tex. I'm hoping to just copy these shell

Re: [R] Scripting call to R-Studio compile PDF

2013-10-23 Thread Yihui Xie
RStudio also uses a script to compile Rnw files to PDF; you can see all the magic in the Compile PDF pane (next to your Console pane) after you click the button Compile PDF. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name Department of Statistics, Iowa State University 2215

[R] question regarding cv.glmnet in glmnet package

2013-10-23 Thread Jack Luo
Hi, I am using glmnet for my data and have questions regarding cv.glmnet: 1. Is the 10 fold CV stratified cross validation for binary classification problem? 2. I am doing binary classification (family = binomial), the plot from cv.glmnet gives the average auc as well as the error bar with

Re: [R] Scripting call to R-Studio compile PDF

2013-10-23 Thread David Winsemius
On Oct 23, 2013, at 10:48 AM, Adam Hughes wrote: Sorry, just to clarify: When I ask how to do this, I mean what does the RStudio compiler actually do? Are there a series of commands that are sent to the shell, similar to how compiling a .tex file is a call to the command line using

Re: [R] Function not working as I'd like

2013-10-23 Thread David Carlson
Your problem is here ninetyoneclaims$total.chgq That produces a logical vector of TRUE/FALSE values, but the length of the vector stays the same even though the number of TRUEs is changing. Try sum(ninetyoneclaims$total.chgq) - David L Carlson Associate

Re: [R] Function not working as I'd like

2013-10-23 Thread David Carlson
Actually I wrote too quickly. Since the logical vector is used to subset a vector, the value of length(ninetyoneclaims$total.chg[ninetyoneclaims$total.chgq]) should be changing. David -Original Message- From: David Carlson [mailto:dcarl...@tamu.edu] Sent: Wednesday, October 23, 2013

Re: [R] How to view un-sampled data from a randomly sampled dataset

2013-10-23 Thread arun
HI, You may try: set.seed(432)  dat1 - data.frame(Col1=1:150,Col2=rnorm(150))  y - dat1[sample(1:nrow(dat1),40,replace=FALSE),] x - dat1[-as.numeric(row.names(y)),]  dim(x) #[1] 110   2 intersect(row.names(x),row.names(y)) #character(0) #or  x1 - dat1[!row.names(dat1) %in% row.names(y),]  

Re: [R] Where is element 30?

2013-10-23 Thread MacQueen, Don
Follow these examples: grep(5,1:10) [1] 5 grep(3, c(1,5,2,3,6)) [1] 4 -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 10/22/13 4:21 AM, Alaios ala...@yahoo.com wrote: Hi I have a vector like that readCsvFile$V1

[R] How to view un-sampled data from a randomly sampled dataset

2013-10-23 Thread erinu
Hi there- I have a 150 row dataset (data). I create y a randomly sampled (without replacement) set number of observations (40): y-data[sample(1:nrow(data),40,replace=FALSE),] I would like to make a new variable x that contains the leftover non-sampled 110 observations. I am sure there is a

Re: [R] Function not working as I'd like

2013-10-23 Thread peter dalgaard
On Oct 23, 2013, at 21:06 , David Carlson wrote: Actually I wrote too quickly. Since the logical vector is used to subset a vector, the value of length(ninetyoneclaims$total.chg[ninetyoneclaims$total.chgq]) should be changing. It would if q did, but q is a single vector which gets

Re: [R] changing model matrix restriction in lm()

2013-10-23 Thread Greg Snow
Also look at ?relevel On Wed, Oct 23, 2013 at 7:45 AM, Rafael Moral rafa_moral2...@yahoo.com.br wrote: Thank you very much! Best, Rafael. Em qua, 23/10/13, Bert Gunter gunter.ber...@gene.com escreveu: Assunto: Re: [R] changing model matrix

Re: [R] How to view un-sampled data from a randomly sampled dataset

2013-10-23 Thread peter dalgaard
On Oct 23, 2013, at 20:13 , erinu wrote: Hi there- I have a 150 row dataset (data). I create y a randomly sampled (without replacement) set number of observations (40): y-data[sample(1:nrow(data),40,replace=FALSE),] I would like to make a new variable x that contains the leftover

Re: [R] How to view un-sampled data from a randomly sampled dataset

2013-10-23 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of erinu Sent: Wednesday, October 23, 2013 11:14 AM To: r-help@r-project.org Subject: [R] How to view un-sampled data from a randomly sampled dataset Hi there- I have a 150

Re: [R] Where is element 30?

2013-10-23 Thread peter dalgaard
On Oct 23, 2013, at 20:04 , MacQueen, Don wrote: Follow these examples: grep(5,1:10) [1] 5 grep(3, c(1,5,2,3,6)) [1] 4 Don't: grep(5,1:15) [1] 5 15 -pd -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark

Re: [R] How to view un-sampled data from a randomly sampled dataset

2013-10-23 Thread erinu
Thanks guys! Easy, quick fix! -- View this message in context: http://r.789695.n4.nabble.com/How-to-view-un-sampled-data-from-a-randomly-sampled-dataset-tp4678887p4678905.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] How to view un-sampled data from a randomly sampled dataset

2013-10-23 Thread Bert Gunter
... which raises an interesting point: What if some of the values are replicated? Does the OP want to have a random sample of everything or of the unique values? Cheers, Bert On Wed, Oct 23, 2013 at 12:39 PM, Nordlund, Dan (DSHS/RDA) nord...@dshs.wa.gov wrote: -Original Message- From:

Re: [R] How to view un-sampled data from a randomly sampled dataset

2013-10-23 Thread William Dunlap
s - sample(1:nrow(data), 40, replace=FALSE) y - data[s,] x - data[-s,] If you don't know the size of the sample and it might be 0 then you have to be a bit more wordy: x - data[setdiff(seq_len(nrow(data)), s), ] or the uglier x - if (length(s) 0) x else x[-s,] Bill Dunlap Spotfire,

Re: [R] How to view un-sampled data from a randomly sampled dataset

2013-10-23 Thread erinu
hi bert- all of the values are unique, so the random sample of everything was also a random sample of all unique numbers. Erin -- View this message in context: http://r.789695.n4.nabble.com/How-to-view-un-sampled-data-from-a-randomly-sampled-dataset-tp4678887p4678908.html Sent from the R

Re: [R] Where is element 30?

2013-10-23 Thread MacQueen, Don
oops. Thank you for the correction. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 10/23/13 12:30 PM, peter dalgaard pda...@gmail.com wrote: On Oct 23, 2013, at 20:04 , MacQueen, Don wrote: Follow these examples:

Re: [R] How to view un-sampled data from a randomly sampled dataset

2013-10-23 Thread peter dalgaard
On Oct 23, 2013, at 21:50 , William Dunlap wrote: s - sample(1:nrow(data), 40, replace=FALSE) y - data[s,] x - data[-s,] If you don't know the size of the sample and it might be 0 then you have to be a bit more wordy: x - data[setdiff(seq_len(nrow(data)), s), ] or the uglier x -

Re: [R] Loop for R

2013-10-23 Thread Jim Lemon
On 10/23/2013 09:51 PM, THIRU MANIAM wrote: Hi, I need kind help from you. I'm doing my assignment in IR and need to do script in R programming and using R studio tool.I don't have any knowledge in R but learning by Youtube. After so long,i successfully came out with below script for

Re: [R] labeling abscissa using a function of the plotted scale

2013-10-23 Thread Hurr
I studied the Add an Axis to a Plot document but I can't figure out where the 1/trueScaleValue goes. Would someone help me? -- View this message in context: http://r.789695.n4.nabble.com/labeling-abscissa-using-a-function-of-the-plotted-scale-tp4678075p4678917.html Sent from the R help

[R] data frame pointers?

2013-10-23 Thread Jon BR
Hello, I've been running several programs in the unix shell, and it's time to combine results from several different pipelines. I've been writing shell scripts with heavy use of awk and grep to make big text files, but I'm thinking it would be better to have all my data in one big structure

Re: [R] data frame pointers?

2013-10-23 Thread David Winsemius
On Oct 23, 2013, at 4:36 PM, Jon BR wrote: Hello, I've been running several programs in the unix shell, and it's time to combine results from several different pipelines. I've been writing shell scripts with heavy use of awk and grep to make big text files, but I'm thinking it would be

Re: [R] data frame pointers?

2013-10-23 Thread David Winsemius
On Oct 23, 2013, at 5:24 PM, David Winsemius wrote: On Oct 23, 2013, at 4:36 PM, Jon BR wrote: Hello, I've been running several programs in the unix shell, and it's time to combine results from several different pipelines. I've been writing shell scripts with heavy use of awk and

Re: [R] How to draw figures in a graph?

2013-10-23 Thread halim10-fes
Hi Patric, Thanks for your explanation and suggestions. I didn't know that it might happen. Sorry about that. A good lesson for the future post. Thanks again. Halim On Wed, 23 Oct 2013 21:00:28 +1300, Patrick Connolly wrote This is a request to anyone who starts a new subject to begin

Re: [R] raster package: merge/mosaic

2013-10-23 Thread Carl Witthoft
According to ?merge, you could try adjusting the default value of the tolerance argument. Nora Ernst wrote I'm working with raster data (satellite imagery) and the raster package. The idea is to merge two raster files that are partially overlaping, do have the same coordinate system

Re: [R] labeling abscissa using a function of the plotted scale

2013-10-23 Thread Jeff Newmiller
Not without a reproducible example. You can Google for suggestions about how to do that, with one result being [1]. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --- Jeff

Re: [R] data frame pointers?

2013-10-23 Thread arun
HI, You may try: library(reshape2) df - data.frame(case=c(case_1,case_1,case_2,case_3), gene=c(gene1,gene1,gene1,gene2), issue=c(nsyn,amp,del,UTR), stringsAsFactors=FALSE) res - dcast(df,gene~case,value.var=issue,list)  res #   gene    case_1 case_2 case_3 #1 gene1 nsyn, amp    del   #2

Re: [R] data frame pointers?

2013-10-23 Thread Jon BR
Hi Arun, Your suggestion using dcast is simple and worked splendidly! Unfortunately, the resulting data frame does not play nicely with write.table. Any idea how to could print this out to a tab-delimited text file, perhaps substituting zeros in for the empty cells? See the error below:

Re: [R] data frame pointers?

2013-10-23 Thread arun
HI, Better would be: res1 - dcast(df,gene~case,value.var=issue,paste,collapse=,,fill=0) str(res1) #'data.frame':    2 obs. of  4 variables: # $ gene  : chr  gene1 gene2 # $ case_1: chr  nsyn,amp 0 # $ case_2: chr  del 0 # $ case_3: chr  0 UTR  

Re: [R] labeling abscissa using a function of the plotted scale

2013-10-23 Thread Hurr
Sorry, I wasn't aware that it was that difficult. Here is the example scatter plot data: xvalue,yvalue 1,9 2,3 3,4 4,7 5,2 6,5 7,3 8,6 Please show me how to label the x axis with 1/xvalue. Hopefully, R plotter takes care of spacing, but maybe not. Thanks -- View this message in context:

Re: [R] labeling abscissa using a function of the plotted scale

2013-10-23 Thread Jim Lemon
On 10/24/2013 01:49 PM, Hurr wrote: Sorry, I wasn't aware that it was that difficult. Here is the example scatter plot data: xvalue,yvalue 1,9 2,3 3,4 4,7 5,2 6,5 7,3 8,6 Please show me how to label the x axis with 1/xvalue. Hopefully, R plotter takes care of spacing, but maybe not. Hi Hurr,