Re: [R] Ruofei Mo - How can I generate correlated data with non-normal distribution?

2016-03-03 Thread Dalthorp, Daniel
Ruofei, Ben's suggestion is simple and gets you close: require(MASS) nsim <- 100 rho <- -.9 Z <- mvrnorm(nsim, mu=c(0,0),Sigma = cbind(c(1,rho),c(rho, 1))) U <- pnorm(Z); a <- Z[,1] b <- qunif(U[,2]) cor(a,b) Pearson correlation characterizes the linear relationship between normal r.v.'s, bu

Re: [R] output my results into Excel

2016-03-02 Thread Dalthorp, Daniel
alue, not a data frame. However, I am not > sure. Any advice? > > > Thanks for your help. > > > Mike > > > -- > *From:* Dalthorp, Daniel > *Sent:* Wednesday, March 2, 2016 3:50 PM > *To:* Michael > *Cc:* r-help@r-project.org > *Sub

Re: [R] output my results into Excel

2016-03-02 Thread Dalthorp, Daniel
Hi Michael, If you are working in Windows: # You can put the matrix directly into the clipboard write.table(PRdist, file = 'clipboard', sep = '\t', row.names = F, col.names = F) The "sep" argument tells what character to use for separating columns. Default for Excel is tab (i.e. '\t') Default fo

Re: [R] Plot multiple similar equations in r

2016-03-02 Thread Dalthorp, Daniel
Or, if you want easy labels, you can play around with contour graphs. ?contour # will give you info on how to make contour plots The basic idea is to construct a matrix of z-values...one z for every combination of x and y contour(x,y,z) The x's would then be the x-values you want in (0.37273*log

Re: [R] Plot multiple similar equations in r

2016-03-02 Thread Dalthorp, Daniel
A simple solution that will give you an idea of some of the plot parameters: x<-seq(1,10,length=1000) # values for x-axis x0<-c(0.4,0.5,0.6,0.7) miny<-(log(min(x0))-(0.37273*log(max(x))-1.79389))/0.17941 # minimum y-value to show on graph maxy<-(log(max(x0))-(0.37273*log(min(x))-1.79389))/0.17941

Re: [R] Pairing and

2016-02-11 Thread Dalthorp, Daniel
Hi Val, There are probably more elegant ways to do it, but the following is fairly transparent: # input data arranged as an array: indat<-cbind(c(1,2,2,1),c(1,2,1,1),c(2,2,2,2),c(2,2,2,2),c(2,2,2,1),c(2,2,2,2),c(2,2,2,1),c(2,2,2,2),c(1,2,1,1),c(1,2,1,2)) indat outdat<-array(dim=c(dim(indat)[1],di

[R] Panel Data Help

2016-02-01 Thread Daniel Dorchuck
Hi, I'm currently working on an econometrics project on banking and looking to merge a dataframe of bank specific data with dataframes of macro variables. I am then going to transform the data set into a plm dataframe using the plm package. The bank specific observations are indexed across time wh

Re: [R] on specifying an encoding for plot's main-argument

2016-02-01 Thread Daniel Bastos
Duncan Murdoch writes: > On 29/01/2016 10:35 AM, Daniel Bastos wrote: >> Here's how I plot a graph. >> >>plot(c(1,2,3), main = "graph ç") >> >> The main-string has a UTF-8 character "ç". I believe I'm using the >> windows

[R] on specifying an encoding for plot's main-argument

2016-01-29 Thread Daniel Bastos
Here's how I plot a graph. plot(c(1,2,3), main = "graph ç") The main-string has a UTF-8 character "ç". I believe I'm using the windows device. It opens up on my screen. (The window says ``R Graphics: Device 2 (ACTIVE)''.) How can I tell it to use my encoding of choice? I looked around the

Re: [R] Angle between two points with coordinates

2016-01-28 Thread Dalthorp, Daniel
Gwennaël, Does the %% operator work for you? It gives x mod y (or the remainder after dividing x into y...result is guaranteed to be <=0 and >y) E.g. -150 %% 360 # 210 570 %% 360# 210 https://stat.ethz.ch/R-manual/R-devel/library/base/html/Arithmetic.html -Dan On Thu, Jan 28, 2

[R] tcltk table: get celltag value

2016-01-25 Thread Dalthorp, Daniel
I'm finding it very difficult to figure out how to read the value of "celltag" for a given cell in a tktable. I'm sure it's something like: tcl(classTable, "get", "celltag", row, column) but of the dozens of variations of names, options, args, and formats I've tried, nothing is working. Any sugg

[R] tcltk table "validateCommand"

2016-01-22 Thread Dalthorp, Daniel
I'd like to allow users to edit data in tcltk tables and to use vcmd to validate data entry, e.g., not allowing non-numbers to be entered in numeric cells and not allowing '\n' to be entered in text cells. The problem is that I can't figure out how to "see" their data entry before it is entered, a

Re: [R] tcltk tkwidget(..."table")

2016-01-22 Thread Dalthorp, Daniel
a good one. > > Greetings, > > Adrian > On Jan 21, 2016 10:36 PM, "Dalthorp, Daniel" wrote: > >> > Once you're up to speed on those issues... >> >> Any suggestions for getting up to speed on those issues? >> >> >> >&g

Re: [R] tcltk: write '[' and ']' in a table cell

2016-01-21 Thread Dalthorp, Daniel
ethz.ch/pipermail/r-help/2009-January/378558.html > > -pd > > > On 21 Jan 2016, at 02:12 , Dalthorp, Daniel wrote: > > > > I know it should not be difficult to write the string: > > > > i<-4 > > j<-17 > > lbl<-paste0("[", i, &quo

Re: [R] tcltk tkwidget(..."table")

2016-01-21 Thread Dalthorp, Daniel
> Once you're up to speed on those issues... Any suggestions for getting up to speed on those issues? On Thu, Jan 21, 2016 at 11:46 AM, peter dalgaard wrote: > > > On 21 Jan 2016, at 00:25 , Dalthorp, Daniel wrote: > > > > Thanks, Peter. > > > &g

[R] tcltk: write '[' and ']' in a table cell

2016-01-20 Thread Dalthorp, Daniel
I know it should not be difficult to write the string: i<-4 j<-17 lbl<-paste0("[", i, ", ", j, "]") # to a table, but I'm having a devil of a time trying to figure out how to do it. # the following gives lbl surrounded by braces. tt<-tktoplevel() tfr <- tkframe(tt) tkgrid(tfr) junk<-tclArray() j

Re: [R] tcltk tkwidget(..."table")

2016-01-20 Thread Dalthorp, Daniel
help. E.g. with a table (called table1) with 3 columns and want to set widths to 30, 5, and 5: colwidths<-c(30, 5, 5) for(i in 1:3) { tcl(table1, "width", i - 1, colwidths[i]) } On Wed, Jan 20, 2016 at 3:07 PM, peter dalgaard wrote: > > > On 19 Jan 2016, at 20:48 , Da

[R] tcltk tkwidget(..."table")

2016-01-19 Thread Dalthorp, Daniel
Does anyone know a simple way to create a tcltk table with columns of varying widths? -Dan -- Dan Dalthorp, PhD USGS Forest and Rangeland Ecosystem Science Center Forest Sciences Lab, Rm 189 3200 SW Jefferson Way Corvallis, OR 97331 ph: 541-750-0953 ddalth...@usgs.gov [[alternative HT

Re: [R] Use SQL in R environment

2016-01-15 Thread Dalthorp, Daniel
Very general question...try searching "R SQL" on google for a start. On Fri, Jan 15, 2016 at 9:59 AM, Amoy Yang via R-help wrote: > Hi All, > I am new here and a beginner for R. Can I use SQL procedure in R > environment as it can be done in SAS starting with PROC SQL; > Thanks for helps! > > A

[R] rjags loading error

2016-01-15 Thread Dalthorp, Daniel
What has happened?! I get the following error message when I try to load rjags package (w/ Windows 7)... > require(rjags) Loading required package: rjags Error in get(method, envir = home) : lazy-load database 'C:/Program Files/R/R-3.2.3/library/rjags/R/rjags.rdb' is corrupt In addition: Warni

Re: [R] creating cubes

2016-01-15 Thread Dalthorp, Daniel
t;-matrix(runif(25),nrow=5,ncol=5) # populating your 3-d array: arrD3[,,1]<-mat1 arrD3[,,2]<-mat2 # to see what it looks like: arrD3 On Fri, Jan 15, 2016 at 2:57 PM, Matteo Richiardi < matteo.richia...@gmail.com> wrote: > Hi Daniel, > thanks for your answer. How can I

Re: [R] creating cubes

2016-01-15 Thread Dalthorp, Daniel
How about: D<-array(dim=c(d1, d2, d3))? On Fri, Jan 15, 2016 at 2:20 PM, Matteo Richiardi < matteo.richia...@gmail.com> wrote: > What is the best way to store data in a cube? That is, I need to create a > data structure D with three indexes, say i,j,h, so that I can access each > data point D[i

Re: [R] different coloured axis title labels for different axes

2016-01-11 Thread Dalthorp, Daniel
How about this: plot(0,0,xlab='',ylab='') mtext(side=1,line=3,text='x axis',col=4) mtext(side=2,line=3,text='y axis',col=2) -Dan On Mon, Jan 11, 2016 at 7:44 AM, Evan Cooch wrote: > Consider a simple plot of X vs Y. There are elements on the plot that > represent X, or Y, that are presented i

[R] close specific graphics device

2015-12-15 Thread Dalthorp, Daniel
dev.off(which) can be used to close a specific graphics device where "which" is the index of the device, but is there a way to assign a custom number (or name) to a windows device so that specific window can be later closed via dev.off (or some other method) if it is open? The following does NOT w

[R] how to eliminate ggplot warning frrom "knitted" document

2015-11-16 Thread Daniel Nordlund
eate a pdf document and the warning is cluttering up my pdf document. Is there anyway to alter the plot statement to avoid the warning? If not, is there a way to get knitr not to print out the warning to the markdown document so that it doesn't end up in the pdf document? Thanks,

Re: [R] Quotes

2015-11-12 Thread Daniel Wiegert
Thank you. This was helpful. I'll try it. Daniel Wiegert > On Nov 12, 2015, at 1:11 AM, Jim Lemon wrote: > > Hi Daniel, > As David said, these problems are almost always due to fancy quotes. If you > want plain old ASCII 34 (double) or 39 (single) quotes, try using

[R] Quotes

2015-11-11 Thread Daniel Wiegert
times for R to accept them, or type them in manually in R. Is there anyway to make this easier? What font in Word/Excel etc. does R prefer and will function using quotes? Commas, letters, numbers, all work, just the full double quotes won't work. Thank you, D

Re: [R] (no subject)

2015-11-01 Thread Daniel Wagenaar
address I subscribed to the list with. When I resent it, I failed to copy the subject line. My apologies. - Daniel On 10/30/2015 03:12 PM, Kevin Wright wrote: Maybe you want summary(aov(Y ~ A + Error(A:B))) Kevin On Fri, Oct 30, 2015 at 9:32 AM, Wagenaar, Daniel (wagenadl) mailto:wagen...@ucm

[R] Nested ANOVA yields surprising results

2015-10-30 Thread Daniel Wagenaar
`Sum Sq`[1] / a$`Sum Sq`[2] P <- 1 - pf(F, a$Df[1], a$Df[2]) (They are not R programmers (yet).) And to be honest, I would find it easier to read those results directly from the table as well. Thanks, Daniel Wagenaar -- Daniel A. Wagenaar, PhD Assistant Professor Department of Biologica

Re: [R] how to work with time of day (independent of date)

2015-10-30 Thread Daniel Nordlund
On 10/30/2015 11:17 AM, Mark Leeds wrote: Daniel: Just to complete my solution, here's the code for doing the mean. Didn't expect this to take 3 emails !!! Have a good weekend. temp <- tapply(f$value, f$justtimes, mean) finalDF <- data.frame(chrontimes = times(rownames(temp)

[R] how to work with time of day (independent of date)

2015-10-30 Thread Daniel Nordlund
uot;2015-10-30 00:50:00", "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00", "2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L, 80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"), ro

[R] (no subject)

2015-10-30 Thread Wagenaar, Daniel (wagenadl)
ow to get the "textbook" result in the most straightforward way? (I'd like to be able to give me students a simple procedure...) Thanks, Daniel Wagenaar -- Daniel A. Wagenaar, PhD Assistant Professor Department of Biological Sciences McMicken College of Arts and Sciences Univers

Re: [R] retaining characters in a csv file

2015-09-23 Thread Daniel Nordlund
o convert strings to factors, so you can modify as needed. In addition, if your files aren't as regular as I inferred, you can increase the number of rows to read in the first line to ensure getting the classes right. Hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA ___

Re: [R] Connecting R to SAS SPDS through ODBC - no results.

2015-09-18 Thread Daniel Nordlund
x27;, believeNRows=FALSE, colQuote=NULL) Hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

[R] Estimating group modes using GLMs for skewed distributions

2015-08-25 Thread Daniel Meddings
I am wondering why for generalized linear models with Gamma, Poisson and Negative Binomial distributions that there appears to be no discussion about estimating the medians or the modes of the distributions. For example in clinical trials for count data where a log link is used it is the quantity

Re: [R] How to simulate informative censoring in a Cox PH model?

2015-08-03 Thread Daniel Meddings
times does not even present itself here? Thanks Dan On Fri, Jul 31, 2015 at 5:06 PM, Greg Snow <538...@gmail.com> wrote: > Daniel, > > Basically just responding to your last paragraph (the others are > interesting, but I think that you are learning as much as anyone and I >

Re: [R] How to simulate informative censoring in a Cox PH model?

2015-07-30 Thread Daniel Meddings
on). So I don't think so much that you are doing > things wrong, just that you are learning that the models are complex. > > Another approach to simulation that you could try is to simulate the > event time and censoring time using copulas (and therefore they can be > correlated to give

Re: [R] How to simulate informative censoring in a Cox PH model?

2015-07-24 Thread Daniel Meddings
dependent data and then transform the > values using your Weibul. Or you could generate your event times and > censoring times based on x1 and x2, but then only include x1 in the > model. > > On Wed, Jul 22, 2015 at 2:20 AM, Daniel Meddings > wrote: > > I wish to simulate event

Re: [R] interactive Map: Popups

2015-07-23 Thread daniel
ecklenburg-Vorpommern", "Niedersachsen", "Nordrhein-Westfalen", "Rheinland-Pfalz", "Saarland", "Sachsen", "Sachsen-Anhalt", "Schleswig-Holstein", "Thüringen"), value = 1:16) G3 <- gvisGeoMap(GR, locationvar

[R] How to simulate informative censoring in a Cox PH model?

2015-07-22 Thread Daniel Meddings
I wish to simulate event times where the censoring is informative, and to compare parameter estimator quality from a Cox PH model with estimates obtained from event times generated with non-informative censoring. However I am struggling to do this, and I conclude rather than a technical flaw in my

Re: [R] remove 0 and NA values

2015-07-13 Thread Daniel Nordlund
equal to zero! On Jul 13, 2015 5:31 PM, "Daniel Nordlund" mailto:djnordl...@frontier.com>> wrote: On 7/13/2015 3:01 PM, Lida Zeighami wrote: Hi there, I have a matrix which its elements are 0, 1,2,NA I want to remove the columns which the colsums are equ

[R] Function returning multiple objects but printing only one

2015-07-13 Thread Daniel Caro
ces bootstrap coefficients so clearly I don't want to print the bootstrap output but I do want users to be able to access it. Many thanks, Daniel [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE a

Re: [R] sampling rows with values never sampled before

2015-06-22 Thread Daniel Nordlund
orld problem. There is no error checking, and for large samples it may not scale well. Hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/l

Re: [R] Combining multiple probability weights for the sample() function.

2015-06-03 Thread Daniel Nordlund
m contain identical letters 1 and 3, AND ~50% again contain identical letters 2 and 3 (except in this example as it is not possible from the choices). Can multiple probability weightings be combined in such a manner? Ben, If I correctly understand your requirements, you can't do what you

Re: [R] Getting a cdf equal to 1 from a variable kernel density estimation

2015-05-27 Thread Daniel Nordlund
lowing: gaussianKernel <- function(u) exp(-u^2/2)/(2*pi)^.5 densityFunction <- function(x, df, ker, h){ difference = t(t(df) - x)/h W = sum(apply(difference, 1, ker)) / (nrow(df)*h) } If you are wanting to do density estimation for real world work, I would get help from someone i

Re: [R] Vincentizing Reaction Time data in R

2015-05-20 Thread Daniel Nordlund
;- rnorm(100,200,50) # create deciles for binning decile <- as.numeric(cut(rt, quantile(rt,0:10)/10),include.lowest=TRUE)) # collect into a dataframe (not really necessary) df <- data.frame(rt=rt, decile=decile) #compute the bin means aggregate(rt,list(decile),mean,data=df) This sho

Re: [R] dotplot

2015-05-16 Thread Daniel Nordlund
On 5/16/2015 1:19 PM, Daniel Nordlund wrote: On 5/16/2015 12:32 PM, li li wrote: Hi all, I wrote the following code and have two questions: (1) As you can see, I would like different colors for different types. It does not come out that way in the graph from this code. Anyone know how to

Re: [R] dotplot

2015-05-16 Thread Daniel Nordlund
over the colors chosen. I created a vector, color, specifying the colors and the order they will be applied. 2. the scales parameter is what you are looking for. The parameter is looking for a list which consists of name=value pairs. You can rotate the labels by a specified number of deg

Re: [R] BIG difficulties in Using boot.ci (bot package)

2015-04-13 Thread Daniel Nordlund
index=3) Error in boot.ci(results, type = "bca", index = 3) : object 'results' not found A reproducible example means that when I run your code on my machine, I get the same results / warnings / errors that you get. I got something different. Dan -- Daniel Nordl

[R] Package build system adds line break in DESCRIPTION URL

2015-04-03 Thread Daniel Lewandowski
Has anybody noticed that if field URL in DESCRIPTION contains a uri with 66 or more characters, then file DESCRIPTION in the resulting package includes a line break at the beginning? So this (source DESCRIPTION): URL: http://ecdc.europa.eu/en/data-tools/seroincidence-calculator-tool/Pages/def

Re: [R] generating phi using function()

2015-03-30 Thread Daniel Nordlund
e help says of the formula argument formula formula for restricted MIDAS regression or midas_r object. Formula must include fmls function your formula does not include the fmls() function, it uses mls(). So I think your problem may have to do with how you are calling the midas

Re: [R] Sampling

2015-03-29 Thread Daniel Nordlund
assuming you want to sample without replacement. Generalizing it to other data structures is left as an exercise for the reader. replicate(100,mean(sample(yourdata,30, replace=FALSE))) hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA __ R

Re: [R] generating phi using function()

2015-03-29 Thread Daniel Nordlund
-- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Daniel Nordlund Bothell, WA USA _

Re: [R] SAS equivalent for R's signif function?

2015-02-09 Thread Daniel Nordlund
AS you could use PROC FCMP to turn this into a function. If you are interested contact me offline and I will send you a PROC FCMP implementation. Dan -- Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and mor

[R] Creating two autocorrelated and correlated time series

2015-02-05 Thread Daniel Marmander
specific correlation between the series. I have found some help here: http://stats.stackexchange.com/questions/71211/how-to-generate-normal-random-variable-vector-which-is-spatially-auto-correlated but I have a hard time implementing it in R, being a R-novice. Thanks, Daniel [[alternative HTML

Re: [R] Chaining multiple replacement functions in R

2014-12-30 Thread Daniel Gabrieli
;FirstKey")) rmatch.pos(app, "attr2", rmatch.pos(app, "SecondKey")) rmatch.pos(app, "attr1", rmatch.pos(app, "ERROR")) rmatch.pos(app, "ERROR", rmatch.pos(app, "attr1")) On Tue, Dec 30, 2014 at 1:08 PM, Daniel Gabrieli wrote: >

Re: [R] Chaining multiple replacement functions in R

2014-12-30 Thread Daniel Gabrieli
uncan Murdoch wrote: > On 29/12/2014 4:41 PM, Daniel Gabrieli wrote: > > I cross posted this on Stack Overflow: > > > http://stackoverflow.com/questions/27694466/chaining-multiple-replacement-functions-in-r > > > > > > I am using R to work with a large JS obje

[R] Chaining multiple replacement functions in R

2014-12-30 Thread Daniel Gabrieli
I cross posted this on Stack Overflow: http://stackoverflow.com/questions/27694466/chaining-multiple-replacement-functions-in-r I am using R to work with a large JS object (using the library rjsonio). As such, I have a lot of nested lists, which are getting somewhat cumbersome to work with. I hav

[R] Fwd: PLEASE HELP ON R-LANGUAGE

2014-12-01 Thread Daniel James
Subject: PLEASE HELP ON R-LANGUAGE I am writing my project on "The effect of Bootstrapping on Time Series Data". My problem is how I will write r programme to run a non stationary time series data. I am familia to r language already. Please help me. [[alternative HTML version deleted]]

[R] HELP ON NON-LINEAR MIXED MODEL

2014-11-13 Thread Popoola Daniel
Good Morning Sir/Ma, I am POPOOLA DANIEL a Forest Biometrician in making from the University of Ibadan, Ibadan Nigeria. Please Sir/Ma I am having issues on performing Non-linear mixed model on R (using maximum likelihood approach). I am trying to input four different measured variables which

Re: [R] Getting the most recent dates in a new column from dates in four columns using the dplyr package (mutate verb)

2014-11-09 Thread Daniel Nordlund
-04 2011-11-04 Pradip K. Muhuri, PhD SAMHSA/CBHSQ 1 Choke Cherry Road, Room 2-1071 Rockville, MD 20857 Tel: 240-276-1070 Fax: 240-276-1260 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Daniel Nordlund Sent: Sunday, November 09, 2

Re: [R] Getting the most recent dates in a new column from dates in four columns using the dplyr package (mutate verb)

2014-11-09 Thread Daniel Nordlund
rg/posting-guide.html and provide commented, minimal, self-contained, reproducible code. I am not familiar with the mutate() function from dplyr, but you can get your wanted results as follows: data2 <- within(data1, oidflag <- apply(data1[,-1], 1, max, na.rm=TRUE)) Hope this is h

[R] Lme4 Package Help!

2014-11-06 Thread Daniel Mello
Hello, all! So, as stated in the title, the Lme4 package used to output p-values for the fixed effects. What happened?! Literally 2 weeks ago, I ran code, got output with no errors, and had p-values listed for my fixed effects. Now, running THE SAME CODE with THE SAME DATASET (nothing at all ha

Re: [R] loops in R

2014-11-05 Thread Daniel Nordlund
,list(Population), mean)) with(your_data_frame,aggregate(R,list(Population), var)) hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Function that create day of the year column.

2014-11-04 Thread daniel
Maybe, you can add a parameter with a list of the column names and inside the function an if statement, if the list lenght is 1 use the function with 1 column else the 3 columns. I am sure you can find better solutions. Daniel Merino 2014-11-04 9:30 GMT-03:00 Frederic Ntirenganya : > Hi Dan

Re: [R] Function that create day of the year column.

2014-11-04 Thread daniel
Frederic, Check the lubridate library. install.packages("lubridate") library(lubridate) yday(Sys.Date()) d <- 4 m <- 11 y <- 2014 yday(as.Date(paste(y,m,d,sep="-"))) Daniel Merino 2014-11-04 7:01 GMT-03:00 Frederic Ntirenganya : > Dear All, > > I would l

Re: [R] converting individual data series to natural log (continuously compounded return)

2014-10-31 Thread daniel
0+100, order.by=seq(as.Date("2014-10-22"), as.Date("2014-10-31"), by="day")) str(df) Return.calculate(df, "log") If you are going to use the PerformanceAnalytics package I highly recommend you to checkl the xts package. Daniel Merino 2014-10-31 15:24 GMT-

Re: [R] Time outside limits

2014-10-16 Thread daniel
Bart, Check if the following could help you. library(xts) y <- c(rnorm(10,25), rnorm(10,32),rnorm(10,25), rnorm(10,20), rnorm(10,25)); x <- seq(c(ISOdate(2000,3,20)), by = "hour", length.out = length(y)) z <- xts( y, order.by=as.POSIXct(x)) limit <- ifelse( lag(z) < 22

Re: [R] errors in initial values in R2winBUGS

2014-10-11 Thread Daniel Miquelluti
You are separating the objects using commas, the correct should be semicolons. Example: xi1=matrix(data=rep(0.0,600),ncol=3);xi2=matrix(data=rep(0.0,600),ncol=3)) Best regards, Daniel Miquelluti Em S�bado, 11 de Outubro de 2014 18:06, Uwe Ligges escreveu: On 11.10.2014 06:09, thanoon

[R] quantreg crq function-incomplete taus fitted

2014-10-07 Thread daniel castro
re the rest un itl 1? qreg1<-crq(Surv(TIME,EVENT,type="right")~VAR1+VAR2, data=DATA_TRAIN,method = "Portnoy",grid=seq(0.1,1,by=0.1)) gives only one value for tau=0.0 I want to control the parameters tau or grid to get the results for the quantiles I want, but it

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
] "=" # is trying to give me a pretty blatant hint... {: -) On Mon, Sep 22, 2014 at 1:24 PM, Duncan Murdoch wrote: > On 22/09/2014 11:34 AM, Daniel Fuka wrote: >> >> Howdy Duncan, >> >> Thanks for the quick reply! I must be missing something >> simple/obvi

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
release of the package. > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > > On Mon, Sep 22, 2014 at 8:34 AM, Daniel Fuka wrote: >> Howdy Duncan, >> >> Thanks for the quick reply! I must be missing something >> simple/obvious. I need to have the &

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
my name is muka,\", x)" return(song) } Thanks again for the quick reply and help you are giving me! dan On Mon, Sep 22, 2014 at 10:37 AM, Duncan Murdoch wrote: > On 22/09/2014 9:16 AM, Daniel Fuka wrote: >> >> Howdy, >> >> I have searched the list

[R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
Howdy, I have searched the lists and can not seem to find a solution to my problem. I need to be able to dynamically modify a string inside a function to build a new function. "sub" replaces with a quoted string... and "parse" of "sub" returns expression... How can I get an unquoted string from a

[R] Problem when estimating through "dlm" package

2014-09-16 Thread Daniel Miquelluti
I'm trying to set up an AR(2) model in the dlm context. I've generated a time series utilizing the code: am = 800; #sample size des = 200; #initial values to be discarded V = 0.5 v = rnorm((am+des+1),0,sqrt(V)) W = 0.9 w = rnorm((am+des+1),0,sqrt(W)) U = 0.9

[R] "no visible binding for global variable" and with() vs. within()

2014-08-17 Thread Daniel Braithwaite
R CMD check does not object to this code when checking a package: foo1 <- function (bar) { with(bar, { x }) } but produces a warning: foo2: no visible binding for global variable 'x' in response to this: foo2 <- function (bar) { within(bar, { x }) } Is this an R bug, o

[R] lm weights argument within function

2014-08-01 Thread Daniel Caro
uot;, but I need wt to be an argument in quotes, not an object. It seems the issue is related to ?lm = "All of weights, subset and offset are evaluated in the same way as variables in formula, that is first in data and then in the environment of formula., but I can't figure it out. Can you

Re: [R] Linear relative rate / excess relative risk models

2014-07-29 Thread Wollschlaeger, Daniel
results closely match those from Epicure. Using the data here: http://dwoll.de/err/dat.txt The stan model fit below replicates the results from Epicure here: http://dwoll.de/err/epicure.log Of course I am still interested in learning about other options or approaches. Daniel ##--- ## rstan

[R] sqldf problems

2014-07-14 Thread Juan Daniel García
ndows 8.1 Do I need any other installations o packages or something else? The code was working in older Windows XP and Linux Thanks -- ** Juan Daniel García Villabrille, Ingeniero de Montes, colegiado nº

Re: [R] Custom sampling method in R XXXX

2014-06-23 Thread Daniel Nordlund
, p=probs, replace=TRUE) } new_sample(x) Daniel Nordlund Bothell, WA USA > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Dan Abner > Sent: Monday, June 23, 2014 3:19 PM > To: Greg Snow > Cc: r-help@r-p

[R] Output levels of categorical data to Excel using with()

2014-06-19 Thread Daniel Schwartz
I have coded qualitative data with many (20+) different codes from a survey in an excel file. I am using the with() function to output the codes so we know what's there. Is it possible to direct the output from with() to an excel file? If not, what's another function that has the same, er, function

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Daniel Nordlund > Sent: Thursday, May 01, 2014 1:10 AM > To: r-help@r-project.org > Subject: Re: [R] A combinatorial assignment problem > >

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Daniel Nordlund
r,m,max_iter=120) { n <- 0 cmb <- combn(r,m) repeat { n <- n+1 tbl <- table(map<-cmb[,sample(1:choose(r,m),k)]) if(min(tbl) == max(tbl)-1) break if(n > max_iter) break } return(t(map)) } a <- assignment(10,7,3) Dan Daniel Nordlund

Re: [R] system()

2014-04-14 Thread Daniel Nordlund
freezes R on my Win 7 Pro x64 box using either 64-bit R-3.0.3 or R-3.1.0. You might try switching to shell() instead of system() > command <- paste(aa, fnm) > shell(command) However, it all depends on what programs you are trying to run and what behavior you expect. Dan Daniel

Re: [R] stratified sampling

2014-03-07 Thread Daniel Nordlund
sp3 = structure(c(1L, 1L, 1L, 1L), .Label = "mean", class = > "factor")), .Names = c("watershed", > "year", "sp1", "sp2", "sp3"), class = "data.frame", row.names = c(NA, > -4L)) > > Any s

Re: [R] help with gettext() for translating text

2014-02-21 Thread Daniel Kelley
Thanks. This helped greatly. I’m sorry about sending the html message, and hope this one is plain-text. Dan. On Feb 21, 2014, at 7:00 AM, Prof Brian Ripley wrote: > On 21/02/2014 10:40, Daniel Kelley wrote: >> I’m wondering whether anyone can help me with a translation exercise. I

[R] help with gettext() for translating text

2014-02-21 Thread Daniel Kelley
I’m wondering whether anyone can help me with a translation exercise. I have a package named “oce”, which does oceanographic processing, and I’d like to make it produce graphs with labels that work in different languages. For example, in English I write “Depth” and in Spanish I’d like to write

Re: [R] ISwR Plotting Issue

2014-02-19 Thread Daniel Nordlund
as cut-n-paste from your email) and got a plot of the data with regression line without any error message. What version of R and ISwR are you running? Have you tried closing R and starting a clean session? Since the example worked for me, there is not much else I can help with. Dan Dan

Re: [R] Difference between two datetimes

2014-01-28 Thread Daniel Nordlund
e of 1.5 hours: > > > as.POSIXct("2010-04-04 03:00:00")- as.POSIXct("2010-04-04 02:30:00") > Time difference of 1.5 hours > > > > > > > Any suggestions? > Thanks, > David Fox. > Daylight savings time change in Australia? Dan Da

Re: [R] Regression on presence/absence matrix

2014-01-25 Thread Daniel Patón Domínguez
rrect and fluid communication" -- **** Daniel Patón Domínguez Numerical Ecology. Ecology Unit Department of Plant Biology, Ecology and Earth Sciences Faculty of Sciences. University of Extremadura Avda. Elvas s/n 06071 Badajoz (Spain) http://unex.academ

[R] Regression on presence/absence matrix

2014-01-24 Thread Daniel Patón Domínguez
Dear all: I want to predict a presence/absence vector using a presence/absence matrix of events. What library can do this in R? Many thanks -- Daniel Patón Domínguez Numerical Ecology. Ecology Unit Department of Plant Biology

Re: [R] Select 5 identical numbers

2014-01-20 Thread Daniel Nordlund
read up on ?sample Dan Daniel Nordlund Bothell, WA USA > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Alaios > Sent: Monday, January 20, 2014 10:12 PM > To: Alaios; R-help@r-project.org > Subject

Re: [R] tables package and alternative to col percent

2014-01-16 Thread Daniel Cher
Thanks for the reply. Another great option would be "missing" (like in SAS), especially for factors. I'm struggling to figure out how to do this with "tables". Daniel Cher, MD djc...@gmail.com +1-650-269-5763 This message and its attachments are confidential. -O

[R] tables package and alternative to col percent

2014-01-12 Thread Daniel Cher
All 8 100 > I'm looking for percents to have gender=1 or gender=2 as the denominator. I.e., Gender Race n Percent 1 32 *50* 42 *50* 2 30 *0* 44 *100* All 8 100 >

Re: [R] Linear relative rate / excess relative risk models

2014-01-09 Thread Wollschlaeger, Daniel
event and offset pyears. Many thanks, D > -Original Message- > From: David Winsemius [mailto:dwinsem...@comcast.net] > Sent: Thursday, January 09, 2014 4:33 AM > To: Wollschlaeger, Daniel > Cc: r-help@r-project.org > Subject: Re: AW: [R] Linear relative rate / excess re

Re: [R] Linear relative rate / excess relative risk models

2014-01-08 Thread Wollschlaeger, Daniel
fset. Unfortunately, I won't have comparable baseline rate tables. And while I could fit a separate model only to the unexposed group for expected counts, I'd prefer to fit both factors (lambda0 and 1+ERR) simultaneously - as it is typically done in the existing literature.

[R] Linear relative rate / excess relative risk models

2014-01-08 Thread Wollschlaeger, Daniel
o me (eg., gnm, timereg) but I currently don't see how to correctly specify the model. Any help on how to approach ERR models in R is highly appreciated! With many thanks and best regards Daniel [1] Preston DL. Beyond Dose Response: Describing Long-Term Health Effects of Radiation Expos

Re: [R] Knitr, ggplot and consistent fonts

2013-12-23 Thread Daniel Haugstvedt
a try, but could not find the problem there either. The code below was pasted though textEdit and converted to plain text. I hope this takes care of any embedded characters. \documentclass{article} \begin{document} <>= library(knitr) library(ggplot2) @ \title{Knitr and ggplot2} \author{

[R] Fwd: Knitr, ggplot and consistent fonts

2013-12-22 Thread Daniel Haugstvedt
I am forwarding to r-help just in case anyone else where wondering or have the same problem running the example. Cheers D -- Forwarded message -- From: Daniel Haugstvedt Date: Sun, Dec 22, 2013 at 11:54 PM Subject: Re: [R] Knitr, ggplot and consistent fonts To: John Kane Hi

[R] Knitr, ggplot and consistent fonts

2013-12-22 Thread Daniel Haugstvedt
work.) There has to be others facing the same problem and someone must have found a nice solution. Additional attempts from my side which failed are not included in the example. I have tested the Google results i could find without any luck. Cheers Daniel PS. I know the example plots could have

<    1   2   3   4   5   6   7   8   9   10   >