Re: [R] multivariate problem

2012-01-08 Thread Iasonas Lamprianou
Dear all,  I am not sure if this is the right place to ask this question, but I will have a go. Please redirect me to a different place if this is not the right one! I have a (relatively) simple problem which causes me some frustration because I cannot find the solution. I measure ten variables

[R] Adding a migration element to a deterministic spatial model

2012-01-08 Thread Aimee Jones
Hi all, I've been working with a friend's model that is a spatial model consisting of 4 patches. She uses the code found below to add migration between the patches for the three species of concern. When I run a script incorporating this code, all four patches run independently without migration

[R] cannot find package in PackagesInstall Packages

2012-01-08 Thread Bill
Hi. I am trying to install a package called DMwR http://cran.r-project.org/web/packages/DMwR/index.html located here: http://cran.r-project.org/bin/windows/contrib/r-release/DMwR_0.2.1.zip on windows 7. I am using R 2.10.1. I also tried typing something like this but it did not work well.

[R] splitting strings effriciently

2012-01-08 Thread Andrew Roberts
Folks, I have a data frame with 4861469 rows that contains an ip address xxx.xxx.xxx.xxx as one of the columns. I want to assign a site to each row based on IP ranges. To do this I have a function to split the ip address as character into class A,B,C and D components. It works but is horribly

Re: [R] cannot find package in PackagesInstall Packages

2012-01-08 Thread Michael Dewey
At 10:21 08/01/2012, Bill wrote: Hi. I am trying to install a package called DMwR http://cran.r-project.org/web/packages/DMwR/index.html located here: http://cran.r-project.org/bin/windows/contrib/r-release/DMwR_0.2.1.zip on windows 7. I am using R 2.10.1. I also tried typing something like this

[R] mode of frequency distribution table

2012-01-08 Thread Mary Kindall
In a frequency distribution table (bell shaped), how can we find the most frequent range? for example: x = c(1,2, 4,4,4,4, 5,5,5,6,6,5,5,5,5,5,6,6,6,13, 17,17,30,100,300) barplot(table(x)) In the code above, which function do we use to find that the most frequent value range from 4 to 6.

Re: [R] Putting an index explicitly into function code --- a curiosity.

2012-01-08 Thread Duncan Murdoch
On 12-01-07 2:44 PM, cbe...@tajo.ucsd.edu wrote: Duncan Murdochmurdoch.dun...@gmail.com writes: On 12-01-06 10:21 PM, Rolf Turner wrote: On 07/01/12 15:51, R. Michael Weylandtmichael.weyla...@gmail.com wrote: I imagine the answer will involve lazy evaluation and require you use force()

Re: [R] colouring a table, data.frame or matrix in an interactive R session

2012-01-08 Thread Vincent Zoonekynd
On 7 January 2012 19:48, drflxms drfl...@googlemail.com wrote: as I am dealing with complex confusion matrices, I wonder whether there might be a way to colour text/tabular data in R. I.e. imagine highlighting the true positive values or certain classes in a table. The colorout package does

Re: [R] cannot find package in PackagesInstall Packages

2012-01-08 Thread Duncan Murdoch
On 12-01-08 5:21 AM, Bill wrote: Hi. I am trying to install a package called DMwR http://cran.r-project.org/web/packages/DMwR/index.html located here: http://cran.r-project.org/bin/windows/contrib/r-release/DMwR_0.2.1.zip on windows 7. I am using R 2.10.1. I also tried typing something like this

Re: [R] splitting strings effriciently

2012-01-08 Thread Enrico Schumann
Hi Andrew, you can use strsplit for a character vector; you do not have to call it for every element data$ComputerName[i]. If I understand correctly, maybe something like this helps ip - 123.456.789.321 ## example data df - data.frame(ip = rep(ip, 9), stringsAsFactors=FALSE) df

Re: [R] mode of frequency distribution table

2012-01-08 Thread andrija djurovic
Hi. You can do something like this: #find the most frequent values of x t - table(x) t[t==max(t)] 5 8 #sort table t based on frequencies t[order(as.numeric(t),decreasing = TRUE)] x 5 6 4 17 1 2 13 30 100 300 8 5 4 2 1 1 1 1 1 1 #extract any range from sorted

[R] Convert components of a list to separate columns in a data frame or matrix XXXX

2012-01-08 Thread Dan Abner
Hello everyone, What is the most efficient simpliest way to convert all components of a list to separate columns in a matrix? Is there an easy way to programmatically pad the length of the resulting shorter character vectors so that they can be easily combined into a data frame? I have the

Re: [R] Putting an index explicitly into function code --- a curiosity.

2012-01-08 Thread Gabor Grothendieck
On Sun, Jan 8, 2012 at 7:50 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 12-01-07 2:44 PM, cbe...@tajo.ucsd.edu wrote: Duncan Murdochmurdoch.dun...@gmail.com  writes: On 12-01-06 10:21 PM, Rolf Turner wrote: On 07/01/12 15:51, R. Michael Weylandtmichael.weyla...@gmail.com wrote:

Re: [R] PLM, Logical subscript too long, error

2012-01-08 Thread David Winsemius
On Jan 7, 2012, at 9:34 PM, therrienak wrote: I have created panel data set using specific variable from our data set. When I attempt to run plm I receive a Error in pdata.frame(data, index) : (subscript) logical subscript too long You are not providing any information about either the

[R] choosing items from array: very stupid and simple question

2012-01-08 Thread Philipp Chapkovski
x-1:11 y-2:3 is there a way to do something like x[x==y] (which actually produce error)? I am really got stuck __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] choosing items from array: very stupid and simple question

2012-01-08 Thread Sarah Goslee
x[x %in% y] [1] 2 3 2012/1/8 Philipp Chapkovski chapkov...@gmail.com: x-1:11 y-2:3 is there a way to do something like x[x==y] (which actually produce error)? I am really got stuck -- Sarah Goslee http://www.functionaldiversity.org __

Re: [R] multivariate problem

2012-01-08 Thread David Winsemius
On Jan 8, 2012, at 3:01 AM, Iasonas Lamprianou wrote: Dear all, I am not sure if this is the right place to ask this question, but I will have a go. Please redirect me to a different place if this is not the right one! I have a (relatively) simple problem which causes me some

Re: [R] choosing items from array: very stupid and simple question

2012-01-08 Thread Richard M. Heiberger
This does literally what you asked for x[x %in% y] [1] 2 3 This is more likely what you want which(x %in% y) [1] 2 3 It is an artifact of this example that the two results look the same. Here is a different example that distinguishes them, and in this example, %in% is probably not right

Re: [R] colouring a table, data.frame or matrix in an interactive R session

2012-01-08 Thread Jakson Alves de Aquino
On Sun, Jan 8, 2012 at 9:52 AM, Vincent Zoonekynd zoo...@gmail.com wrote: On 7 January 2012 19:48, drflxms drfl...@googlemail.com wrote: as I am dealing with complex confusion matrices, I wonder whether there might be a way to colour text/tabular data in R. I.e. imagine highlighting the true

Re: [R] multivariate problem

2012-01-08 Thread Clifford Long
Would some type of multivariate SPC be useful? Potentially useful options might include those based on SPC using PCA, or perhaps Hotelling's T2. Maybe you would find something useful in a package such as rrcov? http://cran.r-project.org/web/packages/rrcov/vignettes/rrcov.pdf R/S Cliff On

Re: [R] Putting an index explicitly into function code --- a curiosity.

2012-01-08 Thread William Dunlap
The following gives a list, 'z', of functions with different values of the variable 'i': z - lapply(1:3, function(i) { force(i) ; function() cat(i is, i, \n)}) z[[3]]() i is 3 z[[2]]() i is 2 Their printed values don't show the difference, as they depend on the 'i' stored in their

Re: [R] mode of frequency distribution table

2012-01-08 Thread jim holtman
'rle' is also your friend: x = c(1,2, 4,4,4,4, 5,5,5,6,6,5,5,5,5,5,6,6,6,13, 17,17,30,100,300) barplot(table(x)) rle(x) Run Length Encoding lengths: int [1:12] 1 1 4 3 2 5 3 1 2 1 ... values : num [1:12] 1 2 4 5 6 5 6 13 17 30 ... y - rle(x) y$values[which.max(y$lengths)] [1] 5 On

Re: [R] Convert components of a list to separate columns in a data frame or matrix XXXX

2012-01-08 Thread jim holtman
Is this what you are after: more-c('R is a free software environment for statistical computing', + 'It compiles and runs on a wide variety of UNIX platforms') result-strsplit(more,' ') result [[1]] [1] R is a freesoftware environment for [8]

Re: [R] mode of frequency distribution table

2012-01-08 Thread Mary Kindall
Thanks andrija I was wondering is there any statistical test that can give me the most frequent continuous interval range. Your code will also give discontinuous frequency intervals. For example, In the code below I dont want the entry with value 400. I am interested more in the bell shape

Re: [R] splitting strings effriciently

2012-01-08 Thread jim holtman
Just a quick followup to the previous post using 4M entries: (20 seconds would seem like a reasonable time for the operation) ip - 123.456.789.321 ## example data df - data.frame(ip = rep(ip, 4e6), stringsAsFactors=FALSE) system.time(x - strsplit(df$ip, '\\.')) user system elapsed

Re: [R] package sampling

2012-01-08 Thread Thomas Lumley
On Fri, Jan 6, 2012 at 5:30 PM, blueberry1228 blueberry1...@hotmail.com wrote: After trouble shooting for a long time, believe me it's  miserable, I finally found: There's conflict between Hmisc and sampling packages. I suggest if strata pops unusual error like this, you should check if your

Re: [R] Allow HTML email on R-Help

2012-01-08 Thread Patrick Connolly
On Tue, 03-Jan-2012 at 09:00PM -0600, Aren Cambre wrote: | Is it possible to allow HTML email on R-Help? | | HTML email is mainstream and would really help with code markup and | embedded graphics. On the contrary, unless special care is taken (rarely happens), HTML email almost invariably

Re: [R] multivariate problem

2012-01-08 Thread Bert Gunter
Iasonas: On Sun, Jan 8, 2012 at 12:01 AM, Iasonas Lamprianou lampria...@yahoo.com wrote: Dear all, I am not sure if this is the right place to ask this question, but I will have a go. Please redirect me to a different place if this is not the right one! I have a (relatively) simple

[R] fix and edit don't work: unable to open X Input Method-segfault

2012-01-08 Thread Paul Johnson
I can't run fix() or edit() anymore. Did I break my system? I'm running Debian Linux with R-2.14.1. As far as I can tell, the R packages came from Debian's testing wheezy repository. I would like to know if users on other types of systems see the same problem. If no, then, obviously, it is a

Re: [R] Convert components of a list to separate columns in a data frame or matrix XXXX

2012-01-08 Thread David Winsemius
On Jan 8, 2012, at 2:28 PM, jim holtman wrote: Is this what you are after: The code below is essentially what I would have imagined to be a method of programming cbind.data.frame.fill. It's worth noting that either reshape2 or plyr (I don't remember which) offer an rbind version:

[R] R package equivalent to Excel SOLVER - Paquete R equivalente a SOLVER de Excel

2012-01-08 Thread Ricardo Bandin
Esteemed colleagues I wonder if there is a package in R that performs the functions of the Excel SOLVER. Thanks in advance for the reply. Best regards, - Estimados colegas Me pregunto si hay un paquete en R que funcione como el SOLVER de Excel. De antemano gracias

Re: [R] R package equivalent to Excel SOLVER - Paquete R equivalente a SOLVER de Excel

2012-01-08 Thread David Winsemius
On Jan 8, 2012, at 4:51 PM, Ricardo Bandin wrote: Esteemed colleagues I wonder if there is a package in R that performs the functions of the Excel SOLVER. Thanks in advance for the reply. http://cran.r-project.org/web/views/Optimization.html -- David Winsemius, MD West Hartford, CT

Re: [R] multivariate problem

2012-01-08 Thread Iasonas Lamprianou
Thank you, I will have a look at rollapply   Dr. Iasonas Lamprianou Department of Social and Political Sciences University of Cyprus From: David Winsemius dwinsem...@comcast.net To: Iasonas Lamprianou lampria...@yahoo.com Cc: r-help@r-project.org

Re: [R] multivariate problem

2012-01-08 Thread Iasonas Lamprianou
Thank you, I downloaded the vignettes and I am currently studying it. It seems pretty good!   Dr. Iasonas Lamprianou Department of Social and Political Sciences University of Cyprus From: Clifford Long gnolff...@gmail.com To: Iasonas Lamprianou

Re: [R] splitting strings effriciently

2012-01-08 Thread Martin Morgan
On 01/08/2012 11:37 AM, jim holtman wrote: Just a quick followup to the previous post using 4M entries: (20 seconds would seem like a reasonable time for the operation) ip- 123.456.789.321 ## example data df- data.frame(ip = rep(ip, 4e6), stringsAsFactors=FALSE) system.time(x-

Re: [R] colouring a table, data.frame or matrix in an interactive R session

2012-01-08 Thread drflxms
Am 08.01.12 13:52, schrieb Vincent Zoonekynd: On 7 January 2012 19:48, drflxms drfl...@googlemail.com wrote: as I am dealing with complex confusion matrices, I wonder whether there might be a way to colour text/tabular data in R. I.e. imagine highlighting the true positive values or certain

Re: [R] colouring a table, data.frame or matrix in an interactive R session

2012-01-08 Thread drflxms
Am 07.01.12 21:12, schrieb Michael Friendly: On 1/7/2012 5:48 AM, drflxms wrote: Hi everybody, as I am dealing with complex confusion matrices, I wonder whether there might be a way to colour text/tabular data in R. I.e. imagine highlighting the true positive values or certain classes in a

[R] Difference across the Nth dimension of an array

2012-01-08 Thread Phil Wiles
I have a multidimensional array - in this case with 4 dimensions of x,y,z and time. I'd like to take the time derivative of this matrix, i.e. perform the diff operator along dimension number 4. In Matlab, there is a simple option to specify which dimension the difference is to be taken across.,

Re: [R] splitting strings effriciently

2012-01-08 Thread drflxms
Hi Andrew, I am aware, that this is an R-mailing list, but for such tasks (I deal a lot with huge genomic datasets) I tend to use awk and sed for preprocessing of data, in case I run into performance problems. Otherwise for handling of strings in R I recommend stringr library, but I don't know

[R] ?any

2012-01-08 Thread R. Michael Weylandt michael.weyla...@gmail.com
Just a silly question about documentation, but might it make sense to change the documentation for ?any [1] to be Are any values true? rather than are some It'd be more consistent with the function name and with ?all, as well as reading more precisely (to my ear at least) Anyway, of no

Re: [R] using deltat parameter in time series in HoltWinters prediction

2012-01-08 Thread John
On Sat, 7 Jan 2012 14:54:30 +0100 Antonio Tirri antonio.ti...@gmail.com wrote: On 7 January 2012 14:34, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: And what did your statistics advisor say? The problem is your understanding of the words 'sampling period'. I don't have a

[R] creating vectors from data-frames

2012-01-08 Thread Philip Robinson
I am having a problem with creating a vector from a rows or columns, I searched around and found as.vector(x), but it does not seem to do what it says it does I have included an example below, of doing what would seem to be the method required to create a vector, but instead it creates a

[R] Summing rows by years (each time separately)

2012-01-08 Thread Andrew Gaska
Dear all, I could not find an answer for the problem. I have a matrix and I want to sum rows in groups i.e. rows are summed as long as rows of column 1 have some value (f.e. 2008 in it), then again rows are summed as long as rows of column 2 have some value (f.e. 2009 in it). In case there is

[R] need help with axis ticks

2012-01-08 Thread vibhava
hi, i am using par(mrow=c(6,6)) function to get 6x6 plots on one screen. the problem that i am having is that the axis tick labels are far away from the ticks and going into previous plots (see attached figure). i need to know how can i reduce the distance between the ticks and their values (y

Re: [R] Convert components of a list to separate columns in a data frame or matrix XXXX

2012-01-08 Thread Rui Barradas
Hello, I believe this solves your problem fun - function(x){ f - function(x, n){ if(length(x) n) x - c(x, rep(NA, n-length(x))) return(x) } lapply(x, f, max(unlist(lapply(x, length } fun(result) # the 'result' list above

[R] Simulate AR(1) starting from X number?

2012-01-08 Thread jfca283
Hi i run arima.sim(n=100,n.start=9,list(ar=c(0.4)),sd=sqrt(3)), but i need that the firs value be 9, i mean x_(-1). Thanks -- View this message in context: http://r.789695.n4.nabble.com/Simulate-AR-1-starting-from-X-number-tp4276550p4276550.html Sent from the R help mailing list archive at

Re: [R] splitting strings efficiently

2012-01-08 Thread Andrew Roberts
Thanks Enrico Jim, The following finished the job in under a minute! res - unlist(strsplit(data[[ComputerName]], \\.)) ii - seq(1, nrow(data)*4, by = 4) data$IPA -res[ii] ## A data$IPB -res[ii+1] ## B data$IPC -res[ii+2] ## C data$IPD -res[ii+3] ## D Andrew On 08/01/2012 13:11, Enrico

[R] rpart question

2012-01-08 Thread Amanda Marie Elling
We are trying to make a decision tree using rpart and we are continually running into the following error: fit_rpart=rpart(ENROLL_YN~MINORITY,method=class) summary(fit_rpart) Call: rpart(formula = ENROLL_YN ~ MINORITY, method = class) n= 5725 CP nsplit rel error 1 0 0 1 Error

[R] Conditional Loop For Data Frame Columns

2012-01-08 Thread jawbonemurphy
Hi, I am trying to create a script that will evaluate each column of a data frame, regardless of # columns, using some function and sorting the results by an index vector: #upload data (112 rows x 73 columns) SD - read.csv(/Users/johnjacob/Desktop/StudentsData_RInput.csv, header=TRUE) #assign

Re: [R] ?any

2012-01-08 Thread Ted Harding
On 09-Jan-2012 R. Michael Weylandt michael.weyla...@gmail.com wrote: Just a silly question about documentation, but might it make sense to change the documentation for ?any [1] to be Are any values true? rather than are some It'd be more consistent with the function name and with ?all, as

Re: [R] creating vectors from data-frames

2012-01-08 Thread David Winsemius
On Jan 8, 2012, at 3:12 PM, Philip Robinson wrote: I am having a problem with creating a vector from a rows or columns, I searched around and found as.vector(x), but it does not seem to do what it says it does I have included an example below, of doing what would seem to be the method

Re: [R] Summing rows by years (each time separately)

2012-01-08 Thread David Winsemius
On Jan 8, 2012, at 1:57 PM, Andrew Gaska wrote: Dear all, I could not find an answer for the problem. I have a matrix and I want to sum rows in groups i.e. rows are summed as long as rows of column 1 have some value (f.e. 2008 in it), then again rows are summed as long as rows of column

Re: [R] rpart question

2012-01-08 Thread Joshua Wiley
Hi Amanda, Can you reproduce the error with a small subset of the data? If so, could you send it to us? For instance if say 20 cases is sufficient, you could send the output of dput() which pastes easily into the console: dput(yourdata[, c(ENROLL_YN, MINORITY)]) You could also try calling

Re: [R] Conditional Loop For Data Frame Columns

2012-01-08 Thread David Winsemius
On Jan 8, 2012, at 4:48 PM, jawbonemurphy wrote: Hi, I am trying to create a script that will evaluate each column of a data frame, regardless of # columns, using some function and sorting the results by an index vector: ?lapply ?[ ?order #upload data (112 rows x 73 columns) SD -

Re: [R] Summing rows by years (each time separately)

2012-01-08 Thread William Dunlap
In aggregate() you can use the following as your grouping ('by') variable group - cumsum(c(TRUE, year[-1] != y[-length(year)])) where 'year' is the column of your matrix containing the 2008, 2009, ... Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From:

Re: [R] Summing rows by years (each time separately)

2012-01-08 Thread David Winsemius
On Jan 8, 2012, at 8:43 PM, William Dunlap wrote: In aggregate() you can use the following as your grouping ('by') variable group - cumsum(c(TRUE, year[-1] != y[-length(year)])) where 'year' is the column of your matrix containing the 2008, 2009, ... I thought those were rownames and was

Re: [R] Simulate AR(1) starting from X number?

2012-01-08 Thread Rolf Turner
On 09/01/12 08:45, jfca283 wrote: Hi i run arima.sim(n=100,n.start=9,list(ar=c(0.4)),sd=sqrt(3)), but i need that the firs value be 9, i mean x_(-1). Thanks Is this homework? cheers, Rolf Turner __ R-help@r-project.org mailing list

[R] Where to download the splines package.

2012-01-08 Thread Xiaobo Gu
Hi, install.packages(splines) Warning in install.packages : package ‘splines’ is not available (for R version 2.14.1) Regards, Xiaobo Gu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Difference across the Nth dimension of an array

2012-01-08 Thread Vincent Zoonekynd
On 9 January 2012 08:53, Phil Wiles philip.wi...@gmail.com wrote: I have a multidimensional array - in this case with 4 dimensions of x,y,z and time.  I'd like to take the time derivative of this matrix, i.e. perform the diff operator along dimension number 4. apply can do that, but you may

Re: [R] Simulate AR(1) starting from X number?

2012-01-08 Thread jfca283
Yes, it's work for my class. -- View this message in context: http://r.789695.n4.nabble.com/Simulate-AR-1-starting-from-X-number-tp4276550p4277462.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Spatial data, rpoispp, using window with fixed radius?

2012-01-08 Thread Adrian.Baddeley
The following message appeared on R-help but this discussion should be moved to R-sig-geo On 07/01/12 02:17, herbert8...@gmx.de wrote: I was searching through the spatstat manual in order to find a function to simulate a Poisson pattern only within a fixed radius (circular moving

Re: [R] tick mark intervals

2012-01-08 Thread mandova
I highly recommand a book written by Paul Murrell: R Graphics. -- View this message in context: http://r.789695.n4.nabble.com/tick-mark-intervals-tp796253p4277584.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] need help with axis ticks

2012-01-08 Thread mandova
I'm having the same problem, it seems to me that when output window is partitioned the tick marks and axis lables behave weirdly... -- View this message in context: http://r.789695.n4.nabble.com/need-help-with-axis-ticks-tp4276465p4277589.html Sent from the R help mailing list archive at

Re: [R] Conditional Loop For Data Frame Columns

2012-01-08 Thread jawbonemurphy
Hi Dave, Thanks for your response! I'm new at R, and I'm afraid I'm not sure what you mean by: ?lapply ?[ ?order Were these suggestions for other commands to try? If so, can you be more specific? I apologize for being clueless :) Secondly, you're right that the script I have now leaves me

Re: [R] Conditional Loop For Data Frame Columns

2012-01-08 Thread David Winsemius
On Jan 9, 2012, at 12:02 AM, jawbonemurphy wrote: Hi Dave, Thanks for your response! I'm new at R, and I'm afraid I'm not sure what you mean by: ?lapply ?[ ?order It means I thought you might get the answers you needed by looking at those functions' help pages. Were these