Re: [R] Drop ALL Levels of a Data Frame Object

2011-10-13 Thread Jeff Newmiller
Why aren't you using as.character instead of drop.levels? --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /So

Re: [R] binding all elements of list (character vectors) to a matrix as rows

2011-10-13 Thread Marion Wenty
hello again, i used the command rbind(Mymatrix, t(as.data.frame(Z))) and it works! thanks very much for your replys! marion 2011/10/11 David Winsemius > > On Oct 11, 2011, at 2:47 AM, Marion Wenty wrote: > > dear r-users, >> >> i have got a problem which i am trying to solve: >> >> i h

Re: [R] Question about GAMs

2011-10-13 Thread Simon Wood
predict.gam is returning a matrix with a named column for each term. Select the appropriate column. Example below library(mgcv) n<-200;sig <- 2 dat <- gamSim(1,n=n,scale=sig) b <- gam(y~s(x0)+s(I(x1^2))+s(x2)+offset(x3),data=dat) newd <- data.frame(x0=(0:30)/30,x1=(0:30)/30,x2=(0:30)/30,x3=(0:30

Re: [R] Length of data.frame column

2011-10-13 Thread Jeff Newmiller
You haven't provided a reproducible example. You haven't even provided a subset of your data, or the commands you used to read it in. I might guess that VAL <- DailyDiary[[1]] might be what you wanted, and the "str" function might help you understand why. Also, the "c" function does not "coerc

[R] Drop ALL Levels of a Data Frame Object

2011-10-13 Thread swonder03
I'm using the package 'gdata' and 'drop.levels' in the following code as a simplified example of what I want to do, pinpointing the issue of isolating variable in a data frame: /dfNamesAndHeight <- data.frame("Name" = c('Bill','Bob','Bo'), "Height" = c(73,68,83)) name_Bob <- drop.levels(dfNamesAnd

Re: [R] Question about GAMs

2011-10-13 Thread pigpigmeow
pre<-predict(ozonea,groupA,type="terms",terms=NULL,newdata.guaranteed=FALSE,na.action=na.pass) yeah! but I don't know how to only show the value of s(ratio,bs="cr") -- View this message in context: http://r.789695.n4.nabble.com/Question-about-GAMs-tp3900848p3903753.html Sent from the R help mail

Re: [R] Minimum cutsets

2011-10-13 Thread R. Michael Weylandt
I don't know the specifics of this package, but generally the C code is called internally by R: it, however, requires compilation before R can "talk" to it. You wont need to learn C though. Look at the link David suggested for a precompiled version, but it may be older than the development-version

Re: [R] Length of data.frame column

2011-10-13 Thread jawbonemurphy
I have a related question...I have a data frame similar with 74 rows that I created with "header=TRUE", but when I try to coerce one of the data frame columns into a vector, it shows up as having length 1, even though when I print it, it shows 74 elements: > VAL <- c(DailyDiary[1]) > VAL > [1] 3 3

[R] is there an option to "turn off" scientific notation in write.csv

2011-10-13 Thread Chris Conner
Dear Help-Rs,   I'm working with a file that contains large numbers and I need to export them "as is".  for example take:   x <- c(27104010002005,27104020001805,27104090001810,90050013000140,90050013000120) y <- c(1:5) df <- data.frame(cbind(x,y))   When I then try a simple: write.csv(df,file="d

Re: [R] pgfSweave-example not compiling

2011-10-13 Thread Peter Meilstrup
Thanks, that lets me move to the next step in figuring out what's wrong with my document :) Funny enough that's not the first problem I've had with Sweave and non-ascii characters. Peter On Thu, Oct 13, 2011 at 7:30 PM, Yihui Xie wrote: > OK, that is really helpful for diagnosis. In line 436 of

Re: [R] Perform 20 x one-way anova in 1 go

2011-10-13 Thread Ken
Hey, Doesn't this give you a ridiculous Type 1 error? Maybe randomly select one result and trust it. Try bestglm or stepwise regression maybe. Hope that's helpful, Ken Hutchison On Oct 14, 2554 BE, at 12:39 AM, "C.H." wrote: > This is one solution > > ?sapply > > sa

Re: [R] Perform 20 x one-way anova in 1 go

2011-10-13 Thread C.H.
This is one solution ?sapply sapply(data.frame(iris$Sepal.Length, iris$Sepal.Width, iris$Petal.Length, iris$Petal.Width), function(x) (summary(aov(x~iris$Species On Tue, Oct 11, 2011 at 5:10 PM, Joshua Wong wrote: > Hi Guys, > > I have about 20 continous predictors and I want to do one-wa

Re: [R] Legend symbols (line, points) in one column.

2011-10-13 Thread David Winsemius
Legends are built in columns. You need to find a graphics symbol to put in the "points" column or you need to find something that the lines paramater will turn into a dot (and I'm not sure what that might be.) My suggestion would be to change the line type to dashed and use " - - -" for the

Re: [R] Legend symbols (line, points) in one column.

2011-10-13 Thread Kenneth Roy Cabrera Torres
It is about the legend. As you see in the example the line is not above the points symbol. I want the line in the symbol in the same column. Thank you for you interest in helping me. Have nice day! El jue, 13-10-2011 a las 22:40 -0400, R. Michael Weylandt escribió: > Looking at your provided e

Re: [R] Legend symbols (line, points) in one column.

2011-10-13 Thread R. Michael Weylandt
Looking at your provided example (thank you!), I'm not entirely sure what you want to put in the same column. Could you perhaps clarify -- is it something about the plot itself or the legend? Michael > > On Thu, Oct 13, 2011 at 8:00 AM, Kenneth Roy Cabrera Torres > wrote: >> Dear R users: >> >> I

Re: [R] pgfSweave-example not compiling

2011-10-13 Thread Yihui Xie
OK, that is really helpful for diagnosis. In line 436 of your tex file, there is an NA, but it should really be this: }% this brace ends the effect of ‘include external’ So the reason for LaTeX failure was this missing bracket }. And the reason for R to output NA here is most likely to be that in

Re: [R] Minimum cutsets

2011-10-13 Thread David Winsemius
On Oct 13, 2011, at 7:47 PM, malhomidi wrote: Hi again, I've looked at the links above No links visible to the rest of us non-Nabble users. When will nabble- users ever learn to include context? (or to post with new Subject: lines when the topic changes?) and I see the develop

Re: [R] boxplot

2011-10-13 Thread R. Michael Weylandt
I'm not sure what the "column to identify other the other columns" maps to graphically, but perhaps something like this will get you started V <- read.table(textConnection(" 45678site 235641 4563 C 218942 10 6

Re: [R] "verbose source" command?

2011-10-13 Thread R. Michael Weylandt
source(FILE, print.eval = TRUE) Hope this helps & good work on getting the next round of R enthusiasts up and going! Michael On Thu, Oct 13, 2011 at 8:59 PM, Stephen Davies wrote: > (Apologies for the n00b question.) > > Hello, I'm teaching R in an introductory programming course and am walking

Re: [R] nls: singular convergeance

2011-10-13 Thread Redding, Matthew
Hi Rolf and others, Once again, I think a misunderstanding. My inexperience has led me to use the term "broken stick" where "non-linear segments" might be more appropriate. This is all experimental data (t and seg_an), and yes I am fitting a model to this data (see the "crv" function in my exam

Re: [R] Comparing the components of a data frame without levels interfering

2011-10-13 Thread swonder03
Thank you both. For my purposes I need the for statement. I looked into merge but what I wound up doing was installing the package 'compare' and using the if statement /if((compare(dfCity[k,1], dfState[j,1], dropLevels=TRUE)==TRUE){do something}/. This seemed to behave the way I wanted. -- View t

[R] "verbose source" command?

2011-10-13 Thread Stephen Davies
(Apologies for the n00b question.) Hello, I'm teaching R in an introductory programming course and am walking the students through the baby steps. One thing I'd like to be able to do is have them copy the commands they type at the R console into a text file, and then execute the text file to see t

Re: [R] nls: singular convergeance

2011-10-13 Thread Redding, Matthew
Hi Rolf and Others, Thanks Rolf for your suggestion. I've had a look at segmented, but can't see how it can help. My model is the solution to an ODE of a physical system. The fitted parameters from this model are the answers I require. I'm not sure how segmented can help -- it is a linear re

Re: [R] Minimum cutsets

2011-10-13 Thread malhomidi
Hi again, I've looked at the links above and I see the development version of the igraph library. I see the src folder implemented in C. Are these source codes available in R or I just would have to use the C code? The reason is that I just started learning R and I really want to stay awa

Re: [R] finding the code underneath a generic function

2011-10-13 Thread David Winsemius
On Oct 13, 2011, at 9:31 PM, R. Michael Weylandt wrote: A more detailed description is available in Circle 7 of the R Inferno (among other places), but the short answer is you type methods(plot) to see all the different plot functions and then just type the name of the specific method to get th

Re: [R] pgfSweave-example not compiling

2011-10-13 Thread Peter Meilstrup
Sure, here's the generated .tex file: http://pastebin.com/b9fTsr0h Peter On Thu, Oct 13, 2011 at 6:14 PM, Yihui Xie wrote: > Seems to be weird. I can run the example smoothly under Ubuntu with R > 2.13.2. Could you also post your .tex file? > > Regards, > Yihui > -- > Yihui Xie > Phone: 515-294

Re: [R] finding the code underneath a generic function

2011-10-13 Thread R. Michael Weylandt
A more detailed description is available in Circle 7 of the R Inferno (among other places), but the short answer is you type methods(plot) to see all the different plot functions and then just type the name of the specific method to get the code. If you know which method you are going for, you can

[R] finding the code underneath a generic function

2011-10-13 Thread Erin Hodgess
Dear R People: How do you find the code underneath a generic function, please? Sorry for the dumb question. Thanks, Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __

Re: [R] pgfSweave-example not compiling

2011-10-13 Thread Yihui Xie
Seems to be weird. I can run the example smoothly under Ubuntu with R 2.13.2. Could you also post your .tex file? Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Thu, Oct 13, 2011 at 7:01 PM,

[R] pgfSweave-example not compiling

2011-10-13 Thread Peter Meilstrup
I'm trying to get pgfSweave up and running. Hopefully I can get it working from within LyX, but first I'm just trying to get the simplest possible thing (compiling one of the example files in the pgfSweave package) to work. I'm using the example that comes in the pgfSweave package unmodified, but f

Re: [R] nls: singular convergeance

2011-10-13 Thread Rolf Turner
On 14/10/11 11:39, Redding, Matthew wrote: Hi Rolf and Others, Thanks Rolf for your suggestion. I've had a look at segmented, but can't see how it can help. My model is the solution to an ODE of a physical system. The fitted parameters from this model are the answers I require. I'm not sure ho

[R] boxplot

2011-10-13 Thread Ruth Arias
hello I want to make a boxplot with diferents rows and also include a column to sort into two groups to each of the other columns my  date set looks like this: 4        5        6        7        8        site 23    56        41      45    63         C 21    89        42      10   63        E

Re: [R] help to ... import the data from Excel

2011-10-13 Thread eyildiz
Hi, i had same problem with xlsReadWrite. this function loads a required package. try this: >xls.getshlib() -- View this message in context: http://r.789695.n4.nabble.com/help-to-import-the-data-from-Excel-tp3893382p3902973.html Sent from the R help mailing list archive at Nabble.com. _

[R] how to plot two surfaces with lattice::wireframe

2011-10-13 Thread Carl Witthoft
Hi all, I'd like to plot the Real and Imaginary parts of some f(z) as two different surfaces in wireframe (the row/column axes are the real and imag axes). I know I can do it by, roughly speaking, something like plotz <- expand.grid(x={range of Re(z)}, y={range of Im(z), groups=1:2) plotz$fun

Re: [R] x axis

2011-10-13 Thread David L Carlson
There are lots of options since you did not tell us what you want on the axis (or what you have tried). For example if you want more than 6 tick marks/labels, replace xlim=c(0, 3000) with xaxp=c(0, 3000, 12) to get labels every 250 meters instead of 500. Depending on the size of the graph window y

Re: [R] SLOW split() function

2011-10-13 Thread Joshua Wiley
Very nice! I am quite impressed at how flexible data.table is. On Thu, Oct 13, 2011 at 1:05 AM, Matthew Dowle wrote: > Using Josh's nice example, with data.table's built-in 'by' (optimised > grouping) yields a 6 times speedup (100 seconds down to 15 on > my netbook). > >> system.time(all.2b <- l

Re: [R] OT RE: US States percentage change plot

2011-10-13 Thread Yihui Xie
One package that you can use is Rcartogram from Omegahat, although it took me a long long time to figure out how to use it for real maps. I noticed there was another unpublished package named cart in R-Forge, and I have never tried it. I also want to know if there are other R packages that have as

[R] Question: Self selection bias and censoring in R

2011-10-13 Thread Mary Swinson
Hi All, I am a relative newbie to R and have the following problem I was trying to solve. I had taken a look at the 'sample selection' package but was having trouble applying it to my use case and was wondering if anyone out there had done something similar and could share code or documentation

Re: [R] binomial GLM quasi separation

2011-10-13 Thread Ben Bolker
lincoln hotmail.com> writes: > > Hi all, > > I have run a (glm) analysis where the dependent variable is the gender > (family=binomial) and the predictors are percentages. > I get a warning saying "fitted probabilities numerically 0 or 1 occurred" > that is indicating that quasi-separation or s

Re: [R] GLM and Neg. Binomial models

2011-10-13 Thread Ben Bolker
D_Tomas hotmail.com> writes: > > Hi userRs! > > I am trying to fit some GLM-poisson and neg.binomial. The neg. Binomial > model is to account for over-dispersion. > > When I fit the poisson model i get: > (Dispersion parameter for poisson family taken to be 1) > > However, if I estimate the d

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread Eik Vettorazzi
Hi, just put it in the formula: aggregate(Number ~ Letter+Test,data=dtf,max) cheers Am 13.10.2011 19:30, schrieb syrvn: > Hello again, > > > dtf<-read.table(textConnection("Letter Test Number > a b 1 >

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-13 Thread Bailey, Daniel
Woohoo! Thank you Sarah and Michael. You are rock stars! Daniel -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Thursday, October 13, 2011 11:54 AM To: Bailey, Daniel Cc: r-help@r-project.org Subject: Re: [R] getting data associated with coordinates in a spa

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-13 Thread Sarah Goslee
On Thu, Oct 13, 2011 at 2:44 PM, Bailey, Daniel wrote: > Michael, that's half of the problem solved (whew!!). Now how do I change the > data at that location? You assign it a new value, just as for any assignment. Using the example from my previous email: > data(meuse.grid) > m = SpatialPixels

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-13 Thread Bailey, Daniel
Michael, that's half of the problem solved (whew!!). Now how do I change the data at that location? This is not an intuitive way to manipulate data. -Original Message- From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] Sent: Thursday, October 13, 2011 11:35 AM To: Bailey, Dan

[R] OT RE: US States percentage change plot

2011-10-13 Thread Farley, Robert
OT question: can R produce Cartograms? Here's an example of World Population: http://www.worldmapper.org/display.php?selected=2 This might make Texas smaller and Rhode Island larger Robert Farley LACMTA -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-13 Thread R. Michael Weylandt
Ah yes, my eternal nemesis the S4 class... You were basically there with e[e$coordinates==(0,17),] but for some access stuff that comes from the SpatialDataPointsFrame class. You'll probably want to do this in two steps: coords = coordinates(e) ## Use the access function coordinates to get a 2

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-13 Thread Sarah Goslee
Hi, On Thu, Oct 13, 2011 at 2:05 PM, Bailey, Daniel wrote: > Thank you Sarah. I tried your suggestion, and if I coerce it into a normal > data.frame, that method works. But if you've already made the data into a > SpatialPixelsDataFrame and run coordinates (both from the package "sp") so > tha

Re: [R] US States percentage change plot

2011-10-13 Thread Greg Snow
Unless your audience is mainly interested in Texas and California and is completely content to ignore Rhode Island, then I would suggest that you look at the state.vbm map in the TeachingDemos package that works with the maptools package. The example there shows coloring based on a variable. -

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-13 Thread Weidong Gu
Because SpatialPointsDataFrame is S4 object, you may try index by @ e@coords or coordinates(e) Weidong Gu On Thu, Oct 13, 2011 at 2:18 PM, Bailey, Daniel wrote: > Michael, > Thank you for the tips. The suggestion didn't work though. Here is the output > of str(e): > Formal class 'SpatialPointsD

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-13 Thread Bailey, Daniel
Michael, Thank you for the tips. The suggestion didn't work though. Here is the output of str(e): Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots ..@ data :'data.frame': 168 obs. of 2 variables: .. ..$ catchcandata: num [1:168] 47.2 50.4 53.7 58 69.8 ... .. ..$ secti

Re: [R] x axis

2011-10-13 Thread R. Michael Weylandt
In your plot call, you can use xaxt = "n" to turn off the default x axis tick marks, then add axis(1, at = VARIABLEWHEREYOUWANTTICKMARKS) # If you want ticks at the x you put in, its just axis(1, at = x) to get ticks where you want them. There's also a label= argument if you want them to be labl

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-13 Thread R. Michael Weylandt
It's going to depend how the coordinates are stored within the data frame. Do you perhaps know if they are factors or character strings? (I'm not familiar with the package). If you don't know, type str(NAMEOFYOUROBJECT) and we can help interpret the output. Untested, I think this would actually wo

[R] GLM and Neg. Binomial models

2011-10-13 Thread D_Tomas
Hi userRs! I am trying to fit some GLM-poisson and neg.binomial. The neg. Binomial model is to account for over-dispersion. When I fit the poisson model i get: (Dispersion parameter for poisson family taken to be 1) However, if I estimate the dispersion coefficient by means of: sum(residuals(fi

Re: [R] Alphabetical sequence of data along the x-axis in a box plot

2011-10-13 Thread Dan_K
The easiest work-around I've found for this problem is to create a vector in your data frame just using numbers to order them how you want, create a separate "labeling" data frame with those numbers and corresponding text labels, and then enter the vector with the grouping names from the labeling f

[R] x axis

2011-10-13 Thread lauren mcdonagh
Dear R users, I am quite desperate for help. I haven't used R in a couple of years and I'm currently finishing a masters project and running out of time to figure out my problem. I have read and tried the examples on many websites, in your forums and R Help yet still can't manage to change the

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-13 Thread Bailey, Daniel
Thank you Sarah. I tried your suggestion, and if I coerce it into a normal data.frame, that method works. But if you've already made the data into a SpatialPixelsDataFrame and run coordinates (both from the package "sp") so that the columns "x" and "y" become a single column "coordinates" with t

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread syrvn
Hello again, dtf<-read.table(textConnection("Letter Test Number a b 1 a b 1 b b 1

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread syrvn
Thanks for your answers! Will check them now :) Yes, sorry, I was wrong. Letter Number d 0 d 0 should be: Letter Number d 0 after applying the algorithm! -- View this message in context: http://r.789695.n4.nabble.com/Remove-specific-rows-in-a-matrix-data-frame-tp3902149p3902216.html Sent fro

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread Jean V Adams
syrvn wrote on 10/13/2011 11:42:44 AM: > > Hi, > > > imagine the following matrix/data.frame > > Letter Number > a 1 > a 1 > b 1 > b 0 > c 0 > c 1 > d 0 > d 0 > > If the numbers for two identical letters are also identical then I want to > remove either the first or the > second row of that

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread Vining, Kelly
Why would you end up with d1 in your output if you don't have a d1 in your original data frame? Are you saying that, when both letters have a zero after them, you want to replace one of them with a 1? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-projec

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread jim holtman
try this: > x <- read.table(textConnection("Letter Number + a 1 + a 1 + b 1 + b 0 + c 0 + c 1 + d 0 + d 0"), as.is = TRUE, header = TRUE) > closeAllConnections() > # following assumes that there are pairs of numbers > result <- do.call(rbind, lapply(split(x, x$Letter), function(.pair){ + if (a

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread Eik Vettorazzi
Hi Syrvn, how about this dtf<-read.table(textConnection("Letter Number a 1 a 1 b 1 b 0 c 0 c 1 d 0 d 0"),header=T) aggregate(Number~Letter,data=dtf,max) cheers. Am 13.10.2011 18:42, schrieb syrvn: > Hi, > > > imagine the following matrix/data.frame > > Letter Number > a 1 > a 1 > b 1 > b 0 > c

Re: [R] How to mean for groups of matrix rows?

2011-10-13 Thread Jean V Adams
Andrey wrote on 10/13/2011 08:40:21 AM: > > Dear All, > > For a vector, I use this > > xu<-1:20 > t<-rep((1:4),each=5) > tapply(xu,t,mean) > 1 2 3 4 > 3 8 13 18 > > and for a matrix the only way I may guess is: > > xu > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] > [1,]

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread David Winsemius
On Oct 13, 2011, at 12:42 PM, syrvn wrote: Hi, imagine the following matrix/data.frame Letter Number a 1 a 1 b 1 b 0 c 0 c 1 d 0 d 0 If the numbers for two identical letters are also identical then I want to remove either the first or the second row of that letter. If for a letter the nu

[R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread syrvn
Hi, imagine the following matrix/data.frame Letter Number a 1 a 1 b 1 b 0 c 0 c 1 d 0 d 0 If the numbers for two identical letters are also identical then I want to remove either the first or the second row of that letter. If for a letter the numbers are 1 and 0 I want to remove the row with t

Re: [R] Question about GAMs

2011-10-13 Thread David Winsemius
On Oct 13, 2011, at 11:20 AM, pigpigmeow wrote: I'm confused... I type .. predict.gam(ozonea,type=s(ratio,bs="cr")) pressure maxtemp s(avetemp) s(ratio) 1 -0.0459102290 -0.185178463 0.263358446 -0.164558673 2 -0.0286464652 -0.194731320 0.199315027 0.727823293 30.04780734

Re: [R] pass an element in a list() from R to C

2011-10-13 Thread William Dunlap
Functions with prototypes of the form SEXP myfunc(SEXP, SEXP, ..., SEXP) must be called via .Call(), not .C(). Also, you declared myfunction as returning SEXP but returned nothing. Try ending the function with return R_NilValue; You should change the default compiler flags to report all warni

Re: [R] [Related Topic] need help on read.spss

2011-10-13 Thread Matt Shotwell
Would it be worthwhile to update the read.spss implementation using the more recent discoveries from the PSPP group? I don't mean to copy their code; but to use the ideas in their code. Is anyone working on this? I wouldn't want the effort to be duplicated. On Thu, 2011-10-13 at 16:22 +0200, Uwe L

Re: [R] Help package for Growing Neural Gas

2011-10-13 Thread David Winsemius
On Oct 13, 2011, at 12:12 PM, Alejandro Coca Castro wrote: Hi, somebody knows a package for running Growing Neural Gas in R. > require(sos) > findFn("Growing Neural Gas") found 0 matches x has zero rows; nothing to display. Warning message: In findFn("Growing Neural Gas") : HIT not found i

Re: [R] high and lowest with names

2011-10-13 Thread Ben qant
Besides being a much better solution, it displays ties (which I see as a benefit). For example, if I ask for 5 I get 8 for top values since 12 occurs 3 times. Here is the same thing David posted with slight mods to generalize it a bit for cnt: x <- swiss$Education[1:25] dat = matrix(x,5,5) colnam

[R] Help package for Growing Neural Gas

2011-10-13 Thread Alejandro Coca Castro
Hi, somebody knows a package for running Growing Neural Gas in R. Thanks in advance, -- Alejandro Coca UN __ 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/posti

Re: [R] high and lowest with names

2011-10-13 Thread David Winsemius
On Oct 13, 2011, at 10:42 AM, Ben qant wrote: Here is a more R'sh solution (speed unknown). Really? The intermediate, potentially large, objects seem to be proliferating. Courtesy of Mark Leeds (I modified it a bit to generalize it for a cnt input and get min and max). Again, getting

Re: [R] Question about GAMs

2011-10-13 Thread Gavin Simpson
On Thu, 2011-10-13 at 08:20 -0700, pigpigmeow wrote: > I'm confused... > I type .. > predict.gam(ozonea,type=s(ratio,bs="cr")) That is not a valid 'type'; normally you'd use `type = "terms"` or `type = "iterms"`, depending on whether you want (any) standard errors to include the uncertainty about

Re: [R] delete columns which partially match expression

2011-10-13 Thread William Dunlap
Be careful with the idiom x[, -which(columnIsBad)] If no columns are bad this leads to x[, -integer(0)] which is a data.rame with no columns, exactly the opposite of what you want. x[, !columnIsBad] doesn't have that problem. However, if you can't tell if a column is bad or not (i.e., col

Re: [R] variable scope for deltavar function from emdbook

2011-10-13 Thread Uwe Ligges
This is R, not S-Plus. In the first two lines you have expr <- as.expression(substitute(fun)) nvals <- length(eval(expr, envir = as.list(meanval))) Simplified example: y <- 0 fn1 <- function(){ y <- 1 fn1sub <- function() print(y) fn1sub() } fn2sub <- function() print(y) fn2 <- fun

Re: [R] How to transfer the variable into function in this code?

2011-10-13 Thread xingxing
I think you made it very clearly. thx -- View this message in context: http://r.789695.n4.nabble.com/How-to-transfer-the-variable-into-function-in-this-code-tp3899576p3901817.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pro

Re: [R] Question about GAMs

2011-10-13 Thread pigpigmeow
I'm confused... I type .. predict.gam(ozonea,type=s(ratio,bs="cr")) pressure maxtemp s(avetemp) s(ratio) 1 -0.0459102290 -0.185178463 0.263358446 -0.164558673 2 -0.0286464652 -0.194731320 0.199315027 0.727823293 30.0478073459 -0.013227033 0.002228896 0.342373202 4 -0.00

[R] binomial GLM quasi separation

2011-10-13 Thread lincoln
Hi all, I have run a (glm) analysis where the dependent variable is the gender (family=binomial) and the predictors are percentages. I get a warning saying "fitted probabilities numerically 0 or 1 occurred" that is indicating that quasi-separation or separation is occurring. This makes sense given

Re: [R] Minimization/Optimization under functional constraints

2011-10-13 Thread jdospina
You can use the DEoptim function in DEoptim package and to include a line of code within your objective function that assigns a very high value when the constraints are not satisfied. I have tried that and it works. - Juan David Ospina Arango School of Statistics Universidad Nacional de Colo

Re: [R] Can I use lm() to fit more than one response and more than one variables in single expression

2011-10-13 Thread Mark Leeds
hi: if you make the design matrix correctly, you can fit that using the systemfit function in Arne Henningsen's systemfit package. You need to construct the response by making one long column response of R1 on top of R2 on top of R3. Then you need to make a diagonal X matrix with X1, X2 and X3 bein

Re: [R] Minimization/Optimization under functional constraints

2011-10-13 Thread Uwe Ligges
On 12.10.2011 20:13, forget_f1 wrote: Hi, I hope someone can help me with the following issue. I need find the minimum beta that satisfies the following: inf{beta>0 | f(x+beta*f(x))*f(x)<=0} where f() is a function and x is a sample statistic. Functions such as "nlminb" and "constrOptim" m

Re: [R] high and lowest with names

2011-10-13 Thread Ben qant
Here is a more R'sh solution (speed unknown). Courtesy of Mark Leeds (I modified it a bit to generalize it for a cnt input and get min and max). Again, getting cnt highest and lowest values in the entire matrix and display the data point row and column names with each: > x <- swiss$Education[1:25]

Re: [R] warning with cut2 function

2011-10-13 Thread Uwe Ligges
On 11.10.2011 10:25, taby gathoni wrote: Dear r user, please find my attached sample of the dataset i am using to create a crosstable and eventually plot a histogram from the output. I am using the cut2 function to create bins, about 7 of them using the code after reading the data: cluste

Re: [R] Can I use lm() to fit more than one response and more than one variables in single expression

2011-10-13 Thread Uwe Ligges
On 13.10.2011 15:50, guoshicheng2005 wrote: Dear All, Can I use lm() to fit more than one response in single expression. e.g data is a matrix of these variables R1 R2 R3 X1 X2 X3 1 2 1 1 2 3 Now i wnat to fit R1~X1 R2~X2 R3~X3 in turn, and I don't want to do it use loops of couse it i

Re: [R] need help on read.spss

2011-10-13 Thread Uwe Ligges
On 11.10.2011 12:07, Smart Guy wrote: Hi, I have one doubt about one of the parameter of 'read.spss()' from 'foreign' package. Here is the syntax :- read.spss ( file, use.value.labels = TRUE, to.data.frame = FALSE, max.value.labels = Inf, trim.factor.names = FALSE,

[R] xyplot() and confidence interval polygons

2011-10-13 Thread Martin Ralphs
Dear all, I'm trying to replicate the panel function behaviour that Deepayan and others discuss here: https://stat.ethz.ch/pipermail/r-help/2007-April/130779.html and Oscar Lamigueiro refers to here and provides sample code for: http://www.r-bloggers.com/confidence-bands-with-lattice-and-r/ whe

[R] Can I use lm() to fit more than one response and more than one variables in single expression

2011-10-13 Thread guoshicheng2005
Dear All, Can I use lm() to fit more than one response in single expression. e.g data is a matrix of these variables R1 R2 R3 X1 X2 X3 1 2 1 1 2 3 Now i wnat to fit R1~X1 R2~X2 R3~X3 in turn, and I don't want to do it use loops of couse it it easy to make it using loops,but the proceed is

[R] How to mean for groups of matrix rows?

2011-10-13 Thread Andrey
Dear All, For a vector, I use this xu<-1:20 t<-rep((1:4),each=5) tapply(xu,t,mean) 1 2 3 4 3 8 13 18 and for a matrix the only way I may guess is: > xu [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,]14321432 [2,]21432

Re: [R] bootstrap means by strata

2011-10-13 Thread Tim Howard
Answering my own question. ?sample (!) y <- by(x, x$TrSeasYr, function(x) mean(sample(x[,1], size=999, replace = TRUE))) >>> Tim Howard 10/13/2011 9:42 AM >>> All - I have an uneven set of replicates and would like to sample from this set X number of times to generate a mean for each groupi

Re: [R] Axis Formats with library(car)

2011-10-13 Thread John Fox
Dear Krishnan, This behaviour isn't particular to scatterplot() in car. Try setting options(scipen=10) and see ?options. I hope this helps, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilt

[R] bootstrap means by strata

2011-10-13 Thread Tim Howard
All - I have an uneven set of replicates and would like to sample from this set X number of times to generate a mean for each grouping variable. I was thinking the boot package would be the thing to use, but now I'm not so sure ... given the discussion here: http://finzi.psych.upenn.edu/Rhel

Re: [R] delete columns which partially match expression

2011-10-13 Thread jim holtman
try this: > x <- read.table(textConnection("A B C D > E + 12 33 Error1 71 Error2 + 12 33 Error1 71 Error2 + 12 33 Error1 71 Error2 + 12 33

[R] delete columns which partially match expression

2011-10-13 Thread Samir Benzerfa
Hello everyone, I'd like to search for certain "expressions" (characters) in my data.frame and delete the containing columns. So, for example in the below table, I'd like to delete all columns which contain the expression "Error". That is, R should delete column C and E from my data. Any id

Re: [R] Question about GAMs

2011-10-13 Thread Simon Wood
I'd be inclined to use predict(ozonea,type="terms") to extract the estimates of s(ratio,bs = "cr") that you need. But do you really want newozone - s(ratio,bs="cr") when you've used a log link? best, Simon On 10/13/2011 09:05 AM, pigpigmeow wrote: hi! I hope all of you can help me this ques

Re: [R] Package snow: is there any way to check if a cluster is "acticve"

2011-10-13 Thread Claudia Beleites
Sören, have a look at package snowfall which provides sfIsRunning. HTH Claudia Am 13.10.2011 06:34, schrieb Søren Højsgaard: Is there a 'proper' way of checking if cluster is active. For example, I create a cluster called .PBcluster str(.PBcluster) List of 4 $ :List of 3 ..$ con :Cl

Re: [R] Counting the number of integers at one swoop

2011-10-13 Thread Jean V Adams
Kathie wrote on 10/13/2011 06:33:59 AM: > > Dear R users, > > I'd like to count the number of integers in a vector y. > > Here is an example. > > y <- c(0,1,1,3,3,3,5,5,6) > > In fact, I know how to count the number of specific number in y. > > sum(y==0) -> 1 > sum(y==1) -> 2 > sum(y==2) -> 0

Re: [R] Counting the number of integers at one swoop

2011-10-13 Thread jim holtman
try this: > y <- c(0,1,1,3,3,3,5,5,6) > x <- tabulate(y+1) > names(x) <- seq(from = 0, by = 1, length = length(x)) > x 0 1 2 3 4 5 6 1 2 0 3 0 2 1 > On Thu, Oct 13, 2011 at 7:33 AM, Kathie wrote: > Dear R users, > > I'd like to count the number of integers in a vector y. > > Here is an example.

Re: [R] moving average TTR

2011-10-13 Thread R. Michael Weylandt
I believe the lag() function can be used to rig this up. Something like sma.365 <- SMA(lag(data, 12), n=120) # Untested, but seems right Michael On Thu, Oct 13, 2011 at 6:31 AM, Laura wrote: > Hello, > > I used the TTR package in R to calculate moving averages. I have a monthly > time series a

Re: [R] Question about GAMs

2011-10-13 Thread Daniel Malter
I am not an expert on this, but there is a way to check this. You can predict from a gam using predict(ozonea, newdata=...). In the "newdata" argument you can specify the X-values of interest to you. Thus, you can compare if your predictions are the same when predicted directly from the gam or when

Re: [R] Counting the number of integers at one swoop

2011-10-13 Thread R. Michael Weylandt
Slight addendum, tabulate() ignores zeros so you'll need to do tabulate(y+1). Table will handle zeros but won't look for values that never appear (in your example 2 & 4). Michael On Thu, Oct 13, 2011 at 8:51 AM, R. Michael Weylandt wrote: > Table() or more generally tabulate() > > Though, as a

  1   2   >