[R] Create sequential vector for values in another column

2013-10-11 Thread Steven Ranney
Hello all - I have an example column in a dataFrame id.name 123.45 123.45 123.45 123.45 234.56 234.56 234.56 234.56 234.56 234.56 234.56 345.67 345.67 345.67 456.78 456.78 456.78 456.78 456.78 456.78 456.78 456.78 456.78 ... [truncated] And I'd like to create a second vector of sequential values

[R] Convert list with missing values to dataFrame

2013-08-13 Thread Steven Ranney
I have a dataFrame sID <- c("a", "1,2,3", "b", "4,5,6") rID <- c("shr1125", "bwr331", "bwr330", "vjhr1022") tmp <- data.frame(cbind(sID,rID)) but I need to split tmp$sID into three different columns, filling locations where tmp$sID has only one value with NA. I can split tmp$sID by the comma t

Re: [R] Creating new vectors from other dataFrames

2013-08-08 Thread Steven Ranney
#2 2 6 10 14 18 22 NA NA > #3 3 7 11 15 19 23 NA NA > #4 4 8 12 16 20 24 NA NA > A.K. > > > > - Original Message - > From: Steven Ranney > To: "r-help@r-project.org" > Cc: > Sent: Thursday, August 8, 2013 2:01 PM > Subject: [R] Creating new ve

[R] Creating new vectors from other dataFrames

2013-08-08 Thread Steven Ranney
I have two data frames data1 <- as.data.frame(matrix(data=c(1:4,5:8,9:12,13:24), nrow=4, ncol=6, byrow=F, dimnames=list(c(1:4),c("a","b","c","d","e","z" data2 <- as.data.frame(matrix(data=c(1:4,5:8,9:12,37:48), nrow=4, ncol=6, byrow=F, dimnames=list(c(1:4),c("a","b","c","f","g","z" that h

[R] If() values in one dataframe then return values from another

2013-02-04 Thread Steven Ranney
I have a large data frame ("data1") that looks like: A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16 A17 A18 A19 A20 [1,] 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 [2,] 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 [3,]

Re: [R] "For" loop and "if" question

2012-12-19 Thread Steven Ranney
lat5", "lat6", "lat7", "lat8", "lat9", "lat10", "lat11", "lat12", "lat13", "lat14", "lat15", "lat16", "lat17", "lat18", "lat19", "lat20", "lat21&q

[R] "For" loop and "if" question

2012-12-19 Thread Steven Ranney
All - I have a large data frame that looks like ID p1 p2 p3...p20 Lat1 Lat2 Lat3...Lat20 Long1 Long2 Long3...Long20 1 0 0 1 0NA NA 29.xx NA NA NA -89.xx NA 2 1 0 0 127.xx NA

Re: [R] Retain last grouping after a strsplit()

2012-12-11 Thread Steven Ranney
> last das, finding what seemed to be a fairly economical solution and one > that does not require back-references: > > sub( "^.+-" , "", x) > > [1] "1" "1" "1" "10" > > If there were no digits after the la

[R] Retain last grouping after a strsplit()

2012-12-11 Thread Steven Ranney
All - I have a column of SiteNames: SiteName OYS-PIA2-FL-1 OYS-PIA2-LA-1 OYS-PI-LA-BB-1 OYS-PIA2-LA-10 ... [truncated] and I want to include only the last few digits into a new column. I tried substr(data$SiteName, 13, 20) but because some SiteName values are of a different length, the final

Re: [R] Read in alphanumeric column without decimals

2012-11-29 Thread Steven Ranney
To change it to > number you have to do the following > > as.numeric(as.character(yourdata$TeamLeaderID)) > > What you as seeing with just the call to as.numeric is the value of > the 'factor', not the value of the number. > > On Thu, Nov 29, 2012 at 2:5

[R] Read in alphanumeric column without decimals

2012-11-29 Thread Steven Ranney
All - How can I read in a column of alphanumeric values without including ".0" on the numeric values? Original column: TeamLeaderID 258 342 316 U8 331 279 D1 116 235 296 ... [truncated] leaders = read.xlsx2('FILE', sheetIndex = 1, header = T) Column after it's been read in: leaders$TeamLeader

Re: [R] Finding values in one column and

2012-11-27 Thread Steven Ranney
Once I figured out the syntax of join() with the plyr package, it worked like a charm. Thanks again. SR Steven H. Ranney On Tue, Nov 27, 2012 at 3:49 PM, John Kane wrote: > Come to think of it the plyr package and the data.table packages also offer > similar tools. For large merges (joins) I

Re: [R] Finding values in one column and

2012-11-27 Thread Steven Ranney
Thanks. Soon after I posted this question, I discovered merge(). Steven H. Ranney On Tue, Nov 27, 2012 at 3:26 PM, John Kane wrote: > Have a look at ?merge > > John Kane > Kingston ON Canada > > >> -Original Message- >> From: steven.ran...@gmail.com >> Sent: Tue, 27 Nov 2012 15:17:58 -

[R] Finding values in one column and

2012-11-27 Thread Steven Ranney
All - I have a data frame data.a ID valueA valueB 6 12 12 17 15 14 58 18 16 98 11 12 73 19 20 84 19 14 58 20 14 24 11 12 81 15 16 21 15 14 62 14 12 67 13 14 78 13

[R] Package RODBC sqlQueries

2012-10-26 Thread Steven Ranney
All - I'm new to SQL and the RODBC package. I've read the documentation associated with the RODBC package, but I'm still having problems with my SQL statements; I think my syntax, particularly with respect to my WHERE statement, is off but I can't find any documentation as to why. When I run a q

Re: [R] rJava install - "%1 is not a valid Win32 application."

2012-10-16 Thread Steven Ranney
in/i386/Rgui.exe). > > On Tue, Oct 16, 2012 at 2:37 AM, Steven Ranney > wrote: > > All – > > > > > > > > I’m having a problem with the rJava package. I can download it to my > > machine (Win 7 64-bit) but when I try to load the package into R (2.15.1

[R] rJava install - "%1 is not a valid Win32 application."

2012-10-15 Thread Steven Ranney
ile R is looking for is in the appropriate place, but I continue to get the error. I have tried to download rJava from another source, but still get the error. I have not been able to find another user with this same issue. Thanks for your help – Steven Ranney [[alternati

Re: [R] nls() and lines()

2011-07-18 Thread Steven Ranney
t(as.numeric(x) =" I've tried putting in modb as the "newdata" in the predict() statement, but I end up with Error in xy.coords(x, y) : 'x' and 'y' lengths differ SR Steven H. Ranney On Mon, Jul 18, 2011 at 7:52 AM, Peter Ehlers wrote: > On 2011-07-18

Re: [R] nls() and lines()

2011-07-18 Thread Steven Ranney
wrote: > On 2011-07-17 17:37, Steven Ranney wrote: >> >> All - >> >> I'm having an issue with trying to plot a model derived from nls() >> onto a simple plot.  I have included a sample data set and the code >> that I've been using. >> >>

[R] nls() and lines()

2011-07-17 Thread Steven Ranney
All - I'm having an issue with trying to plot a model derived from nls() onto a simple plot.  I have included a sample data set and the code that I've been using.    year month day   date location mileage  cost gallon  cpg   mpg  x 2009 1   4   1/4/2009  BZN  124585 19.39 

[R] "for" loop assistance -

2011-03-25 Thread Steven Ranney
ailable to me that I am overlooking. I am sure that I could use a “for” loop, but as someone that is new to R programming, I am unsure of how to go about creating the for loop to build the second data frame. I've tried to modify existing for loops that I already have but have been unsuccessful.

Re: [R] tapply with specific quantile value

2011-03-24 Thread Steven Ranney
m: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> project.org] On Behalf Of Steven Ranney >> Sent: Friday, 25 March 2011 12:18 p.m. >> To: r-help@r-project.org >> Subject: [R] tapply with specific quantile value >> >> All - >> >> I have an e

[R] tapply with specific quantile value

2011-03-24 Thread Steven Ranney
All - I have an example data frame x l.c.1 43.38812035 085 47.55710661 085 47.55710661 085 51.99211429 085 51.99211429 095 54.78449958 095 54.78449958 095 56.70201864 095 56.70201864 105 59.66361903 105 61.69573564 105 61.69573564 105 63.77469

Re: [R] TukeyHSD error

2010-11-19 Thread Steven Ranney
Rescinded. Problem solved. I discovered that TukeyHSD doesn't like numeric factors; changing the "level" to a factor solved my problem. SR Steven H. Ranney steven.ran...@montana.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/lis

[R] TukeyHSD error

2010-11-19 Thread Steven Ranney
quot;, xx), data = mf) : non-factors ignored: level" What am I missing? Thanks for your help - Steven Ranney steven.ran...@montana.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posti

[R] Quantile Regression and Goodness of Fit

2010-08-23 Thread Steven Ranney
All - Does anyone know if there is a method to calculate a goodness-of-fit statistic for quantile regressions with package quantreg? Specifically, I'm wondering if anyone has implemented the goodness-of-fit process developed by Koenker and Machado (1999) for R? Though I have used package quantreg