Re: [R] help stored permanently

2012-10-23 Thread Martin Maechler
R Michael Weylandt michael.weyla...@gmail.com on Mon, 22 Oct 2012 09:06:35 +0100 writes: On Monday, October 22, 2012, Christian Hoffmann wrote: Hi, Each help.start() generates a new tree of the R help system, somewhere in 127.0.0.1:xxx, each xxx being

[R] SPI using Nonparametric Approach

2012-10-23 Thread cahaya iman
Dear r-users, Any such a way that we can compute SPI using kernel function (nonparametric approach) without assuming any parametric distributions? Any existing package for above method using R? Thank you for your help. Fayyad [[alternative HTML version deleted]]

Re: [R] Memory issue with svm modeling in R

2012-10-23 Thread Jessica Streicher
Well, i'm no expert on these topics, but if its 2.7 gig and R can maximally use 2gig, then the easiest solution would be giving R more memory. Did you read through help(memory.size) as the error suggested? try calling memory.size(T) or memory.limit(3000) and see if it works. I don't have any

[R] vector indexing

2012-10-23 Thread Al Ehan
Hi, I got a small problem on how to define the vector index without manually inspect the vector. example: y=c(2,3,5,2,4,6,8,3,6,2,5) #I have ten set of this kind of vectors (with different values but same length) that I would also like to run the routine below #say; v=the first index in y

Re: [R] vector indexing

2012-10-23 Thread Ivan Calandra
Hi, Is it what you're looking for? which(y4) ##all indexes for y4 [1] 3 6 7 9 11 which(y4)[1] ##the first index [1] 3 HTH, Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosciences 6 Boulevard Gabriel 21000 Dijon, FRANCE +33(0)3.80.39.63.06

[R] [r] How to pick colums from a ragged array?

2012-10-23 Thread Stuart Leask
I have a large dataset (~1 million rows) of three variables: ID (patient's name), DATE (of appointment) and DIAGNOSIS (given on that date). Patients may have been assigned more than one diagnosis at any one appointment - leading to two rows, same ID and DATE but different DIAGNOSIS. The

Re: [R] vector indexing

2012-10-23 Thread Rui Barradas
Hello, Try the following. y=c(2,3,5,2,4,6,8,3,6,2,5) first - function(x) min(which(x)) prefix - function(x, v) x[seq_len(v)] suffix - function(x, v) x[-seq_len(v)] first(y 4) prefix(y, first(y 4)) suffix(y, first(y 4)) Hope this helps, Rui Barradas Em 23-10-2012 10:21, Al Ehan escreveu:

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread Rui Barradas
Hello, I'm not sure I understand it well, in the solution below the only returned value is ID == 814 but it's not the first nor the last DATE. how.many - ave(id.d[,1], id.d[,1], id.d[,2], FUN = length) id.d[how.many 1, ] See the help page for ?ave if the repetition of id.d[,1] is confusing.

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread Rui Barradas
Hello, Thinking again, if you just want the first/last in each ID that repeats the DATE, the following function does the job. Since there were no such cases in your data example, I've added 3 rows to the dataset. ID - c(58,58,58,58,167,167,323,323,323,323,323,323,323

Re: [R] vector indexing

2012-10-23 Thread Duncan Murdoch
On 12-10-23 5:39 AM, Rui Barradas wrote: Hello, Try the following. y=c(2,3,5,2,4,6,8,3,6,2,5) first - function(x) min(which(x)) prefix - function(x, v) x[seq_len(v)] suffix - function(x, v) x[-seq_len(v)] first(y 4) prefix(y, first(y 4)) suffix(y, first(y 4)) Be careful with this: it

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread PIKAL Petr
Hi I did not check your code and rather followed your explanation. BTW, thanks for test data. small change in data frame to make DATE as Date class datum-as.Date(as.character(DATE), format=%Y%m%d) id.d - data.frame(ID,datum ) ordering by date id.d-id.d[order(id.d$datum),] two functions to

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread PIKAL Petr
Hi Rui's answer brought me to more elaborated solution which still needs data frame to be ordered by date fff-function(data, first=TRUE, remove=FALSE) { testfirst - function(x) x[1,2]==x[2,2] testlast - function(x) x[length(x),2]==x[length(x)-1,2] if(first) sel -

[R] plotting multiple variables in 1 bar graph

2012-10-23 Thread Macy Anonuevo
I'd greatly appreciate your help in making a bar graph with multiple variables plotted on it. All the help sites I've seen so far only plot 1 variable on the y-axis Data set: I have 6 sites, each measured 5 times over the past year. During each sampling time, I counted the occurrences of

[R] Mirror of the R manuals with a new visual style

2012-10-23 Thread Jon Clayden
Dear all, I've created a new mirror of the HTML versions of the main R manuals at http://r-manuals.flakery.org. This mirror does not modify the content of the manuals at all, but simply injects a new visual style with the aim of making the text easier to read and navigate. It will be updated

[R] Olmstead-Tukey Diagram

2012-10-23 Thread Evelina
Hi everyone, I am Evelina and i have just joined the forum and hope to be able to support soembody as well as finding some help for my stats problem. I am trying to plot Frequencies against Densities of an ecological community using a Olmstead-Tukey diagram (O-T diagram). it is based on the

[R] Represent point size according to frequency

2012-10-23 Thread Henrik Pärn
You may also have a look here: http://flowingdata.com/2010/11/23/how-to-make-bubble-charts/ Note the Circles incorrectly sized by radius instead of area. Large values appear much bigger. Similar point made here: https://stat.ethz.ch/pipermail/r-help/2011-January/265475.html Message: 44

[R] Minimizing Computational Time

2012-10-23 Thread Naser Jamil
Dear R-users, May I seek some suggestions from you. I have a long programme written in R with several 'for' loops inside. I just want to get them out by any elegant way (if there is!) to reduce the computational time of the main programme. For instance, is there any smart way for the following

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread Stuart Leask
Ah, no, my method does fail. Consider an ID that has a duplicate DATE that isn't the first date, but it's first date is the same as another ID's first date that IS a duplicate. Test data is all - see below it failing. So, I remain very grateful for your function! Stuart ID -

Re: [R] Trouble returning 2D array into R from Fortran

2012-10-23 Thread paulfjbrowne
Yes, I had stripped out the Fortran from the geta subroutine downwards because is wasn't very important in returning a test output matrix. I think that I should make explicit what problem I believe I am seeing in what I have coded, and what form of the output matrix I would prefer. When I run

[R] Export summary from regression output

2012-10-23 Thread fxen3k
Hi there, I tried it many times but didn't get it worked. I just want to export the summary of a OLS regression (lm() function) into a csv-file including the call-formula, coefficients, r-squared, adjusted r-squared and f statistic. I know I can export:

[R] Rserve-PHP client warning

2012-10-23 Thread sagarnikam123
i connected Rserver successfully. can do some functions like rnorm(),print(),etc... i am connecting R with Hive-hadoop i have installed library RHive which will take care of connection but when i am connecting it throws warning..like Warning: type 7 is currently not implemented in the PHP client.

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread Stuart Leask
Thanks Rui - your initial, very elegant suggestion, has spurred me on! 1. As you noticed, my example data had no examples of duplicate first dates (DOH!) I have corrected this, and added a test - an ID that has a duplicate which is not the earliest DATE, but is the same DATE an

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
I believe that previously could not be understood. To facilitate'll give you an example. Assuming my table is presented below with the amount received from each candidate for president in a particular country state. AL AR CA NY Doug 250 250 250 NA Jennifer 20 340 300

Re: [R] Minimizing Computational Time

2012-10-23 Thread R. Michael Weylandt
On Tue, Oct 23, 2012 at 11:06 AM, Naser Jamil jamilnase...@gmail.com wrote: Dear R-users, May I seek some suggestions from you. I have a long programme written in R with several 'for' loops inside. I just want to get them out by any elegant way (if there is!) to reduce the computational time

[R] Join data frame columns

2012-10-23 Thread brunosm
Hi, I have a data frame with 100 variables (numeric and non numeric types), and I want to join them in only one column, like a vector, but i want to keep the non numeric variables like they are. I know that i can do something like this: Suppose that my data is in df variable

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread Stuart Leask
Hi there. Not sure I follow what you are doing. I want a list of all the IDs that have duplicate DATE entries, only when the DATE is the earliest (or last) date for that ID. I have refined my test dataset, to include some tests (e.g. 910 has the same dup as 1019, but for 910 it's not the

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread PIKAL Petr
Hi -Original Message- From: Stuart Leask [mailto:stuart.le...@nottingham.ac.uk] Sent: Tuesday, October 23, 2012 2:29 PM To: PIKAL Petr; r-help@r-project.org Subject: RE: [r] How to pick colums from a ragged array? Hi there. Not sure I follow what you are doing. I want a list

Re: [R] fit a threshold function with nls

2012-10-23 Thread Matthieu Stigler
Hi You indeed cannot use conventional optimisation algorithms as the indicator function is discontinuous, with no derivative. The search hence has to be done with a grid search over each potential threshold value, which is termed conditional/concentrated least square, or also profile likelihood.

Re: [R] Join data frame columns

2012-10-23 Thread Ivan Calandra
Hi! Either I don't understand what you want to do, or it doesn't make any sense. First, a vector cannot have different modes. If you want a single vector it will most likely be coerced in to characters; probably not what you want. Second, what you do is build a data.frame with another

Re: [R] Export summary from regression output

2012-10-23 Thread PIKAL Petr
Hi section Arguments of write.table help page clearly says x the object to be written, preferably a matrix or data frame. If not, it is attempted to coerce x to a data frame. summary object from lm is highly structured list an AFAIK can not be easily coerced to data frame. So either copy

Re: [R] Mirror of the R manuals with a new visual style

2012-10-23 Thread Barry Rowlingson
On Tue, Oct 23, 2012 at 12:37 PM, Jon Clayden jon.clay...@gmail.com wrote: Dear all, I've created a new mirror of the HTML versions of the main R manuals at http://r-manuals.flakery.org. This mirror does not modify the content of the manuals at all, but simply injects a new visual style with

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread arun
HI, I was not following the thread. May be this is what you are looking for: new1-id.d[duplicated(id.d)|duplicated(id.d,fromLast=TRUE),] tapply(new1$ID,new1$DATE,head,1) #19870508 20040205 20040429 20050421   #  1019  167  814  841 A.K. - Original Message - From: Stuart

Re: [R] plotting multiple variables in 1 bar graph

2012-10-23 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Macy Anonuevo Sent: Tuesday, October 23, 2012 10:23 AM To: r-help@r-project.org Subject: [R] plotting multiple variables in 1 bar graph I'd greatly appreciate your help

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread arun
Hi, tapply(new1[,1],new1[,2],head,1) # works. I used: id.d-data.frame(ID,DATE) #In that case, tapply(new1$ID,new1$DATE,head,1) #works On closer look, I think you don't want 814 id.  Not sure about the logic behind that. A.K. - Original Message - From: Stuart Leask

Re: [R] Any good R server-with connection examples

2012-10-23 Thread Matt Shotwell
I want to connect R with HTML/PHP pages to take input from user,do some statistical processing on it show results to HTML page again. I search on net,i got Rserve package,but examples are mainly for java langaure not for PHP i am wondering how to connect it to PHP-Apache-MySQL Is there

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread arun
Hi, Also one more thing: This should get the dates which are duplicated.  In my first reply, I was looking for the duplicated rows. Sorry for that! id.d-data.frame(ID,DATE) new1-id.d[duplicated(id.d$DATE)|duplicated(id.d$DATE,fromLast=TRUE),] new2-new1[order(new1$ID,new1$DATE),]  

Re: [R] multivariate way to aaply on different arrays

2012-10-23 Thread Jannis
Hi R gurus, just in case anybody else has a similar problem ... I have programmed a function that solves this problem by creating a higher dimensional array out of the individual variables. I have no idea though whether this is very efficient. Feel welcome to comment in case you think that

[R] doubt in command

2012-10-23 Thread Julio Oliveira
Dear All, I I have one doubt about use of the command when has the same name (name of command) in two packages. For example: package: Stats package: Signal Both have the filter command. How use the command (filter) to a specific package, when I need work with both packages ? Thanks

Re: [R] doubt in command

2012-10-23 Thread Ivan Calandra
Hi Julio, Someone correct me if I'm wrong, but I think you can use '::' For example: Stats::filter() HTH, Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosciences 6 Boulevard Gabriel 21000 Dijon, FRANCE +33(0)3.80.39.63.06 ivan.calan...@u-bourgogne.fr

Re: [R] Join data frame columns

2012-10-23 Thread Rui Barradas
Hello, Use apply/paste. apply(df, 1, paste, collapse = ) # outputs a vector Also, df is the name of an R function, you should choose something else, it can become confusing. Hope this helps, Rui Barradas Em 23-10-2012 12:45, brunosm escreveu: Hi, I have a data frame with 100 variables

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread Stuart Leask
I too had a parsimonious solution that was also fooled by IDs that had a duplicate date that wasn't the first date, but was the same as another ID's duplicate+first. The right answer From this data: ID - c(58,58,58,58,167,167,323,323,323,323,323,323,323

Re: [R] doubt in command

2012-10-23 Thread Duncan Murdoch
On 23/10/2012 9:42 AM, Ivan Calandra wrote: Hi Julio, Someone correct me if I'm wrong, but I think you can use '::' For example: Stats::filter() Yes, but there is no Stats package: R is case-sensitive, and the package is called stats, and needs to be used that way: stats::filter()

Re: [R] Olmstead-Tukey Diagram

2012-10-23 Thread Bert Gunter
Well then,,, On Tue, Oct 23, 2012 at 2:03 AM, Evelina eve.gio...@gmail.com wrote: Hi everyone, I am Evelina and i have just joined the forum and hope to be able to support soembody as well as finding some help for my stats problem. Start by ditching Nabble and join and post from the r-help

[R] FW: [r] How to pick colums from a ragged array?

2012-10-23 Thread Stuart Leask
Sorry, I must be a bit thick.! getRepeat gives me the data with duplicates - but I don't seem to be able to manipulate the result. It looks like a list of dataframes: g.r-getRepeat(id.d) dim(g.r) NULL summary(g.r) Length Class Mode [1,] 2 data.frame list [2,] 2 data.frame

Re: [R] FW: [r] How to pick colums from a ragged array?

2012-10-23 Thread Rui Barradas
Hello, You're right, getRepeat returns a list of data.frames, one per each ID. To put them all in the same df use do.call(rbind, g.r) Rui Barradas Em 23-10-2012 13:36, Stuart Leask escreveu: Sorry, I must be a bit thick.! getRepeat gives me the data with duplicates - but I don't seem to be

Re: [R] Join data frame columns

2012-10-23 Thread brunosm
Hi Ivan, thanks for your help! For example: df num letters 1 1 A 2 2 B 3 3 C 4 4 D 5 5 E What i want is to join num and letters in a single column. Something like this new_df 1 1 2 2 3 3 4 4 5 5 6 A 7 B

Re: [R] FW: [r] How to pick colums from a ragged array?

2012-10-23 Thread Stuart Leask
So I get my list of IDs to exclude from: g.rr-do.call(rbind, g.r)[1] dim(g.rr) g.rr[1:(dim(g.rr)[1]/2)] Many thanks. Stuart -Original Message- From: Rui Barradas [mailto:ruipbarra...@sapo.pt] Sent: 23 October 2012 13:42 To: Stuart Leask Cc: r-help@r-project.org Subject: Re: FW: [R]

[R] Extracting results from Google Search

2012-10-23 Thread ECAMF
Dear list, I have a long list of towns in Africa and would need to get their geographical coordinates. The Google query [/TownName Country coordinates/] works for most of the TownNames I have and give a nicely formatted Google output (try Ingall Niger coordinates for an example). I would like to

Re: [R] plotting multiple variables in 1 bar graph

2012-10-23 Thread Macy Anonuevo
Thank you for replying. On Tue, Oct 23, 2012 at 9:11 PM, PIKAL Petr [via R] ml-node+s789695n4647131...@n4.nabble.com wrote: Hi -Original Message- From: [hidden email]http://user/SendEmail.jtp?type=nodenode=4647131i=0[mailto: r-help-bounces@r- project.org] On Behalf Of Macy

Re: [R] Join data frame columns

2012-10-23 Thread arun
Hi, Try this: set.seed(1) df1-data.frame(col1=rnorm(10,15),col2=rep(c(a,b),5),col3=sample(1:50,10,replace=TRUE),col4=sample(LETTERS[1:10],10,replace=TRUE)) df2-do.call(rbind,lapply(df1,function(x) data.frame(x))) str(df2) 'data.frame':    40 obs. of  1 variable:  $ x: chr  14.3735461892577

Re: [R] Linear discriminant function analysis based median as group centroid and nonparametric scale estimators???

2012-10-23 Thread Richard James
Hi Thomas, It does appear me and you are working on very similar sediment mixing model problems. I ran a robust lda using the median by specifying method = t within the lda function. So for my data I used: model-lda(All[,2:12],grouping=All$Catagory, method = t) Hope this helps. Regards

[R] multi-panel figure: overall title for each row

2012-10-23 Thread capy_bara
Dear all, I have a 3x2 plot and in addition to the title of the individual plots I would like to have an overall title for each row. I managed to get an overall title for the whole plot matrix with mtext: par(mfrow=(c(3,2)), mar=c(6.4,4.5,4.2, 1.8), oma=c(0,0,3,0)) for (i in 1:6)

[R] List of multidimensional arrays

2012-10-23 Thread Loukia Spineli
Dear all, I am trying to create a list, where each list element is a vector of different length arrays that contain 2by2 matrices. To be more specific there are 11 treatments that are compared with placebo (we have 11 comparisons) and each comparison is studied by a different number of trials and

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread Rui Barradas
Hello, Inline. Em 23-10-2012 14:53, Stuart Leask escreveu: I too had a parsimonious solution that was also fooled by IDs that had a duplicate date that wasn't the first date, but was the same as another ID's duplicate+first. The right answer From this data: ID -

Re: [R] Mirror of the R manuals with a new visual style

2012-10-23 Thread Jon Clayden
Hi Barry, On 23 October 2012 14:00, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On Tue, Oct 23, 2012 at 12:37 PM, Jon Clayden jon.clay...@gmail.com wrote: Dear all, I've created a new mirror of the HTML versions of the main R manuals at http://r-manuals.flakery.org. This mirror does

Re: [R] Help with applying a function to all possible 2x2 submatrices

2012-10-23 Thread Michael Friendly
On 10/22/2012 1:10 PM, CMB123 wrote: Hi all, I'm working with a large data set (on the order of 300X300) and trying to apply a function which compares the elements of all possible 2x2 submatrices. There are rc(r-1)(c-1) such submatrices, so obviously the naive method of looping through the rows

Re: [R] Join data frame columns

2012-10-23 Thread Rui Barradas
Hello, Sorry for my earlier post, I misunderstood what you want. dat - data.frame(letters, 1:26) as.vector(sapply(d, as.character)) Hope this helps, Rui Barradas Em 23-10-2012 14:13, brunosm escreveu: Hi Ivan, thanks for your help! For example: df num letters 1 1 A 2 2

Re: [R] Join data frame columns

2012-10-23 Thread Bert Gunter
I don't think so. The OP wanted the list by columns, not rows, if I understand correctly. unlist(df) provides this. Of course, the request probably does not makes sense in the first place, as the different types/classes in the data.frame will be coerced to one type/class. Moreover, factors will

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread PIKAL Petr
Hi and what is wrong? Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of noobmin Sent: Tuesday, October 23, 2012 2:52 PM To: r-help@r-project.org Subject: Re: [R] How to use tapply with more than one variables grouped

Re: [R] Join data frame columns

2012-10-23 Thread Ivan Calandra
Hi again, It seems that you want the modes to be conserved. This is just not possible; everything will be coerced to characters, as Rui highlighted. But the question is why do you want to do this? You would loose helpful information (i.e. modes). Maybe there is a better way to do what you

Re: [R] Join data frame columns

2012-10-23 Thread Rui Barradas
Hello, Inline. Em 23-10-2012 15:23, Bert Gunter escreveu: I don't think so. The OP wanted the list by columns, not rows, if I understand correctly. unlist(df) provides this. Of course, the request probably does not makes sense in the first place, as the different types/classes in the

Re: [R] bitwise XOR of Matrix

2012-10-23 Thread shahab
You are right.Thanks a lot for the help Rui. best, /Shahab On Mon, Oct 22, 2012 at 5:52 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Your error message means that the arrays have different dim attributes. check with dim(M1) == dim(M2) They must be the same. If they are, the

Re: [R] Downloading a html table

2012-10-23 Thread Duncan Temple Lang
Rather than requiring manual tweaking, library(XML) readHTMLTable(http://www.worldatlas.com/aatlas/populations/usapoptable.htm;) will do the job for us. D. On 10/22/12 8:17 PM, David Arnold wrote: All, A friend of mine would like to use this data with his stats class:

Re: [R] Trouble returning 2D array into R from Fortran

2012-10-23 Thread Berend Hasselman
On 23-10-2012, at 12:33, paulfjbrowne wrote: Yes, I had stripped out the Fortran from the geta subroutine downwards because is wasn't very important in returning a test output matrix. But then any results are not reproducible. So there is no purpose in trying to reproduce your results. See

[R] Filling a covariance matrix

2012-10-23 Thread emorway
useRs – I’m working with the attached data that contains one year’s worth of sub-daily observations of flow (“Q”) and specific conductance (“SC”, a surrogate for concentration) at a point in a stream. The R code posted below shows the extent of data processing thus far. My goal is to create a

[R] Testing proportional odds assumption in R

2012-10-23 Thread Eiko Fried
I want to test whether the proportional odds assumption for an ordered regression is met. The UCLA website points out that there is no mathematical way to test the proportional odds assumption (http://www.ats.ucla.edu/stat//R/dae/ologit.htm), and use graphical inspection (We were unable to locate

Re: [R] Any good R server-with connection examples

2012-10-23 Thread Aleksandar Blagotić
Don't try to integrate R with PHP, as you'll end up writing spaghetti code. Use AJAX to send requests to the server with RApache scripts. OpenCPU will do the job just fine, but make sure you use JSONP/CORS to bypass the same origin policy. Long story short, it's something like this: LAMP -AJAX- R

Re: [R] plotting multiple variables in 1 bar graph

2012-10-23 Thread David Carlson
If you have your data organized in a matrix like the one printed at the bottom of your jpg, barplot will produce the same graph: set.seed(42) a - matrix(round(runif(45)*100, 0), nrow=5, ncol=9) a [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 91 52 46 94 90 51 74 83

[R] Best R textbook for undergraduates

2012-10-23 Thread Jonathan Greenberg
R-helpers: I'm sure this question has been asked and answered through the ages, but given there are some new textbooks out there, I wanted to re-pose it. For a course that will cover the application of R for general computing and spatial modeling, what textbook would be best to introduce

[R] Data type in a data frame

2012-10-23 Thread asafwe
Hi all, How does R know to regard a variable as a factor and not a character? For example, consider the following table: ObservationGenderDosage Alertness 1 ma 8 2

[R] repeat takes along time

2012-10-23 Thread JPM
Hi I want help for repeat because it takes a long time repeat{ for (i in 1:n){ probb[i]=sum(Wc[z[,j]=yb[i]]) } deltab[,b]=rbinom(n,1,probb) if(length(which(is.na(deltab[,b])==T))==0){break} } This code works but takes much computation time. Anyone could help me to find a solution to take a

[R] find similarity between two spectral profile

2012-10-23 Thread pina
Hi, I'm Pina and I'm a student in geology. I'm working with spectral profile of sand and I have to find the similarity between one spectral profile selected by hyperspectral image anche one that I created to mix different percentage of 4 mineral component. I have to find the best mix of percentage

[R] Creating a polygon from an unordered set of points

2012-10-23 Thread peleve
Hello, I have the contour of the shoreline of a lake. I have measured data points away from the lake shore signifying a particular depth. The data is not ordered as a polygon and hence trying to draw it creates a series of lines all over the place. I would like to turn the points into a ordered

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
Hi, If the criteria is to pick which among the following states are the top 2 contributors for each candidate, dat1-read.table(text=   AL  AR  CA  NY Doug    250 250 250  NA Jennifer  20 340 300 100 Michele  250 500 250  60 Obama    15  45 520 600

Re: [R] Trouble returning 2D array into R from Fortran

2012-10-23 Thread paulfjbrowne
Thank you for your help. In any case, I eventually realized that I had reversed the Fortran/R column major order in the Fortran, which is why elements were returned incorrectly. As you point out, I did not run into memory access issues because of the self-similar array sizes. -- View this

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread arun
Hi Stuart, This also should get you the IDs you wanted. new1-id.d[duplicated(id.d[,2])|duplicated(id.d[,2],fromLast=TRUE),] earliest - tapply ( DATE, ID, min)                 rownames(earliest[earliest%in% new1]) #[1] 167  841  1019 A.K. - Original Message - From: Stuart Leask

Re: [R] Data type in a data frame

2012-10-23 Thread asafwe
So helpful, Arun -- Thank you! Asaf -- View this message in context: http://r.789695.n4.nabble.com/Data-type-in-a-data-frame-tp4647161p4647171.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] barplot

2012-10-23 Thread Thiho Jules
Hi, I want to make a barplot with the following datasets: I have a file as following: name chr position A1 A2 pop1 pop1 pop2 pop2 I have calculated a measure using all the values in columns pops, the values are saved in a vector. Now I want to make a barplot using the values in this vector

[R] After sorting a dataframe by date

2012-10-23 Thread martiny
HI, I have created a dataframe df and try to sort it by its date using the order() as below: df-read.csv(constr,header=T) sorted.df-df[order(as.Date(df$Date), decreasing = F),] print(sorted.df) The dataframe was sorted, but the output from the command console shows reserved line

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
To take this example I reduced the number of records absurdly. In the original database there are 48 000 candidates and dozens of states. There is no way to analyze data visually. I would not put 400 mb of tables here. But based on the example how could list the states where obama received more

[R] Random Forest imbalanced data and partial plots

2012-10-23 Thread Valerie Steen
Hello, Regarding imbalanced data: When using sampsize correction to balanced inbalanced data in Random Forests, what are the implications of the algorithm no longer using a bootstrapped sample? For instance, if I set sampsize to 25, 25 for a binary response, in a dataset of N=800, how does

Re: [R] plotting multiple variables in 1 bar graph

2012-10-23 Thread Macy Anonuevo
The data isn't in a matrix yet. The data printed at the bottom of the jpg are the means of the variables for each sampling time and I haven't calculated the means yet. Does this mean that I have to get the means first then use cbind to make a new matrix? The data looks like this: [site] [time]

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread arun
Hi,  res1-data.frame(col=sapply(tapply(DATE,ID,function(x)  duplicated(head(x,2))),function(x) x[2])) row.names(subset(res1,col==TRUE)) #[1] 167  841  1019 #assuming that dates are sorted A.K. - Original Message - From: Stuart Leask stuart.le...@nottingham.ac.uk To: Rui Barradas

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
Hi, Suppose if you have a threshold (say 500), then: dat1-read.table(text=   AL  AR  CA  NY Doug    250 250 250  NA Jennifer  20 340 300 100 Michele  250 500 250  60 Obama    15  45 520 600 ,header=TRUE,stringsAsFactors=FALSE,sep=)  

[R] Summary of variables with NA, empty

2012-10-23 Thread Lopez, Dan
Hi, Is there a function I can use on my dataframe to give me a concise summary of variables that are NA,blank,etc? Basically all Null values, Empty strings, white space, blank values. Ideally it would look something like the below: # it should only includes the fields with NAs, blanks, etc.

[R] factor or character

2012-10-23 Thread Silvano Cesar da Costa
Hi, The program below work very well. (snps = c('rs621782_G', 'rs8087639_G', 'rs8094221_T', 'rs7227515_A', 'rs537202_C')) Selec = todos[ , colnames(todos) %in% snps] head(Selec) But, I have a data set with 1.000 columns and I need extract 70 to use (like snps in command above). This 70 snps

Re: [R] Data type in a data frame

2012-10-23 Thread Rui Barradas
Hello, When read into a data.frame, R defaults to reading character strings as factors. If you don't want that, use option stringsAsFactors = FALSE. Using your dataset, dat1 - read.table(text = Observation Gender Dosage Alertness 1 m a 8 2 m

Re: [R] rms plot.Predict question: swapping x- and y- axis for categorical predictors

2012-10-23 Thread Frank Harrell
Stephanie, I just realized this is already implemented. For your problem use p - Predict(f,x2); plot(p, ~ x2, nlines=TRUE) Frank Frank Harrell wrote Stephanie, I'm working on an option for the plot method for Predict that will allow you to do this. Note that this approach will not result

Re: [R] Longitudinal categorical response data

2012-10-23 Thread Frank Harrell
Random effects models of the type fitted by ordinal assume something akin to compound symmetry, which is not realistic when time between measurements is long or irregular. Frank Rune Haubo-2 wrote lmer is not designed for ordered categorical data as yours are. You could take a look at the

Re: [R] Creating a polygon from an unordered set of points

2012-10-23 Thread Greg Snow
One possibility: Estimate the center of the polygon with the mean of the x coords and the mean of the y coords. Calculate the angle of each point from that center point using the atan2 function sort the data by the angle calculated. This will not be perfect if you have inlets and peninsulas, but

Re: [R] Data type in a data frame

2012-10-23 Thread William Dunlap
When read into a data.frame, R defaults to reading character strings as factors. If you don't want that, use option stringsAsFactors = FALSE. This is somewhat tangential, but if you plan on using predict(fit,newdata=nd) after fitting a model like fit - lm(y~x, data=d) be sure you have

[R] scatterplot with wrong line offset

2012-10-23 Thread fm3c2007
Hi All, I'm trying to do a Scatterplot (package: car), and add a line (just for reference). There is my code: #Code--- library(car) library(calibrate) G_T-c(car,bike,boat) ave-c(80,10,45) perf-c(100,80,75)

[R] Error in contrasts message when using logistic regression code.

2012-10-23 Thread hoguejm
I have a rather large data set (about 30 predictor variables) I need to preform a logistic regression on this data. My response variable is binary. My code looks like this: mylogit - glm(Enrolled ~ A + B + C + ... + EE, data = data, family = binomial(link=logit)) with A,B,C, ... as my

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
The criteria is to list where Obama has a higher number of contributions. The table shows the number of contribution that each presidential candidate received in a state of the country. The table shown is an example, the query should be generic to a database with hundreds of candidates and dozens

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
Thank you! This seems to work, just do not understand why you used a threshold? I will study your solution, thanks again! -- View this message in context: http://r.789695.n4.nabble.com/How-to-use-tapply-with-more-than-one-variables-grouped-tp4646948p4647199.html Sent from the R help mailing

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
I meant where obama has higher value compared to other candidates. Looking at the column NY, Obama has the highest. So to state that he wins. Looking for AR column, Michelle wins. I JUST want to list where obama wins. Thank you! This seems to work, just do not understand why you used a threshold?

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
Hi, Your question is not clear. Suppose if you want to find the highest two contributions for each candidate: dat1-read.table(text=   AL  AR  CA  NY Doug    250 250 250  NA Jennifer  20 340 300 100 Michele  250 500 250  60 Obama    15  45 520 600

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread Bert Gunter
You're posting on Nabble, so we don't see earlier messages in the thread here. -- Bert On Tue, Oct 23, 2012 at 11:36 AM, noobmin pseudov...@hotmail.com wrote: The criteria is to list where Obama has a higher number of contributions. The table shows the number of contribution that each

[R] frequency

2012-10-23 Thread farnoosh sheikhi
Hello, I have a data as follow: ID    Visit xa1 xa2 yb1 yc23 yb33   I want to look at frequency of visit for ID and create a new column as response .  For example my response would be 2 for x and 3 for y. I think I need to write a loop, but I don't know how. I really appreciate your help. Thanks

Re: [R] Package Design

2012-10-23 Thread Joost Kremers
Ah, thanks for the info. I'll go ahead and use rms and see how far I get. Joost On Mon, Oct 22 2012, Frank Harrell f.harr...@vanderbilt.edu wrote: Incorrect. The code is 90% compatible. Look at http://biostat.mc.vanderbilt.edu/Rrms for differences. Frank Joost Kremers wrote On Mon,

  1   2   >