Re: [R] Dimension of quantile function output

2016-01-22 Thread ruipbarradas
Hello, Maybe something like the following. temp2 <- cbind(temp[[3]][, 1], temp[[3]][, 2]) str(temp2) Hope this helps, Rui Barradas   Citando Jun Shen : > Dear list, > > Say I have some quantile operation like this > > data.frame(ID=rep(1:10,each=10),CONC=runif(100)) ->

Re: [R] aggregate and the $ operator

2016-01-22 Thread Ed Siefker
So that's how that works! Thanks. On Fri, Jan 22, 2016 at 1:32 PM, Joe Ceradini wrote: > Does this do what you want? > > aggregate(Nuclei ~ Slide, example, sum) > > On Fri, Jan 22, 2016 at 12:20 PM, Ed Siefker wrote: >> >> Aggregate does the right

[R] tcltk table "validateCommand"

2016-01-22 Thread Dalthorp, Daniel
I'd like to allow users to edit data in tcltk tables and to use vcmd to validate data entry, e.g., not allowing non-numbers to be entered in numeric cells and not allowing '\n' to be entered in text cells. The problem is that I can't figure out how to "see" their data entry before it is entered,

Re: [R] aggregate and the $ operator

2016-01-22 Thread William Dunlap via R-help
Using column names where you used column numbers would work: example <- data.frame( check.names = FALSE, Nuclei = c(133L, 96L, 62L, 60L), `Positive Nuclei` = c(96L, 70L, 52L, 50L), Slide = factor(c("A1", "A1", "A2", "A2"), levels = c("A1", "A2"))) aggregate(example["Nuclei"],

[R] Dimension of quantile function output

2016-01-22 Thread Jun Shen
Dear list, Say I have some quantile operation like this data.frame(ID=rep(1:10,each=10),CONC=runif(100)) -> test lapply(c('mean','sd','quantile'), function(x) aggregate(test['CONC'],by=test['ID'],FUN=x)) -> temp The output temp is a list of three elements. I would like to merge the three

Re: [R] aggregate and the $ operator

2016-01-22 Thread Joe Ceradini
Does this do what you want? aggregate(Nuclei ~ Slide, example, sum) On Fri, Jan 22, 2016 at 12:20 PM, Ed Siefker wrote: > Aggregate does the right thing with column names when passing it > numerical coordinates. > Given a dataframe like this: > > Nuclei Positive Nuclei

Re: [R] Error opening SHP file

2016-01-22 Thread David Winsemius
> On Jan 22, 2016, at 9:24 AM, Amoy Yang via R-help > wrote: > > This is the results that addresses David's advice. >> library(maptools) >> library(maps) >> state.map <- readShapeSpatial("maps/st24_d00.shp") > Error in getinfo.shape(fn) : Error opening SHP file >> # David

Re: [R] getting values from php or javascript

2016-01-22 Thread Jeff Newmiller
There are ways, but most likely you will not be satisfied with such a monster. Try the maptools package or the Analysis of Spatial Data Task View [1]. [1] https://cran.r-project.org/web/views/Spatial.html -- Sent from my phone. Please excuse my brevity. On January 22, 2016 1:18:45 AM PST,

[R] aggregate and the $ operator

2016-01-22 Thread Ed Siefker
Aggregate does the right thing with column names when passing it numerical coordinates. Given a dataframe like this: Nuclei Positive Nuclei Slide 1133 96A1 2 96 70A1 3 62 52A2 4 60 50A2 I can call 'aggregate'

Re: [R] aggregate and the $ operator

2016-01-22 Thread David Wolfskill
On Fri, Jan 22, 2016 at 01:20:59PM -0600, Ed Siefker wrote: > Aggregate does the right thing with column names when passing it > numerical coordinates. > Given a dataframe like this: > > Nuclei Positive Nuclei Slide > 1133 96A1 > 2 96 70A1 > 3 62

Re: [R] Logical operator in R

2016-01-22 Thread li li
I see. Thanks! 2016-01-22 10:57 GMT-05:00 Rmh : > FAQ 7.31 > > in this case subtract the two numbers and see that > they differ by about 1e-16 > > Sent from my iPhone > > > On Jan 22, 2016, at 10:46, li li wrote: > > > > Hi all, > > I encountered the

Re: [R] tcltk tkwidget(..."table")

2016-01-22 Thread Dalthorp, Daniel
Thanks, Adrian...the discussions about R bindings to Tcl and Tk look very helpful! -Dan On Fri, Jan 22, 2016 at 2:49 AM, Adrian Waddell wrote: > I have written some content about the R bindings to Tcl and Tk: > > http://waddella.github.io/loon/learn_R_tcltk.html > >

Re: [R] tcltk tkwidget(..."table")

2016-01-22 Thread peter dalgaard
Good pointers, although R bindings document is not quite getting into the really messy bits. I think Daniel may be at a point where he needs to study the code snippets that he has got to work and figure out why and how they work. The help(TclInterface) page is the most definitive

[R] getting values from php or javascript

2016-01-22 Thread Alaios via R-help
Dear all,I would like to execute some php or javascripts I found on the web. see at middle of this page towards bottom http://www.howtocreate.co.uk/php/gridref.php#samples Is there any way I can call the php function for example directly from R? I would like to thank you in advance for your

[R] calculating functional complimentarity

2016-01-22 Thread pushan chakraborty
hi group How 'functional complimentarity' of a bipartite network can be calculated using the package 'bipartite' -- Pushan Chakraborty CSIR - SRF Center for Pollination Studies, University of Calcutta 35, Ballyguanje Circular Road, Kolkata - 700019 & Wildlife Institute of India

Re: [R] Lists heading in an array of lists in R

2016-01-22 Thread Dénes Tóth
Hi, Provide a list of a list in the second assignment: -- TunePar <- matrix(list(NULL), 2, 2) TunePar[2,1] <- list(list(G = 2)) TunePar[2,1] TunePar[2,1][[1]]$G TunePar[[2]]$G --- The point is that "[" returns the list element of the same level as the original object (TunePar in the present

Re: [R] use gcheckbox in gWidgets to switch on/off gframe

2016-01-22 Thread Rolf Fankhauser
Hi Tonja Maybe I wasn't clear in my last post. This is the code: library(gWidgetstcltk) library(gWidgets) options(guiToolkit="tcltk") Population <- c("A","B","C","D","E","F") w = gwindow("") g1 = ggroup(horizontal = F, cont=w) g2 = ggroup(horizontal = T, cont=g1) glabel("Population:", cont=g2)

Re: [R] tcltk tkwidget(..."table")

2016-01-22 Thread Adrian Waddell
I have written some content about the R bindings to Tcl and Tk: http://waddella.github.io/loon/learn_R_tcltk.html And the pack geometry manager http://adrian.waddell.ch/EssentialSoftware/Rtcltk_geometry.pdf But if you have no experience with building graphical user interfaces then you might

Re: [R] Error opening SHP file

2016-01-22 Thread Amoy Yang via R-help
Let me just make this case simple and quick to address what I need. Giving a data-file that includes tow columns: zip5 and population. How do I put pop (colored with different segments) by zips (with boundary) on the USA map with R? Amoy On Friday, January 22, 2016 12:45 PM, David

Re: [R] Error opening SHP file

2016-01-22 Thread boB Rudis
Look at the choroplethr package. On Fri, Jan 22, 2016 at 5:31 PM, Amoy Yang wrote: > Let me just make this case simple and quick to address what I need. > > Giving a data-file that includes tow columns: zip5 and population. How do I > put pop (colored with different segments)

Re: [R] Lists heading in an array of lists in R

2016-01-22 Thread Duncan Murdoch
On 22/01/2016 2:29 AM, TJUN KIAT TEO wrote: I am trying to populate an array of lists in R . Here is my code TunePar<-matrix(list(Null),2,2) TunePar[1,1]=list(G=2) But when I type TunePar[1,1,], all I get is 2. The G has disappeared. why? If I do this Test=list(G=2) Test $G [1] 2

[R] Sorting a Data Frame

2016-01-22 Thread Robert Sherry
In R, I run the following commands: df = data.frame( x=runif(10), y=runif(10) ) df2 = df[order(x),] The first, as I would expect, creates a data frame with two columns and 10 rows. I expect the second to sort the data based upon the columns x and produce a new data frame, df2, with the

[R] Constrained Poisson model / Bayesian Poisson model

2016-01-22 Thread mara . pfleiderer
Hi all, I am dealing with a problem about my linear Poisson regression model (link function=identity). I am using the glm()-function which results in negative coefficients, but a negative influence of the regressors wouldn't make sense. (i) Is there a possibility to set constraints on

Re: [R] Shift all values above certain value by 1

2016-01-22 Thread Dimitri Liakhovitski
I think I got it: set.seed(123) x <- data.frame(a = 1:10, b = 2:11, c = 3:12, other = rnorm(10)) x temp <- as.matrix(x[1:3]) temp[temp %in% 7] <- 4 temp[temp > 7] <- temp[temp > 7]-1 x[1:3] <- temp x It works only with matrices, right? Can't do x[x>7] when x is a data frame? Thanks! On Fri, Jan

Re: [R] Updating a Time Series After Forecast()

2016-01-22 Thread Paul Gilbert
Lorenzo Berend's suggestion may be the simplest if you have univariate ts style series. If you are writing code and you want it to work with multivariate series and other time representations then you might want to consider the splice() function in package tframe. library(tfplot) ts3 <-

Re: [R] Logical operator in R

2016-01-22 Thread Rick Bilonick
On 01/22/2016 10:46 AM, li li wrote: Hi all, I encountered the following strange phenomenon. For some reason, the obs_p[1] and res1$st_p[89] have the same value but when I run "==", it returns FALSE. Can anyone help give some explanation on this? Thanks very much! Hanna obs_p[1]

[R] pgmm error message, Error in terms.default(formula) : no terms component nor attribute

2016-01-22 Thread Xin Shi
Dear I try to use pgmm to estimate dynamic model for panel data. I got the message below. It is appreciate that you could help on this. data<-read.csv("G:/MMU/Research/Urbanlisation/paneldata.csv",sep=",", header=TRUE) library(plm) library(Formula) urban<-pdata.frame(data,

Re: [R] Logical operator in R

2016-01-22 Thread Bert Gunter
FAQ 7.31 -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Jan 22, 2016 at 7:46 AM, li li wrote: > Hi all, > I

Re: [R] Error opening SHP file

2016-01-22 Thread Barry Rowlingson
We can duplicate the error by giving a path to a non-existent shapefile, which is probably the original problem: > require(maptools) Loading required package: maptools Loading required package: sp Checking rgeos availability: TRUE > foo=readShapeSpatial("fnord.shp") Error in getinfo.shape(fn) :

[R] Logical operator in R

2016-01-22 Thread li li
Hi all, I encountered the following strange phenomenon. For some reason, the obs_p[1] and res1$st_p[89] have the same value but when I run "==", it returns FALSE. Can anyone help give some explanation on this? Thanks very much! Hanna > obs_p[1] [1] 0.002201438 > res1$st_p[89] [1]

Re: [R] Logical operator in R

2016-01-22 Thread Fábio Magalhães
Hi, This can get you started: https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f --Fabio On Fri, Jan 22, 2016 at 1:46 PM, li li wrote: > Hi all, > I encountered the following strange phenomenon. > For some reason, the

Re: [R] Logical operator in R

2016-01-22 Thread Rmh
FAQ 7.31 in this case subtract the two numbers and see that they differ by about 1e-16 Sent from my iPhone > On Jan 22, 2016, at 10:46, li li wrote: > > Hi all, > I encountered the following strange phenomenon. > For some reason, the obs_p[1] and res1$st_p[89] have >

[R] Shift all values above certain value by 1

2016-01-22 Thread Dimitri Liakhovitski
Hello! # I have a data frame x: x <- data.frame(a = 1:10, b = 2:11, c = 3:12, other = rnorm(10)) # First, I need to change every value 7 in columns a:c to 4 # Then, I need to decrease by 1 all values in columns a:c that are >7 What would be the fastest way of doing it? Thank you! -- Dimitri

Re: [R] Error opening SHP file

2016-01-22 Thread Amoy Yang via R-help
This is the results that addresses David's advice. > library(maptools) > library(maps) > state.map <- readShapeSpatial("maps/st24_d00.shp") Error in getinfo.shape(fn) : Error opening SHP file > # David question: What does list.files('maps') return? Is there a > 'st24_d00.shp' value in there? >

Re: [R] unexpected behaviour of an extended time series (using packages spuRs and xts)

2016-01-22 Thread Joshua Ulrich
Try using the latest xts on GitHub: https://github.com/joshuaulrich/xts On Thu, Jan 14, 2016 at 9:05 AM, Olivier ETERRADOSSI wrote: > Hi list, > > > > I thought I knew how to use extended time series (package xts), but I was > wrong J … > > > > While

Re: [R] Constrained Poisson model / Bayesian Poisson model

2016-01-22 Thread David Winsemius
> On Jan 22, 2016, at 7:01 AM, mara.pfleide...@uni-ulm.de wrote: > > Hi all, > > I am dealing with a problem about my linear Poisson regression model (link > function=identity). > > I am using the glm()-function which results in negative coefficients, but a > negative influence of the

Re: [R] Sorting a Data Frame

2016-01-22 Thread Uwe Ligges
On 23.01.2016 01:21, Robert Sherry wrote: In R, I run the following commands: df = data.frame( x=runif(10), y=runif(10) ) df2 = df[order(x),] You use another x from your workspace, you actually want to df2 = df[order(df[,"x"]),] Best, Uwe Ligges The first, as I would