Re: [R] Strange data frame behavior

2012-09-24 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Raoni Rodrigues > Sent: Tuesday, September 25, 2012 7:22 AM > To: r-help@r-project.org > Subject: [R] Strange data frame behavior > > Hello all, > > I don't understand a str

Re: [R] Strange data frame behavior

2012-09-24 Thread Jeff Newmiller
This has nothing to do with data frames and everything to do with how factors behave. The levels of a factor are not necessarily linked with the content of the factor. For example, a factor representing "Male" and "Female" has both of those levels even if all the data in a subset represents "Ma

Re: [R] Memory usage in R grows considerably while calculating word frequencies

2012-09-24 Thread arun
HI, In the previous email, I forgot to add unlist(). With four paragraphs, sapply(strsplit(txt1," "),length) #[1] 4850 9072 6400 2071 #Your code: system.time({ txt1<-tolower(scan("text_file","character",sep="\n")) pattern <- "(\\b[A-Za-z]+\\b)" match <- gregexpr(pattern,txt1) words.txt <- regma

Re: [R] Memory usage in R grows considerably while calculating word frequencies

2012-09-24 Thread arun
HI, In a text file of 6834 words, I compared your program with a modified program. sapply(strsplit(txt1," "),length) #[1] 6834 #your program system.time({ txt1<-tolower(scan("text_file","character",sep="\n")) pattern <- "(\\b[A-Za-z]+\\b)" match <- gregexpr(pattern,txt1) words.txt <- regmatches(t

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Marius Hofert
Dear Paul, Thanks. Redrawing the points solves it for the minimal example, but what happens if you have plot(.., type="b") like below? Actually, originally I wanted to use just grid (without mixing it with base graphics), but I couldn't find an equivalent for plot(.., type="b"). Also, later on,

Re: [R] parallel

2012-09-24 Thread Marc Girondot
Le 25/09/12 05:35, Tjun Kiat Teo a écrit : Does the function parallel work for windows ? Tjun Kiat Try to reproduce these exemples and you will have your answer: http://max2.ese.u-psud.fr/epc/conservation/Girondot/Publications/Blog_r/Entrees/2012/8/25_First_steps_with_parallel_running.html

[R] Strange data frame behavior

2012-09-24 Thread Raoni Rodrigues
Hello all, I don't understand a strange behavior in data frame manipulation. data_frame1 = data.frame(Site = c("S1", "S2", "S3", "S4", "L1", "L2", "L3", "L4"), Number = c(1, 3, 5, 2, 1, 1, 2, 1)) data_frame2 = data_frame1 [data_frame1$Site != "S1", ] dput

[R] appropriate test in glm when the family is Gamma

2012-09-24 Thread 粕谷 英一
Dear R users, Which test is most appropriate in glm when the family is Gamma? In the help page of anova.glm, I found the following “For models with known dispersion (e.g., binomial and Poisson fits) the chi-squared test is most appropriate, and for those with dispersion estimated by moments

Re: [R] boxplot of different colors

2012-09-24 Thread Richard M. Heiberger
See ?panel.bwplot for pch="|". That explains that pch="|" puts horizontal lines instead of dots at the median(and also at the outliers). The rep makes it into a vector to be indexed by panel.bwplot.intermediate.hh in each of its calls to panel.bwplot The names under each plot are the levels of the

[R] boxplot of multi box color

2012-09-24 Thread Elaine Kuo
Hello, I want to draw a boxplot using 13 colors for 13 boxes. Each box represents a type of diet of birds. Y axis is the breeding range of the birds. I checked the previous r-help and found a possible solution. However, it did not work by showing "error in ncol(Diet_B)," Diet_B not found. Please

[R] parallel

2012-09-24 Thread Tjun Kiat Teo
Does the function parallel work for windows ? Tjun Kiat __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-

Re: [R] boxplot of different colors

2012-09-24 Thread Elaine Kuo
Hello Sarah, Thanks for the suggestion of table(obs.group). I checked it and found no problems of the obs.group. As for using dput(), please kindly share some examples to display the colored graph in r-help. In fact, some colors were assigned to all types of diets, like A=>red1 B=>red2 C=>green1

Re: [R] boxplot of different colors

2012-09-24 Thread Elaine Kuo
Hello Richard, Your answer is a great help to my problem. The boxplot of 13 colors is very beautiful :) By the way, I have three subsequent questions of your code 1. the meaning of pch=rep("|",13) I read the R manual but could not interpret the part. "pch" means the point type in plot, but here

Re: [R] Exactly Replicating Stata's Survey Data Confidence Intervals in R

2012-09-24 Thread Thomas Lumley
In the first and third examples it looks as though confint(svymean()) matches the totals and svyciprop(method="logit") matches the proportions, which is what Stata says (http://www.stata.com/statalist/archive/2006-10/msg01127.html). The agreement isn't perfect for the counts in the first example,

Re: [R] Adding textbox to multiple panels in lattice

2012-09-24 Thread Paul Murrell
Hi Here's a panel function that does what I think you want (NOTE that you need to load 'grid' for this to work) ... library(grid) panel.tpop <- function(x,y,...){ panel.grid(h=length(agegrs),v=5,col="lightgrey",lty=1) ls1 <<- list(...) y <<- y iFrame <- iEduDat[ls1$subscripts,

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Paul Murrell
Hi On 25/09/12 11:50, Marius Hofert wrote: Dear Paul, Thanks for helping. Is there a way to call grid() first? The problem seems to be that everything drawn before grid() is overplotted. No, but you can redraw the points ... require(grid) require(gridBase) pdf(file="Rplot.pdf", width=8, hei

Re: [R] passing a matrix from R to C code

2012-09-24 Thread Rui Barradas
Hello, Also, R uses doubles, not floats. Hope this helps, Rui Barradas Em 24-09-2012 23:27, Peter Langfelder escreveu: Erin, you seem to confuse R and C syntax a bit, among other things. See below. On Mon, Sep 24, 2012 at 3:03 PM, Erin Hodgess wrote: Dear R People: I'm working on a projec

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Marius Hofert
Dear Paul, Thanks for helping. Is there a way to call grid() first? The problem seems to be that everything drawn before grid() is overplotted. Cheers, Marius require(grid) require(gridBase) pdf(file="Rplot.pdf", width=8, height=8, onefile=FALSE) ## set up the grid layout plot.new() # star

[R] Memory usage in R grows considerably while calculating word frequencies

2012-09-24 Thread mcelis
I am working with some large text files (up to 16 GBytes). I am interested in extracting the words and counting each time each word appears in the text. I have written a very simple R program by following some suggestions and examples I found online. If my input file is 1 GByte, I see that R us

Re: [R] boxplot of different colors

2012-09-24 Thread Richard M. Heiberger
## I would do this in lattice using the panel.bwplot.intermediate.hh ## function from the HH package. ## install.packages("HH") ## if necessary library(HH) dataN <- data.frame(GE_distance=rnorm(260), Diet_B=factor(rep(1:13, each=20))) Diet.colors <- c("forestgreen", "darkgreen

Re: [R] boxplot of different colors

2012-09-24 Thread Sarah Goslee
Hi Elaine, Without a reproducible example it's impossible to say, but I'd take a hard look at: table(obs.group) If that doesn't give you some insight, a small reproducible example included in your email using dput() would allow us to answer you more effectively. Sarah On Mon, Sep 24, 2012 at 6

[R] Comparing x-intercepts between linear regression lines

2012-09-24 Thread Seth Munson
Is anyone familiar with a way to test for differences in the x-intercepts (not y-intercepts) of two simple linear regression lines in R? I'm familiar with a method to calculate standard error estimates of the x-intercept (http://www.mail-archive.com/r-help@r-project.org/msg50241.html), and ANCO

Re: [R] passing a matrix from R to C code

2012-09-24 Thread Peter Langfelder
Erin, you seem to confuse R and C syntax a bit, among other things. See below. On Mon, Sep 24, 2012 at 3:03 PM, Erin Hodgess wrote: > Dear R People: > > I'm working on a project that will pass a matrix from an R function to > a C subroutine. > > I tried to write the following: > > #include > #in

[R] boxplot of different colors

2012-09-24 Thread Elaine Kuo
Hello, I am making a boxplot of 13 boxes. I tried to color the box using 13 colors but failed. Only red and brown were displayed. Green, blue, and grey disappeared. Please kindly advise modification after checking the code below. Thank you in advance. Elaine R code # data input dataN <-read

[R] passing a matrix from R to C code

2012-09-24 Thread Erin Hodgess
Dear R People: I'm working on a project that will pass a matrix from an R function to a C subroutine. I tried to write the following: #include #include void lu1(int *n, float *a, float *b, float *ab) { int i,k,j,p,na=*n+10; float sum, l[200][200],u[200][200]z[200]; for(i=0;i0;i

Re: [R] Confused by code?

2012-09-24 Thread Rui Barradas
I've just reread my answer and it's not very clear. Not at all. Inline. Em 24-09-2012 18:34, Rui Barradas escreveu: Hello, Inline. Em 24-09-2012 15:31, Bazman76 escreveu: Thanks Rui Barrudas and Peter Alspach, I understand better now: x<-matrix(c(1,0,0,0,2,0,0,0,2),nrow=3) y<-matrix(c(7,8,9

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Paul Murrell
Hi On 24/09/12 18:06, Marius Hofert wrote: Dear Paul, Thank you for helping. This works great. I then tried to put in a grid (via grid()). Why does that fail? Because grid() is used to add lines to an existing plot; just put the grid() call AFTER the plot() call and it should work ok. Pa

[R] Install of R-2.15.1 for Windows (64 bit) on application server

2012-09-24 Thread dthomas
Hi, I'm looking to install ‘R’ on an application server which we can give plenty of resource to, and actually run the program from a terminal server. Do you know if this is possible, and if so are there any special installation instructions required? Many thanks, D -- View this message in co

[R] Deldir() Thiessen Polygons Problem

2012-09-24 Thread Lucas Chaparro
Good evening to all. I find myself trying to create some Thiessen Polygons, in order to finish a meteorology research. This is the script I found to create the Polygons: * * *voronoipolygons <- function(x) {* * require(deldir)* * if (.hasSlot(x, 'coords')) {* *crds <- x@coords * *} else

Re: [R] Confused by code?

2012-09-24 Thread Rui Barradas
Hello, Inline. Em 24-09-2012 15:31, Bazman76 escreveu: Thanks Rui Barrudas and Peter Alspach, I understand better now: x<-matrix(c(1,0,0,0,2,0,0,0,2),nrow=3) y<-matrix(c(7,8,9,1,5,10,1,1,0),nrow=3) z<-matrix(c(0,1,0,0,0,0,6,0,0),nrow=3) x[z]<-y[z] viewData(x) produces an x matrix 7

Re: [R] POSIXct coerced into numeric when filling a data frame

2012-09-24 Thread arun
Hi, You can also try this:  x1<-list(a=data.frame(x[["a"]]),b=data.frame(x[["b"]])) library(plyr) x2<-do.call(rbind.fill,x1) colnames(x2)<-c("a","b") x2first<-subset(x2,format(a,"%Y-%m-%d")=="2011-10-30" )  x2second<-subset(x2,format(b,"%Y-%m-%d")=="2011-10-30" ) y<-data.frame(t(data.frame(a=x2fir

Re: [R] Exactly Replicating Stata's Survey Data Confidence Intervals in R

2012-09-24 Thread Anthony Damico
Hi Dr. Lumley, you're obviously correct about all of that. Thank you for cluing me into it! And sorry for overlooking that part of the documentation. I'm unfortunately still struggling with matching numbers exactly, and I foolishly provided a dataset without a weight variable - thinking there wa

Re: [R] add lowess predicted line to scatter plot

2012-09-24 Thread Greg Snow
Is GNI sorted? if not then the lines function plots the line segments to the points in the order given and that would explain part of the strangeness (the png file did not make it through). Are there gaps between the GNI values? even if GNI is sorted, your code below will just draw line segments

[R] problems with function geese in geepack

2012-09-24 Thread André Gabriel
Hi, In my research I am studying the marginal models, where the main goal is on the structure of the association. My practical example has cluster with up to 600 observations and with this database, the function geese() return me the following message: This application has requested the r

Re: [R] POSIXct coerced into numeric when filling a data frame

2012-09-24 Thread arun
Hi, Upon running your code, the "y" I am getting is: y #  ID  first second #1  a 1320003900 1320004800 #2  b 1320003000 1320003900 This you can convert back by: within(y,{first<-as.POSIXct(first,origin="1970-01-01");second<-as.POSIXct(second,origin="1970-01-01")}) #  ID   first

Re: [R] [ reached getOption("max.print") -- omitted 138 rows]

2012-09-24 Thread eliza botto
thnx sarah, it was options(max.print=100) regards eliza > Date: Mon, 24 Sep 2012 13:14:30 -0400 > Subject: Re: [R] [ reached getOption("max.print") -- omitted 138 rows] > From: sarah.gos...@gmail.com > To: eliza_bo...@hotmail.com > CC: r-help@r-project.org > > ?options will tell you how

[R] Rolling Correlations with Multiple Data Points per Month

2012-09-24 Thread kobysf
I have a table with approximately 1000 actual stock returns and forecasted stock returns per month. I want to calculate rolling correlations for rolling 12-month periods. All of the rolling correlation solutions I've seen are for cases where there is just one row per time period. How can I do th

Re: [R] [ reached getOption("max.print") -- omitted 138 rows]

2012-09-24 Thread Sarah Goslee
?options will tell you how to access and set the max.print option, and all the other options that R has. Sarah On Mon, Sep 24, 2012 at 1:08 PM, eliza botto wrote: > > Dear useRs, > does anyonw now how to avoid [ reached getOption("max.print") -- omitted 138 > rows]. i read from the R forum that

Re: [R] List creation based on matrix

2012-09-24 Thread benrgillespie
Thanks - not sure why it came through scrambled. This has now been solved - thanks for your help, Ben Gillespie Research Postgraduate School of Geography University of Leeds Leeds LS2 9JT Tel: +44(0)113 34 33345 Mob: +44(0)770 868 7641 http://www.geog.leeds.ac.uk/ __

Re: [R] converting 3D array to a data-frame (with coordinate-columns x, y, z)

2012-09-24 Thread frauke
Hi Martin, did you ever find a solution? I have the a similar problem because I want to do a regression where the independent and dependent variables are matrices of measurements. I can run loops to make each matrix one very long vector, but I m looking for a more elegant solution. Thank you! F

[R] R Interview Request

2012-09-24 Thread Brock Palen
I am one half of the RCE podcast (www.rce-cast.com). We would like to feature R on the show, We would like a dev or two for about an hour on the phone or skype to chat about R its history and general information for an HPC/RC focused crowed. Feel free to contact me off list if you would like

Re: [R] Confused by code?

2012-09-24 Thread Bazman76
Thanks Rui Barrudas and Peter Alspach, I understand better now: x<-matrix(c(1,0,0,0,2,0,0,0,2),nrow=3) y<-matrix(c(7,8,9,1,5,10,1,1,0),nrow=3) z<-matrix(c(0,1,0,0,0,0,6,0,0),nrow=3) x[z]<-y[z] viewData(x) produces an x matrix 7 0 0 0 2 0 0 10 2 which makes sense the first el

[R] R for commercial use

2012-09-24 Thread Zastko,Samuel ALB co-mw
Hi everyone, want to use R in our company but have to complete an intern questionnaire first. Can anyone help? Thanks in advance! Here the questions I’m not sure about: 1. Is R a Clientsoftware / Serversoftware / Systemsoftware? 2. Does R need a “chellenge-response” treatment for activat

[R] [ reached getOption("max.print") -- omitted 138 rows]

2012-09-24 Thread eliza botto
Dear useRs, does anyonw now how to avoid [ reached getOption("max.print") -- omitted 138 rows]. i read from the R forum that it can be avoided by increasing the 'max.print' option as much as i like, but i dnt know, how?? need your help on it. regards eliza

Re: [R] POSIXct coerced into numeric when filling a data frame

2012-09-24 Thread jim holtman
Try this; does away with the 'for', but have to convert back to POSIXct since sapply strips off the class: > x<-list() > x[["a"]]<-as.POSIXct(c("2011-08-27 10:45:00 GMT", "2011-10-30 15:45:00 GMT", > "2011-10-30 16:00:00 GMT", "2012-06-22 09:30:00 GMT", "2012-06-22 10:00:00 > GMT")) > x[["b"]]<

Re: [R] knnFinder Package

2012-09-24 Thread Uwe Ligges
On 24.09.2012 18:40, Gyanendra Pokharel wrote: What is the newest version of package knnFinder? because it was removed from the CRAN repository. Actually it has been archived. There are typically reasons for it (e.g. not passing the checks any more). http://cran.r-project.org/web/packag

Re: [R] Latitude Longitude to SPDF

2012-09-24 Thread Bert Gunter
You might wish to post on the R-sig-geo list instead if you are involved with spatial data. -- Bert On Mon, Sep 24, 2012 at 8:02 AM, Bhupendrasinh Thakre wrote: > Hi Team, > > Need your guidance in building SPDF objects from Latitude, Longitude > Information available. > I am using package "plo

Re: [R] List creation based on matrix

2012-09-24 Thread Benjamin Gillespie
Great, thanks, Ben Gillespie Research Postgraduate School of Geography University of Leeds Leeds LS2 9JT Tel: +44(0)113 34 33345 Mob: +44(0)770 868 7641 http://www.geog.leeds.ac.uk/ From: Jeff Newmiller [jdnew...@dcn.davis.ca.us] Sent: 24 September 2012 1

[R] Latitude Longitude to SPDF

2012-09-24 Thread Bhupendrasinh Thakre
Hi Team, Need your guidance in building SPDF objects from Latitude, Longitude Information available. I am using package "plotGoogleMaps" which is really awesome but it requires SPDF objects to build the maps. I have a data frame which have Latitude and Longitude information and wanted to convert i

[R] POSIXct coerced into numeric when filling a data frame

2012-09-24 Thread Arnaud Duranel
A.K., many thanks for your reply. I have realised there was a mistake in my code, and that the example could have been clearer; my apologies for this, the corrected code is below: > x<-list() > x[["a"]]<-as.POSIXct(c("2011-08-27 10:45:00 GMT", "2011-10-30 15:45:00 GMT", "2011-10-30 16:00:00 GM

[R] stop on rows where !is.na(mydata$ti_all)

2012-09-24 Thread Eric Fail
Dear R experts, I got help to build a loop but there is a bug inside it that causes one part of the mechanism to fail. It should grow once, but if keep growing on rows where $ti_all is not NA. Here is a wall of code that very crudely demonstrates the problem, there is a couple of dim() outputs a

Re: [R] List creation based on matrix

2012-09-24 Thread arun
Hi, Couldn't find your attachment. But, from Nabble, I saw the data. Try this:dat1<-data.frame(Species=paste0("Species",1:6),Site1=c(5,NA,4,NA,3,NA),Site2=c(4,NA,4,4,NA,4),Site3=c(NA,5,NA,NA,NA,NA),Site4=c(NA,NA,NA,6,5,NA)) dat2<-melt(dat1) dat3<-dat2[!is.na(dat2$value),] dat3<-dat3[,1:2] colname

Re: [R] Rows not common in dataframes

2012-09-24 Thread arun
Hi, Try this: set.seed(1)  Dataframe_A<-data.frame(x=sample(1:10,5,replace=TRUE),y=rnorm(5,15))  set.seed(1)  Dataframe_B<-data.frame(x=sample(3:15,6,replace=TRUE),z=rnorm(6,10))  Dataframe_A[!Dataframe_A[[1]] %in% Dataframe_B[[1]],] # Milan's code had ...B[[2]] #or subset(Dataframe_A,!x%in%Data

Re: [R] serial subtraction within a vector

2012-09-24 Thread arun
Hi, #Just to add:  v<-c(3,5,8,4,9)  diff(v) #[1]  2  3 -4  5 #if it is a dataframe, v1<-as.data.frame(v)  lapply(v1,diff) apply(v1,2,diff) A.K. - Original Message - From: Jorge I Velez To: Hermann Norpois Cc: r-help@r-project.org Sent: Monday, September 24, 2012 8:19 AM Subject: Re:

Re: [R] POSIXct coerced into numeric when filling a data frame

2012-09-24 Thread arun
HI, Try this: dat1<-do.call(data.frame,x) dat1<-data.frame(ID=letters[1:4],dat1) dat1 #  ID   first  second #1  a 2011-08-27 10:45:00 2011-08-27 11:00:00 #2  b 2011-10-30 15:45:00 2011-10-30 15:30:00 #3  c 2011-10-30 16:00:00 2011-10-30 15:45:00 #4  d 2012-06-22 09:30:00 201

[R] Problem with R script

2012-09-24 Thread Woo Back Lee
To whom I concern, I am a recent user of program R I do not know how to explain this but after I installed the program the words on the scrpit does R console does not appear clear but something square(?)/Cube(?) which seems like the words are broken More suprisingly, the squared words are writte

Re: [R] Script to count unique values from two linked matricies

2012-09-24 Thread benrgillespie
Richness should look like this: -- View this message in context: http://r.789695.n4.nabble.com/Script-to-count-unique-values-from-two-linked-matricies-tp4643979p4644004.html Sent from the R help mailing list archive at Nabble.co

Re: [R] List creation based on matrix

2012-09-24 Thread Rui Barradas
Hello, Like this your data example is unusable, how can we reproduce it? Please use dput() to post data. Example: # Make up some data. x <- data.frame(A = letters[1:5], X = 1:5) # Paste the output of this in a post dput(x) structure(list(A = structure(1:5, .Label = c("a", "b", "c", "d", "e"), c

[R] Adding textbox to multiple panels in lattice

2012-09-24 Thread Erich Strießnig
Dear R-users, I am trying to add some text in a textbox to all panels in the following example file. Using the panel-function, I can add a white rectangle with panel.rect but then I have to fit in the text into the box by hand and it will not automatically be centered. Does anyone know how to add

Re: [R] Script to count unique values from two linked matricies

2012-09-24 Thread PIKAL Petr
Hi I have no access to Nabble so it is difficult to understand what do you want. > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of benrgillespie > Sent: Monday, September 24, 2012 1:47 PM > To: r-help@r-project.org > Subject: [

Re: [R] List creation based on matrix

2012-09-24 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of benrgillespie > Sent: Monday, September 24, 2012 1:20 PM > To: r-help@r-project.org > Subject: [R] List creation based on matrix > > Hi guys, > > It would be great if you co

Re: [R] List creation based on matrix

2012-09-24 Thread Benjamin Gillespie
Hi Arun, I've just run through that - thanks so much, it worked perfectly. Learnt lots of new commands too :) Thanks for all your help - awesome! ps. the only thing I changed was to remove the '0' from the first line after 'paste'. Ben Gillespie Research Postgraduate School of Geography Univ

Re: [R] How to Write a Model in R that has the Log taken of the Intercept

2012-09-24 Thread PIKAL Petr
Hi I do not understand your point. actually lm(y~x) is the same as lm(y~x+1) You can specify a model without intercept by lm(y~x-1) you can even do lm(y~log(x)) But log(intercept) does not have sense. You will get an intercept which is a number and you can consider it log(intercept) exp(

Re: [R] add lowess predicted line to scatter plot

2012-09-24 Thread Hasan Diwan
Instead of attachments, put the out On 24 September 2012 01:58, Maximilian Lklweryc wrote: > Hi, > I have a scatter plot of the variables GNI and Lifeexp (Gross National > Income and Life Expectancy, both metric). So I plotted them and I want to > add a regression line and a lowess line. I use lo

[R] Estimated covariance matrix with tgp package

2012-09-24 Thread Jochen Fiedler
Hello everyone, at the moment I'm using the tgp package for modelling a nonstationary data set on a two dimensional area D and I'm interested in the prediction and the estimated covariance matrix. For this purpose I'm using the function btgp. As far as I understand, btgp uses a MCMC algorithm

Re: [R] Rows not common in dataframes

2012-09-24 Thread Rui Barradas
Hello, See also ?setdiff Hope this helps, Rui Barradas Em 24-09-2012 08:30, Milan Bouchet-Valat escreveu: Le lundi 24 septembre 2012 à 13:22 +1000, Chintanu a écrit : Hi, I have two dataframes (Dataframe_A, Dataframe_B) with the same no. of columns. The first column of both the dataframes co

Re: [R] serial subtraction within a vector

2012-09-24 Thread Jorge I Velez
?diff HTH, Jorge.- On Mon, Sep 24, 2012 at 9:00 PM, Hermann Norpois wrote: > Hello, > > I have a vector (numeric) v-> c(a,b,c,d,e) and I want to create the vector > n->c(b-a,c-b,d-c,e-d). How can I do that? > > > Thank you > Hermann > > [[alternative HTML version deleted]] > > _

Re: [R] serial subtraction within a vector

2012-09-24 Thread PIKAL Petr
Hi I suppose you want diff(v) Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Hermann Norpois > Sent: Monday, September 24, 2012 1:01 PM > To: r-help@r-project.org > Subject: [R] serial subtraction within a v

Re: [R] List creation based on matrix

2012-09-24 Thread PIKAL Petr
Hi Your attachment came scrambled. Something wrong with dput? anyway having > mat<-matrix(1:6, 3,2) > df<-as.data.frame(mat) >df$species<-letters[1:3] > df V1 V2 species a 1 4 a b 2 5 b c 3 6 c > library(reshape) > melt(df, id="species") species variable value 1

[R] R on a cluster head node and memory limits

2012-09-24 Thread Sean Davis
On our local cluster, users relatively routinely crash the head node by doing simple and silly things that inadvertently eat all memory and crash the head node. I read a bit about memory limits, but I am still a bit unclear as to whether memory limits can be imposed a the R level under linux. Cur

Re: [R] serial subtraction within a vector

2012-09-24 Thread Rui Barradas
Hello, Try diff(v) Hope this helps, Rui Barradas Em 24-09-2012 12:00, Hermann Norpois escreveu: Hello, I have a vector (numeric) v-> c(a,b,c,d,e) and I want to create the vector n->c(b-a,c-b,d-c,e-d). How can I do that? Thank you Hermann [[alternative HTML version deleted]] __

[R] Script to count unique values from two linked matricies

2012-09-24 Thread benrgillespie
I hope you can help with this one. I have two matricies: 1. A species abundance matrix: 2. A species trait score matrix: The trait matrix lists trait scores for

[R] serial subtraction within a vector

2012-09-24 Thread Hermann Norpois
Hello, I have a vector (numeric) v-> c(a,b,c,d,e) and I want to create the vector n->c(b-a,c-b,d-c,e-d). How can I do that? Thank you Hermann [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailm

[R] List creation based on matrix

2012-09-24 Thread benrgillespie
Hi guys, It would be great if you could help me with this one... I'm looking to create a script to convert a matrix of species abundance e.g: into two vectors e.g:

Re: [R] List creation based on matrix

2012-09-24 Thread Benjamin Gillespie
Please see the attached .csv files for further info, Thanks guys, Ben Gillespie Research Postgraduate School of Geography University of Leeds Leeds LS2 9JT Tel: +44(0)113 34 33345 Mob: +44(0)770 868 7641 http://www.geog.leeds.ac.uk/ From: PIKAL Petr [pet

Re: [R] Script to count unique values from two linked matricies

2012-09-24 Thread Benjamin Gillespie
Hi Petr, Please see the attached .csv files - perhaps these will help, Thanks, Ben Gillespie Research Postgraduate School of Geography University of Leeds Leeds LS2 9JT Tel: +44(0)113 34 33345 Mob: +44(0)770 868 7641 http://www.geog.leeds.ac.uk/ From: P

Re: [R] creating new variable

2012-09-24 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Niklas Fischer > Sent: Thursday, September 20, 2012 11:13 PM > To: r-help@r-project.org > Subject: [R] creating new variable > > Dear R-helper > > I have a data which is ab

Re: [R] Script to count unique values from two linked matricies

2012-09-24 Thread benrgillespie
Note, trait richness would be 5 and not 4 at site 1 perfectly demonstrating why I want to create a script rather than manually count! -- View this message in context: http://r.789695.n4.nabble.com/Script-to-count-unique-values-from-two-linked-matricies-tp4643979p4643980.html Sent from the

[R] add lowess predicted line to scatter plot

2012-09-24 Thread Maximilian Lklweryc
Hi, I have a scatter plot of the variables GNI and Lifeexp (Gross National Income and Life Expectancy, both metric). So I plotted them and I want to add a regression line and a lowess line. I use lowess and not loess because I have missing values. My code: plot(GNI,Lifeexp) abline(lm(Lifeexp~GNI),

Re: [R] correlating matrices

2012-09-24 Thread PIKAL Petr
Hi before you can use predict you need to do lm(whatever.). If you used lm(whatever., na.action=na.exclude) predict will give you results with correctly placed NA values. Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project

Re: [R] eval and tcltk : target of assignment expands to non-language object

2012-09-24 Thread peter dalgaard
On Sep 24, 2012, at 10:27 , vincent guyader wrote: > Hi everyone, > > I have a problem to assign a value with tcl/tk Not really. You'll get into the same sort of trouble if you try other kinds of complex assignments: > a <- 1:2 > eval(as.name("a"))[[1]] [1] 1 > eval(as.name("a"))[[1]] <- 3 Er

[R] eval and tcltk : target of assignment expands to non-language object

2012-09-24 Thread vincent guyader
Hi everyone, I have a problem to assign a value with tcl/tk ths is the code ( it should be simple to understand) : library(tcltk) valA<-tclVar("0") valB<-tclVar("0") valC<-tclVar("0") id<-"A" out<-"1" out2<-"2" print(paste("tclvalue(val",id,")",sep="")) # ok print(as.name(paste("tclvalue(val",

Re: [R] Confused by code?

2012-09-24 Thread Rui Barradas
Hello, It is pretty basic, and it is deceptively simple. The worst of all :) When you index a matrix 'x' by another matrix 'z' the index can be a logical matrix of the same dimensions or recyclable to the dims of 'x', it can be a matrix with only two columns, a row numbers column and a column

Re: [R] Regression Problem

2012-09-24 Thread Jeff Newmiller
What is it you think as.numeric accomplishes for you? A reproducible example as requested in the posting guide might clarify. Making factors and leaving them that way seems more productive. --- Jeff Newmiller

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-24 Thread Jeff Newmiller
Same reason. grid() is part of base graphics, which are incompatible with grid graphics. Perhaps you want grid.grill(), which you could find out about in the grid graphics vignette mentioned earlier. --- Jeff Newmiller

[R] POSIXct coerced into numeric when filling a data frame

2012-09-24 Thread Arnaud Duranel
Hello I have a list of POSIXct objects, from which I want to extract those values that match a specific date, keeping them in POSIXct format. For a specific date there is 0-2 matching values. As an example (the actual list and objects are much longer): x<-list() x[["first"]]<-as.POSIXct(c("2011

Re: [R] Return level plots

2012-09-24 Thread R. Michael Weylandt
Hi Michelle, Please cc the list on your replies so others (far more knowledgeable than I) can answer. On Mon, Sep 24, 2012 at 12:12 AM, Michelle Cipullo wrote: >>> I am doing some extreme value analysis on model output (WRF) which have the >>> following dimensions: >>> >>> speed(time,lat,lon) >>

Re: [R] Regression Problem

2012-09-24 Thread Milan Bouchet-Valat
Le lundi 24 septembre 2012 à 11:25 +0530, Vignesh Prajapati a écrit : > Hello all, > > I am new to R, I am learning regression and logistic modeling > with categorical predictor variables, when there is only one predictor > categorical variable i can use as.numeric() but when more than t

Re: [R] Rows not common in dataframes

2012-09-24 Thread Milan Bouchet-Valat
Le lundi 24 septembre 2012 à 13:22 +1000, Chintanu a écrit : > Hi, > > I have two dataframes (Dataframe_A, Dataframe_B) with the same no. of > columns. The first column of both the dataframes contains unique names. > I wish to have Dataframe_A with the rows that are NOT common to > Dataframe_B. So