Re: [R] Handling of factors

2009-01-21 Thread Thomas Lumley
On Tue, 20 Jan 2009, Stavros Macrakis wrote: I'm rather confused by the semantics of factors. snip actual confusion It is all very confusing. Of course, most of this behavior is documented and is easily determined by experimentation, but it would be easier to learn and teach the language

[R] merging several dataframes from a list

2009-01-21 Thread Antje
Hi there, I have a list of dataframes (generated by reading multiple files) and all dataframes are comparable in dimension and column names. They also have a common column, which, I'd like to use for merging. To give a simple example of what I have: df1 - data.frame(c(LETTERS[1:5]),

Re: [R] Handling of factors

2009-01-21 Thread Thomas Lumley
As a follow-up, I don't see any reason why rle() shouldn't work on factors. There's no ambiguity about what the result should be, and the current implementation in rle() would work on factors if they could get past the pre-test. -thomas On Wed, 21 Jan 2009, Thomas Lumley wrote: On

[R] Can I add a point to a pointsGrob from an xyplot without redrawing ?

2009-01-21 Thread Daniel Kornhauser
Hi: I am a newbie using grid and lattice. I want to update a xyplot without redrawing and I was wondering if there is a way of adding a point to a pointsGrob ? For example, take the example from the R Graphics Book page 218-219: grid.newpage() angle - seq(0, 2*pi, length=21)[-21] x - cos(angle)

Re: [R] merging several dataframes from a list

2009-01-21 Thread Gabor Grothendieck
What version of R are you using? I get this: do.call(cbind, mylist) df1.pos df1.data df2.pos df2.data df3.pos df3.data 1 A2 A6 A9 2 B6 B2 B3 3 C3 C9 C6 4 D

Re: [R] merging several dataframes from a list

2009-01-21 Thread Antje
Gabor Grothendieck schrieb: What version of R are you using? R version 2.8.1 (2008-12-22) (running Windows) I get this: do.call(cbind, mylist) df1.pos df1.data df2.pos df2.data df3.pos df3.data 1 A2 A6 A9 2 B6 B2

Re: [R] Can I add a point to a pointsGrob from an xyplot without redrawing ?

2009-01-21 Thread Mark Difford
Hi Daniel, Is there a way I can add a point to pg (or GRID.points.755) to update the xyplot without redrawing all the points ? I think you want to look at ?grid.edit to do this. grid.edit(yourGROB, redraw = FALSE) HTH, Mark. Daniel Kornhauser-3 wrote: Hi: I am a newbie using grid

[R] using time series

2009-01-21 Thread Yana Mileva
Hello, I'm trying to analyze the behavior of a series of numbers. Let's say I have the following data: 0 0 0 20 20 20 50 50 53 56 23 24 21 10 0 4 129 159 30 0 0 0 (for example) - these numbers are some measurements that are taken on equal interval of times (but the specific moment in time (e.g.

Re: [R] using time series

2009-01-21 Thread Gabor Grothendieck
Try: library(forecast) plot(forecast(auto.arima(x))) On Wed, Jan 21, 2009 at 4:01 AM, Yana Mileva yanamil...@googlemail.com wrote: Hello, I'm trying to analyze the behavior of a series of numbers. Let's say I have the following data: 0 0 0 20 20 20 50 50 53 56 23 24 21 10 0 4 129 159 30 0 0

[R] Vector Autocorrelation Function in R?

2009-01-21 Thread Andreas Klein
Hello. Does anyone know, if there is a function in R to compute the vector autocorrelations? Thank you in advance. Regards, Andreas. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] Looking for a special date function in R

2009-01-21 Thread Sergey Goriatchev
Hello, everyone I wonder if R has something similar to Excel function EDATE(start_date; months) which returns a serial number of the date that is the indicated number of months before of after the start date. Example (the second column EDATE(first_column; -6)): 01.01.1999 01.07.1998

Re: [R] Looking for a special date function in R

2009-01-21 Thread Gabor Grothendieck
See ?julian julian(Sys.Date(), Sys.Date() - 10) # 10 [1] 10 attr(,origin) [1] 2009-01-11 and R News 4/1. On Wed, Jan 21, 2009 at 4:37 AM, Sergey Goriatchev serg...@gmail.com wrote: Hello, everyone I wonder if R has something similar to Excel function EDATE(start_date; months) which returns

Re: [R] Text Outside Lattice Plot

2009-01-21 Thread Richard . Cotton
I created the graph at the bottom using xyplot in the lattice package. I added a title using the main=Title command in xyplot, however it is plotted too close to the legend for my liking. To remedy this I increased the upper margin of the plot using plot(data, position = c(0,0,1,.9)) and

[R] Odp: problem with rbind

2009-01-21 Thread Petr PIKAL
Hi data-read.table(data.txt, header=T, sep='\t') Error in file(file, r) : cannot open the connection In addition: Warning message: In file(file, r) : cannot open file 'data.txt': No such file or directory gives me an error so it is not possible to reproduce your function. However it looks

[R] Odp: problem with writing data to *.xls file

2009-01-21 Thread Petr PIKAL
Hi It depends if you have Excel available write.excel-function(tab, ...) write.table( tab, clipboard, sep=\t, row.names=F) this function I use for copying object through clipboard to opened Excel file. just write.excel(someobject) open excel list Ctrl-V puts an object into a list. Regards

[R] R and Xcode Editor

2009-01-21 Thread Gregor Reich
Hi From the R for OS X FAQ page: (http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html ) 4.4.6 Editor (internal and external): Using AppleScript it is easy to implement Command-E and Command-Return like functionality. How? Regards, Gregor. __

[R] Function able to identify the row and the column in a matrix

2009-01-21 Thread enrico.fosco...@libero.it
Good morning to all, I should evaluate a function for every cell of a given matrix with n rows and n columns. This function, named fun(), has got two arguments: the number of the row and the number of the column which characterized every single cell. So the result should be fun(1,1)

[R] Odp: Function able to identify the row and the column in a matrix

2009-01-21 Thread Petr PIKAL
Hi ?outer regards Petr r-help-boun...@r-project.org napsal dne 21.01.2009 11:47:03: Good morning to all, I should evaluate a function for every cell of a given matrix with n rows and n columns. This function, named fun(), has got two arguments: the number of the row and the number

Re: [R] Predictions with GAM

2009-01-21 Thread Simon Wood
Here's a simulated example (although really for this model structure, one might as well fit seperate models for each factor level). ## Simulate some data with factor dependent smooths n - 400 x - runif(n, 0, 1) f1 - 2 * sin(pi * x) f2 - exp(2 * x) - 3.75887 f3 - 0.2 * x^11 * (10 * (1 - x))^6 +

[R] Function able to identify the row and the column in a matrix

2009-01-21 Thread enrico.fosco...@libero.it
Good morning to all, I should evaluate a function for every cell of a given matrix with n rows and n columns. This function, named fun(), has got two arguments: the number of the row and the number of the column which characterized every single cell. So the result should be fun(1,1)

Re: [R] Looking for a special date function in R

2009-01-21 Thread Sergey Goriatchev
Dear Gabor, Thanks for that! Still, it is not really similar to how EDATE works. With julian(Sys.Date(), Sys.Date() - 10) one moves 10 days back. The problem is that I need to move by months, not by days, as months have different number of days. I need to come to the same day when I move

Re: [R] Problem with cyrillic in postscript

2009-01-21 Thread Prof Brian Ripley
1) Please update your R as requested in the posting guide, and provide the 'at a mimimum' information requested. 2) Try reading ?postscript and setting the encoding: I suspect yours is not one of the cases that are guessed correctly. 3) If all else fails, give a 'commented, minimal,

[R] Help Regarding STL Technique

2009-01-21 Thread Kishore
Team, I have a time series data with lot of seasonality and trends. I am familiar with some forecasting techniques, but for this set, I believe STL would be the best. Please let me know any tips to use STL using R. Best, Kishore [[alternative HTML version deleted]]

Re: [R] Looking for a special date function in R

2009-01-21 Thread Prof Brian Ripley
On Wed, 21 Jan 2009, Sergey Goriatchev wrote: Dear Gabor, Thanks for that! Still, it is not really similar to how EDATE works. With julian(Sys.Date(), Sys.Date() - 10) one moves 10 days back. The problem is that I need to move by months, not by days, as months have different number of days. I

[R] Odp: R: Odp: Function able to identify the row and the column in a matrix

2009-01-21 Thread Petr PIKAL
enrico.fosco...@libero.it enrico.fosco...@libero.it napsal dne 21.01.2009 11:54:49: I can't use the function outer because my function fun() doesn't take vectors as arguments. If you can not R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Looking for a special date function in R

2009-01-21 Thread Sergey Goriatchev
Dear Prof. Ripley, Thank you for help. Yes, that is an interesting question you pose. I already thought myself how February should be handled, as EDATE(31.08.2008; -6) returns 29.02.2008. In Excel it is not a problem, since this nonexisting date is then used in VLOOKUP function where one can have

Re: [R] Looking for a special date function in R

2009-01-21 Thread Prof Brian Ripley
On Wed, 21 Jan 2009, Sergey Goriatchev wrote: Dear Prof. Ripley, Thank you for help. Yes, that is an interesting question you pose. I already thought myself how February should be handled, as EDATE(31.08.2008; -6) returns 29.02.2008. In Excel it is not a problem, since this nonexisting date is

Re: [R] Handling of factors

2009-01-21 Thread Peter Dalgaard
Thomas Lumley wrote: On Tue, 20 Jan 2009, Stavros Macrakis wrote: I'm rather confused by the semantics of factors. snip actual confusion It is all very confusing. Of course, most of this behavior is documented and is easily determined by experimentation, but it would be easier to learn

Re: [R] Looking for a special date function in R

2009-01-21 Thread Gabor Grothendieck
This will give you 6 months after today. Use negative numbers to move backwards: d - Sys.Date() seq(d, length = 2, by = paste(6, months))[2] [1] 2009-07-21 On Wed, Jan 21, 2009 at 6:27 AM, Sergey Goriatchev serg...@gmail.com wrote: Dear Gabor, Thanks for that! Still, it is not really

Re: [R] A question on histogram (hist): coordinates on x-axis are too sparse

2009-01-21 Thread Duncan Murdoch
Li, Hua wrote: Dear R helpers: Let's say I have some data X, X - runif(1000, 1, 100) pdf('X.pdf', width=100,height=5) hist(X, breaks=1000) dev.off() I find that, on x-axis the coordinates are 0e+00, 2e+09, 4e+09, 6e+09, 8e+09, 1e+10. Only five

Re: [R] merging several dataframes from a list

2009-01-21 Thread Henrique Dallazuanna
Try this also: cbind(pos = mylist$df1$pos, data.frame(mylist)[grep(data, names(data.frame(mylist)))]) On Wed, Jan 21, 2009 at 6:19 AM, Antje niederlein-rs...@yahoo.de wrote: Hi there, I have a list of dataframes (generated by reading multiple files) and all dataframes are comparable in

Re: [R] Sweave: conflict between setwd and \SweaveOpts{prefix.string=}

2009-01-21 Thread Matthieu Stigler
Have you tried specifying an absolute path in prefix.string instead of a relative one? HTH, Thierry Good point! This actually solves the problem, I just wanted to avoid this as I wanted to send it to someone else... so I just reordered the files and it works. Solutions given by

Re: [R] merging several dataframes from a list

2009-01-21 Thread Antje
Henrique Dallazuanna schrieb: Try this also: cbind(pos = mylist$df1$pos, data.frame(mylist)[grep(data, names(data.frame(mylist)))]) Hi Henrique, cool solution - that's seems to be the easiest way! though I thought there should be some possibiliy of multiple merge Anyway, this will do it

Re: [R] merging several dataframes from a list

2009-01-21 Thread Henrique Dallazuanna
Hi Antje, Try this: merge(merge(mylist[[1]], mylist[[2]], by = pos), mylist[[3]]) On Wed, Jan 21, 2009 at 11:19 AM, Antje niederlein-rs...@yahoo.de wrote: Henrique Dallazuanna schrieb: Try this also: cbind(pos = mylist$df1$pos, data.frame(mylist)[grep(data, names(data.frame(mylist)))])

Re: [R] merging several dataframes from a list

2009-01-21 Thread Gabor Grothendieck
merge.zoo can do a multiple merge. We create a list of zoo objects, mylist.z, and then perform the merge: library(zoo) mylist.z - lapply(mylist, function(x) zoo(x$data, as.character(x$pos))) do.call(merge.zoo, mylist.z) df1 df2 df3 A 2 6 9 B 6 2 3 C 3 9 6 D 1 7 2 E

Re: [R] Looking for a special date function in R

2009-01-21 Thread Sergey Goriatchev
Thank you all for your help! Sergey On Wed, Jan 21, 2009 at 13:25, Gabor Grothendieck ggrothendi...@gmail.com wrote: This will give you 6 months after today. Use negative numbers to move backwards: d - Sys.Date() seq(d, length = 2, by = paste(6, months))[2] [1] 2009-07-21 On Wed, Jan

Re: [R] matching more than two vectors (?)- Resolved

2009-01-21 Thread Juliane Struve
Dear Juliet, I found out that the issue of matching more than two vectors can be avoided by pasting vectors into one using paste(). Also, it is not actually necessary for my problem to use match(). I was looking for a method to match points by coordinates, this can be done be using equal

[R] obtaining null components of a list

2009-01-21 Thread diego Diego
Hello everybody! I have a list of length 5000 whose components are (mostly) ts objects, but some these components are intentionally left empty, ie, they are NULL components of the list. My question is how can I get the position of these null components in a effective way (I'm trying to avoid a

[R] Two similar zoo objects with different structures, how to get same structure?

2009-01-21 Thread Sergey Goriatchev
Dear all, I have a zoo object that has following structure: str(bldata) zoo [1:5219, 1:12] 91.9 91.8 91.7 91.8 91.7 ... - attr(*, index)=Classes 'dates', 'times' atomic [1:5219] 7305 7306 7307 7308 7309 ... .. ..- attr(*, format)= chr m/d/y .. ..- attr(*, origin)= Named num [1:3] 1 1

Re: [R] obtaining null components of a list

2009-01-21 Thread jim holtman
Try this: x - list(NULL, 1:10, 25, NULL, more) x [[1]] NULL [[2]] [1] 1 2 3 4 5 6 7 8 9 10 [[3]] [1] 25 [[4]] NULL [[5]] [1] more which(sapply(x, is.null)) [1] 1 4 On Wed, Jan 21, 2009 at 7:42 AM, diego Diego dhab...@gmail.com wrote: Hello everybody! I have a list of

Re: [R] Two similar zoo objects with different structures, how to get same structure?

2009-01-21 Thread Gabor Grothendieck
Please reduce your examples down to small amounts of data and use dput so that they are reproducible. On Wed, Jan 21, 2009 at 9:32 AM, Sergey Goriatchev serg...@gmail.com wrote: Dear all, I have a zoo object that has following structure: str(bldata) zoo [1:5219, 1:12] 91.9 91.8 91.7 91.8

Re: [R] merging several dataframes from a list

2009-01-21 Thread Phil Spector
Another possibility is Reduce: Reduce(function(x,y,by='pos')merge(x,y,by='pos'),mylist) pos data.x data.y data 1 A 2 69 2 B 6 23 3 C 3 96 4 D 1 72 5 E 9 51 - Phil Spector

Re: [R] Predictions with GAM

2009-01-21 Thread Robbert Langenberg
Thanks a lot for all the mails! With all the different examples I now have got it working. The problem finally after I had worked out the newd2 as supplied by Gavin was that I found the plot so strange looking. I have altered my newd2 a bit, and after your e-mails Simon I figured out how to

[R] filling blanks with NA

2009-01-21 Thread kayj
Hi, I do have a data set with some missing values that appear as blanks. I want to fill these blanks with an NA. How can this be done? Thanks for your help -- View this message in context: http://www.nabble.com/filling-blanks-with-NA-tp21584278p21584278.html Sent from the R help mailing list

[R] Linux 64-bit server crashes on large dataset

2009-01-21 Thread Katrine Damgaard
Hello everybody! We have a problem with a linux server that crashes when we try to read large datasets in R. The R code is as followed: komplett - read.spss(komplett2003aar.sav, to.data.frame =TRUE, reencode =Latin1) The information about the linux server is: Linux version 2.6.24-19-generic

[R] timeSeries and aggregation() question

2009-01-21 Thread 00alastair00
Hello, I've a time series, T, for an irregular sequence of days (data for bank holidays weekends have been removed). I would like to aggregate this series by into weeks using aggregate(x, by=weeks, FUN=mean). To do this, I think that x needs to be a timeSeries object, and when I try to call

Re: [R] filling blanks with NA

2009-01-21 Thread K. Elo
Hi, kayj wrote: Hi, I do have a data set with some missing values that appear as blanks. I want to fill these blanks with an NA. How can this be done? Thanks for your help Something like this? my.data-data.frame(var=c(1,2,5,,66,4,3,,67,5,3,2,1,4,32,56,23), stringsAsFactors=F)

[R] Multifractal detrended fluctuation analysis

2009-01-21 Thread James Dixon
Dear R-users, Has anyone written a function for multifractal detrended fluctuation analysis? The fractal package does mono-fractal DFA, but not multifractal as far as I can tell. The MF-DFA approach is presented in: J. W. Kantelhardt, S. Zschiegner, E. Koscielny-Bunde, S. Havlin, A.

[R] forecasting issue

2009-01-21 Thread diego Diego
Hello everybody! I have a problem when I try to perform a forecast of an ARIMA model produced by an auto.arima function. Here is what I'm doing: c-auto.arima(fil[[1]],start.p=0,start.q=0,start.P=0,start.Q=0,stepwise=TRUE,stationary=FALSE,trace=TRUE) # fil[[1]] is time series of monthly data

Re: [R] Predictions with GAM

2009-01-21 Thread Robbert Langenberg
In addition to this, is it in anyway possible to get the variance in the prediction graph as a shade similar to the GAM plots? 2009/1/21 Robbert Langenberg mcre...@gmail.com Thanks a lot for all the mails! With all the different examples I now have got it working. The problem finally after I

Re: [R] filling blanks with NA

2009-01-21 Thread Henrique Dallazuanna
Try this also: is.na(my.data$var) - which(my.data$var == ) On Wed, Jan 21, 2009 at 12:33 PM, kayj kjaj...@yahoo.com wrote: Hi, I do have a data set with some missing values that appear as blanks. I want to fill these blanks with an NA. How can this be done? Thanks for your help --

Re: [R] Two similar zoo objects with different structures, how to get same structure?

2009-01-21 Thread Sergey Goriatchev
Dear Dr. Grothendieck, First of all, I realized I did not load zoo package before I tried the first str(bldata). If I load zoo and then do str(bldata) I get the following: 'zoo' series from 7305 to 14609 Data: num [1:5219, 1:12] 91.9 91.8 91.7 91.8 91.7 ... - attr(*, dimnames)=List of 2 ..$

Re: [R] download/retain text file structure with RCurl/getURL(): Solution

2009-01-21 Thread zack holden
Dear list, I'm posting the solution to my problem in case others may find this useful. This code was sent to me by Phil Spector. With a bit of cleaning, it can easily be converted to a usable format. Thanks to Gabor Grothendieck, David winsemius and Martin Morgan for also sending possible

[R] Error as.Date on Invalid Dates

2009-01-21 Thread Brigid Mooney
Hi All, I have an script in R which accepts user inputs for certain parameters, particularly dates, which the user inputs as character strings. eg: date1 - 2009-01-21 The script later parses the input via the as.Date function: as.Date(date1) However, as.Date encounters an error when the

Re: [R] Two similar zoo objects with different structures, how to get same structure?

2009-01-21 Thread Sergey Goriatchev
Dear Dr. Grothendieck, My purpose in this case it to have the structure of the object on non-Bloomberg machine the same as that of the object on the Bloomberg machine. That way I am sure that whatever code I write away from Bloomberg machine will work on it when I copy the code to it. Also, I am

Re: [R] filling blanks with NA

2009-01-21 Thread Richard . Cotton
I do have a data set with some missing values that appear as blanks. I want to fill these blanks with an NA. How can this be done? Thanks for your help Please help us to help you. What form are the data in? Are they in a text file, or are they in R already? What do you mean by 'blanks'?

[R] cv.glm: delta squared -- squared q

2009-01-21 Thread Markus Mühlbacher
Dear list members, I am using a cross validation of a generalised linear model (glm). The cv.glm function (from boot package) returns an error as so-called „delta“ value. I would like to get to a (cross-validated) squared q, because I want to directly compare it to the squared correlation

[R] should I use rbind in my example?

2009-01-21 Thread SNN
Hi, I need to rbind two data frames. Each one has a header . after the rbind I would like to keep the header for each and have the two data frames separated by a line. Is this possible to do in R? For example weight_meanweight_sd.dev F 14.3 4.932883 M 34.7 10.692677

Re: [R] should I use rbind in my example?

2009-01-21 Thread jim holtman
What do you want to do with it? Is this just for printing out? What other types of transformations are you intending to do? Why not just put them in a 'list' and then write your own specialized print routine. On Wed, Jan 21, 2009 at 10:30 AM, SNN s.nan...@yahoo.com wrote: Hi, I need to

Re: [R] Error as.Date on Invalid Dates

2009-01-21 Thread jim holtman
?try On Wed, Jan 21, 2009 at 10:55 AM, Brigid Mooney bkmoo...@gmail.com wrote: Hi All, I have an script in R which accepts user inputs for certain parameters, particularly dates, which the user inputs as character strings. eg: date1 - 2009-01-21 The script later parses the input via the

Re: [R] Two similar zoo objects with different structures, how to get same structure?

2009-01-21 Thread Gabor Grothendieck
So far we have dput(a). Does that represent what you have? what you want? Can you provide both and a description in words. See the last line to every message to r-help. On Wed, Jan 21, 2009 at 11:13 AM, Sergey Goriatchev serg...@gmail.com wrote: Dear Dr. Grothendieck, My purpose in this case

Re: [R] R and Xcode Editor

2009-01-21 Thread Rob Goedman
Gregor, Section 6.1 of the FAQ provides further examples. It does depend on the editor you are using. Several editors come with add-ons that support R. Recently, on the Mac specific r-sig-mac mailing list ( r-sig-...@stat.math.ethz.ch ), Smultron came up. Regards, Rob On Jan 21, 2009,

[R] seq()

2009-01-21 Thread Felipe Carrillo
HI: Could someone help me with the seq function? I have a range of values starting from 1 to 52 but I want seq to start at 27 by=2, but when it reaches 51 start with with number 1 to 25. is this possible. I can do the basics of seq() but I can't figure how to do this one. This is how I want my

Re: [R] seq()

2009-01-21 Thread Berwin A Turlach
G'day Felipe, On Wed, 21 Jan 2009 09:29:03 -0800 (PST) Felipe Carrillo mazatlanmex...@yahoo.com wrote: Could someone help me with the seq function? I have a range of values starting from 1 to 52 but I want seq to start at 27 by=2, but when it reaches 51 start with with number 1 to 25. is this

Re: [R] seq()

2009-01-21 Thread jim holtman
Is this what you want: x - seq(1, 52, 2) x [1] 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 (x + 26) %% 52 [1] 27 29 31 33 35 37 39 41 43 45 47 49 51 1 3 5 7 9 11 13 15 17 19 21 23 25 On Wed, Jan 21, 2009 at 12:29 PM, Felipe Carrillo

Re: [R] seq()

2009-01-21 Thread Stephan Kolassa
Hi Felipe, concatenate two sequences using c(): c(seq(from=27,to=51,by=2),seq(from=1,to=25,by=2)) HTH, Stephan Felipe Carrillo schrieb: HI: Could someone help me with the seq function? I have a range of values starting from 1 to 52 but I want seq to start at 27 by=2, but when it reaches 51

Re: [R] seq()

2009-01-21 Thread Gavin Simpson
On Wed, 2009-01-21 at 09:29 -0800, Felipe Carrillo wrote: HI: Could someone help me with the seq function? I have a range of values starting from 1 to 52 but I want seq to start at 27 by=2, but when it reaches 51 start with with number 1 to 25. is this possible. I can do the basics of

[R] vegan metaMDS

2009-01-21 Thread Radu Ioviță
Hi, I'm trying to use metaMDS with a dissimilarity matrix of angles, not Bray-Curtis, and I wanted to know if there is an in-built function to produce a plot of stress values against dimensions, that could be used to determine the 'true' dimension of the solution. The number of objects is only a

[R] X matrix deemed to be singular;

2009-01-21 Thread Michele Santacatterina
Hello, i'm tring to use a cox's model for a survival analysis. I have a dataset, this is a part: VOD SESSO fonte_sct donor RT_CGY STATOBMT TEMPO morto 1 0 F midrelated 1200 CP651 2 0 M mid

Re: [R] seq()

2009-01-21 Thread Felipe Carrillo
It works like a charm,thank you all for your help. --- On Wed, 1/21/09, jim holtman jholt...@gmail.com wrote: From: jim holtman jholt...@gmail.com Subject: Re: [R] seq() To: mazatlanmex...@yahoo.com Cc: r-h...@stat.math.ethz.ch Date: Wednesday, January 21, 2009, 9:40 AM Is this what you

Re: [R] heatmap.2 color issue

2009-01-21 Thread Matthias Kohl
the heatmapCol function of package MKmisc might help ... try: library(MKmisc) example(heatmapCol) Best Matthias Liu, Hao [CNTUS] wrote: Dear All: I tried to use heatmap.2 to generate hierarchical clustering using the following command: heatmap.2(datamatrix, scale=row, trace=none,

Re: [R] should I use rbind in my example?

2009-01-21 Thread SNN
Hi, This is just for print out so it looks nice. what I have is a loop that loops over my variables and calculates the mean and the sd for these variables. Then I need to rbind them so I can stack them up in one file. the problem is that only the fist header appears and the rest do not. this is

Re: [R] should I use rbind in my example?

2009-01-21 Thread David Freedman
Are you sure that you want to loop over variables for each subset, and do this within each subset? A simple way to generate summary statistics (across variables and within categories) is the summaryBy function in the doBy package:

[R] finding row and column indices of date in multiple columns of a data frame

2009-01-21 Thread Gonçalo Ferraz
Hi, I have a data.frame SAMPLES with columns: Site Site# Season Day1 Day2 Day3 Day1, Day2, Day3 are class Date, the other columns are numeric or factor. I have a date mydate that may or may not be listed in my data.frame and I need to find that out. If mydate is there, I

Re: [R] finding row and column indices of date in multiple columns of a data frame

2009-01-21 Thread Jorge Ivan Velez
Dear Gonçalo, If DF is your data set, something like this should do the job: which(DF==yourdate,arr.ind=TRUE) # Example Dates-c('01/18/2009','01/19/2009','01/20/2009','01/21/2009') DF-data.frame( +Site=sample(4), + Site#=sample(4), + Season=sample(4), +

[R] Profiling code with lots of 'apply' calls?

2009-01-21 Thread David Reiss
Hi, I have some code with a bunch of apply/sapply/lapply calls to different functions. I am trying to profile it using Rprof, however the resulting summary looks like this (output from 'R CMD Rprof'): % total % self totalseconds selfsecondsname 100.00

[R] plotting activity time intervals

2009-01-21 Thread Martin Tomko
Dear All, I have interval data (for Mon-Sun, 00-24h) of an activity and would like to visually plot them in a matrix-like plot, where color A would be assigned to the activity, and color X to unspecified time usage. Note that the activities are not in standardised units (hours or so), but

[R] Replacing dates with consecutive observations

2009-01-21 Thread Alina Sheyman
I am working with a list of dates and I would like to replace each date with the one that comes after, ie. 1/1/07 will become 1/5/07, 1/5/07 will become 1/7/07, etc. The number of days between my dates always varies, so I can't just increase each one by 5 days or so. Does anyone know of a way I

Re: [R] Problem with FAME

2009-01-21 Thread Jeffrey J. Hallman
My bad. I used system(test -r blah) to see if a file was readable, forgetting that not all Windows installations have the test program (from Cygwin) installed. I've changed this to use the R function file.access() in version 2.5, which I've just submitted to CRAN. The Windows binary should be

[R] Normality Test and T-Test

2009-01-21 Thread Ferry
Hello R Users, Suppose I have data with the structure below: Group_Name Pre_Test Post_Test Grp_A xxx xxx Grp_A xxx xxx Grp_A xxx xxx ... Grp_B xxx xxx Grp_B xxx xxx ... Grp_Z

[R] X matrix deemed to be singular;

2009-01-21 Thread Michele Santacatterina
Hello, i'm tring to use a cox's model for a survival analysis. I have a dataset, this is a part: VOD SESSO fonte_sct donor RT_CGY STATOBMT TEMPO morto 1 0 F midrelated 1200 CP651 2 0 M mid

[R] getting caller's environment

2009-01-21 Thread Yi Zhang
Hello, I'm writing a function like this: f-function(x,y,...) { ... assign(x,y,envir=?) } I need the caller (of f) 's environment for the ? so that the assignment is done at the right place. To be specific, when the code f(x,1) appears in environment A, I need the assignment of 1 to x happen in

[R] Does anyone has this paper in pdf?

2009-01-21 Thread aiminy
de Jong, S. (1993) SIMPLS: an alternative approach to partial least squares regression. Chemometrics and Intelligent Laboratory Systems, 18, 251–263 Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] getting caller's environment

2009-01-21 Thread Gabor Grothendieck
Try this: f - function(env = parent.frame()) env$x g - function(x=1) f() x - 2 g() # 1 On Wed, Jan 21, 2009 at 5:45 PM, Yi Zhang yizhan...@gmail.com wrote: Hello, I'm writing a function like this: f-function(x,y,...) { ... assign(x,y,envir=?) } I need the caller (of f) 's environment

[R] U R ready for R! Now deploy your R models via cloud computing!

2009-01-21 Thread MZ
Following the recent NYT article about R, I thought this group is not only ready for R but ready to take it one step further. Got models in R? Deploy and score them in ADAPA in minutes on the Amazon EC2 cloud computing infrastructure! Zementis ( http://www.zementis.com ) has been working with

[R] title: words in different colors?

2009-01-21 Thread Michael Friendly
In ?title I see the plot(cars, main = ) title(main = list(Stopping Distance versus Speed, cex=1.5, col=red, font=3)) I can't seem to generalize this to use several colors in a single title. What I'd like is in latex-ish \red{Hair color} \black{ and } \blue{Eye color} to serve also as an

[R] Joint significance of more regressors in summary

2009-01-21 Thread Roberto Patuelli
Dear All, I was wondering if it is possible to generate a regression summary (it does not matter at this stage if from an lm or for example a glm estimate) in which to obtain the joint significance of a set of regressors? Examples could be looking at the joint significance level of a

Re: [R] title: words in different colors?

2009-01-21 Thread Barry Rowlingson
2009/1/21 Michael Friendly frien...@yorku.ca: In ?title I see the plot(cars, main = ) title(main = list(Stopping Distance versus Speed, cex=1.5, col=red, font=3)) I can't seem to generalize this to use several colors in a single title. Solution from

Re: [R] title: words in different colors?

2009-01-21 Thread Duncan Murdoch
Michael Friendly wrote: In ?title I see the plot(cars, main = ) title(main = list(Stopping Distance versus Speed, cex=1.5, col=red, font=3)) I can't seem to generalize this to use several colors in a single title. What I'd like is in latex-ish \red{Hair color} \black{ and } \blue{Eye

[R] plot: abline() - define line length

2009-01-21 Thread Jörg Groß
Hi, is there a way to define, that a line drawn via abline() should only go from for example -2 to 1 on the x-axis (with something working similiar to xlim()) ? thanks for any help! __ R-help@r-project.org mailing list

Re: [R] plot: abline() - define line length

2009-01-21 Thread Remko Duursma
I use this function (a lot): ablinepiece - function(a=NULL,b=NULL,reg=NULL,from,to,...){ # Borrowed from abline if (!is.null(reg)) a - reg if (!is.null(a) is.list(a)) { temp - as.vector(coefficients(a)) if (length(temp) == 1) { a - 0 b -

Re: [R] plot: abline() - define line length *solved*

2009-01-21 Thread Jörg Groß
Thanks, that's great! Am 22.01.2009 um 01:18 schrieb Remko Duursma: I use this function (a lot): ablinepiece - function(a=NULL,b=NULL,reg=NULL,from,to,...){ # Borrowed from abline if (!is.null(reg)) a - reg if (!is.null(a) is.list(a)) { temp -

[R] Special function? [non-R query]

2009-01-21 Thread Ted Harding
Greetings all, Sorry for posting what is primarily not an R question (though it will have an R target in due course). Let F(x) be the CDF of the Normal -- i.e. pnorm(x) Let f(x) be the density function -- i.e. dnorm(x) Define G(psi) = Integral[-inf,inf] F(x)*f(x)*exp(x*psi) dx Is G(psi) a

Re: [R] getting caller's environment

2009-01-21 Thread Yi Zhang
On Wed, Jan 21, 2009 at 5:57 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this: f - function(env = parent.frame()) env$x Thanks. What if the x in env$x is an argument passed in? e.g. f - function(x, env=parent.frame()) { #assign to env$x ? } g - function(x=1) f() x - 2 g() # 1

[R] how to study the lead and lag relation of two time series?

2009-01-21 Thread Michael
Hi all, Is there a way to study the lead and lag relation of two time series? Let's say I have two time series, At and Bt. Is there a systematic way of concluding whether it's A leading B or B leading A and by how much? Thanks! __

Re: [R] Joint significance of more regressors in summary

2009-01-21 Thread Kingsford Jones
try install.packages('car') ?car::linear.hypothesis hth, Kingsford Jones On Wed, Jan 21, 2009 at 4:20 PM, Roberto Patuelli roberto.patue...@lu.unisi.ch wrote: Dear All, I was wondering if it is possible to generate a regression summary (it does not matter at this stage if from an lm or for

Re: [R] how to study the lead and lag relation of two time series?

2009-01-21 Thread Jim Porzak
Try a search on cross correlation time series HTH, Jim Porzak TGN.com San Francisco, CA http://www.linkedin.com/in/jimporzak use R! Group SF: http://ia.meetup.com/67/ On Wed, Jan 21, 2009 at 5:17 PM, Michael comtech@gmail.com wrote: Hi all, Is there a way to study the lead and lag

Re: [R] Normality Test and T-Test

2009-01-21 Thread David Winsemius
One of: ?by ?aggregate ?ave Next time include the package name where these functions come from AND code that creates an example data situation and you will increase your probability of getting a more prompt and complete reply. -- David Winsemius On Jan 21, 2009, at 4:54 PM, Ferry wrote:

[R] Problem with cex=0.1 when making jpegs

2009-01-21 Thread davidfarr
I am using the following script to make .jpg files. jpeg('plotx.jpg') ddat -read.table(file,header=T) attach(ddat) tdat-read.table(file1) plot(xx1,yy1,type='p',pch=1,col=blue,cex=0.2,xlim=c(0,3.5),ylim=c(-75,75)) points(tdat,col=green,pch=1,cex=0.2) dev.off() The problem is that I want the

Re: [R] getting caller's environment

2009-01-21 Thread Gabor Grothendieck
Try this: myassign - function(x, val, env = parent.frame()) assign(deparse(substitute(x)), val, env) myassign(x, 3) x # 3 On Wed, Jan 21, 2009 at 8:03 PM, Yi Zhang yizhan...@gmail.com wrote: On Wed, Jan 21, 2009 at 5:57 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this: f -

  1   2   >