Re: [R] question about the axis label

2011-01-25 Thread Uwe Ligges
Unfortunately, this fine control is only hardly possible: 1. [x,y].ticklabs labels the ticks that are in the plot. If there are less ticks than ticklabs, the ticklabs are recycled and hence overlap. 2. xlim should do the trick to restrict to a certain range of values. It does not precisely

[R] Extract NA data rows

2011-01-25 Thread typhoong
hi i have the following dataframe x y 1 345 6 NA 8 123 32 123 12 NA 6 124 7 NA and i want to extract the data rows which contains NA data, I tried subset(dataframe,y==NA) but fail. if you know the answers, please let me know thanks. typhoong

[R] setting headers in POST

2011-01-25 Thread fayazvf
I need to use an API which requires me set certain attribute=values pairs in the header. The postToHost() method allows only to send data in the body. Please help me. -- View this message in context: http://r.789695.n4.nabble.com/setting-headers-in-POST-tp3235542p3235542.html Sent from the R

[R] Using open calais in R

2011-01-25 Thread fayazvf
I am using calais api in R for text analysis. But im facing a some problem when fetching the rdf from the server. I'm using the getToHost() method for the api call but i get just a null string. The same url in browser returns an RDF document.

[R] question about the axis label

2011-01-25 Thread 孟欣
Hello sir: I have a question about the axis label of scatterplot3d function. The data is in the attachment. If I use the command: scatterplot3d(x,y,z,type=h) I want the plot's x-axis lab to be 1,2,3,...,13, y-axis lab to be 1,2,3,...11 But if I use the command:

Re: [R] crazy loop error.

2011-01-25 Thread Petr Savicky
On Mon, Jan 24, 2011 at 11:18:35PM +0100, Roy Mathew wrote: Thanks for the reply Erik, As you mentioned, grouping consecutive elements of 'a' was my idea. I am unaware of any R'ish way to do it. It would be nice if someone in the community knows this. The error resulting in the NA was

Re: [R] crazy loop error.

2011-01-25 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 24.01.2011 23:18:35: Thanks for the reply Erik, As you mentioned, grouping consecutive elements of 'a' was my idea. I am unaware of any R'ish way to do it. It would be nice if someone in the community knows this. The error resulting in the NA

Re: [R] Extract NA data rows

2011-01-25 Thread David Scott
On 25/01/2011 8:07 p.m., typhoong wrote: hi i have the following dataframe x y 1 345 6 NA 8 123 32 123 12 NA 6 124 7 NA and i want to extract the data rows which contains NA data, I tried subset(dataframe,y==NA) but fail. if you know the

[R] Odp: Extract NA data rows

2011-01-25 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 25.01.2011 08:07:10: hi i have the following dataframe x y 1 345 6 NA 8 123 32 123 12 NA 6 124 7 NA and i want to extract the data rows which contains NA data, I tried subset(dataframe,y==NA) See ?is.na however

Re: [R] Extract NA data rows

2011-01-25 Thread Ivan Calandra
Hi! Try subset(dataframe, is.na(y)) or df[is.na(df$y),] HTH, Ivan Le 1/25/2011 08:07, typhoong a écrit : hi i have the following dataframe x y 1 345 6 NA 8 123 32 123 12 NA 6 124 7 NA and i want to extract the data rows which contains NA data,

[R] Problems plotting the efficient frontier with fPortfolio

2011-01-25 Thread Luis Felipe Parra
Hello, I have some simulations of financial data, I have 17 variables simulated 1000 times to three horizons. I am tring to plot the efficient frontier which I already obtained using th fPortfolio package. I am using the following commands: Data=timeSeries(X[1,,]) lppSpec - portfolioSpec()

Re: [R] crazy loop error.

2011-01-25 Thread Prof Brian Ripley
On Tue, 25 Jan 2011, Petr Savicky wrote: On Mon, Jan 24, 2011 at 11:18:35PM +0100, Roy Mathew wrote: Thanks for the reply Erik, As you mentioned, grouping consecutive elements of 'a' was my idea. I am unaware of any R'ish way to do it. It would be nice if someone in the community knows this.

[R] Subtracting elements of data.frame

2011-01-25 Thread Vincy Pyne
Dear R helpers I have a dataframe as df = data.frame(x = c(1, 14, 3, 21, 11), y = c(102, 500, 40, 101, 189)) df    x   y 1  1 102 2 14 500 3  3  40 4 21 101 5 11 189 # Actually I am having dataframe having multiple columns. I am just giving an example. I need to subtract all the rows of df

Re: [R] ggplot geom_boxplot and stat_smooth

2011-01-25 Thread Dennis Murphy
Hi Petr: I had to do a little bit of finagling, but this seems to work. I basically did the following: (i) coordinated the dodging of the points and boxplots by typ within konc.f; (ii) summarized the group medians in a separate data frame and added an additional column to compensate for the

Re: [R] Extract NA data rows

2011-01-25 Thread kamel gaanoun
Hi, May be try this : data[which(is.na(data[,2])),] 2011/1/25 typhoong graham...@eurus-energy.com hi i have the following dataframe x y 1 345 6 NA 8 123 32 123 12 NA 6 124 7 NA and i want to extract the data rows which contains NA

Re: [R] crazy loop error.

2011-01-25 Thread Petr Savicky
On Tue, Jan 25, 2011 at 09:05:03AM +0100, Petr Savicky wrote: [...] to foreach loop in Perl. If v is a vector, then for (n in v) first creates the vector v and then always performs length(v) iterations. I forgot that ‘break’ may stop the loop. See ?for for further information. In

Re: [R] crazy loop error.

2011-01-25 Thread Roy Mathew
Dear Erik, Thanks for the mapply idea. I never got around to understand all those apply functions. I am still curious as to why the other loop didnt work. I even tried the debug but doesnt help. Anyway I will leave that for now. Thanks a lot for your help. Regards, Roy On Mon, Jan 24, 2011 at

Re: [R] Subtracting elements of data.frame

2011-01-25 Thread Dennis Murphy
Hi: df = data.frame(x = c(1, 14, 3, 21, 11), y = c(102, 500, 40, 101, 189)) apply(df, 2, function(x) x - x[1]) x y [1,] 0 0 [2,] 13 398 [3,] 2 -62 [4,] 20 -1 [5,] 10 87 HTH, Dennis On Tue, Jan 25, 2011 at 1:20 AM, Vincy Pyne vincy_p...@yahoo.ca wrote: Dear R helpers I have a

Re: [R] Subtracting elements of data.frame

2011-01-25 Thread Ivan Calandra
Hi, Try this: df_new - as.data.frame(lapply(df, FUN=function(x) x-x[1])) I hope it works! Ivan Le 1/25/2011 10:20, Vincy Pyne a écrit : Dear R helpers I have a dataframe as df = data.frame(x = c(1, 14, 3, 21, 11), y = c(102, 500, 40, 101, 189)) df x y 1 1 102 2 14 500 3 3 40 4

Re: [R] Subtracting elements of data.frame

2011-01-25 Thread Ivan Calandra
I always forget about sapply(): df_new - sapply(df, FUN=function(x) x-x[1]) Ivan Le 1/25/2011 10:33, Ivan Calandra a écrit : Hi, Try this: df_new - as.data.frame(lapply(df, FUN=function(x) x-x[1])) I hope it works! Ivan Le 1/25/2011 10:20, Vincy Pyne a écrit : Dear R helpers I have a

[R] review of R Graphs Cookbook

2011-01-25 Thread Patrick Burns
If you are foolish enough not to be following R Bloggers via RSS or twitter, you might miss: http://www.portfolioprobe.com/2011/01/24/review-of-r-graphs-cookbook-by-hrishi-mittal/ Executive summary: Extremely useful for new users, informative to even quite seasoned users. -- Patrick Burns

Re: [R] crazy loop error.

2011-01-25 Thread Ivan Calandra
Mr Ripley, May I ask why seq_len() and seq_along() are better than seq()? Thanks, Ivan Le 1/25/2011 09:58, Prof Brian Ripley a écrit : On Tue, 25 Jan 2011, Petr Savicky wrote: On Mon, Jan 24, 2011 at 11:18:35PM +0100, Roy Mathew wrote: Thanks for the reply Erik, As you mentioned, grouping

Re: [R] ggplot geom_boxplot and stat_smooth

2011-01-25 Thread Petr PIKAL
Thank you I did not realise I can simply add data from different source data frame to constructed graph. It even works with stat_smooth() quite straightforward. One is always learning new tricks. Best regards Petr r-help-boun...@r-project.org napsal dne 25.01.2011 10:24:42: Hi Petr: I

Re: [R] Masking commands - Permutation in gregmisc and e1071

2011-01-25 Thread Uwe Ligges
On 24.01.2011 23:53, Peter Langfelder wrote: On Mon, Jan 24, 2011 at 2:47 PM, Yanika Borgakina...@gmail.com wrote: I am using the function permutations from the package *gregmisc*. However, I am also making use of the package *e1071*, which also contains a function called permutations. I

Re: [R] how to get loglik parameter from splm package?

2011-01-25 Thread Millo Giovanni
Dear useR, although I admit that getting the log likelihood is important, you must concede that obtaining the parameter estimates is not bad either. Regarding craze, well there are crazier things in the world than this, just look at the political situation in Italy. Anyway, the loglik has always

[R] Integration of two lines

2011-01-25 Thread Xavier Robin
Hello, I need to integrate the absolute difference between two lines measured on different points. # For example : x - seq(0, 1, 1/100) f_x - runif(101) + x y - seq(0, 1, 1/23) f_y - runif(24) + (1 - y) plot(x, f_x, type=l) lines(y, f_y) Then I would like to compute Integral( | f_x - f_y |

[R] Map an Area to another

2011-01-25 Thread Alaios
Dear All, I would like to ask you help with the following: Assume that I have an area of 36 cells (or sub-areas) sr-matrix(data=seq(from=1,to=36),nrow=6,ncol=6,byrow=TRUE) sr [,1] [,2] [,3] [,4] [,5] [,6] [1,]123456 [2,]789 10 11 12 [3,] 13 14

Re: [R] Subtracting elements of data.frame

2011-01-25 Thread Peter Ehlers
On 2011-01-25 01:20, Vincy Pyne wrote: Dear R helpers I have a dataframe as df = data.frame(x = c(1, 14, 3, 21, 11), y = c(102, 500, 40, 101, 189)) df x y 1 1 102 2 14 500 3 3 40 4 21 101 5 11 189 # Actually I am having dataframe having multiple columns. I am just giving an

Re: [R] Subtracting elements of data.frame

2011-01-25 Thread Henrique Dallazuanna
Try this: sweep(as.matrix(df), 2, as.matrix(df[1,])) On Tue, Jan 25, 2011 at 7:20 AM, Vincy Pyne vincy_p...@yahoo.ca wrote: Dear R helpers I have a dataframe as df = data.frame(x = c(1, 14, 3, 21, 11), y = c(102, 500, 40, 101, 189)) df x y 1 1 102 2 14 500 3 3 40 4 21 101

Re: [R] Train error:: subscript out of bonds

2011-01-25 Thread Max Kuhn
What version of caret and R? We'll also need a reproducible example. On Mon, Jan 24, 2011 at 12:44 PM, Neeti nikkiha...@gmail.com wrote: Hi, I am trying to construct a svmpoly model using the caret package (please see code below). Using the same data, without changing any setting, I am just

Re: [R] Integration of two lines

2011-01-25 Thread Rmh
g - function(x) abs(f1(x)-f2(x)) now you have one function and you can integrate it. Rich Sent from my iPhone On Jan 25, 2011, at 7:32, Xavier Robin xavier.ro...@unige.ch wrote: Hello, I need to integrate the absolute difference between two lines measured on different points. # For

[R] How to simulate a variable Xt=Wit+0.5Wit-1 with

2011-01-25 Thread Millo Giovanni
Dear Carlos, please refrain from posting the same question umpteen times. Please consider that code is hard to read and people might not have the time to run your simulation etc. etc.. As I told you privately in response to your message on 18/1, Re: generating correlated effects, I tried this

[R] xlsReadWrite 1.5.4 and xlsReadWritePro 1.6.4 released

2011-01-25 Thread Hans-Peter Suter
The xlsReadWrite[Pro] package allows to natively read and write Excel files (.xls) on the Win 32-bit platform. Changes: o fix bug with integer conversion (http://dev.swissr.org/issues/113) PROBLEM: values outside the integer range (i.e. 12345678901) didn't give an NA (and a warning

Re: [R] Problem reading PostgreSQL data with RODBC

2011-01-25 Thread Albin Blaschka
Am 24.01.2011 14:08, schrieb Bart Joosen: I think this is a problem with quotes. If you look good, you see: seiz.df- sqlFetch(chnl, 'source.MAIN') ... 'source.main': table not found on channel You asked MAIN, but your db can't find main. If you use seiz.df- sqlFetch(chnl, '\source\.\MAIN\')

Re: [R] Integration of two lines

2011-01-25 Thread Hans W Borchers
Xavier Robin Xavier.Robin at unige.ch writes: Hello, I need to integrate the absolute difference between two lines measured on different points. # For example : x - seq(0, 1, 1/100) f_x - runif(101) + x y - seq(0, 1, 1/23) f_y - runif(24) + (1 - y) plot(x, f_x, type=l) lines(y,

Re: [R] Integration of two lines

2011-01-25 Thread Xavier Robin
Le 25.01.2011 15:23, Rmh a écrit : g - function(x) abs(f1(x)-f2(x)) now you have one function and you can integrate it. Thank you Rich. Unfortunately I have no f1 and f2 functions, only a set of observed points on two lines - and no idea about the underlying distribution to create a

Re: [R] Using open calais in R

2011-01-25 Thread Duncan Temple Lang
fayazvf wrote: I am using calais api in R for text analysis. But im facing a some problem when fetching the rdf from the server. I'm using the getToHost() method for the api call but i get just a null string. You haven't told us nearly enough for us to be able to reproduce what you are

[R] Learn Vectorization (Vectorize)

2011-01-25 Thread Alaios
Greetings Friends, I would be grateful if you can help me undestand how to make my R code more efficiently. I have read in R intoductory tutorial that a for loop is not used so ofter (and is not maybe not that efficient) compared to other languages. So I am trying to build understanding how to

Re: [R] Train error:: subscript out of bonds

2011-01-25 Thread Neeti
Version: R = 2.11.1 CARET = 4.68 -- View this message in context: http://r.789695.n4.nabble.com/Train-error-subscript-out-of-bonds-tp3234510p3236251.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Downloading data from internet

2011-01-25 Thread Mike Marchywka
From: ggrothendi...@gmail.com Date: Mon, 24 Jan 2011 22:43:55 -0500 To: megh700...@gmail.com CC: r-help@r-project.org Subject: Re: [R] Downloading data from internet On Mon, Jan 24, 2011 at 8:48 PM, Megh Dal wrote: Dear all, I need to download an excel file from net, on which I

Re: [R] crazy loop error.

2011-01-25 Thread Roy Mathew
ooh.. I have another question. What if I want to add the value in the vector a to the hello each time it prints. Here is your output a - c(2,3,5,5,5,6,6,7) mapply(rep, hello, rle(a)$lengths, USE.NAMES = FALSE) [[1]] [1] hello [[2]] [1] hello [[3]] [1] hello hello hello [[4]] [1] hello hello

[R] Problem with matchit() and zelig()

2011-01-25 Thread F.Giammarino
Dear all, Does anybody know why the following code returns an error message? library(MatchIt) library(Zelig) data(lalonde) m.out1-matchit(treat~age+educ+black+hispan+nodegree+married +re74+re75, method=full, data=lalonde) z.out1-zelig(re78~age+educ+black+hispan+nodegree+married+re74+re75,

[R] 3D Binning

2011-01-25 Thread vioravis
I am trying to do binning on three variables (3d binning). The bin boundaries are specified by the user separately for each variable. I used the bin2 function in the 'ash' package for 2d binning that involves only two variables but didn't any package for similar binning with three variables. Are

Re: [R] Paired data survival analysis

2011-01-25 Thread Terry Therneau
--- begin included message --- Im an honours student at Monash University. I'm trying to analyse some data for my project, which involved 2 treatments. My subjects were exposed to both treatments, and i gave them 60 minutes to perform a certain behaviour. 3 of my subjects performed the behaviour

Re: [R] Learn Vectorization (Vectorize)

2011-01-25 Thread Henrique Dallazuanna
Try this: expand.grid(seq(startpos, endpos, by = diff(c(startpos, endpos)) / nrow(sr)), seq(startpos, endpos, by = diff(c(startpos, endpos)) / nrow(sr))) On Tue, Jan 25, 2011 at 1:29 PM, Alaios ala...@yahoo.com wrote: Greetings Friends, I would be grateful if you can help me

[R] Extracting SSE from lm

2011-01-25 Thread Brian J Mingus
Apologies for this simple question - Given the number of comparisons I need to do it has become somewhat laborious to compute the SSE manually. I first have to extract the coefficients, build the model and run the model on the data. So far I haven't found any method in R that will do this for me.

[R] deSolve: Problem solving ODE including modulo-operator

2011-01-25 Thread apokaly
I have a problem integrating the 'standard map' ( http://en.wikipedia.org/wiki/Standard_map http://en.wikipedia.org/wiki/Standard_map ) with deSolve: By using the modulo-operator '%%' with 2*pi in the ODEs (standardmap1), the resulting values of P and Theta, should not be greater than 2pi.

[R] barplot with varaible-width bars

2011-01-25 Thread Gould, A. Lawrence
I would like to produce a bar plot with varying-width bars. Here is an example to illustrate: ww - c(417,153,0.0216,0.0065,556,256,0.0162,0.0117, + 726,379,0.0358,0.0501,786,502,0.0496,0.0837, + 892,591,0.0785,0.0795) yy-t(t(array(ww,c(2,10

Re: [R] crazy loop error.

2011-01-25 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 25.01.2011 10:58:36: ooh.. I have another question. What if I want to add the value in the vector a to the hello each time it prints. Here is your output a - c(2,3,5,5,5,6,6,7) mapply(rep, hello, rle(a)$lengths, USE.NAMES = FALSE) [[1]] [1]

[R] applying a function to output a matrix

2011-01-25 Thread Lara Poplarski
Dear List, I am using function distCosine from package geosphere to a list of lat/lon coordinates, and I want to calculate the great circle distance between a pair of coordinates in the list and all other pairs --- essentially, the output should be a matrix. I have been able to achieve this with

Re: [R] crazy loop error.

2011-01-25 Thread Bert Gunter
Well, I'm not Prof. Ripley, but the answer is: Look at the code. seq_len, seq.int, and seq_along call Primitives, which are implemented in C, and therefore MUCH faster than seq(), which is implemented as pure R code (and is also a generic, so requires method dispatch). Though for small n (up to a

[R] Multivariate polynomials Howto

2011-01-25 Thread Alaios
Good Evening, I would like to work with multivariate polynomials (x and y variables). I know that there is a package called multipol but I am not sure that supports my needs. I use a function (in reality legendre.polynomials) which creates me the polynomials I want. For example the following

Re: [R] Learn Vectorization (Vectorize)

2011-01-25 Thread Bert Gunter
Inline below. -- Bert On Tue, Jan 25, 2011 at 7:48 AM, Henrique Dallazuanna www...@gmail.com wrote: Try this: expand.grid(seq(startpos, endpos, by = diff(c(startpos, endpos)) / nrow(sr)),          seq(startpos, endpos, by = diff(c(startpos, endpos)) / nrow(sr))) On Tue, Jan 25, 2011 at

[R] ggplot - controlling point size

2011-01-25 Thread Gene Leynes
Can anyone illuminate the following for me? How can I get rid of the blue line in the key in the second plot? ## Create a simple data frame df=data.frame(x=1:1000, y=2*1:1000+rnorm(1000,sd=1000), type=sample(letters[1:2],1000, replace=TRUE)) ## Very nice! Almost what I want qplot(x, y,

[R] Failing to install {rggobi} on win-7 R 2.12.0

2011-01-25 Thread Tal Galili
Greetings all, I am failing to install the package rggobi on windows 7 with R 2.12.0. On R 2.11.1, the package was installed fine. I asked for help on the rggobi google group 4 days ago, and didn't receive any help, so I was wondering if someone here might have a suggestion. Here are the

[R] NA replacing

2011-01-25 Thread andrija djurovic
Hello R user, I have following data frame: df=data.frame(id=c(1:10),strata=rep(c(1,2),c(5,5)),y=c( 10,12,10,NA,15,70,NA,NA,55,100),x=c(3,4,5,7,4,10,12,8,3,15)) and I would like to replace NA's with: instead of first NA tapply(na.exclude(df)$y,na.exclude(df)$strata,sum)[1]* *7

Re: [R] ggplot - controlling point size

2011-01-25 Thread Felipe Carrillo
try this: qplot(x, y, data=df, colour=factor(type), size=I(1)) + geom_smooth()   Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA http://www.fws.gov/redbluff/rbdd_jsmp.aspx - Original Message From: Gene Leynes

Re: [R] Train error:: subscript out of bonds

2011-01-25 Thread Neeti
after using options(error=utils::recover) option, following is the output. if i am correct this means that in ksvm there is some problem, but really could not understand. could anyone please tell me what is wrong... any help will be great thank you so much.. Enter a frame number, or 0 to

Re: [R] determining the order in which points are plotted

2011-01-25 Thread Greg Snow
With large numbers of points you might want to consider hexagonal binning instead of scatter plots. I don't know of any tools that both do the binning and take groups into account, but you could think it through and work something out. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center

[R] coxme and random factors

2011-01-25 Thread Sophie Armitage
Hi I would really appreciate some help with my code for coxme... My data set I'm interested in survival of animals after an experiment with 4 treatments, which was performed on males and females. I also have two random factors: Response variable: survival (death) Factor 1:

Re: [R] crazy loop error.

2011-01-25 Thread Ivan Calandra
Now I understand what the difference between a primitive and a non-primitive! Thanks for the clarification! Ivan Le 1/25/2011 18:03, Bert Gunter a écrit : Well, I'm not Prof. Ripley, but the answer is: Look at the code. seq_len, seq.int, and seq_along call Primitives, which are implemented in

Re: [R] ggplot - controlling point size

2011-01-25 Thread Brian Diggs
On 1/25/2011 9:44 AM, Felipe Carrillo wrote: try this: qplot(x, y, data=df, colour=factor(type), size=I(1)) + geom_smooth() Felipe very nicely answered the how of your question. I thought I'd followup with the why. Using qplot, it assumes that you are giving a set of aesthetic mappings.

Re: [R] ggplot - controlling point size

2011-01-25 Thread Gene Leynes
Thank you both, very much. Using the identity function I() is a very nice trick, but it still feels like a trick. Using ggplot makes the most sense to me. ggplot(df, aes(x=x, y=y, colour=factor(type))) + geom_point(size=1) + geom_smooth() Thank you very much for taking the time to

Re: [R] Extracting SSE from lm

2011-01-25 Thread Greg Snow
It is not clear what you are doing or why you are doing it. If you tell us your ultimate goal we may be able to help you find a way that does not require all the computing that you are doing. How do you get your coefficients? Are you using lm? Have you looked at the resid function? --

Re: [R] Extracting SSE from lm

2011-01-25 Thread Peter Ehlers
On 2011-01-25 08:08, Brian J Mingus wrote: Apologies for this simple question - Given the number of comparisons I need to do it has become somewhat laborious to compute the SSE manually. I first have to extract the coefficients, build the model and run the model on the data. So far I haven't

[R] Warning with predict.glm method

2011-01-25 Thread Lars Bishop
Dear list, When I use the predict.glm method on a glm fitted object, I get the following warning message: In addition: Warning message: In predict.lm(object, x) : prediction from a rank-deficient fit may be misleading As the documentation says this happens if the fit is rank-deficient, some

[R] Counting number of rows with two criteria in dataframe

2011-01-25 Thread Ryan Utz
Hi R-users, I'm trying to find an elegant way to count the number of rows in a dataframe with a unique combination of 2 values in the dataframe. My data is specifically one column with a year, one with a month, and one with a day. I'm trying to count the number of days in each year/month

Re: [R] Counting number of rows with two criteria in dataframe

2011-01-25 Thread Henrique Dallazuanna
If you want count: xtabs( ~ x + y, X) or sum: xtabs(z ~ x + y, X) On Tue, Jan 25, 2011 at 5:25 PM, Ryan Utz utz.r...@gmail.com wrote: Hi R-users, I'm trying to find an elegant way to count the number of rows in a dataframe with a unique combination of 2 values in the dataframe. My

[R] subsetting based on joint values of critera

2011-01-25 Thread Simon Kiss
Dear colleagues, I have a dataset that looks as below. I would like to make a new dataset that excludes the cases which are joint conjunctions of particular state names and years, so Connecticut and 2010, Maryland and 2010 and Vermont and 2010. I'm trying the following subset code: newdata-

[R] Importing xls from a http://

2011-01-25 Thread cameron
I know a lot of people asked similar questions like this. I have tried using read.xls () Error in .Call(ReadXls, file, colNames, sheet, type, from, rowNames, : Incorrect number of arguments (11), expecting 10 for ReadXls read.table or read.csv (Wrong table format) odbcConnectExcel have

[R] Help Derivate for Nonlinear Growth Models

2011-01-25 Thread acocac
Hi!! Im doing my graduated work in Onion Curves Growth with Nonlinear Models, I'm amateur in R so i have doubt how i put or program next models, http://r.789695.n4.nabble.com/file/n3236748/96629508.png Also, i cant derivate for Gauss Model, and Richard Model dont have funtion, If someone

[R] Does anybody knows the default value of starting value in glm?

2011-01-25 Thread Akram Khaleghei Ghosheh balagh
Hello ; Do you know what is the default value of starting value in glm ? glm(..., start=c(),... ) I know that it is NULL by default but it need a value to start iteration . what is this value? Thanks; [[alternative HTML version deleted]] __

[R] Help with calculating correlation coefficient - creating a network

2011-01-25 Thread kparamas
Hi, I am creating a correlation based graph for the data 27 X 3040. I am not sure if I am allocating enough space for the data. I am using the following .R file (which is an example for geneData)! http://r.789695.n4.nabble.com/file/n3236801/sampleClimate.R sampleClimate.R/nabble_a and the data

Re: [R] Counting number of rows with two criteria in dataframe

2011-01-25 Thread Ista Zahn
Hi Ryan, One option would be X$a - paste(X$x, X$y, sep=.) table(X$a) Best, Ista On Tue, Jan 25, 2011 at 2:25 PM, Ryan Utz utz.r...@gmail.com wrote: Hi R-users, I'm trying to find an elegant way to count the number of rows in a dataframe with a unique combination of 2 values in the

Re: [R] Importing xls from a http://

2011-01-25 Thread Gabor Grothendieck
On Tue, Jan 25, 2011 at 2:06 PM, cameron raymond...@invesco.com wrote: I know a lot of people asked similar questions like this.  I have tried using read.xls () Error in .Call(ReadXls, file, colNames, sheet, type, from, rowNames,  :  Incorrect number of arguments (11), expecting 10 for

[R] Predictions with 'missing' variables

2011-01-25 Thread Axel Urbiz
Dear List, I think I'm going crazy here...can anyone explain why do I get the same predictions in train and test data sets below when the second has a missing input? y - rnorm(1000) x1 - rnorm(1000) x2 - rnorm(1000) train - data.frame(y,x1,x2) test - data.frame(x1) myfit - glm(y ~ x1 + x2,

Re: [R] subsetting based on joint values of critera

2011-01-25 Thread Ista Zahn
Hi Simon, You almost had it! Just need to move the negation outside the rest of the logic, and remove the quotes from year. Not actually tested (no data), but I think newdata- subset(bpa, !(State==Connecticut year2010)) should do it. Best, Ista On Tue, Jan 25, 2011 at 1:34 PM, Simon Kiss

Re: [R] Predictions with 'missing' variables

2011-01-25 Thread Ista Zahn
See the note in the help page for ?predict.glm Best, Ista On Tue, Jan 25, 2011 at 2:59 PM, Axel Urbiz axel.ur...@gmail.com wrote: Dear List, I think I'm going crazy here...can anyone explain why do I get the same predictions in train and test data sets below when the second has a missing

[R] Manual two-stage least squares in R

2011-01-25 Thread Katharina Ley
Hi, I am trying to manipulate a gls regression model output to adjust for use of two-stage least squares. Basically, I want to estimate a model, then feed in a new set of residuals, then re-calculate all of the model output (i.e. the standard errors of the estimators, etc.). I have found some

[R] lattice draw.key(): position of key in panels

2011-01-25 Thread Boris.Vasiliev
Good afternoon, I am working on a plot that requires custom legends to be placed in some panels of the plot; other panels do not contain legends. The problem that I run into is positioning of the legend in individual panels. In particular, the 'x' and 'y' elements of the key-list are ignored by

Re: [R] Manual two-stage least squares in R

2011-01-25 Thread Kevin Wright
Your question has some similarities this paper: Alison Smith, Brian Cullis, and Arthur Gilmour. The analysis of crop variety evaluation data in Australia. Aust. N. Z. J. Stat., 43:129--145, 2001. In that paper, the authors fit a mixed model with several random effects. The variances are then

[R] MAtrix addressing

2011-01-25 Thread Alaios
Hello I would like to ask you if it is possible In R Cran to change the default way of addressing a matrix. for example matrix(data=seq(from=1,to=4,nrow=2,ncol=2, by row numbering) # not having R at this pc will create something like the following 1 2 3 4 the way R address this matrix is from

[R] FW: question about the pt() calculation

2011-01-25 Thread Leitch, Matthew C.
From: Leitch, Matthew C. Sent: Monday, January 24, 2011 6:53 PM To: 'i...@network-theory.co.uk' Subject: question about the pt() calculation Hello Thank you for your time. I am a graduate student at the University of Texas Medical Branch, and I was wondering if you could help me with a R

Re: [R] 3D Binning

2011-01-25 Thread Petr Savicky
On Tue, Jan 25, 2011 at 06:00:36AM -0800, vioravis wrote: I am trying to do binning on three variables (3d binning). The bin boundaries are specified by the user separately for each variable. I used the bin2 function in the 'ash' package for 2d binning that involves only two variables but

[R] function application

2011-01-25 Thread Roy Shimizu
Suppose I have a function, like list, that takes a variable number of arguments, and I have those arguments in some vector x. How can execute the function with the *contents* of x as its arguments? I.e., I don't want list(x), but rather list(x[[1]], x[[2]], ..., x[[n]]), but I don't want to

[R] FW: question about the pt() calculation

2011-01-25 Thread Leitch, Matthew C.
From: Leitch, Matthew C. Sent: Monday, January 24, 2011 6:53 PM To: 'i...@network-theory.co.uk' Subject: question about the pt() calculation Hello Thank you for your time. I am a graduate student at the University of Texas Medical Branch, and I was wondering if you could help me with a R

Re: [R] function application

2011-01-25 Thread Erik Iverson
Suppose I have a function, like list, that takes a variable number of arguments, and I have those arguments in some vector x. How can execute the function with the *contents* of x as its arguments? I.e., I don't want list(x), but rather list(x[[1]], x[[2]], ..., x[[n]]), but I don't want to

Re: [R] function application

2011-01-25 Thread Phil Spector
?do.call Please provide a reproducible example if the help file is not sufficient. - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Train error:: subscript out of bonds

2011-01-25 Thread mxkuhn
You should try different tuning parameters; the defaults are not likely to work for many datasets. I don't use the polynomial kernel too much but scale parameter values that are really of could cause this. Unlike the rbf, I don't know of any good techniques for estimating this. Max On Jan 25,

Re: [R] FW: question about the pt() calculation

2011-01-25 Thread Phil Spector
Matthew - Others will probably tell you about the folly of performing 1733 t-tests on groups with 4 observations each, but an alternative to your approach would be to use R to solve your problem. (I'm using var.equal=TRUE because that's what you're calculating, but you might consider using

[R] ANOVA table look

2011-01-25 Thread Keith Jones
Y'all, I need to get the look of a standard fixed effect ANOVA table: anova(aov(meas~op*part,data=fs)) Analysis of Variance Table Response: meas Df Sum Sq Mean Sq F value Pr(F) op 22.62 1.308 1.3193 0.2750 part 19 1185.43 62.391 62.9151 2e-16 *** op:part 38

Re: [R] Does anybody knows the default value of starting value in glm?

2011-01-25 Thread Douglas Bates
On Tue, Jan 25, 2011 at 1:14 PM, Akram Khaleghei Ghosheh balagh a.khaleg...@gmail.com wrote: Hello ; Do you know what is the default value of starting value in glm ? glm(..., start=c(),... ) I know that it is NULL by default but it need a value to start iteration . what is this value?

[R] write.table -- maintain decimal places

2011-01-25 Thread Jim Moon
Hello, All, How can I maintain the decimal places when using write.table()? Jim e.g. df: EFFECT2 PVALUE 1 0.0230.88080 2 -0.260 0.08641 3 -0.114 0.45200 write.table(df,file='df.txt',quote=F,sep='\t',row.names=F) df.txt: EFFECT2PVALUE 0.023 0.8808 -0.26 0.08641 -0.114

[R] post-hoc comparisons in GAMs (mgcv) with parametric terms

2011-01-25 Thread Julian Burgos
Dear list, I´m wondering if there is something analogous to the TukeyHSD function that could be used for parametric terms in a GAM. I´m using the mgcv package to fit models that have some continuous predictors (modeled as smooth terms) and a single categorical predictor. I would like to do post

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Sebastian P. Luque
On Tue, 25 Jan 2011 16:16:37 -0800, Jim Moon moo...@ohsu.edu wrote: Hello, All, How can I maintain the decimal places when using write.table()? Have a look at ?format.data.frame -- Seb __ R-help@r-project.org mailing list

[R] crash when using hazard.ratio.plot from rms package

2011-01-25 Thread Hongying Li
Dear all, I always encounter a crash when running hazard.ratio.plot from rms package with my predictor as a factor. It works fine when the predictor is a continous score. Anyone encounters this too? Is this a bug or something? Thanks, Lilian

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Peter Ehlers
On 2011-01-25 16:16, Jim Moon wrote: Hello, All, How can I maintain the decimal places when using write.table()? Jim e.g. df: EFFECT2 PVALUE 1 0.0230.88080 2 -0.260 0.08641 3 -0.114 0.45200 write.table(df,file='df.txt',quote=F,sep='\t',row.names=F) write.table(format(df,

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Jim Moon
Thank you for the response, Peter. The approach: write.table(format(df, drop0trailing=FALSE),file='df.txt',quote=F,sep='\t',row.names=F) surprisingly still results in some loss of trailing 0's. df: EFFECT2 PVALUE 1 0.0230.88080 2 -0.260 0.08641 3 -0.114 0.45200 df.txt: EFFECT2

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Peter Ehlers
On 2011-01-25 17:22, Jim Moon wrote: Thank you for the response, Peter. The approach: write.table(format(df, drop0trailing=FALSE),file='df.txt',quote=F,sep='\t',row.names=F) surprisingly still results in some loss of trailing 0's. What version of R? I'm using R version 2.12.1 Patched

[R] return object from loop inside a function

2011-01-25 Thread Nicolas Gutierrez
Hi All, I have a for loop inside the function and I cannot get UUU to give me an updated grid.dens object when I run the function (it does update when I run just the for loop). Here's a simplified version of my function: UUU=function(pop, grid.dens) { for (i in 1:10){

  1   2   >