Re: [R] R CMD BATCH Unicode

2013-06-26 Thread Prof Brian Ripley
On 25/06/2013 20:35, Ned Harding wrote: Just to clarify: The encoding didn't come through in the email. print(éíôåëëåãåâáè) is meant to be a bunch of random greek characters. In that case the message is likely correct. You failed to give us the 'at a minimum information' required by the

Re: [R] Heatmap with error message: `x' must be a numeric matrix

2013-06-26 Thread peter dalgaard
On Jun 25, 2013, at 21:51 , Rui Barradas wrote: Hello, Your data has commas as decimal points, R uses the period. So the data is read in as strings, not numbers. You can change this by using argument 'dec' of read.table: ?read.table read.table(...etc..., dec = ,) Or you can

Re: [R] Loops

2013-06-26 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of bett kimutai Sent: Wednesday, June 26, 2013 3:17 AM To: Law, Jason; r-help@r-project.org Subject: Re: [R] Loops Thanks for you response. The issue is that I need to run a

[R] match rows of R

2013-06-26 Thread Sachinthaka Abeywardana
Hi all, What would be an efficient way to match rows of a matrix to a vector? ex: m-matrix(1:9, nrow=3) m [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 # which(m==c(2,5,8))# I want this to return 2 ##

[R] Margins in dcast (reshape2)

2013-06-26 Thread Johannes Radinger
Hi, I'd like to get mean values for the margins of my casted data.frame. For the casting I am using dcast() from reshape2. However, when I set the margins parameter (margins=c(grand\_row)) I get following error concerning an unrecognized escape character '\_'. So what is the correct command to

Re: [R] match rows of R

2013-06-26 Thread Berend Hasselman
On 26-06-2013, at 10:03, Sachinthaka Abeywardana sachin.abeyward...@gmail.com wrote: Hi all, What would be an efficient way to match rows of a matrix to a vector? ex: m-matrix(1:9, nrow=3) m [,1] [,2] [,3] [1,]147 [2,]258 [3,]369

Re: [R] match rows of R

2013-06-26 Thread Yuliya Matveyeva
I suggest using vectorization : find_row - function(m,v) { which(!(abs(rowSums(m - rep(v, each = nrow(m))) )) 0) } The function matroweqv mentioned above would give any row with the first element equal to the first element in vector v. The function find_row matches each row of the matrix as a

[R] Error when using median as aggregation function in dcast

2013-06-26 Thread Johannes Radinger
Hi, I am trying to calculated various summary statistics using the dcast function of reshape2. This works perfectly for getting the mean, sum, length, sd. But when I want to calculate the median I get an error. I tried it with and without removing NAs: my_median - function(x) median(x, na.rm =

Re: [R] Correct scaling of axis in persp3d plot

2013-06-26 Thread Ivanov Ruporvrich
I uploaded the data here: http://uploadeasy.net/upload/p4d81.rar As I said, I know my color example is wrong, that's why I am looking for a correct solution, also, I would be interested in how I can get a better axis, as I described the problem. Thanks a lot for your help, Ivanov -

Re: [R] match rows of R

2013-06-26 Thread Berend Hasselman
On 26-06-2013, at 10:30, Yuliya Matveyeva yuliya.rm...@gmail.com wrote: I suggest using vectorization : find_row - function(m,v) { which(!(abs(rowSums(m - rep(v, each = nrow(m))) )) 0) } The function matroweqv mentioned above would give any row with the first element equal to the first

Re: [R] Psych package: Error in biplot.psych(sample.mod) : Biplot requires factor/component scores:

2013-06-26 Thread peter dalgaard
On Jun 26, 2013, at 00:33 , Simon Kiss wrote: Hello: I'm trying to construct a biplot from the psych package. The underlying data frame looks just like sample.data, below. I turned it into a polychoric correlation matrix sample.cor, below, as it is derived from a series of Likert

Re: [R] Lexical scoping is not what I expect

2013-06-26 Thread S Ellison
-Original Message- It may be helpful not to worry about the technical details, just to look at the source code defining the function: if it is defined in a place where a variable can be seen, it can see that variable. I too find R's lexical scoping rules straightforward.

Re: [R] Margins in dcast (reshape2)

2013-06-26 Thread Ista Zahn
Hi Johannes, I think the documentation is wrong. The Readme at https://github.com/hadley/reshape says grand_row and grand_col have been dropped. You should submit a bug report at https://github.com/hadley/reshape/issues describing the documentation problem. Best, Ista On Wed, Jun 26, 2013 at

Re: [R] Lexical scoping is not what I expect

2013-06-26 Thread Duncan Murdoch
On 13-06-26 6:57 AM, S Ellison wrote: -Original Message- It may be helpful not to worry about the technical details, just to look at the source code defining the function: if it is defined in a place where a variable can be seen, it can see that variable. I too find R's lexical

[R] Transpose of the rows

2013-06-26 Thread Nico Met
Dear R users, I am using a big data matrix and need to transpose rows (formatting of input matrix). I would like write a general code for this example. for example: my input file is dta dput(dta) structure(list(id = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L), .Label =

Re: [R] Transpose of the rows

2013-06-26 Thread arun
 dta[,3]-as.numeric(as.character(gsub(,,.,dta[,3]))) library(reshape2)   dcast(dta,id~name,value.var=value) #    id   AreaCycl   AreaEmer   AreaMax  HeightMax nrfilledseed #1 TN00016-003A -1.3998944 -3.2771509 -3281.077   8.434493    1.825 #2 TN00016-014A -0.5843794 -0.8428928

Re: [R] Error when using median as aggregation function in dcast

2013-06-26 Thread arun
Hi, Please check this link: http://stackoverflow.com/questions/4835202/error-with-custom-aggregate-function-for-a-cast-call-in-r-reshape2 A.K. - Original Message - From: Johannes Radinger johannesradin...@gmail.com To: R help r-help@r-project.org Cc: Sent: Wednesday, June 26, 2013

Re: [R] Transpose of the rows

2013-06-26 Thread Blaser Nello
reshape(dta, idvar=id, timevar=name, direction=wide) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Nico Met Sent: Mittwoch, 26. Juni 2013 13:38 To: R help Subject: [R] Transpose of the rows Dear R users, I am using a big data

Re: [R] Comparing each level of a factor to the global mean

2013-06-26 Thread Adams, Jean
Shaun, See the help on contrasts ... ?contr.treatment Jean On Tue, Jun 25, 2013 at 7:07 PM, Shaun Jackman sjack...@gmail.com wrote: Hi, I've used `lm` to create a linear model of a continuous variable against a factor variable with four levels using an example R data set (see

Re: [R] Calculating an index of colocation for a large dataset

2013-06-26 Thread Adams, Jean
Bree, See StackOverflow for my response ... http://stackoverflow.com/questions/17244824/calculating-an-index-of-colocation-for-a-large-dataset-r/17299168#17299168 Jean On Tue, Jun 25, 2013 at 5:00 PM, Bree W bree.wittev...@alaska.edu wrote: My apologies for cross-posting and for failing to

[R] help with plotmeans (gplots)

2013-06-26 Thread Simone Gabbriellini
Dear List, I have replicated an experiment 100 times. Each experiment lasts for 15 iteration. Thus I have collected results into a data.frame with 100 columns (one column for each experiment) and 15 rows (one row for each iteration). I would like to plot mean values at each iteration using

Re: [R] Fwd: Questions about working with a dataframe

2013-06-26 Thread John Kane
It is always better when dealing with R to use plain text. HTML messes things up badly sometimes and it is also a good idea to reply to the R-help list rather than individual respondents.  You can get more responses if the problem continues and if either of us were away then it might be weeks

[R] Generalised Linear models in R-Studio

2013-06-26 Thread Darren Andrew Whitehead
Hello, I would like some help with my Generalised Linear Model in R-Studio I am a little confused about what family to use and for my data My outcome variable (response) is categories 0,1,2,3 but my data i dont have any individuals that have fallen into the top group 3 What i have read about

[R] 2nd question about adding an additional variable along certain criteria in a dataframe

2013-06-26 Thread Jacqueline Oehri
Hello everybody, I have a question concerning the work with my dataframe and i hope some of you can help me out: I have A data frame called WWA that looks like the testframe underneath: Additionally, i have a testvector, containing coordinate IDs: testvector -c(503146,551154,557154)

[R] XYZ data

2013-06-26 Thread Shane Carey
I have x, y, z data. The x, y fields dont change but Z does. How do I add a very small number onto the end of each x, y data point. For example: Original (X) Original (Y) Original (Z) 15 20 30 15

Re: [R] 2nd question about adding an additional variable along certain criteria in a dataframe

2013-06-26 Thread Sarah Goslee
Hi, Using your testframe and testvector (and thank you for the convenient reproducible example): # I used NA instead of to be assigned testframe - data.frame(testframe, landuse = NA, stringsAsFactors=FALSE) # checks membership in testvector testframe[testframe$testcoordID %in% testvector,

Re: [R] help with plotmeans (gplots)

2013-06-26 Thread Blaser Nello
The formula in plotmeans compares vectors. This should work: data - unlist(data) times - rep(1:15, 100) plotmeans(data~times) Best, Nello -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Simone Gabbriellini Sent: Mittwoch, 26.

[R] Creating a matrix with an unknown variable

2013-06-26 Thread Jennifer Tickner
Hi all I'm trying to create a matrix, A, with an unknown variable delta. The code I have so far is: D-c(-1, -2/3, -1/3, 0, 1/3, 2/3, 1) A-matrix(NA,nrow=7,ncol=7) for (i in 1:7) { for (j in 1:7) { A[i,j]-exp(-((D[i]-D[j])/delta)^2) } } Of course, R comes up with an error message

Re: [R] Creating a matrix with an unknown variable

2013-06-26 Thread Blaser Nello
You have to define a function. For instance: Afct - function(delta){ D - c(-1, -2/3, -1/3, 0, 1/3, 2/3, 1) Dmat - matrix(D, nrow=7, ncol=7) Smat - Dmat-t(Dmat) A - exp(-(Smat/delta)^2) return(A) } Afct(2) Also try to avoid loops... Best, Nello

Re: [R] help with plotmeans (gplots)

2013-06-26 Thread David Carlson
Your data is probably not arranged correctly. See if this works for your data: # Creating a reproducible example set.seed(42) dat - matrix(rnorm(100*15, 5, 5)+rep(1:15, each=100), 15, 100, byrow=TRUE) str(dat) num [1:15, 1:100] 12.85 13 -2 8.98 16.67 ... require(gplots) # Rearranging dat

Re: [R] XYZ data

2013-06-26 Thread John Kane
mm - 1:10 nn - mm + .001 John Kane Kingston ON Canada -Original Message- From: careys...@gmail.com Sent: Wed, 26 Jun 2013 16:48:34 +0100 To: r-help@r-project.org Subject: [R] XYZ data I have x, y, z data. The x, y fields dont change but Z does. How do I add a very small

Re: [R] XYZ data

2013-06-26 Thread Clint Bowman
John, That still leaves a string of identical numbers in the vector. Shane, ?jitter perhaps jitter(X,1,0.0001) Clint Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE:

[R] Ifelse leading to inconsistent result

2013-06-26 Thread Neville O'Reilly
I have used ifelse in count variables to count the number of times in a simulation the values of a vector of logprice fall within mutually exclusive ranges. However, there is a double count in the result i.e. i am getting output indicating values falling in mutually exclusive ranges. Here is

Re: [R] Creating a matrix with an unknown variable

2013-06-26 Thread David Carlson
Another approach passing both D and delta: Afct - function(D, delta) exp(-(outer(D, D, -)/delta)^2) D - c(-1, -2/3, -1/3, 0, 1/3, 2/3, 1) Delta - 2 Afct(D, delta) - David L Carlson Associate Professor of Anthropology Texas AM University College Station, TX

Re: [R] XYZ data

2013-06-26 Thread Shane Carey
Nope, neither work. :-( On Wed, Jun 26, 2013 at 5:16 PM, Clint Bowman cl...@ecy.wa.gov wrote: John, That still leaves a string of identical numbers in the vector. Shane, ?jitter perhaps jitter(X,1,0.0001) Clint Clint BowmanINTERNET: cl...@ecy.wa.gov Air

Re: [R] R CMD BATCH Unicode

2013-06-26 Thread Ned Harding
So just to clarify - there is no way to use R CMD BATCH on windows with Unicode? Any advice of how to use R in a batch mode with Unicode inputs and outputs? Ned. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Prof Brian Ripley

Re: [R] XYZ data

2013-06-26 Thread Clint Bowman
perhaps x-x+0.1*seq(1,length(x)) Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 407-6815 PO Box 47600FAX:(360) 407-7534

Re: [R] XYZ data

2013-06-26 Thread arun
Hi, Not sure whether there is any pattern in adding the small number. dat1- read.table(text= X  Y Z 15   20  30 15   20  40 ,sep=,header=TRUE)

Re: [R] Ifelse leading to inconsistent result

2013-06-26 Thread Duncan Murdoch
On 26/06/2013 11:40 AM, Neville O'Reilly wrote: I have used ifelse in count variables to count the number of times in a simulation the values of a vector of logprice fall within mutually exclusive ranges. However, there is a double count in the result i.e. i am getting output indicating

Re: [R] Ifelse leading to inconsistent result

2013-06-26 Thread peter dalgaard
On Jun 26, 2013, at 17:40 , Neville O'Reilly wrote: I have used ifelse in count variables to count the number of times in a simulation the values of a vector of logprice fall within mutually exclusive ranges. However, there is a double count in the result i.e. i am getting output

Re: [R] R CMD BATCH Unicode

2013-06-26 Thread Jeff Newmiller
Just because the subject mentions R doesn't mean it is on topic here. This is more related to Windows than R. I recommend studying windows documentation for awhile. A quick search turned up a number of discussions on the web, including

Re: [R] Ifelse leading to inconsistent result

2013-06-26 Thread David Carlson
I don't see that you have set up mutually exclusive ranges. If we modify your code so save the maxlogP and minlogP values: niter = 1e5 # number of iterations is 10^5 CountLoss = rep(0,niter) CountProf = rep (0,niter) maxlogP - rep(0, ninter) minlogP - rep(0, ninter) set.seed(2009) # enables

Re: [R] Ifelse leading to inconsistent result

2013-06-26 Thread Neville O'Reilly
You are right, I inadvertently deleted part of the script - so I ended up with non-mutually exclusive regions. My apologies Neville O'Reilly, Ph.D Associate Director, Financial Statistics Risk Management, Rm 479 Hill Center, Rutgers University, 110 Freylinghuysen Rd., Piscataway, NJ 08854.

Re: [R] R CMD BATCH Unicode

2013-06-26 Thread Ned Harding
I have no problems with the windows command line. I don't need any Unicode there. It really is an internal R question because of the way R is reading and writing the input and output files. Ned. -Original Message- From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] Sent:

[R] Fitting a negative Gompertz model to data

2013-06-26 Thread amon
Hi, First: i have looked through previous posts but could get one related to my problem! I am trying to fit a negative gompertz curve in my data seems alright but the curve doesn't bend at the left (max asymptote)...see graph attached. Here is my code; EProb=read.table(ProbF.txt,header=TRUE)

[R] Thought you'd find this interesting

2013-06-26 Thread bett kimutai
Hi! I’ve just learned about the water crisis and thought you would be interested to check out this story: https://waterforward.charitywater.org/et/FF0wBx00 Let me know what you think! Thanks, bett -- Sent via WaterForward, an initiative of charity: water WaterForward, 387 Tehama

Re: [R] match rows of R

2013-06-26 Thread arun
Hi, Try:  roweqv- function(m,v) which(!is.na(match(interaction(as.data.frame(m),drop=TRUE),paste(v,collapse=. v- c(2,5,8) roweqv(m,v) #[1] 2 set.seed(24) m1-matrix(sample(1:15,3e5,replace=TRUE),ncol=3) v1- c(10,12,4)  system.time(res- roweqv(m1,v1))   # user  system elapsed   #0.132  

Re: [R] match rows of R

2013-06-26 Thread arun
This might also work: roweqv2- function(m,v){indx-1+Reduce(+,lapply(seq_len(ncol(m)),function(i) (2^i)*(m[,i]==v[i])))              which(indx==max(indx))}    roweqv2(m,v) #[1] 2  system.time(res2-roweqv2(m1,v1)) #   user  system elapsed   #0.008   0.000   0.008  identical(res,res2) #[1]

[R] pasting columns of a dataframe together

2013-06-26 Thread Anika Masters
I want to paste the contents of the first column of a dataframe with all the columns of the same dataframe. What is a good way to do this, perhaps something more elegant than what I have below. (My actual dataframe has ~400 columns and ~35000 rows.) example1: mydf - data.frame(

Re: [R] pasting columns of a dataframe together

2013-06-26 Thread Anika Masters
Given the size of my dataframe (400 columns, 35000 rows), I should have clarified that speed and efficiency is perhaps as important as elegance, and I'd like to use the examples to learn about any corrections and improvements I can make in the examples I provided. Thanks for any help you can

Re: [R] pasting columns of a dataframe together

2013-06-26 Thread Bert Gunter
Anika: 1. You do realize that all columns of your result will be character (even if they started out as numeric). 2. That being the case, all your data frame columns can be considered to be character to begin with. 3. That being the case, convert your data frame to a matrix: mdf - as.matrix(df)

Re: [R] [Rd] How can C++ read the R object written into socket with saveRDS or save

2013-06-26 Thread Simon Urbanek
On Jun 25, 2013, at 11:52 AM, Rong lI Li wrote: Hi, all, Recently, I met one issue when using socket between R C++ to transmit R object. Would you pls help give me some suggestions? Many thanks! [Background]: I create a socket connection between R C++ binary first, and then, want to

Re: [R] XYZ data

2013-06-26 Thread Aaron Mackey
for plotting purposes, I typically jitter() the x's and y's to see the otherwise overlapping data points -Aaron On Wed, Jun 26, 2013 at 12:29 PM, Shane Carey careys...@gmail.com wrote: Nope, neither work. :-( On Wed, Jun 26, 2013 at 5:16 PM, Clint Bowman cl...@ecy.wa.gov wrote: John,

Re: [R] XYZ data

2013-06-26 Thread David Winsemius
On Jun 26, 2013, at 5:04 PM, Aaron Mackey wrote: for plotting purposes, I typically jitter() the x's and y's to see the otherwise overlapping data points That is one method for relatively sparse data. Also availble are the use of transparent colors, 2d-density estimators, and binned hex

Re: [R] How to avoid overlapping labels

2013-06-26 Thread gregk
I ran into a similar problem and wrote a basic package that uses force field simulation to adjust object location. While much improvement is possible, including integration with ggplot, etc. it seems to get the task accomplished. The following illustrates the functionality. If someone runs into

[R] Image Gray Level Co-occurrence Matrix in R

2013-06-26 Thread ashz
Hi, I've been looking for Image Processing packages without success. I am mainly interested in image Gray Level Co-occurrence Matrix (GLCM) parameters like Contrast, Correlation, Energy, Homogeneity. Is there a package that can do it? Any ideas, comments, etc are welcome. Thanks. --

[R] unable to install rPython

2013-06-26 Thread Kaptue Tchuente, Armel
Hello everyone, I try without success to install the package rPython I get the message --- * installing *source* package ‘rPython’ ... could not locate python-config ERROR: configuration failed for package ‘rPython’ * removing

[R] Fw: Remove from mailing list

2013-06-26 Thread dinesh wadhwani
This has bounced back twice already - would help if anybody cna remove me from the list and close my account. I have been deleting 100s of emails daily from my yahoo inbox becaue i cannot get them to stop, even after i canceld  my account. my currnet status is that i have an account, but have

Re: [R] Fw: Remove from mailing list

2013-06-26 Thread David Winsemius
On Jun 26, 2013, at 7:37 PM, dinesh wadhwani wrote: This has bounced back twice already - would help if anybody cna remove me from the list and close my account. I have been deleting 100s of emails daily from my yahoo inbox becaue i cannot get them to stop, even after i canceld my

Re: [R] unable to install rPython

2013-06-26 Thread Pascal Oettli
Hello, You need to install python-devel. Regards, Pascal On 27/06/2013 12:24, Kaptue Tchuente, Armel wrote: Hello everyone, I try without success to install the package rPython I get the message --- * installing *source*