Re: [R] Generating a polygon around points

2014-08-15 Thread Rolf Turner
On 16/08/14 11:01, David Winsemius wrote: On Aug 15, 2014, at 3:11 PM, Rolf Turner wrote: I tried RSiteSearch("convex hull") just now, as an experiment, and it seemed to work just fine. I think that the Universe is picking on Dave (instead of on me, for once!). :-) RSiteSearch("conve

Re: [R] unable to use functions require DLL from package

2014-08-15 Thread David Winsemius
On Aug 15, 2014, at 2:56 PM, Charlotte de Vries wrote: > David Winsemius comcast.net> writes: > >> >> >> On Aug 15, 2014, at 8:06 AM, Charlotte de Vries wrote: >> >>> Hey there! >>> >>> I'm having problems with the same code, but I get a different error: >> >> This is apparently yet anoth

Re: [R] unable to use functions require DLL from package

2014-08-15 Thread Charlotte de Vries
David Winsemius comcast.net> writes: > > > On Aug 15, 2014, at 8:06 AM, Charlotte de Vries wrote: > > > Hey there! > > > > I'm having problems with the same code, but I get a different error: > > This is apparently yet another example demonstrating why the Posting Guide suggests that you i

Re: [R] Generating a polygon around points

2014-08-15 Thread David Winsemius
On Aug 15, 2014, at 3:11 PM, Rolf Turner wrote: > On 16/08/14 05:10, Jeff Newmiller wrote: >> I use RSiteSearch regularly with no problems. Perhaps I have just had >> a lucky streak? I wonder what the odds are... :-) > > > > >> On August 15, 2014 8:55:40 AM PDT, David Winsemius >> wrote: >>>

Re: [R] Generating a polygon around points

2014-08-15 Thread Rolf Turner
On 16/08/14 05:10, Jeff Newmiller wrote: I use RSiteSearch regularly with no problems. Perhaps I have just had a lucky streak? I wonder what the odds are... :-) On August 15, 2014 8:55:40 AM PDT, David Winsemius wrote: On Aug 15, 2014, at 8:15 AM, Jeff Newmiller wrote: Not really sure

Re: [R] Generating a polygon around points

2014-08-15 Thread Rolf Turner
On 16/08/14 02:51, Bob O'Hara wrote: I've been struggling for half a day on what should be a simple problem... I have a data frame of lat/long coordinates that describe a region, and I want to draw a polygon around them so I can use that as a boundary (to be thrown at INLA, but those details are

Re: [R] A basic statistics question

2014-08-15 Thread Rolf Turner
On 16/08/14 01:29, Joshua Wiley wrote: On Wed, Aug 13, 2014 at 7:41 AM, Rolf Turner mailto:r.tur...@auckland.ac.nz>> wrote: On 13/08/14 07:57, Ron Michael wrote: Hi, I would need to get a clarification on a quite fundamental statistics property, hope expeRts here w

Re: [R] Turn Rank Ordering Into Numerical Scores By Transposing A Data Frame

2014-08-15 Thread Simon Kiss
Both the suggestions I got work very well, but what I didn't realize is that NA values would cause serious problems. Where there is a missing value, using the argument na.last=NA to order just returns the the order of the factor levels, but excludes the missing values, but I have no idea where

Re: [R] unable to use functions require DLL from package

2014-08-15 Thread David Winsemius
On Aug 15, 2014, at 8:06 AM, Charlotte de Vries wrote: > Hey there! > > I'm having problems with the same code, but I get a different error: This is apparently yet another example demonstrating why the Posting Guide suggests that you include the text of any earlier posting to which you want u

Re: [R] regex pattern assistance

2014-08-15 Thread arun
Hi Tom, You could try: library(stringr) str_extract(x, perl("(?<=[A-Za-z]{4}/).*(?=/[0-9])")) #[1] "S01-012" A.K. On Friday, August 15, 2014 12:20 PM, Tom Wright wrote: Hi, Can anyone please assist. given the string > x<-"/mnt/AO/AO Data/S01-012/120824/" I would like to extract "S01-012"

Re: [R] how to avoid change string to number automaticlly in r

2014-08-15 Thread arun
A similar post was found in stackoverflow (http://stackoverflow.com/questions/25328311/how-to-avoid-change-string-to-number-automaticlly-in-r), which already got an accepted reply. A.K. On Friday, August 15, 2014 2:18 PM, Wenlan Tian wrote: I was trying to save some string into a matrix, bu

Re: [R] Generating a polygon around points

2014-08-15 Thread Tsjerk Wassenaar
Hi Bob, You probably want to have a look at the package alphahull. Cheers, Tsjerk On Fri, Aug 15, 2014 at 5:25 PM, Clint Bowman wrote: > Your question seems to need an answer to, "How do you find a convex hull > on a sphere?" Google has many references. > > Clint BowmanI

[R] NA error with the dredge function

2014-08-15 Thread Valentina Lauria
Dear members, I am experiencing a strange error using the dredge function of the package MuMIn. I am not sure what is happening here as this script worked in the past and I have no idea about this new error, I do not have any NA in my data. > full_m<- gam(nep~ s(depth, k=4) + s(sed, k=4) + s(sl

[R] how to avoid change string to number automaticlly in r

2014-08-15 Thread Wenlan Tian
I was trying to save some string into a matrix, but it automatically changed to numbers (levels). How can i avoid it?? Here is the original table: trtmeans M1 0 12.16673 a2 111 11.86369 ab3 125 11.74433 ab4 14 11.54073 b I wanna to save to a matrix like: J0001 a ab ab b But, what i

Re: [R] unable to use functions require DLL from package

2014-08-15 Thread Charlotte de Vries
Hey there! I'm having problems with the same code, but I get a different error: Error in .C("spline_coef", method = as.integer(method), n = n, x = as.double(x), : "spline_coef" not available for .C() for package "stats" I'm using R3.1.0 on windows 8 and I've never used R before, so I migh

Re: [R] Generating a polygon around points

2014-08-15 Thread MacQueen, Don
I have been using a process like the following to create polygons that (closely) surround a non-convex set of points. buf1 <- gBuffer(tmpb.ne, width=bstart, byid=TRUE) buf2 <- gUnaryUnion(buf1) buf <- gBuffer(buf2, width=bshrink) These functions are from the rgeos package. In my case, tmpb

Re: [R] Operating on the value from row i and row i+1

2014-08-15 Thread MacQueen, Don
Perhaps use approx() separately for each patient. But your new example, with times 1, 2, 6, 8 does not match your first example with times 0, 3, 9. Nor had you mentioned having multiple patients before. So it is difficult to understand what you are really asking for. None the less, approx() does

Re: [R] regex pattern assistance

2014-08-15 Thread Marc Schwartz
On Aug 15, 2014, at 11:56 AM, Tom Wright wrote: > WOW!!! > > What can I say 4 answers in less than 4 minutes. Thank you everyone. If > I can't make it work now I don't deserve to. > > btw. the strsplit approach wouldn't work for me as: > a) I wanted to play with regex and > b) the location i

Re: [R] regex pattern assistance

2014-08-15 Thread Jeff Newmiller
Must be another lucky streak. :-) --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#..

Re: [R] Generating a polygon around points

2014-08-15 Thread Jeff Newmiller
I use RSiteSearch regularly with no problems. Perhaps I have just had a lucky streak? I wonder what the odds are... :-) --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#.

Re: [R] regex pattern assistance

2014-08-15 Thread Rui Barradas
Hello, I don't believe you need an extra package for that. Try sub("\\/mnt\\/AO\\/AO Data\\/([-[:alnum:]]*)\\/.+", "\\1", x) or, with package stringr, str_match(x,"\\/mnt\\/AO\\/AO Data\\/(.+)\\/.+") Hope this helps, Rui Barradas Em 15-08-2014 17:18, Tom Wright escreveu: Hi, Can anyone p

Re: [R] regex pattern assistance

2014-08-15 Thread Tom Wright
WOW!!! What can I say 4 answers in less than 4 minutes. Thank you everyone. If I can't make it work now I don't deserve to. btw. the strsplit approach wouldn't work for me as: a) I wanted to play with regex and b) the location isn't consistent. Nice to see email support still works, not everyt

Re: [R] regex pattern assistance

2014-08-15 Thread Marc Schwartz
On Aug 15, 2014, at 11:18 AM, Tom Wright wrote: > Hi, > Can anyone please assist. > > given the string > >> x<-"/mnt/AO/AO Data/S01-012/120824/" > > I would like to extract "S01-012" > > require(stringr) >> str_match(x,"\\/mnt\\/AO\\/AO Data\\/(.+)\\/+") >> str_match(x,"\\/mnt\\/AO\\/AO Data

Re: [R] regex pattern assistance

2014-08-15 Thread S Ellison
> -Original Message- > > x<-"/mnt/AO/AO Data/S01-012/120824/" > > I would like to extract "S01-012" > gsub("/mnt/AO/AO Data/(.+)/.+", "\\1", x) #does it, as does > gsub("/mnt/AO/AO Data/([\\w-]+)/.+", "\\1", x, perl=TRUE)# \w is perl RE; > the default is POSIX, which would be. >

[R] regex pattern assistance

2014-08-15 Thread Tom Wright
Hi, Can anyone please assist. given the string > x<-"/mnt/AO/AO Data/S01-012/120824/" I would like to extract "S01-012" require(stringr) > str_match(x,"\\/mnt\\/AO\\/AO Data\\/(.+)\\/+") > str_match(x,"\\/mnt\\/AO\\/AO Data\\/(\\w+)\\/+") both nearly work. I expected I would use something lik

Re: [R] reshape a dataset

2014-08-15 Thread sohail13
Great! Thanks Sent from my LG G Flex, an AT&T 4G LTE smartphone -- Original message-- From: Jorge I Velez Date: Fri, Aug 15, 2014 8:54 AM To: Sohail Khan; Cc: Jim Lemon;R Help; Subject:Re: [R] reshape a dataset If that's the case, you could do the following: d <- with(skdat, table(ID,

Re: [R] Generating a polygon around points

2014-08-15 Thread Jeff Newmiller
No wonder I didn't understand your constraints... you didn't state them. In fact, I think you still haven't stated them. Perhaps you need a map outline? Or, you could just create a polygon manually? Isocline of a two-D kernel density estimate or kriging fit? Manually partition your data into reg

Re: [R] Generating a polygon around points

2014-08-15 Thread David Winsemius
On Aug 15, 2014, at 8:15 AM, Jeff Newmiller wrote: > Not really sure I understand your constraints, but perhaps > > RSiteSearch("convex hull ") RSiteSearch has really been broken for some time now. (You get the headers but the links are all broken. A more effective way of searching the existin

Re: [R] Generating a polygon around points

2014-08-15 Thread Clint Bowman
Your question seems to need an answer to, "How do you find a convex hull on a sphere?" Google has many references. Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE:

Re: [R] Generating a polygon around points

2014-08-15 Thread Bob O'Hara
Unfortunately my region isn't convex, and I don't want to end up predicting the distribution of a forest-dwelling bird in the Atlantic ocean... Bob On 15 August 2014 17:15, Jeff Newmiller wrote: > Not really sure I understand your constraints, but perhaps > > RSiteSearch("convex hull ") > > mi

Re: [R] Generating a polygon around points

2014-08-15 Thread Jeff Newmiller
Not really sure I understand your constraints, but perhaps RSiteSearch("convex hull ") might help? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go

Re: [R] Obtaining predicted values for glm() function

2014-08-15 Thread David L Carlson
You don't show us your function call, so it is hard to be certain what the problem is. Have you read the manual page? ?predict.glm Have you used the newdata= argument? If not, you should know that R's ability to read your mind will not be available until the 4.0 release. David Carlson -

[R] Generating a polygon around points

2014-08-15 Thread Bob O'Hara
I've been struggling for half a day on what should be a simple problem... I have a data frame of lat/long coordinates that describe a region, and I want to draw a polygon around them so I can use that as a boundary (to be thrown at INLA, but those details aren't important). The coordinates are alm

Re: [R] A basic statistics question

2014-08-15 Thread Joshua Wiley
On Wed, Aug 13, 2014 at 7:41 AM, Rolf Turner wrote: > On 13/08/14 07:57, Ron Michael wrote: > >> Hi, >> >> I would need to get a clarification on a quite fundamental statistics >> property, hope expeRts here would not mind if I post that here. >> >> I leant that variance-covariance matrix of the

Re: [R] reshape a dataset

2014-08-15 Thread Jorge I Velez
If that's the case, you could do the following: d <- with(skdat, table(ID, lettertag)) d <- data.frame(cbind(ID = rownames(d), d)) rownames(d) <- NULL d HTH, Jorge.- On Fri, Aug 15, 2014 at 8:22 PM, Sohail Khan wrote: > Thanks Jim and Jorge, > Clever solutions, the final output is a list. >

Re: [R] Sldf command returns negative value for date

2014-08-15 Thread Sneha Bishnoi
It works :) Thanks so much! I tried searching a lot but I guess i missed this fact! On Thu, Aug 14, 2014 at 4:35 PM, Gabor Grothendieck wrote: > On Thu, Aug 14, 2014 at 3:47 PM, Sneha Bishnoi > wrote: > > Hi All! > > > > I am trying to increment date column of data frame so as to merge it with

Re: [R] A basic statistics question

2014-08-15 Thread peter dalgaard
On 13 Aug 2014, at 20:49 , (Ted Harding) wrote: > Indeed, this topic has got me wondering how many times I may have > blindly used sd(x) in the past, as if it were going to give me the > standard (sum(x - mean(x))^2)/length(x) result! At the risk of flogging a horse that has been dead for the

Re: [R] reshape a dataset

2014-08-15 Thread Jim Lemon
On Fri, 15 Aug 2014 06:22:53 AM Sohail Khan wrote: > Thanks Jim and Jorge, > Clever solutions, the final output is a list. > How do I covert it back a dataframe? > -Sohail > as.data.frame(newskdat) or for Jorge's as.data.frame(res) Jim __ R-help@r-pr

Re: [R] reshape a dataset

2014-08-15 Thread Sohail Khan
Thanks Jim and Jorge, Clever solutions, the final output is a list. How do I covert it back a dataframe? -Sohail On Fri, Aug 15, 2014 at 5:37 AM, Jorge I Velez wrote: > Dear Sohail, > > Using Jim's data set skdat, two more options would be > > # first option > d <- with(skdat, table(ID, lettert

Re: [R] reshape a dataset

2014-08-15 Thread Jorge I Velez
Dear Sohail, Using Jim's data set skdat, two more options would be # first option d <- with(skdat, table(ID, lettertag)) names <- colnames(d) d <- c(list(rownames(d)), lapply(1:ncol(d), function(i) as.numeric(d[,i]))) names(d) <- c('ID', names) d # second option d <- with(skdat, table(ID, letter

Re: [R] Obtaining predicted values for glm() function

2014-08-15 Thread DHIMAN BHADRA
Thanks Jeff for the suggestion - will explore the predict function. So far I was working on the fitted() function but it seems to generate fitted (response) values only for predictor values in the original data set, not for values beyond that. I never intended to spam the mailing list. I re-posted

Re: [R] reshape a dataset

2014-08-15 Thread Jim Lemon
On Thu, 14 Aug 2014 06:08:51 PM Sohail Khan wrote: > Hi > I have data set as follows: > A 92315 A 35018 A 56710 B 52700 B 92315 B 15135 C 35018 C 52700 > I would like to transform this data set into: > ID 92315 35018 56710 52700 15135 A 1 1 1 0 0 B 1 0 0 1 1 C 0 1 0 1 0 > I looked i

Re: [R] unable to call certain functions

2014-08-15 Thread Jim Lemon
On Thu, 14 Aug 2014 09:53:31 PM Pfauth, Mary C wrote: > Hello R users, > I am new to R and, so far, am finding it relatively easy to use. I have > run into what seems to me to be an odd problem. I have tried using the > "import" and calendarPlot" functions while in the open air package. I ge

Re: [R] Operating on the value from row i and row i+1

2014-08-15 Thread Jaiprasart, Pharavee (HSC)
Hi Don. The reason I want to do this is that I have the recorded infusion rate of time 1, 2, 6, 8 but I have the recorded response of time 1.5, 3, 4, 12. Notice that the time does not match between the two. Ultimately I want to plot Response VS Infusion Rate. If I just use xyplot between the tw

[R] reshape a dataset

2014-08-15 Thread Sohail Khan
Hi I have data set as follows: A 92315 A 35018 A 56710 B 52700 B 92315 B 15135 C 35018 C 52700 I would like to transform this data set into: ID 92315 35018 56710 52700 15135 A 1 1 1 0 0 B 1 0 0 1 1 C 0 1 0 1 0 I looked into reshape package to no avail. I would appreciate any suggestio

[R] unable to call certain functions

2014-08-15 Thread Pfauth, Mary C (DEC)
Hello R users, I am new to R and, so far, am finding it relatively easy to use. I have run into what seems to me to be an odd problem. I have tried using the "import" and calendarPlot" functions while in the open air package. I get a message returned stating "unable to find function." I know

Re: [R] How Can SVD Reconstruct a Matrix

2014-08-15 Thread Peter Brady
On 15/08/2014 2:40 am, Peter Langfelder wrote: > On Wed, Aug 13, 2014 at 11:57 PM, Peter Brady > wrote: >> > Hi All, >> > >> > I've inherited some R code that I can't work out what they've done. It >> > appears to work and give sort of reasonable answers, I'm just trying to >> > work out why they