Re: [R] Linear regression and stand deviation at the Linux command line

2024-08-23 Thread Keith Christian
Hi Ivan, Thanks for the suggestions. Will try them. Keith On Fri, Aug 23, 2024 at 1:57 AM Ivan Krylov wrote: > > В Thu, 22 Aug 2024 13:07:37 -0600 > Keith Christian пишет: > > > I'm interested in R construct(s) to be entered at the command > > li

[R] Linear regression and stand deviation at the Linux command line

2024-08-22 Thread Keith Christian
seems most capable of generating. standard_deviation_data.csv file contents (Are line numbers, commas, etc. needed or no?) 1 16837 2 9498 3 31389 4 2365 5 17384 Many thanks, --Keith __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

[R] Contract work for non-linear regressions

2022-05-09 Thread Marlin Keith Cox
I am not sure if this is appropriate here, my apologies if not. I have used R for 20 years now and need help with non-linear regression analysis over 100's of different frequencies and my data has exceeded by R program capabilities. My company would provide the contract. keith M. Keit

[R] Time series and correlation

2022-04-26 Thread Marlin Keith Cox
ctionality of giving correlations by Frequency works, but not when Time is used. I hope this is clear enough. keith M. Keith Cox, Ph.D. Principal MKConsulting 17415 Christine Ave. Juneau, AK 99801 U.S. 907.957.4606 [[alternative HTML version deleted]] ___

[R] correlation by factor

2021-07-27 Thread Marlin Keith Cox
approach my problem this way. Data is below. Keith R<-c(1,8,3,6,7,2,3,7,2,3,3,4,3,7,3) Day<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3) Freq<-(a1,a2,a3,a4,a5,a1,a2,a3,a4,a5,a1,a2,a3,a4,a5,) M. Keith Cox, Ph.D. Principal MKConsulting 17415 Christine Ave. Juneau, AK 99801 U.S. 907

[R] dates by week multiple years

2019-02-05 Thread Marlin Keith Cox
such as 53, 54, 55, 56, etc. instead of starting over? Below has worked for me until we moved into 2019. data$Date<- as.Date(data$TIMESTAMP,format="%m/%d/%y %H:%M") data$Week1<- strftime(data$Date,format = "%V") data$Week<-as.factor(data$Week1) Keith

Re: [R] Question

2018-04-19 Thread Keith Jewell
On 15/04/2018 17:26, Marc Girondot via R-help wrote: Le 15/04/2018 à 17:56, alireza daneshvar a écrit : break-down point Can you explain more what you plan to do and give an example of what you have tried to do until now to do a "break down point" in R. Perhaps a "break down point" is common

Re: [R] Problem with choose.files(default=..., multi=FALSE)

2017-05-10 Thread Keith Jewell
nally (Windows Server 2008 R2 x64) and also in Windows 10 x64 Keith Jewell On 09/05/2017 17:49, Duncan Murdoch wrote: On 09/05/2017 12:06 PM, Keith Jewell wrote: I'm very hesitant to suggest that there's a bug in such a venerable R function, but I can't see what I'm doin

[R] Problem with choose.files(default=..., multi=FALSE)

2017-05-09 Thread Keith Jewell
I'm very hesitant to suggest that there's a bug in such a venerable R function, but I can't see what I'm doing wrong. Any comments are welcome When using choose.files() where: default = something multi = FALSE selected file path is shorter than the default ... then the returned value

Re: [R] Antwort: Re: RStudio: Place for Storing Options

2017-02-23 Thread Keith Jewell
RStudio seems to not pay due regard to the distinction between APPDATA and LOCALAPPDATA. See https://support.rstudio.com/hc/en-us/community/posts/200650543-File-history-and-project-history-stored-in-LOCALAPPDATA On 23/02/2017 08:00, g.maub...@weinwolf.de wrote: Hi Martin, the command %loca

[R] Works outside but not inside!

2017-02-15 Thread Keith S Weintraub
Folks, The following function works like a charm! > #Amortization for multiple rows > createAmorts<-function(ams, numPer, term) { > fctrs<-rep(1:term, each = numPer) > > oneRow<-function(am, fac){ > tdf<-data.frame(ams = c(am), yrs=fac) > agg<-aggregate(ams ~ yrs, data

Re: [R] Strange message after reading multiple scripts from one folder

2016-07-29 Thread Keith Jewell
I can't immediately see it in the help text but it seems that source returns a list with two named elements; value and visible. I surmise that it is returned using withVisible (qv). KJ On 29/07/2016 13:26, jim holtman wrote: Hard to tell without seeing the scripts. Do you have a matrix in yo

[R] [R-pkgs] New package: simstudy

2016-07-11 Thread Goldfeld, Keith
comments. - Keith Keith Goldfeld Department of Population Health School of Medicine, New York University 227 East 30th Street, 6th Floor New York, NY 10016 This email message, including any attachments, is for the sole use of the intended

Re: [R] [FORGED] Re: Generate list if sequence form two vector element

2016-06-22 Thread Keith Jewell
or as a one-liner mapply(pmin(a, b), pmax(a,b), FUN=seq, SIMPLIFY=FALSE) On 22/06/2016 10:23, peter dalgaard wrote: There's also mapply(a, b, FUN=seq, SIMPLIFY=FALSE) (turn off simplication so that you don't unexpectedly get a matrix whenever all elements of results have same length. This als

[R] expand.model.frame issue

2016-06-09 Thread Keith Jewell
Following on from a stackoverflow question "Why does this simple function calling `lm(..., subset)` fail?" -- myfun <- function(form., data., subs.) lm(form., data., subs.) myfun(mpg ~ cyl + hp, mtcars, TRUE) ## Error in eval(expr, envir, encl

[R] error.crosses

2016-04-27 Thread Marlin Keith Cox
7.17 7.17 0.00 NaN NaN Supplier*3 6 NaN NA NA NaN NA Inf -Inf -Inf NA NA se CQN 2.33 Price 0.00 Supplier* NA M. Keith Cox, PhD Assistant Professor of Biology Natural Sciences Coordinator Alaska Native Science and Engineering Program (ANSEP) 111

[R] error.crosses

2016-04-27 Thread Marlin Keith Cox
7.17 7.17 0.00 NaN NaN Supplier*3 6 NaN NA NA NaN NA Inf -Inf -Inf NA NA se CQN 2.33 Price 0.00 Supplier* NA M. Keith Cox, Ph.D. Principal MKConsulting 17415 Christine Ave. Juneau, AK 99801 U.S. 907.957.4606 [[alternative HTML versi

[R] XLConnect Package

2016-04-19 Thread Keith S Weintraub
Folks, I am using the XLConnect package. I can download all the named ranges except a couple that are defined by the Excel function “Offset”. For example I have this named range: =OFFSET(APA!$A$1,0,0,APA!$K$11,3) I am pretty sure that this won’t work but I thought I would give it a shot here

Re: [R] formula argument evaluation

2016-04-12 Thread Keith Jewell
On 12/04/2016 11:24, Adrian Dușa wrote: I have a simple function such as: foo <- function(x) { call <- lapply(match.call(), deparse) testit <- capture.output(tryCatch(eval(x), error = function(e) e)) if (grepl("Error", testit)) { return(call$x) } } and I would like

Re: [R] Having trouble updating and installing R 3.2.1 and 3.2.2

2015-10-27 Thread Keith S Weintraub
------- > Sent from my phone. Please excuse my brevity. > > On October 26, 2015 6:16:47 AM PDT, Keith S Weintraub > wrote: >> I uninstalled all versions of R on my computer and killed all R >> directories

Re: [R] Having trouble updating and installing R 3.2.1 and 3.2.2

2015-10-26 Thread Keith S Weintraub
> /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --- > Sent from my phone. Please excuse my brevity. > > On October 25, 2015 7:50:07 AM PDT, Keith S Weintraub > wrote: >>

[R] Having trouble updating and installing R 3.2.1 and 3.2.2

2015-10-25 Thread Keith S Weintraub
I get the following error: Warning message: In normalizePath(path.expand(path), winslash, mustWork) : path[1]="C:\Users\Administrator\My Documents/R/win-library/3.2": Access is denied This may be the first time that I have tried to upgrade R since I upgraded my Windows installation (on Parall

Re: [R] Reordering of numerical vector

2015-10-21 Thread Marlin Keith Cox
Got it. During a read.csv I used stringsAsFactors=FALSE M. Keith Cox, Ph.D. Principal MKConsulting 17105 Glacier Hwy Juneau, AK 99801 U.S. 907.957.4606 On Wed, Oct 21, 2015 at 10:31 AM, Marlin Keith Cox wrote: > I do not have a dataset to share as I do not believe it needs it and I am &g

[R] Reordering of numerical vector

2015-10-21 Thread Marlin Keith Cox
other order. I am a fairly experienced R user and I cannot find the answer anywhere. I am certain it is simple as these things usually are for me. Thank you ahead of time. Keith M. Keith Cox, Ph.D. Principal MKConsulting 17105 Glacier Hwy Juneau, AK 99801 U.S. 907.957.4606 [[alternative

Re: [R] Issue with results from 'summary' function in R

2015-09-18 Thread Keith Jewell
On 18/09/2015 13:08, Praveen Surendran wrote: Hi all, Attached table (that contains summary for a genetic association study) was read using the command: test <- read.table('testDat.txt',header=FALSE,stringsAsFactors=FALSE) Results from the summary of the attached table is provided below: su

Re: [R] Households per Census block

2015-08-04 Thread Keith S Weintraub
d." > > Best, > > -- Zack > - > Zack W. Almquist > Assistant Professor > Department of Sociology and School of Statistics > Affiliate, Minnesota Population Center > University of Minnesota > > On Tue, Aug 4, 2015 at 2:12 PM, Zack Almquist wrote: > Hi K

Re: [R] Households per Census block

2015-08-04 Thread Keith S Weintraub
(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open: HTTP status was '400 Bad Request’ I have a feeling that this is not a problem with the API. Thanks for your help, KW > On Aug 3, 2015, at 2:12 PM, Zack Almquist

[R] Households per Census block

2015-08-03 Thread Keith S Weintraub
Folks, I am using the UScensus2010 package and I am trying to figure out the number of households per census block. There are a number of possible data downloads in the package but apparently I am not smart enough to figure out which data-set is appropriate and what functions to use. Any help

[R] predict.poly for multivariate data

2015-07-10 Thread Keith Jewell
I've got the wrong end of the stick and/or my suggestions can be improved so I welcome correction. Otherwise, how do I go about getting these changes implemented? I see stats is maintained by R Core Team. Are they likely to pick it up from here, or do I need to take any othe

Re: [R] Problem with particular file in XML package?

2015-05-28 Thread Keith Jewell
The OP asked "Has anyone else had trouble with the XML package lately and if so, how did you resolve it?" For what it's worth... I failed to install XML using install() with the defaults; I can't remember the exact error message, something about access denied. Downloading XML_3.98-1.1.zip wi

Re: [R] open xlsx file using read.xls function of gdata package

2015-04-05 Thread Keith S Weintraub
Will it work with .xlsm files? Best, KW > You might try the readxl package - it's only available on github but it > reads both xlsx and xls. All going well, it should be on its way to CRAN > next week. > > Hadley > > On Friday, April 3, 2015, Luigi Marongiu wrote: > >> Dear all, >> I am tryin

Re: [R] Debug package options

2015-03-31 Thread Keith S Weintraub
me to have the right size font and Tk window to be able to do debugging using the debug package. In case you are interested I use Windows 7 on my Mac via Parallels. Thanks again, Best, KW > On Mar 30, 2015, at 2:05 PM, Duncan Murdoch wrote: > > On 30/03/2015 1:50 PM, Keith S W

[R] Debug package options

2015-03-30 Thread Keith S Weintraub
Folks, I would like change some of the options for the Tk window that pops up when using the debug package. I know how to change the options: e.g. options(debug.font = "Courier 12 italic”). Is there a way to “preset” these in my environment so when debug starts up I have all the options set u

[R] C#

2015-03-10 Thread Keith S Weintraub
I will keep this short as this might be the wrong list: I have found one (beta) project that allows R to interface with C#. Are there others? Any favorites. Best, KW __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.eth

Re: [R] rgl::writeWebGL( , prefix = , )

2015-02-03 Thread Keith Jewell
L was the template for the next. E.g. in the above example with two scenes: outfile <- writeWebGL(dir=getwd(), template = file.path(getwd(), "template.html"), prefix="") # position to next scene outfile <- writeWebGL(dir=getwd(), template = outfile, prefix="A"

[R] Interview questions?

2015-01-11 Thread Keith S Weintraub
Folks, I was wondering if anyone has put together a list of R job interview questions? I’m thinking of about 5-20 possibly open ended questions for interviewing a candidate to do R programming. Just programming. Not statistics or mathematics. What I don’t want are tricky “puzzles” that are more

Re: [R] Is it possible to define another kind of NA

2014-11-13 Thread Keith Jewell
On 13/11/2014 11:08, Marc Girondot wrote: Le 13/11/2014 01:26, MacQueen, Don a écrit : Along the lines of what Bert Gunter said, the ideal way to represent I agree that LDL is a special case of what could be named ODL (Out of detection limit). To answer to Bert Gunter, indeed if LDL (or ODL) va

Re: [R] Is xyz point inside 3d convex hull?

2014-10-13 Thread Keith Jewell
Back in 2009 I posted some code to this list, see: <http://tolstoy.newcastle.edu.au/R/e8/help/09/12/8784.html> I submitted the function 'inhull' to the geometry package maintainer, but I don't think it was ever included. HTH Keith J On 12/10/2014 21:24, Don McKenzie wro

Re: [R] Befuddled by ddply

2014-10-03 Thread Keith S Weintraub
then it made more sense. > > Dennis > > On Thu, Oct 2, 2014 at 7:19 AM, Keith S Weintraub wrote: >> Folks, >> >> I have the following data: >> >> mdf<-structure(list(a = 1:3, b = c(10, 20, 30)), .Names = c("a", "b" >> ), row.

[R] Befuddled by ddply

2014-10-02 Thread Keith S Weintraub
Folks, I have the following data: mdf<-structure(list(a = 1:3, b = c(10, 20, 30)), .Names = c("a", "b" ), row.names = c(NA, -3L), class = "data.frame") And function: defCurveBreak<-function(x, y) { cumsum(rep(diff(c(0, x)), each = y)/y) } lapply'ing to get the result "foo" foo<-data.frame(l

Re: [R] How to check to see if a variable is within a range of another variable

2014-10-02 Thread Keith Jewell
On 01/10/2014 23:54, Peter Alspach wrote: Tena koe Kate If kateDF is a data.frame with your data, then apply(kateDF, 1, function(x) isTRUE(all.equal(x[2], x[1], check.attributes = FALSE, tolerance=0.1))) comes close to (what I think) you want (but not to what you have illustrated in your 'ev

Re: [R] Can't seem to get lapply to work.

2014-09-26 Thread Keith S Weintraub
ware/Embedded Controllers) .OO#. .OO#. rocks...1k > --- > Sent from my phone. Please excuse my brevity. > > On September 25, 2014 8:25:44 PM PDT, Keith S Weintraub > wrote: >> Folks, &g

[R] Can't seem to get lapply to work.

2014-09-25 Thread Keith S Weintraub
Folks, I have the following problem. tstSet<-structure(list(corr = c(0.59, 0.62), term = c(7, 7), am = c("AmYes", "AmNo"), prem = c(19.5, 14.75)), .Names = c("corr", "term", "am", "prem"), out.attrs = structure(list(dim = structure(c(3L, 2L, 2L, 41L), .Names = c("corr", "term", "am", "prem")),

Re: [R] XLConnect on Linux Mint Maya

2014-07-31 Thread Keith S Weintraub
next week I will switch over to the r-sig-debian group and start bothering them. Thanks again for everyone that chimed in to help me, Best, KW -- On Jul 31, 2014, at 2:54 PM, Ista Zahn wrote: > Hi Keith, > > So the plot thickens. How is it that you have R 3.1.1 but apt-get > instal

Re: [R] XLConnect on Linux Mint Maya

2014-07-31 Thread Keith S Weintraub
me, Best, KW -- On Jul 29, 2014, at 2:22 PM, Ista Zahn wrote: > On Tue, Jul 29, 2014 at 12:54 PM, Jeff Newmiller > wrote: >> Sounds to me like a problem outside of R (off topic here). > > Possibly, but I suspect that the OP now has two versions of XLConnect > inst

Re: [R] XLConnect on Linux Mint Maya

2014-07-29 Thread Keith S Weintraub
29 08:28 /home/refserv/R/i686-pc-linux-gnu-library/3.1/rJava/libs/rJava.so The file rJava.so exists. Thanks so much for your time and help, Best, KW -- On Jul 24, 2014, at 11:16 PM, John McKown wrote: > On Thu, Jul 24, 2014 at 8:36 PM, Keith S Weintraub wrote: >> Folks, >> >

[R] XLConnect on Linux Mint Maya

2014-07-24 Thread Keith S Weintraub
Folks, I have been trying to get XLConnect to work on my Linux Mint Maya machine. R works fine but this package doesn't seem to want to build. Here is the message I get after supposedly building XLConnect and rJava: >> require(XLConnect) > Loading required package: XLConnect > Error : .onLoad

Re: [R] Windows R doesn't recognize shortcuts ?

2014-07-24 Thread Keith Jewell
On 23/07/2014 14:21, Duncan Murdoch wrote: On 23/07/2014 9:08 AM, ce wrote: Hi All, In Windows 7 , R installation: R version 3.1.1 Patched (2014-07-14 r66149) -- "Sock it to Me" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) it doesn't

[R] Subsets of a function

2014-05-19 Thread Marlin Keith Cox
") size.2011b<-subset(size,Year==2011&Season=="b") size.2012b<-subset(size,Year==2012&Season=="b") size.2013b<-subset(size,Year==2013&Season=="b") The smooth.spline is below 2003<-with(size.2003,smooth.spline(Size,Prop,spar=0.25)) 2004&l

Re: [R] Equation of a curve

2014-04-04 Thread Keith Jewell
On 03/04/2014 16:26, Frances Cheesman wrote: Hi all, I have a number of bacterial growth curves I would like to find the equations for these and then integrate them to find the area under the curves for me to do stats on later. Is there any way I can do this in R? Thanks, Frances [[a

[R] Time series

2014-04-01 Thread Marlin Keith Cox
A simplified ask is: when I use the time series plot function, R treats each time on 9/19/13 as an individual day, when clearly it isn't. Thank you ahead of time. Keith ts(chum) with(chum,plot.ts(Time,PA)) Chum<- Time PA 9/18/13 18:29 16 9/19/13 13:29 14 9/19/13 16:29 13.2 9/

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Keith Jewell
It seems so simple to me, that I must be missing something. Subject to Jeff Newmiller's reminder of FAQ 7.31; if the sum is zero then the mean is zero and vice versa. The OP's original attempt of: - l <- 100 aux <- rnorm(l,0,0.5) s <- sum(aux)/l aux2 <- aux-s sum(aux2)

Re: [R] Data Frame to list?

2014-03-08 Thread Keith S Weintraub
Arun et al. Thanks, This is exactly what I need. All the best, KW -- On Mar 7, 2014, at 10:59 PM, arun wrote: > Try: > oof1 <- list() > oof1[foo$name] <- foo$num > A.K. > > > > > On Friday, March 7, 2014 10:43 PM, Keith S Weintraub wrote: > Folks,

[R] Data Frame to list?

2014-03-07 Thread Keith S Weintraub
Folks, I have a data frame as follows: > foo<-structure(list(name = c("A", "B", "C"), num = c(3L, 2L, 1L)), .Names = > c("name", "num"), row.names = c(NA, -3L), class = "data.frame") > str(foo) 'data.frame': 3 obs. of 2 variables: $ name: chr "A" "B" "C" $ num : int 3 2 1 > foo name

Re: [R] shapiro.test

2014-02-25 Thread Keith S Weintraub
Regarding : "... I don't know what the 4th to last page would be called (could add another ante-, or in R just use tail(book,4))..." According to wordsmith.org (sign up it's free, note I have no affiliation to that site) the word is "preantepenultimate". Check it out: http://wordsmith.org/words

[R] predict model time series

2014-02-21 Thread Marlin Keith Cox
en hopefully use the logic and apply it to my gam model predictions. Thanks, Keith M. Keith Cox, Ph.D. Principal MKConsulting 17105 Glacier Hwy Juneau, AK 99801 U.S. 907.957.4606 [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] princomp/prcomp packages not available for 3.0.2

2014-02-19 Thread Keith Jewell
On 19/02/2014 15:47, Rich Shepard wrote: Running 3.0.2 on Slackware here. Tried to install.packages() for both princomp and prcomp (Principal Components Analysis) but R responded by telling me neither is available for this version of R. Has anyone an idea when either (but especially prcomp

Re: [R] grep for multiple pattern?

2014-02-13 Thread Keith Jewell
On 13/02/2014 15:51, Marc Schwartz wrote: On Feb 13, 2014, at 8:43 AM, Rainer M Krug wrote: Hi I want to search for multiple pattern as grep is doing for a single pattern, but this obviously not work: grep("an", month.name) [1] 1 grep("em", month.name) [1] 9 11 12 grep("eb", month.nam

Re: [R] creating an equivalent of r-help on r.stackexchange.com ?

2014-02-04 Thread Keith S Weintraub
My sentiments exactly! Thanks to all for taking the time to flesh out the potential flaws of the stackexchange "solution". KW > Date: Tue, 04 Feb 2014 10:36:21 +1300 > From: Rolf Turner > To: Bert Gunter > Cc: "r-help@r-project.org" > Subject: Re: [R] creating an equivalent of r-help on >

Re: [R] Best way to get the prices from these strings?

2014-01-29 Thread Keith S Weintraub
Thanks to Dan Wang, Petr Pikal, Arun, Jim Holtman and Arun for all of your solutions. All the best, KW -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/post

[R] Best way to get the prices from these strings?

2014-01-29 Thread Keith S Weintraub
Folks, I got the following prices by scraping a web page just for my own edification: thePrices<- c("id=\"p0\">$69.95", "id=\"p1\">$44.95", "id=\"p2\">$69.95", "id=\"p3\">$59.95", "id=\"p4\">$69.95", "id=\"p5\">$79.95", "id=\"p6\">$89.95", "id=\"p7\">$59.95", "id=\"p8\">$59.95", "id=\"p9\">$79

Re: [R] How to "apply" correctly.

2014-01-07 Thread Keith S Weintraub
In your example that doesn't work you are > ending up with a vector rather than a one > column data frame. > > Pat > > > On 07/01/2014 17:44, Keith S Weintraub wrote: >> Folks, >> >> # I have the following function: >> >> breakByFreq<-fu

[R] How to "apply" correctly.

2014-01-07 Thread Keith S Weintraub
Folks, # I have the following function: breakByFreq<-function(freq, defData) { breakUpFun<-function(freq, defs) { if(freq != 1) { defs<-diff(c(0, defs)) defs<-cumsum(rep(defs/freq, each = freq)) } defs } defMat<-sapply(defData[,-1], function(x) breakUpFun(freq, x))

[R] Time series and lm

2013-12-17 Thread Marlin Keith Cox
Time1 ~ pa.s, drop.unused.levels = TRUE) : invalid type (list) for variable 'Time1' I cannot figure it out. Keith M. Keith Cox, Ph.D. Principal MKConsulting 17105 Glacier Hwy Juneau, AK 99801 U.S. 907.957.4606 [[alternative HTML version deleted]]

Re: [R] More Columns than column names Error

2013-10-22 Thread Keith Jewell
Carl is right. Going to the nabble post and looking in the source data file I see the headings row has 'Material' tab 'Weight...' tab 'Percent'. Each of the data rows has 1 tab character between the 'Material' and 'Weight' columns and 3

[R] Applying and labeling scenarios

2013-10-04 Thread Keith S Weintraub
Folks, I have a working version of the code below for my "real world" problem. I was wondering if there was a better way to do this. I have 3 sets of parameters and I want to iterate over all combinations and label the results. Would some of the plyr tools make this easier? # Input Scenarios

Re: [R] Problem with converting F to FALSE

2013-09-05 Thread Keith Jewell
Depending what you're doing with the data, you might want colClasses=c("factor","numeric") On 05/09/2013 13:58, Joshua Wiley wrote: Hi, You can either manually specify colClasses or the asis argument. See ?read.csv for more details. If you just had those two columns, something like:

Re: [R] XLSX package + Excel creation question

2013-09-04 Thread Keith Jewell
al to.) and a value. For example, the following format displays numbers that are less than or equal to 100 in a red font and numbers that are greater than 100 in a blue font. [Red][<=100];[Blue][>100] -- R package xlsx allows such formats (?DataFormat) as does R package

Re: [R] just a small variable-naming question

2013-08-27 Thread Keith Jewell
In case the OP wanted to append columns, rather than rename existing columns: cbind(myData, var1=NA, var2=NA, var3=NA) col1 col2 col3 var1 var2 var3 1123 NA NA NA 2234 NA NA NA 3345 NA NA NA On 24/08/2013 17:22, arun wrote: Hi, You could

[R] X11 and printing/copying graphics from mac

2013-08-01 Thread Marlin Keith Cox
multiple graphic windows is a must as well as being able to print or copy from them. Thanks ahead of time. Keith M. Keith Cox, Ph.D. Principal MKConsulting 17105 Glacier Hwy Juneau, AK 99801 U.S. 907.957.4606 [[alternative HTML version deleted

[R] Simple example of web-scraping.

2013-07-23 Thread Keith S Weintraub
Folks, I was wondering if anyone has an example or a pointer to an example of code to scrape a web page. The tricky parts for me are the following: * I might need to get multiple pages in sequence. * I need to login with user-name and password. Thanks for your time and help, KW -- ___

Re: [R] Add a column to a dataframe based on multiple other column values

2013-06-12 Thread Keith S Weintraub
Tom, Here is my solution. Note that I assume the columns are interleaved as you describe below. I'm sure others will have better replies. Note that using dput helps the helpers. # From dput(mdat) mdat<-structure(list(x1 = c(2L, 2L, 2L, 3L, 3L, 30L, 32L, 33L, 33L), y1 = c(100L, 100L, 100L,

Re: [R] ggpairs in GGally replaces plotmatrix in ggplot2

2013-06-11 Thread Keith S Weintraub
Yes. I was able to run it in RStudio but it did seem much slower than in R.app (on the Mac). Note that the "it" that I ran still didn't give the same results as plotmatrix. Thanks, KW -- On Jun 11, 2013, at 11:16 AM, John Kane wrote: > Note that the code below might not work in RStudio. I a

Re: [R] ggpairs in GGally replaces plotmatrix in ggplot2

2013-06-11 Thread Keith S Weintraub
lt in ggpairs. Thanks again, KW -- On Jun 11, 2013, at 10:48 AM, John Kane wrote: > Hi Keith,, > ggpairs(dat1, upper = list(continuous = "density", combo = "box")) > appears to be what you want. > > > > John Kane > Kingston ON Canada > >

Re: [R] R-help Digest, Vol 124, Issue 12

2013-06-11 Thread Keith S Weintraub
Folks, Sorry for butting in here. I ran the code from John Kane below and it worked fine. I did however get a deprecation message suggesting the use of ggpairs from the GGally package to make this chart. Unfortunately I haven't found the correct incantation to get the diagonal to display th

Re: [R] Some unrelated questions.

2013-05-07 Thread Keith S Weintraub
Jim, Thanks for your comments. KW -- On May 6, 2013, at 5:48 PM, Jim Lemon wrote: > see inline > > On 05/07/2013 02:14 AM, Keith S Weintraub wrote: >> Folks, >> >> I have been working on an R project that has a few dozen functions. >> >> I have so

[R] Some unrelated questions.

2013-05-06 Thread Keith S Weintraub
Folks, I have been working on an R project that has a few dozen functions. I have some questions that are only tangentially related and might only be a difference in style. 1. Some of my functions take single-row data.frames as input parameters lists. I don't force the user of the function to

Re: [R] nls: example code throws error

2013-04-26 Thread Keith Jewell
On 26/04/2013 00:16, Steven LeBlanc wrote: > Greets, > > I'm trying to learn to use nls and was running the example code for an exponential model: > > > > Perhaps also, a pointer to a comprehensive and correct document that details model formulae syntax if someone has one? > > Thanks& Best

[R] Best way to calculate averages of Blocks in an matrix?

2013-04-17 Thread Keith S Weintraub
Folks, I recently was given a simulated data set like the following subset: sim_sub<-structure(list(V11 = c(0.01, 0, 0, 0.01, 0, 0.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), V12 = c(0, 0, 0, 0.01, 0.03, 0, 0, 0, 0, 0, 0, 0.01, 0, 0.01, 0, 0, 0, 0, 0, 0.04), V13 = c(0, 0, 0, 0.01, 0, 0, 0,

[R] gc()

2013-04-12 Thread Keith S Weintraub
Folks, I have some computations in a function that create some large matrices. I have been in the habit in these circumstances to call "null out" a matrix once used and call gc(). Some pseudo code: theFunction<-function(x, y, z, 1) { myMatrix <- black.box.function(x, y, z, 100

Re: [R] arrayInd and which

2013-04-05 Thread Keith S Weintraub
>> >> On Apr 3, 2013, at 7:53 AM, Keith S Weintraub wrote: >> >>> Folks, >>> >>> I have Googled but not found much regarding arrayInd aside from the "which" >>> help page. >>> >>> Any good examples or docs on

[R] arrayInd and which

2013-04-03 Thread Keith S Weintraub
Folks, I have Googled but not found much regarding arrayInd aside from the "which" help page. Any good examples or docs on what arrayInd does that is better or different from which()? In addition take the following 20x10 matrix: td<-structure(c(1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 6, 6,

[R] lognormal sampleing using covariance matrix

2013-04-02 Thread Keith S Weintraub
Andras, I am no expert but you could start with correlated normal random variables and then convert to lognormal. You can use rmvsnorm from the {fCopulae} package to generate the correlated normals. Here is a call that I have used in the past: set.seed(12345) numSims<-10 # number of mult

[R] string split at xth position

2013-03-13 Thread Keith Weintraub
Here is another way require(stringr) aaa<-paste0("a", 1:20) bbb<-paste0("b", 101:120) ab<-paste0(aaa,bbb) ab ptrn<-"([ab][[:digit:]]*)" unlist(str_extract_all(ab, ptrn)) > Hi, > > I have a vector of strings like: > c("a1b1","a2b2","a1b2") which I want to spilt into two parts like: > c("a1"

Re: [R] What happened to "financial" package?

2013-02-27 Thread Keith Weintraub
is still a problem please let me know. Also I read the digests daily. What is the best way to reply to a message in the digest? Thanks for the help, KW > On 26/02/2013 14:45, Keith Weintraub wrote: >> Folks, >> I have been using the cf function from the "financial" pack

[R] What happened to "financial" package?

2013-02-26 Thread Keith Weintraub
Folks, I have been using the cf function from the "financial" package for a few years now. Upon updating my version of R to ... I found that the package no longer exists in the main collection of R packages. Has this package been renamed or merged with another package? If the functionality i

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,

[R] Packages with functionality related to Oil/Gas exploration

2013-01-30 Thread Keith Weintraub
Folks, As the subject describes: I would like to know if there are packages that have functionality tailored for standard Oil/Gas exploration and monetization. Thanks, KW -- [[alternative HTML version deleted]] __ R-help@r-project.org maili

Re: [R] Query on package to use for investment quotes

2013-01-29 Thread Keith Weintraub
Bruce, Have you looked at the Edgar database here: http://www.sec.gov/edgar.shtml You should be able to get daily mutual fund quotes. KW -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mail

[R] How do I get Garamond font in R?

2013-01-17 Thread Keith Weintraub
Folks, I run R on a early 2009 MacBook Pro running Mountain Lion. I have a bunch of fonts in my user Library one of which is Garamond. I have tried the ttf_import function to no avail. I played with this for a couple of hours at least and I have gotten nowhere. Here is a bit of one of my sess

Re: [R] function coverage

2013-01-15 Thread Keith Jewell
On 14/01/2013 22:25, Hadley Wickham wrote: I think codetools could do this reasonably well with the walkCode function, but I've never done it so I don't have sample code, and walkCode is mostly an internal function. There are a couple of approaches here: http://stackoverflow.com/questions/14276

Re: [R] Effect of each term in the accuracy of Nonlinear multivariate regression fitting equation

2012-11-27 Thread Keith Jewell
In this context, "linear model" means linear in the _coefficients_ not (necessarily) linear in the predictors, so your model: JIM ~ z1*A + z2*B + z3*A*B^2 + z4*C*D^3 + z5*A^2*B^2 ... is a linear model (in z1, z2, ...). So you don't need to use nls, lm is probably favourite. You can use all t

[R] Question about VAR (Vector Autoregression) in differences.

2012-11-21 Thread Keith Weintraub
Folks, I have been using the VAR {vars} program to find a fit for the following bi-variate time series (subset): bivariateTS<-structure(c(0.950415958293559, 0.96077848972081, 0.964348957109053, 0.967852884998915, 0.967773510751625, 0.970342843688257, 0.97613937178359, 0.980118627997436, 0.98

Re: [R] Creating yyyymm regexp strings on the fly for aggregation.

2012-11-09 Thread Keith Weintraub
names(res) <- as.integer(names(res)) + 1L >res > } > > fun(2010:2011, 1) > fun(2010:2011, 2) > fun(2010:2011, 4) > fun(2010:2011, 12) > > > Hope this helps, > > Rui Barradas > Em 09-11-2012 03:39, Keith Weintraub escreveu: >> Folks, >>

[R] Creating yyyymm regexp strings on the fly for aggregation.

2012-11-08 Thread Keith Weintraub
Folks, This question is somewhat related to a previous posting of mine. I just can't seem to create a generic solution. Here is a function that I found searching around the internet: splitIt <- function(x, n) {split(x, sort(rank(x) %% n))} I use it like so: > splitIt(1:12, 2) $`0` [1] 1 2 3 4

Re: [R] Aggregate data frame across columns

2012-11-07 Thread Keith Weintraub
Arun, Jeff, Bert, Thanks for your help. I have put a subset of my data below in mySubset. I would like to be able to sum the rows by year. In this case the results would be the result data.frame below. How can I automate something like this and how would I do it quarterly if necessary. The

[R] Aggregate data frame across columns

2012-11-07 Thread Keith Weintraub
Folks, I have a data frame with columns 200401, 200402, ..., 201207, 201208. These represent years/months. What would be the best way to sum these columns by year? What about by quarter? Thanks for your time, KW -- [[alternative HTML version deleted]] __

[R] Estimating credit card default probabilities.

2012-10-25 Thread Keith Weintraub
Folks, I am working on a credit card defaults and transition probabilities. For example a single credit card account could be in a number of states: up-to-date, 30, 60, 90 days in arrears or in default. * Are there packages in R that do estimation of the transition probabilities given historica

Re: [R] Mailing List

2012-09-05 Thread Keith Jewell
You might prefer to read list via the web or a news reader or an RSS feed, in which case http://dir.gmane.org/gmane.comp.lang.r.general might be helpful. Keith J On 05/09/2012 13:47, David Winsemius wrote: On Sep 5, 2012, at 3:00 AM, Marcus Tullius wrote: Hello there, is there a way I

Re: [R] Tendonitis and R users

2012-09-04 Thread Keith Jewell
When I suffered from wrist pain I found changing from a standard mouse to a cordless trackball gave rapid and complete relief. Your mileage may vary. Keith J I think I've avoided tendonitis by carefully stretching the affected area when I begin to feel discomfort and, as John sug

  1   2   3   4   >