Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread Yihui Xie
All your questions are answered by the knitr book in my first reply, which introduces knitr in a systematic manner. For the web pages, I have tried my best, and nobody can make everybody happy. I do not understand why you do not understand Rnw and markdown, and I do not quite believe a person who u

[R] construct stem and leaf plot

2013-07-18 Thread Roslina Zakaria
Dear r-users,   I would like to construct tem and leaf plot using iris data. It should be easy, but I don't understand why the plot is not right.   Thank you so much for your help.   dat <- iris[,1] > stem(dat) The decimal point is 1 digit(s) to the left of the | 42 | 0 44 | 46 | 00 48

[R] Paternity data analysis

2013-07-18 Thread Moshiur Rahman
Dear R-experts! I did an experiment with Guppy where I had two dietary groups ("High" and "Low"). I completed all my data analysis, but stacked in "paternity analysis". I ran the attached model to analyse them, but as a novice in R, it's very hard for me to confirm whether this gives me the correc

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread Yixuan Qiu
Hi Mike, As long as you have access to some user folder, you can download a non-install version of RStudio. Go to the page http://www.rstudio.com/ide/download/desktop and select "Show zip/tarball downloads", download, extract, and run. Do believe Yihui that running an example using RStudio saves yo

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread C W
Hi, @Yihui When I am using a public computer, say university computer lab or financial company. I do not have control what to install. I'm also very happy with R editor on OS X, it integrates with Mac well. As for my Mac Air, I am keeping installation to the minimal. There are a lot links on yo

Re: [R] Test if 2 samples differ if they have autocorrelation

2013-07-18 Thread Rolf Turner
I imagine that most readers of this list will put your question in the too hard basket. That being so, here is my inexpert take on the question. The issue is to estimate the uncertainty in the estimated difference of the means. This uncertainty depends on the nature of the serial dependence

Re: [R] How code for an exponential function

2013-07-18 Thread Rui Barradas
Hello, First of all, you need to read the posting guide. Where is a data example? And code? As for the question, at an R prompt, type ?log. Hope this helps, Rui Barradas Em 18-07-2013 20:18, Munroe, Ryan escreveu: Hi, I ran a linear regression on a data set and got an Rsq of about .27. The

[R] How code for an exponential function

2013-07-18 Thread Munroe, Ryan
Hi, I ran a linear regression on a data set and got an Rsq of about .27. The plot looks as though an exponential curve would be a better fit. What codes do I use to do this? Thank you, Ryan Munroe [[alternative HTML version deleted]] __ R-he

Re: [R] combine select data from 2 dataframes sharing same variables

2013-07-18 Thread bcrombie
Wow. That is exactly what I wanted (thread viewers see output below). I think/hope this script will be more user friendly for my needs (RTF final output) than the loop I currently have for LaTex output. Thanks very much A.K. I’ll need to send you a Bundt cake at some point I suppose… BN

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread Simon Zehnder
Hi Mike, if you browse the folders, you find always the Rscript binary (the executable) under /Library/Frameworks/R.framework/Versions/.../Resources/Rscript. Do not forget to give your tex file the extension .Rnw! Then surround each Rcode with <>= Here your r code as you do it in the R shell .

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread Yihui Xie
I recommend RStudio not because I want to promote it in any sense, but because of the fact that it has the best support for Rnw/knitr at the moment, and it will save you a lot of headache to get started. It seems you just do not believe me, and insist on going through all the low-level configuratio

Re: [R] 'save' method for S4 class

2013-07-18 Thread Uwe Ligges
On 18.07.2013 20:23, Christofer Bogaso wrote: Hi Simon, Thanks for your pointer. However could you please explain what 'function(x, file_Path) standardGeneric("save")' means here? It is the definition of the generic function for save()? The underlying help files look quite rocket science

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread Berend Hasselman
On 18-07-2013, at 22:22, C W wrote: > Thanks, Simon. I would never figured it out! > > I apologize if I sound frustrated, because I am. > > @package author: you have a great package, but I think a lot of the > directions are hand waving. For the newbies, this leads to more > confusion. > >

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread C W
Thanks, Simon. I would never figured it out! I apologize if I sound frustrated, because I am. @package author: you have a great package, but I think a lot of the directions are hand waving. For the newbies, this leads to more confusion. @Berend: I am using OS X. Mike On Thu, Jul 18, 2013 at

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread Berend Hasselman
On 18-07-2013, at 22:09, C W wrote: > http://tex.stackexchange.com/questions/85154/knitr-with-texworks/85165#85165 > > In step 3: "add the executable file (step 3)". > > What is the executable file? Locate package knitr directory path in R? > >From the window: Executable ==> Program. So th

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread Simon Zehnder
The executable is in case of knitr always Rscript. On a mac it is simply Rscript on windows it is Rscript.exe. This should be on your PATH. If you are not sure, open the Mac Terminal and type Rscript --version. If it does not say "Command not found" all is fine. Best Simon On Jul 18, 2013, at

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread C W
http://tex.stackexchange.com/questions/85154/knitr-with-texworks/85165#85165 In step 3: "add the executable file (step 3)". What is the executable file? Locate package knitr directory path in R? Mike On Thu, Jul 18, 2013 at 3:56 PM, C W wrote: > Actually, I see it at the bottom. Sorry! > > O

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread C W
Actually, I see it at the bottom. Sorry! On Thu, Jul 18, 2013 at 3:44 PM, C W wrote: > Hi Simon, > I am on OS X Lion, I have TeXworks, I don't have knitr as an option. > > How do I install that into TeXworks? Seems like I have to something > in terminal? > > Mike > > On Thu, Jul 18, 2013 at 3:3

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread C W
Hi Simon, I am on OS X Lion, I have TeXworks, I don't have knitr as an option. How do I install that into TeXworks? Seems like I have to something in terminal? Mike On Thu, Jul 18, 2013 at 3:31 PM, Simon Zehnder wrote: > Hi Mike, > > I found my way with this little blog: http://yihui.name/knit

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread Simon Zehnder
Hi Mike, I found my way with this little blog: http://yihui.name/knitr/demo/editors/ The .Rnw files are created very well in a Latex editor. Everything else can be easily googled. The command via knitr::knit2pdf works very fine if you use the chunks. If you are trying to compile an Rtex file, t

Re: [R] 'save' method for S4 class

2013-07-18 Thread Simon Zehnder
Hi Christofer, R's S4 class system builds on generics, that is one class defines the raw frame of a function and maybe an own distinct implementation and other classes, that (usually) inherit from this class, set their special implementations of it. Consider a generic function in R as being an

Re: [R] Difference between arima(1, 1, 1) of y and arima(1, 0, 1) of diff(y)

2013-07-18 Thread George Milunovich
Hi Mark, This is very helpful!! Much appreciated Sent from my iPad On Jul 19, 2013, at 3:51 AM, Mark Leeds wrote: > Hi George: Assuming it's still relevant, the link below will explain why. > > http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm > > > > On Thu, Jul 18, 2013 at 2:14 PM, Georg

[R] extracting variance and covariance

2013-07-18 Thread G Girija
Hi, I am not able to ‘extract variance and covariance’ As mentioned, there are 5 stocks and changed the code [ http://www.forecastingfinancialrisk.com/3.html] as follows: > S<-cov(returns) > S V1 V2 V3 V4 V5 V1 0.0004951526 0.0001256519 0.0

[R] Principal component / EOF analysis of data dominated by a couple frequencies

2013-07-18 Thread Ateljevich, Eli@DWR
Hi R folk, I have a time series of scalar downstream velocity data measured across a tidal channel. The variables are the locations in bins across the channel, the samples are over time. The fluctuation over the tide cycle is an enormous fraction of the time variation in the data ... 96%. The s

Re: [R] cut into groups of equal nr of elements...

2013-07-18 Thread Wet Bell Diver
Here's one way: Vec <- rnorm(30) Vec.cut <- cut(Vec, breaks=c(quantile(Vec, probs = seq(0, 1, by = 0.20))), labels=c("0-20","20-40","40-60","60-80","80-100"), include.lowest=TRUE) table(Vec.cut) or determine the breaks automatically: cut.size <- function(x, size) { cut.prob <- size/leng

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread C W
How do you create a .Rnw file, in R or LaTex? I don't think any tutorial mentions it. btw, I am very new to the terms like markdown, so I don't understand "markdown to HTML". I am reading here http://biostat.mc.vanderbilt.edu/wiki/Main/KnitrHowto that you need to compile at terminal. I do not k

Re: [R] Difference between arima(1, 1, 1) of y and arima(1, 0, 1) of diff(y)

2013-07-18 Thread Mark Leeds
Hi George: Assuming it's still relevant, the link below will explain why. http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm On Thu, Jul 18, 2013 at 2:14 PM, George Milunovich < george.milunov...@mq.edu.au> wrote: > Dear all, > When I run an arima(1,1,1) on an I(1) variable, y, I get different

[R] Difference between arima(1, 1, 1) for y and arima(1, 0, 1) for diff(y)

2013-07-18 Thread george
Dear all, When I run an arima(1,1,1) on an I(1) variable, e.g. y, I get different estimates to when I first difference the variable myself, e.g y2<-diff(y), and then run arima(1,0,1) on y2. Shouldn't these two approaches give the same output? Any help will be much appreciated. george -- View thi

Re: [R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread Yihui Xie
I'm not sure what your question really is. You do not have to use RStudio, but it will be much easier to get started with RStudio, because it does a lot of automatic conversion behind the scenes (e.g. tex to PDF, markdown to HTML, ...). If you want a "pure" solution without any text editor support,

Re: [R] 'save' method for S4 class

2013-07-18 Thread Christofer Bogaso
Hi Simon, Thanks for your pointer. However could you please explain what 'function(x, file_Path) standardGeneric("save")' means here? The underlying help files look quite rocket science for me! Thanks for your time. Thanks and regards, On Thu, Jul 18, 2013 at 4:32 PM, Simon Zehnder wrote: >

Re: [R] restrected arima models

2013-07-18 Thread george
Thanks Sent from my iPhone On 19/07/2013, at 1:43 AM, "Prof Brian Ripley [via R]" wrote: > On 18/07/2013 16:14, george wrote: > > Dear all, > > Does anyone know if it is possible to estimate restricted arima models > > using > > the arima command in R? For instance lets say I want arima(6,

[R] Difference between arima(1, 1, 1) of y and arima(1, 0, 1) of diff(y)

2013-07-18 Thread George Milunovich
Dear all, When I run an arima(1,1,1) on an I(1) variable, y, I get different estimates to when I first difference the variable myself, e.g y2<-diff(y), and then run arima(1,0,1) on y2. Shouldn't these two approaches give the same output? Any help will be much appreciated. george

[R] Looking for knitr example for beginner (NO RStudio)

2013-07-18 Thread C W
Hi everyone, I am using package knitr, FIRST TIME. I don't have access to RStudio. Read through Yihui's page, didn't find it helpful. Stuck on terms Rnw, GFM (GitHub Flavored Markdown). Never used Sweave, so the reference is not helping. Is there a simple step-by-step example WITHOUT RStudio?

Re: [R] Changing settings

2013-07-18 Thread David Winsemius
On Jul 18, 2013, at 9:02 AM, Jason wrote: > How do I change my email settings? I would like to limit the emails that I > receive to only those of interest. > You can use various search engines. I like the MarkMail option. It allows me to search in various r-related groups. If you wnat to run

Re: [R] restrected arima models

2013-07-18 Thread Prof Brian Ripley
On 18/07/2013 16:14, george wrote: Dear all, Does anyone know if it is possible to estimate restricted arima models using the arima command in R? For instance lets say I want arima(6,0,0) but where the first three ar parameters are restricted to zero, ie. ar(1)=ar(2)=ar(3) = 0, and only the last

Re: [R] restrected arima models

2013-07-18 Thread Rui Barradas
Hello, Take a look at parameter 'fixed' of function arima. From the help page for arima(): "fixed optional numeric vector of the same length as the total number of parameters. If supplied, only NA entries in fixed will be varied." Example use ('fixed' has length 7 because we must cou

Re: [R] Changing settings

2013-07-18 Thread David Carlson
Go to Settings | Filters in Gmail and set filters to delete the r-help messages you don't want or move them to a folder for review. R-help messages are not tagged so you cannot restrict them before they are sent. - David L Carlson Associate Professor of Anthro

Re: [R] panel setting

2013-07-18 Thread Greg Snow
I am guessing that you are trying to use the densityplot function from the lattice package (if you had followed the posting guidelines and told us which package you were using, then we would not need to guess). If that is the case then you are trying to mix base graphics (mfrow) and grid graphics

[R] Changing settings

2013-07-18 Thread Jason
How do I change my email settings? I would like to limit the emails that I receive to only those of interest. __ 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/po

Re: [R] cut into groups of equal nr of elements...

2013-07-18 Thread Marc Schwartz
Greg, Good catch. My recollection was that the vector would be broken up into 'breaks' groups of equal size, however it is range(x) that is split into 'breaks' intervals, each of which is equal width. Thanks, Marc On Jul 18, 2013, at 10:55 AM, Greg Snow <538...@gmail.com> wrote: > Marc, >

Re: [R] Orders of levels affecting wilcox.test() output

2013-07-18 Thread Greg Snow
The p-value and inference is the same, the only difference that I see is the value of the W statistic. The definition of the W statistic (as discussed in the Note section on the help page) is based on the sum of the ranks in the **First** group, so if you change which group is first then you shoul

Re: [R] cut into groups of equal nr of elements...

2013-07-18 Thread Wensui Liu
my fault. qcut() is a python function in pandas ;-) what i meant is cut2() in hmisc. sorry for messing up. On Jul 18, 2013 11:51 AM, "Greg Snow" <538...@gmail.com> wrote: > Wensui, > > ?qcut on my machine gives an error and ??qcut does not find anything in > the installed packages. Which packa

Re: [R] Orders of levels affecting wilcox.test() output

2013-07-18 Thread David Carlson
The short answer is whichever version you want since they are the same. Look at the t-test results, they are also different. In one t is positive and in the other it is negative. That is just a result of whether the smaller mean is subtracted from the larger mean or vice versa. The same is happenin

Re: [R] cut into groups of equal nr of elements...

2013-07-18 Thread Greg Snow
Marc, Your method works fine when the data is perfectly uniform, but try it with "Vec <- rnorm(30)" and you will see that there are more observations in the middle groups and fewer in the tail groups. Something like quantile needs to be used to find the unequally spaced breaks that will give equa

Re: [R] cut into groups of equal nr of elements...

2013-07-18 Thread Greg Snow
Wensui, ?qcut on my machine gives an error and ??qcut does not find anything in the installed packages. Which package is qcut in? On Wed, Jul 17, 2013 at 4:43 PM, Wensui Liu wrote: > ?qcut > On Jul 17, 2013 5:45 PM, "Witold E Wolski" wrote: > > > I would like to "cut" a vector into groups o

[R] restrected arima models

2013-07-18 Thread george
Dear all, Does anyone know if it is possible to estimate restricted arima models using the arima command in R? For instance lets say I want arima(6,0,0) but where the first three ar parameters are restricted to zero, ie. ar(1)=ar(2)=ar(3) = 0, and only the last three are actually estimated. Any he

[R] Moran's I

2013-07-18 Thread Owen Yancey
Dear list, I’m an undergraduate research assistant trying to create a single function that can calculate Moran’s I using the “ape” package. The example that I will use comes from online data about ozone levels. Here are the commands that I have been using: > library(ape) > ozone<-read.table("ht

Re: [R] binary distance measure of the "dist" function in the "stats" package

2013-07-18 Thread David Carlson
If you read ?dist, it says that: binary: (aka asymmetric binary): The vectors are regarded as binary bits, so non-zero elements are ‘on’ and zero elements are ‘off’. The distance is the proportion of bits in which only one is on amongst those in which at least one is on. The short answer is t

[R] binary distance measure of the "dist" function in the "stats" package

2013-07-18 Thread 朱林
Dear all: I want to ask question about "binary" distance measure. As far as I know, there are many binary distance measures,eg, binary Jarcad distance, binary euclidean distance, and binary Bray-Curtis distance,etc. It is even more confusing because many have more than one name. So , I wan to k

[R] Bland Altman summary stats for all column combinations

2013-07-18 Thread moadeep
Hello, I have the following data.frame structure(list(Study = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 1

Re: [R] combine select data from 2 dataframes sharing same variables

2013-07-18 Thread bcrombie
Hi, Peter. Thanks for the suggestion. I will investigate ?merge. BNC From: Peter Alspach-2 [via R] [mailto:ml-node+s789695n4671809...@n4.nabble.com] Sent: Wednesday, July 17, 2013 8:08 PM To: Crombie, Burnette N Subject: Re: combine select data from 2 dataframes sharing same variables Tena koe

[R] panel setting

2013-07-18 Thread meng
Hi all: My data: f1 f2 f3 f4 y 1 -4.45 3 6.44 3.721 2 25.66 121 39.03 3.55 0 3 -9.75 12 11.77 3.40 1 4 -12.09 17 13.75 3.33 0 5 -3.53 4 6.47 3.24 0 6 13.18 69 26.55 3.201 ... ... I want to plot f1 for y=0 and 1; f2 for y=0 and 1...and the same as

Re: [R] R-squared and GLM

2013-07-18 Thread Chris89
Haha, true true! ;) It was to be used as a measure on how good the models I use are, but I found out that the AIC would be much easier to implement, and as I understand, a better measure of how good the model fit. Thanks, Chris -- View this message in context: http://r.789695.n4.nabble.com/R-

[R] Orders of levels affecting wilcox.test() output

2013-07-18 Thread Alastair Potts
Good day all, My first posting to this list. It looked like the best place to post this question. When running the wilcox.test(), I noticed that the output values change if you change the ordering of the levels (example below which includes a t.test for comparison). I think this has something to

[R] Test if 2 samples differ if they have autocorrelation

2013-07-18 Thread Eric Jaeger
> Dear all > > I have one question that I struggle to find an answer: > > Let`s assume I have 2 timeseries of daily PnL data over 2 years coming from 2 > different trading strategies. I want to find out if strategy A is better than > strategy B. The problem is that the two series have serial co

Re: [R] Bland Altman summary stats for all column combinations

2013-07-18 Thread arun
HI, #dat1: data Combn1<-combn(colnames(dat1)[2:5],2) #For the first part, may be this helps: library(plyr)  res<-lapply(split(Combn1,col(Combn1)),function(x) {x1<-cbind(Var1=colnames(dat1[,x])[1],Var2=colnames(dat1[,x])[2],dat1[,x],Method=dat1[,6]);colnames(x1)[3:4]<- c("V1","V2"); ddply(x1,.(Met

Re: [R] Merge with transposed matrix.

2013-07-18 Thread arun
Hi, m1<- matrix(NA,5,5) m1[upper.tri(m1)]<-c(2,3,8,4,9,14,5,10,15,20) One way would be: m1[lower.tri(m1)]<-t(m1)[lower.tri(t(m1))]  m1 # [,1] [,2] [,3] [,4] [,5] #[1,]   NA    2    3    4    5 #[2,]    2   NA    8    9   10 #[3,]    3    8   NA   14   15 #[4,]    4    9   14   NA   20 #[5,]   

Re: [R] stopping functions with long execution times

2013-07-18 Thread Prof Brian Ripley
On 18/07/2013 10:37, ONKELINX, Thierry wrote: Dear all, I am running the same model on several datasets, each dataset is a different species. The problem is that for some datasets the model is not converging. Currently I have an INLA model running for 35 days and still no results. The process

Re: [R] 'save' method for S4 class

2013-07-18 Thread Martin Morgan
On 07/18/2013 03:47 AM, Simon Zehnder wrote: Hi Christopher, I think, that "save" is no generic function like "plot", "show", etc. So at first you have to determine a generic. setGeneric("save", function(x, file_Path) standardGeneric("save")) The implementation offered by Christofer shows wr

Re: [R] stopping functions with long execution times

2013-07-18 Thread ONKELINX, Thierry
Hi Henrik, That is exactly what I was looking for. Thanks a lot. Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht

Re: [R] 'save' method for S4 class

2013-07-18 Thread Simon Zehnder
Hi Christopher, I think, that "save" is no generic function like "plot", "show", etc. So at first you have to determine a generic. setGeneric("save", function(x, file_Path) standardGeneric("save")) Now your definition via setMethod. Best Simon On Jul 18, 2013, at 12:09 PM, Christofer Bog

Re: [R] stopping functions with long execution times

2013-07-18 Thread Henrik Bengtsson
See evalWithTimeout() of R.utils, e.g. tryCatch({ evalWithTimeout({ slowFunction(); }, timeout=7*24*3600); }, TimeoutException=function(ex) { cat("Timeout. Skipping.\n"); }) help("evalWithTimeout") have more information and cross links. /Henrik On Thu, Jul 18, 2013 at 11:37 AM, ONKELI

[R] 'save' method for S4 class

2013-07-18 Thread Christofer Bogaso
Hello again, I am trying to define the 'save' method for my S4 class as below: setClass("MyClass", representation( Slot1 = "data.frame" )) setMethod("save", "MyClass", definition = function(x, file_Path) { write.table(x@Slot1

Re: [R] truncation and approximation

2013-07-18 Thread alfonso . carfora
Maybe you can use "round" and "trunc" functions For example if you have a vector like this: x<- c(3.000 3.125 3.250 3.375 3.500 3.625 3.750 3.875 4.000) and you want to round the numbers to 2 decimals you can use: round(x,2) [1] 3.00 3.12 3.25 3.38 3.50 3.62 3.75 3.88 4.00 if you want a n

Re: [R] EWMA error

2013-07-18 Thread Pascal Oettli
Please reply to the list. You will have more chance to get an answer. Pascal 2013/7/18 G Girija > Hi, > > Many thanks for your hint. Yes I made a mistake there. > > Also could you *please* help me in rectifying the following also? > > I am not able to ‘extract variance and covariance’ > > As m

[R] stopping functions with long execution times

2013-07-18 Thread ONKELINX, Thierry
Dear all, I am running the same model on several datasets, each dataset is a different species. The problem is that for some datasets the model is not converging. Currently I have an INLA model running for 35 days and still no results. The process still uses near 100% of the CPU and less than 1

[R] Finding All paths in a graph

2013-07-18 Thread Azam Peyvand
Hi, Do you know any function/package in R which returns all possible paths in a graph. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guid