[R] How to draw y axis in horizontal bar plot?

2012-05-25 Thread Manish Gupta
http://r.789695.n4.nabble.com/file/n4631428/Image2.png How can i draw y axis in bar plot at x = 0? After plotting axis it will look like. -- View this message in context: http://r.789695.n4.nabble.com/How-to-draw-y-axis-in-horizontal-bar-plot-tp4631428.html Sent from the R help mailing list

Re: [R] How to change width of bar when there are very few bars?

2012-05-25 Thread Manish Gupta
If i assign a vector with same small width for each bar (here) still both are same broad. I think it takes ratio for whole area. Is there any other parameter to control it.? Any working example will help me. -- View this message in context: http://r.789695.n4.nabble.com/How-to-change-width-of

Re: [R] How to draw y axis in horizontal bar plot?

2012-05-25 Thread Manish Gupta
continued to previous mail ... http://r.789695.n4.nabble.com/file/n4631429/Image1.png After plotting y axis it will look like -- View this message in context: http://r.789695.n4.nabble.com/How-to-draw-y-axis-in-horizontal-bar-plot-tp4631428p4631429.html Sent from the R help ma

Re: [R] Rolling Sample VAR

2012-05-25 Thread bantex
But after looking through rollapply I still don't seem to be able to implement it to my problem. Could you make it more explicit for me to understand? B -- View this message in context: http://r.789695.n4.nabble.com/Rolling-Sample-VAR-tp4631328p4631430.html Sent from the R help mailing list arc

Re: [R] Query about creating time sequences

2012-05-25 Thread R. Michael Weylandt
One (somewhat kludgy) way would be to use seq() to make one day's worth of times then to pass those to outer() to add in the needed days and then coerce the whole thing back to a sorted vector. I'm not at a computer right now so this won't be quite right but something like x <- seq(x.start.fi

Re: [R] How to change width of bar when there are very few bars?

2012-05-25 Thread R. Michael Weylandt
You can supply a width argument but you also need xlim if I remember right for the specification to have visible effect. Michael On May 25, 2012, at 2:03 PM, Manish Gupta wrote: > http://r.789695.n4.nabble.com/file/n4631371/Bar_Chart.png > > > How to control width of bar chart when there a

Re: [R] evaluate whether function returns error

2012-05-25 Thread R. Michael Weylandt
I'm not sure I follow... It's an error -- what do you mean by "evaluate"? If you are looking to catch errors, you can do so with try or tryCatch and then check for inherits(x, "try-error") to see if there was an error. See the examples for details of how exactly to set this up -- I'm not at a co

Re: [R] Multiple rms summary plots in a single device

2012-05-25 Thread Frank Harrell
Mike I don't know what you are trying to do with plot(summary( ... ~ ...)) as this is not calling an rms function such as summary.rms. To use mfrow and to control which variables are placed on one panel using plot(summary(rms model fit object)) specify est.all=FALSE to summary( ) after specifying

Re: [R] applying cbind (or any function) across all components in a list

2012-05-25 Thread Rui Barradas
Hello, The use of function(i) is because there are two list to be processed, with just one I would have used a simpler form of lapply. I don't rebember exactly who wrote this in a post some time ago (Michael Weylandt?) but imagine a list is a train. Then, list[ i ] is a car and list[[ i ]] is

[R] "shift" + "arrow" in getGraphicsEvent

2012-05-25 Thread cgenolin
Hi the list, Do you know if getGraphicsEvent can detect the use of keys combinaison like "shift+arrow" or "Crlt+arrow" ? Best Christophe -- View this message in context: http://r.789695.n4.nabble.com/shift-arrow-in-getGraphicsEvent-tp4631419.html Sent from the R help mailing list archive at Nab

Re: [R] sweave tables as images?

2012-05-25 Thread Yihui Xie
The hook function hook_pdfcrop() also works on PNG images, although the function name is somehow misleading. The requirement is that you have ImageMagick installed and the command 'convert' is in your PATH. It is a contribution from @r2d3 https://github.com/yihui/knitr/issues/209#issuecomment-52665

Re: [R] sweave tables as images?

2012-05-25 Thread Yihui Xie
Normally I hate the device()+code+dev.off()+cat('\\includegraphics{}) trick. Let me show you how trivial this can be in knitr: https://gist.github.com/2790922 This example shows the real source code to the reader (device()+dev.off() makes no sense to them), and leaves all the dirty tricks behind t

Re: [R] How to remove square brackets, etc. from address strings?

2012-05-25 Thread Sarah Goslee
Part of your problem is that your regexes have spaces in them, so that's what you're matching. A small reproducible example would be more useful. I'm not feeling inclined to wade through all your linked files on Friday evening, but see if this helps: > testdata <- "[Engel, Kathrin M. Y.; Schroeck

Re: [R] sweave tables as images?

2012-05-25 Thread baptiste auguie
My guess is that it would be impossible to use the table size in Sweave, only mildly non-trivial in knitr with a proper hook. The easiest hack in either of them would be to manually open the png device, and use cat() with \includegraphics{} where you want the plot diplayed. HTH, b. On 26 May 201

Re: [R] sweave tables as images?

2012-05-25 Thread Alexander Shenkin
this works - thanks baptiste! i'm working in Sweave right now - perhaps it will be tough in knitr as you mention. On 5/25/2012 4:31 PM, baptiste auguie wrote: > you can open a device that has the exact dimensions of the table, > > g = tableGrob(head(iris, 4)) > png("test.png", width=convertWidth

Re: [R] sweave tables as images?

2012-05-25 Thread baptiste auguie
you can open a device that has the exact dimensions of the table, g = tableGrob(head(iris, 4)) png("test.png", width=convertWidth(grobWidth(g), "in", value=TRUE), height=convertHeight(grobHeight(g), "in", value=TRUE),units="in", res=150) grid.draw(g) dev.off() Doing this with knitr might

Re: [R] applying cbind (or any function) across all components in a list

2012-05-25 Thread Hans Thompson
Thank you everyone for working through the confusion from me posting from Nabble and missing context. Both Rui's and David's solutions are working for my problem. Rui's first interpretation is the application I was looking for but I was also more generally interested in how to do the second one i

Re: [R] sweave tables as images?

2012-05-25 Thread Alexander Shenkin
Thanks Yihui, That's a great idea, and comes close to the mark, except that I have to use png's in order to "Insert & Link" them as pictures in Word (and hence make the doc both shareable and update when new figures are generated). thanks, allie On 5/25/2012 2:57 PM, Yihui Xie wrote: > You may t

Re: [R] question about TryCatch and lapply

2012-05-25 Thread Martin Morgan
On 5/25/2012 12:48 PM, John Kerpel wrote: Jim: That's the ticket! I'm actually using parLapply with a long, ugly function - so I was loath to post that mess. Many thanks - you saved my weekend. In the context of tryCatch in your question lst <- list(1, 2, -3, 4) sapply(lst, function(x)

Re: [R] Could "incomplete final line found" be more serious than a warning?

2012-05-25 Thread Michael Bärtl
Dear all, thank you very much for the prompt reply by Professor Dalgaard! Unfortunately, the option he recommended doesn't work for me but still gives me the same error. But when I manually change the encoding of the text file and save it, my script works properly again. So, thanks a lot again!

[R] evaluate whether function returns error

2012-05-25 Thread mdvaan
Hi, The following returns an error message. How do I evaluate (TRUE or FALSE) the function? require(XML) readHTMLTable("http://www.sec.gov/Archives/edgar/data/2969/95012399010952/950123-99-010952.txt";) Thanks in advance! Math -- View this message in context: http://r.789695.n4.nabble

[R] change colors/ symbols of lda plots

2012-05-25 Thread dga...@huskers.unl.edu
Greetings R experts, I am running a simple lda on some simulation data of mine to show an illustration of my multivariate response data, since it is a simulation I have a very large amount of data and the default on plot seems to plot the category names. This is very difficult to interpret even

[R] Selecting with mouse the lines drawn by matplot()

2012-05-25 Thread servet cizmeli
Dear all, I have a dataset of spectral measurements of sunlight. One row for each different observation, one column for each spectral channel. I would like to select the spectral curves drawn with matplot() (I only know matplot() as a way of easily drawing them) with the help of the mouse an

Re: [R] subset columns from list with variable substitution

2012-05-25 Thread MacQueen, Don
The select argument to subset() is supposed to name the columns you want to keep. So is the syntax I gave, table[,list1], and it is the correct way when list1 is a character vector (which it is). Your error message says that at least one of the values in list1 is not the name of a column in your d

Re: [R] Reading a bunch of csv files into R

2012-05-25 Thread Rich Shepard
On Fri, 25 May 2012, HJ YAN wrote: Is there any claver way that I do not have to type in all these hundreds names by hand, maybe using a R package or write some code in some other languages if it is not too difficult to learn. I'd put the list of commands in a shell script; e.g., # import_f

Re: [R] How to remove square brackets, etc. from address strings?

2012-05-25 Thread Sabina Arndt
Hello r-help members, the solutions which Sarah Goslee and arun sent to me in such a prompt and helpful manner work well with the examples I cut from the data.frame I'm analyzing. Thank you very much for that! I incorporated them into my R-script and discovered that it still doesn't work prope

Re: [R] Hash Table - Select and Change Data iniside Matrix

2012-05-25 Thread Bert Gunter
Well... (inline) On Fri, May 25, 2012 at 11:19 AM, arun wrote: > Hi Antony, > > Try this, > da<-read.table(text="NAME    AGE    PLACE > ABC    20  INDIA > XYZ    30  FRANCE > PQR    40  USA > MNO    30   KENYA > DEF    25    AUSTRALIA", header=TRUE,stri

Re: [R] knitr customization

2012-05-25 Thread Yihui Xie
On Fri, May 25, 2012 at 2:30 PM, Giovanni Petris wrote: > > I am trying to transition from Sweave to knitr, but there are a few > things about customization of the appearence of R input and output that > I did not get yet. Maybe somebody on the list can help me. > > In my Sweave presentations I us

Re: [R] sweave tables as images?

2012-05-25 Thread Yihui Xie
You may take a look at knitr's graphics manual which tells you how you can automatically crop the white margins: https://github.com/downloads/yihui/knitr/knitr-graphics.pdf ("Cropping PDF Graphics"). I'm not sure if pdfcrop works in this case, though. Regards, Yihui -- Yihui Xie Phone: 515-294-2

Re: [R] question about TryCatch and lapply

2012-05-25 Thread John Kerpel
Jim: That's the ticket! I'm actually using parLapply with a long, ugly function - so I was loath to post that mess. Many thanks - you saved my weekend. On Fri, May 25, 2012 at 2:23 PM, jim holtman wrote: > Please show us the 'lapply' statement you are using. Here is a simple > case of catchi

Re: [R] subset columns from list with variable substitution

2012-05-25 Thread jween
Thanks Don but table[,list1] did not work either: Error in `[.data.frame`(table, , list1) : undefined columns selected. I'm guessing my list (list1) is not structured right? Displaying it has no commas, so the whole list may be taken as a single variable rather than a sequence of variables? I

Re: [R] sweave tables as images?

2012-05-25 Thread Alexander Shenkin
grid.table() works well, but using it in sweave creates graphics with very wide margins. I'm sure this has something to do with grid, and not just grid.table. Any idea how I can clip the graphic to the edges of the table graphic? I've looked into viewports, etc, but I can't seem to find anything

Re: [R] Reading a bunch of csv files into R

2012-05-25 Thread Rui barradas
Hello, Or maybe put the data frames in a list df.list <- lapply(seq_len(filenames), read.csv, ...) # '...other...' are options you might want to pass, (like headers=TRUE) names(df.list) <- data_names Now access the data frames by number in the list or by name in data_names. Hope this helps,

[R] knitr customization

2012-05-25 Thread Giovanni Petris
I am trying to transition from Sweave to knitr, but there are a few things about customization of the appearence of R input and output that I did not get yet. Maybe somebody on the list can help me. In my Sweave presentations I used a slanted font for the R input and a normal font for the output,

Re: [R] question about TryCatch and lapply

2012-05-25 Thread jim holtman
Please show us the 'lapply' statement you are using. Here is a simple case of catching an error in an lapply and continuing: > lapply(c(1,2,-3, 4), function(x){ + a <- try(stopifnot(x > 0)) # force an error + if (inherits(a, 'try-error')) return(NULL) + x + }) Error : x > 0 is not TR

Re: [R] Reading a bunch of csv files into R

2012-05-25 Thread Nutter, Benjamin
For example: myDir <- "some file path" filenames <- list.files(myDir) filenames <- filenames[grep("[.]csv", filenames)] data_names <- gsub("[.]csv", "", filenames) for(i in 1:length(filenames)) assign(data_names[i], read.csv(file.path(myDir, filenames[i])))   Benjamin Nutter |  Biostatistic

Re: [R] Reading a bunch of csv files into R

2012-05-25 Thread Bryan Hanson
HJ, try something like this: files <- list.files(pattern = "\\.(csv|CSV)$") for (i in 1:length(files)) { temp <- read.csv(files[i], header = FALSE) ... do whatever you want with the contents of temp... } Bryan *** Bryan Hanson Professor of Chemistry & Biochemistry

Re: [R] Breaking up a vector

2012-05-25 Thread Marc Schwartz
Just to throw out another approach to the underlying problem. Since the original vector length is an integer multiple of 7, taking the 'whole object' approach that is intrinsic to R, one can convert the vector to a 7 column matrix and then use apply() to run the entire process on each 7 element

Re: [R] subset columns from list with variable substitution

2012-05-25 Thread MacQueen, Don
Instead of subset(table, select=list1) try table[, list1] However, I suspect you have other problems. Particularly, i is not defined when you use i %in% namelist. You may have wanted i in namelist -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermo

[R] question about TryCatch and lapply

2012-05-25 Thread John Kerpel
Folks: I've replaced an outer for-loop with lapply and it works great. But, I can't seem to do the following type of exception handling: tryCatch(dlmMLE(x)$value==Inf,error = function(e) NULL) which basically says if the likelihood is Inf, throw an error. But what I want it to do is just go to

Re: [R] difference between qnorm and qqnorm

2012-05-25 Thread Duncan Murdoch
On 25/05/2012 12:41 PM, QAMAR MUHAMMAD UZAIR wrote: dear all, it will just take you a minute to tell me the difference between qnorm and qqnorm. are they same or is there any difference between them?? They are very different, qqnorm draws a plot, qnorm does a calculation of some of the values

Re: [R] Hash Table - Select and Change Data iniside Matrix

2012-05-25 Thread arun
Hi Antony, Try this, da<-read.table(text="NAME    AGE    PLACE    ABC    20  INDIA XYZ    30  FRANCE PQR    40  USA MNO    30   KENYA DEF    25    AUSTRALIA", header=TRUE,stringsAsFactors=FALSE) > da2<-function(x){  if(x==30)  TRUE  else  FALSE  } da3<

Re: [R] Reading a bunch of csv files into R

2012-05-25 Thread Kevin Wright
See ?dir Assign the value to a vector and loop over the elements of the vector. Kevin On Fri, May 25, 2012 at 12:16 PM, HJ YAN wrote: > Dear R users > > > I am struggling from a data importing issue: > > I have some hundreds of csv files needed to be read into R for futher > analysis. All thos

[R] How to change width of bar when there are very few bars?

2012-05-25 Thread Manish Gupta
http://r.789695.n4.nabble.com/file/n4631371/Bar_Chart.png How to control width of bar chart when there are very few bars in plot? Regards -- View this message in context: http://r.789695.n4.nabble.com/How-to-change-width-of-bar-when-there-are-very-few-bars-tp4631371.html Sent from the R hel

Re: [R] Breaking up a vector

2012-05-25 Thread AOLeary
Thank you very much, I will be more careful in future. -- View this message in context: http://r.789695.n4.nabble.com/Breaking-up-a-vector-tp4631329p4631369.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing l

[R] Reading a bunch of csv files into R

2012-05-25 Thread HJ YAN
Dear R users I am struggling from a data importing issue: I have some hundreds of csv files needed to be read into R for futher analysis. All those csv files are named in one of the three formats: (1) strings: e.g. London_Oxford street (2) Integer: e.g. 1234_5678 (3) combined: e.g. London_1234

Re: [R] Java problem - XLConnect/xlsx package

2012-05-25 Thread Martin Studer
Hi Rainer, Looking at your sessionInfo() it looks like you are using 32-bit R on 64-bit Windows 7. My guess is that the installed JVM is 64-bit. This leads to an architecture clash between R and Java. It is important to make sure that the architectures of R and the JVM match, i.e. either both are

[R] difference between qnorm and qqnorm

2012-05-25 Thread QAMAR MUHAMMAD UZAIR
dear all, it will just take you a minute to tell me the difference between qnorm and qqnorm. are they same or is there any difference between them?? regards __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do r

Re: [R] applying cbind (or any function) across all components in a list

2012-05-25 Thread Rui Barradas
Hello, Let me give it a try. This last post made it clear, I hope. I have two interpretations of your problem. 1. 'l1' only has three columns, corresponding to clusters (genotypes) XX, XY and YY, and 'l2' has one less column, corresponding to the midpoints between their closest genotype clus

Re: [R] Problem sourcing file

2012-05-25 Thread Jeff Newmiller
Ah, my default font makes that distinction too subtle. Action item for me, then, to change fonts. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go..

Re: [R] Multiple cbind according to filename

2012-05-25 Thread Rui Barradas
Hello, You can split the filenames vector according to a pattern, filenames <- c("a1.csv", "a2.csv", "b1.csv", "b2.csv", "c1.csv", "c2.csv") fnpattern <- gsub("[[:digit:]]", "", filenames) df.groups <- split(filenames, fnpattern) and then use this list to process each of the groups of data.frame

[R] subset columns from list with variable substitution

2012-05-25 Thread jween
Hi there, I would like to use a list variable to select columns in a subset from a parent table: I have a data frame "table" with column headers a,b,c,d,e,x,y,z and list variables list1=c("a","b","c","d") list2=c("a","b","x",y","z") namelist=c("peter","paul","mary","jane") group1=c("peter","paul

Re: [R] Breaking up a vector

2012-05-25 Thread Rui Barradas
Hello, Tip: see the difference between the following two. for(i in 1:7) cat(i, ":", (i-1)*7:(i)*7, "\n") for(i in 1:7) cat(i, ":", ((i-1)*7):(i*7), "\n") (operator ':' has high precedence...) Hope this helps, Rui Barradas AOLeary wrote > > Hi all, > > My problem is as foll

Re: [R] Multiple cbind according to filename

2012-05-25 Thread Ken
Matthew Ouellette gmail.com> writes: > > Hi all, > > I'm just a beginner with R but I have not been able to search for any > relevant answer to my problem. I apologize if it has in fact been asked > before. > > Recently I've realized that I need to combine hundreds of pairs of data > frames.

Re: [R] Issues while using “lift.chart” and “adjProbScore” function from ”BCA” library

2012-05-25 Thread Uwe Ligges
Please talk to the maintainer of the BCA *package* in order to report bugs. Uwe Ligges On 24.05.2012 06:31, aajit75 wrote: Dear List, Couple of issues while using functions from “BCA” library: 1. I am trying to use “lift.chart” function from “BCA” library, but facing issues while using model

Re: [R] Problem sourcing file

2012-05-25 Thread Uwe Ligges
On 25.05.2012 20:17, Jeff Newmiller wrote: What isn't proper about single quotes? Those were *directed* quotes. Uwe Ligges --- Jeff NewmillerThe . . Go Live... DCN:

Re: [R] Problem sourcing file

2012-05-25 Thread Duncan Murdoch
On 25/05/2012 2:17 PM, Jeff Newmiller wrote: What isn't proper about single quotes? They look like directional quotes to me. Might just be the mailer... Duncan Murdoch --- Jeff NewmillerThe ..

Re: [R] Problem sourcing file

2012-05-25 Thread Jeff Newmiller
What isn't proper about single quotes? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead:

Re: [R] Filling NA with cumprod?

2012-05-25 Thread Igor Reznikovsky
This is a nice trick, Jeff, thank you. I think this is what I was looking for. Thank you all. On May 25, 2012 12:18 PM, "Jeff Newmiller" wrote: > This calls for a trick I have seen before on this list. Once you > understand it, you will be able to apply it to many similar problems. > The key i

Re: [R] R does not recognise columns and rows as they are supposed to be

2012-05-25 Thread Jonsson
I tried to read only one file and get some information but this is what I got: sam=file("C:\\Users\\2001\\SWdown_200101_01.img", "rb") file1<- readBin(sam, double(),size=4, n=360*720) file.info(file1)$size Error in file.info(file1) : invalid filename argument dim(file1) NULL -- View this mes

Re: [R] count number of groups

2012-05-25 Thread Charles Determan Jr
That works perfectly, thank you very much Michael, Sincere regards, Charles On Fri, May 25, 2012 at 11:59 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > You'll have to be a little trickier if you want it to be smart and > pick up the name: [or I'm missing something obvious] > > y

Re: [R] Problem with Autocorrelation and GLS Regression

2012-05-25 Thread Mark Leeds
Hi: Thanks for the correction and reference. Eric uses monthly returns in the example in his book and I would think that using daily data would result in very unstable betas but I've been wrong before. Hopefully others can comment. Mark On Fri, May 25, 2012 at 12:44 PM, and_mue wrote: > Fo

Re: [R] Problem sourcing file

2012-05-25 Thread Duncan Murdoch
On 25/05/2012 10:08 AM, Marta Tolós wrote: Hi all, I created a file to define some functions. When I try to source this file, sometimes it works but sometimes I get the following error: >Source(‘File.R’) Those aren't proper quotes, and source() shouldn't be capitalized, and you didn't te

[R] Query about creating time sequences

2012-05-25 Thread Shivam
Hi All, I have a query about time based sequences. I know such questions have been asked a lot on forums, but I couldnt find the exact thing that I was looking for. I want to create a time-based sequence which will mimic the trading window AND would span multiple days. Something like below: "201

Re: [R] count number of groups

2012-05-25 Thread William Dunlap
You did: > >> ID=c(1,1,1,1,2,2,2,2,3,3,3,3) > >> as.data.frame(ID) and I infer that you want the number of groups in each column of the data.frame. First, make an example of your data.frame D <- data.frame(ID, Name=rep(state.name[1:7],len=length(ID))) (note I use data.frame, not as.data.frame,

Re: [R] Problem sourcing file

2012-05-25 Thread Jeff Newmiller
It does not have anything to do with the sourcing. Rather, it lies in the code that is in your File.R, which is not given here. --- Jeff NewmillerThe . . Go Live... DCN:Basics

Re: [R] count number of groups

2012-05-25 Thread R. Michael Weylandt
You'll have to be a little trickier if you want it to be smart and pick up the name: [or I'm missing something obvious] yourFunc <- function(x){ dsx <- deparse(substitute(x)) x <- length(unique(x)) names(x) <- dsx x } yourFunc(ID) yourFunc(ID^2) yourFunc(ID[ID==2]) etc. Hope this

Re: [R] count number of groups

2012-05-25 Thread Charles Determan Jr
That works if I want a count of each group but I needed a count of the number of groups. Michael answered that question with length(unique(ID)) However, this doesn't supply a title, it is just a number. I need it to still have the identifier 'ID'. Regards, Charles On Fri, May 25, 2012 at 11:50

Re: [R] Problem with Autocorrelation and GLS Regression

2012-05-25 Thread and_mue
For the analysis I follow the approach of Keown & Pinkerton ( http://e-m-h.org/KePi81.pdf http://e-m-h.org/KePi81.pdf ). They do also use daily data to compute alphas and betas of the market model. These estimated coefficients are then used to estimate abnormal returns for a given period. market

Re: [R] count number of groups

2012-05-25 Thread Charles Determan Jr
Thank you Michael, However, this only provides the number of groups without a column label. Is there a way to have it give the count with the 'ID' label? Regards, Charles On Fri, May 25, 2012 at 10:52 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > length(unique(ID)) > > Michael

Re: [R] R does not recognise columns and rows as they are supposed to be

2012-05-25 Thread Jonsson
The trick may be behind not reading the files properly is that all my 365 files donot have the same name. for example: files from number 1 to number9 are named for the first month: SWdown_200101_01.img SWdown_200101_09.img files from number 10 to number30 are named: SWdown_200101_10.i

Re: [R] R does not recognise columns and rows as they are supposed to be

2012-05-25 Thread William Dunlap
In the absence of documentation for the file format, what="double",size=4,endian="little" would be a good guess. Many problems people report on this list are due to errors in reading data into R. Converting data from one format to another is always error-prone and you need to check that the conv

Re: [R] Problem with Autocorrelation and GLS Regression

2012-05-25 Thread Mark Leeds
Hi: I don't have time to look at it carefully but, at a glance, you're not getting a significant ror_spi_resn coeffficent so worrying about residuals being auto-correlated is jumping the gun because you're not really filtering anything in the first place. when you say, "market model", I don't know

Re: [R] Filling NA with cumprod?

2012-05-25 Thread Jeff Newmiller
This calls for a trick I have seen before on this list. Once you understand it, you will be able to apply it to many similar problems. The key is the "ave" function, which applies a function to various groups of values in a vector. a <- c(1, 2, 3, NA, NA, 6, 7, NA, NA, 10) f <- c(0.9, 1.1, 0.9

Re: [R] Breaking up a vector

2012-05-25 Thread jim holtman
Learn how to put parentheses in expression when you do not know what the operator precedence is: z <- lx[(1+(i-1)*7):((i)*7)] On Fri, May 25, 2012 at 11:29 AM, AOLeary wrote: > Hi all, > > My problem is as follows: > > I want to run a loop which calculates two values and stores them in vec

Re: [R] Correlograms: using boxes and different variables on rows and columns

2012-05-25 Thread Kevin Wright
In general, when you have a question about a package, it is best to contact the package author directly. (In this case, me). 1. Easy. You just have to define your own panel function. I just modified panel.shade to create panel.bar panel.bar <- function(x, y, corr=NULL, ...){ usr <- par()$us

Re: [R] R does not recognise columns and rows as they are supposed to be

2012-05-25 Thread Jonsson
Yes I did so. Yes the first values are the right ones: - -. so this meant that I should consider my data as: double/4/little Is it so? file <- "C:\\Users\\aalyaari\\Documents\\INRA\\WFD_reprocessed\\dialyswco\\2001\\SWdown_200101_01.img" > for(what in c("double", "integer")) { + f

Re: [R] count number of groups

2012-05-25 Thread andrija djurovic
Hi. try using table function: > ID=c(1,1,1,1,2,2,2,2,3,3,3,3) > table(IF) ID 1 2 3 4 4 4 Also check ?tapply function Andrija On Fri, May 25, 2012 at 5:38 PM, Charles Determan Jr wrote: > Hello, > > Simple question that I am stuck on and can't seem to find an answer in the > help files current

Re: [R] count number of groups

2012-05-25 Thread R. Michael Weylandt
length(unique(ID)) Michael On Fri, May 25, 2012 at 11:38 AM, Charles Determan Jr wrote: > Hello, > > Simple question that I am stuck on and can't seem to find an answer in the > help files currently.  I have a list which contains repeated ID's.  I would > like to have R count the number of ID's.

Re: [R] Rolling Sample VAR

2012-05-25 Thread andrija djurovic
Hi. rollapply function for zoo package could be a useful here. library(zoo) ?rollapply Andrija On Fri, May 25, 2012 at 5:22 PM, bantex wrote: > hi guys, > > I am using trivariate VAR model to get 10 step ahead orthogonalized impulse > response functions. I want to use rolling sample analysis

Re: [R] Problem sourcing file

2012-05-25 Thread arun
Hi, Try source("File.R") A.K. - Original Message - From: Marta Tolós To: r-help@r-project.org Cc: Sent: Friday, May 25, 2012 10:08 AM Subject: [R] Problem sourcing file Hi all, I created a file to define some functions. When I try to source this file, sometimes it works but someti

[R] Breaking up a vector

2012-05-25 Thread AOLeary
Hi all, My problem is as follows: I want to run a loop which calculates two values and stores them in vectors r and rv, respectively. They're calculated from some vector x with length a multiple of 7. x <- c(1:2058) I need to difference the values but it would be incorrect to difference it all

[R] Problem with Autocorrelation and GLS Regression

2012-05-25 Thread and_mue
Hi, I have a problem with a regression I try to run. I did an estimation of the market model with daily data. You can see to output below: /> summary(regression_resn) Time series regression with "ts" data: Start = -150, End = -26 Call: dynlm(formula = ror_resn ~ ror_spi_resn) Residuals: M

Re: [R] Problem sourcing file

2012-05-25 Thread jim holtman
Is the file just definitions of functions, or do you have some statements that are being executed? Could the error be coming from them? Just defining functions should work just fine. On Fri, May 25, 2012 at 10:08 AM, Marta Tolós wrote: > Hi all, > > > > I created a file to define some functio

[R] count number of groups

2012-05-25 Thread Charles Determan Jr
Hello, Simple question that I am stuck on and can't seem to find an answer in the help files currently. I have a list which contains repeated ID's. I would like to have R count the number of ID's. For example: ID=c(1,1,1,1,2,2,2,2,3,3,3,3) as.data.frame(ID) Clearly, there are 3 groups. How w

[R] Rolling Sample VAR

2012-05-25 Thread bantex
hi guys, I am using trivariate VAR model to get 10 step ahead orthogonalized impulse response functions. I want to use rolling sample analysis on the coefficients of the irf but I have no idea how to do that. I looked through the forums but I can't seem to find any solutions. Any suggestions wou

Re: [R] R memory allocation

2012-05-25 Thread Martin Morgan
On 05/25/2012 06:29 AM, swaraj basu wrote: Dear All, I am running R in a system with the following configuration *Processor: Intel(R) Xeon(R) CPU X5650 @ 2.67GHz OS: Ubuntu X86_64 10.10 RAM: 24 GB* The R session info is * R version 2.14.1 (2011-12-22) Platform: x86_64-pc-linux-gnu (

[R] qnorm to a list

2012-05-25 Thread QAMAR MUHAMMAD UZAIR
dear jim, thakyou very much for your help. i would really appreciate if you give me one more favor. i want to apply qnorm to the whole coulmn so that i would have on the x-axis the quantile of the lognormal distribution (qnorm()) with zero-mean and unit-variance, corresponding to excedence

Re: [R] Basic help

2012-05-25 Thread Rui Barradas
Hello, First of all, 'c' is a bad name for a variable, it's also the name of an R function. Think a, b, k, d, ... Now, try y <- m %o% x + k Hope this helps, Rui Barradas Em 24-05-2012, 2:07, Abhay Joshi

Re: [R] Hash Table - Select and Change Data iniside Matrix

2012-05-25 Thread Rantony
Thank you Michael. You are awesome…. It works, what I mean. Thank you very much. - Antony. From: Michael Weylandt [via R] [mailto:ml-node+s789695n4631319...@n4.nabble.com] Sent: Friday, May 25, 2012 7:48 PM To: Akkara, Antony (GE Energy, Non-GE) Subject: Re: Hash Table - Sel

[R] Problem sourcing file

2012-05-25 Thread Marta Tolós
Hi all, I created a file to define some functions. When I try to source this file, sometimes it works but sometimes I get the following error: >Source(‘File.R’) Error in srcfilecopy(filename, lines, file.info(filename)[1, "mtime"]) : unused argument(s) (file.info(filename)[1, "mtime

[R] [snowFT] Problems with passing arguments to performParallel

2012-05-25 Thread Marta Tolós
Hi all, I am trying to use performParallel from the snowFT package. But I have a really hard time to be able to pass arguments to the function that I want to run in parallel. Since I could not pass the arguments I create a XML file to read the information from there, the problem is that I can

[R] Multiple rms summary plots in a single device

2012-05-25 Thread Mike Harwood
I would like to incorporate multiple summary plots from the rms package into a single device and to control the titles, and also to open a new device when I reach a specified number of plots. Currently I am only getting a single "plot(summary(" graph in the upper left- hand corner of each successi

Re: [R] R does not recognise columns and rows as they are supposed to be

2012-05-25 Thread William Dunlap
Is the file format documented? If not you can search for a possible format if you know the values at the start of the file. For one of your files, show the results of the following: file <- "your filename here" for(what in c("double", "integer")) { for(size in c(4, 8)) { for(end

Re: [R] Breakpoint in logistic GLM with 'segmented' package - error: replacement length zero

2012-05-25 Thread Vito Muggeo (UniPa)
dear Peter, Your code appears correct, so it is difficult to reply without the data.. If you are interested in further details, please contact me off-list vito Il 25/05/2012 15.34, Peter Hoitinga ha scritto: Hello all, I've been having trouble with assessing a breakpoint in a logistic GLM wi

Re: [R] problem with installing rms package

2012-05-25 Thread Marc Schwartz
Hi, First, please be sure to "reply-all" when following up so that the thread stays on the public list. The messages suggest that you might not have 'root' access when installing the packages, so the installation of the packages to the default location fails. You need to 'su' to root via the c

Re: [R] Filling NA with cumprod?

2012-05-25 Thread David L Carlson
This will loop only as many times as the largest number of consecutive NA's but uses vectorization within the loop. As currently defined, it will loop forever if the first value is NA. a <- c(1, 2, 3, NA, NA, 6, 7, NA, NA, 10) f <- c(0.9, 1.1, 0.9, 1.1, 0.9, 1.1, 0.9, 1.1, 0.9, 1.1) a1 <- a alag

Re: [R] Multiple cbind according to filename

2012-05-25 Thread Ken
Matthew Ouellette gmail.com> writes: > > Hi all, > > I'm just a beginner with R but I have not been able to search for any > relevant answer to my problem. I apologize if it has in fact been asked > before. > > Recently I've realized that I need to combine hundreds of pairs of data > frames.

Re: [R] applying cbind (or any function) across all components in a list

2012-05-25 Thread David L Carlson
This should give you what you want and it is simpler than the earlier version: a1<- array(1:6, dim=c(2,3)) a2<- array(7:12, dim=c(2,3)) l1<- list(a1,a2) a3<- array(1:4, dim=c(2,2)) a4<- array(5:8, dim=c(2,2)) l2<- list(a3,a4) pattern <- cbind(c(1, 2, 2, 3), c(1, 1, 2, 2)) lnew <- lapply(1:

Re: [R] Hash Table - Select and Change Data iniside Matrix

2012-05-25 Thread Jeff Newmiller
Read help for the ifelse function. Type ?ifelse at the command line. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

  1   2   >