Re: [R] lme funcion in R

2009-08-05 Thread Hongwei Dong
Thanks, Thierry and other R users. I estimate the model using the factor rather than the dummy variables I used previously. It still takes forever for the function lme to run. But lmer is much better with my large data size (about 60,000 observations). The interesting part is that the results from

Re: [R] writing a simulation

2009-08-05 Thread Meenu Sahi
No its not an or condition. Please see the changed attachment. Many thanks for your help. Regards Meenu On Wed, Aug 5, 2009 at 6:36 PM, David Winsemius dwinsem...@comcast.netwrote: On Aug 4, 2009, at 2:12 PM, Meenu Sahi wrote: Dear R Users I'm writing my first simulation in R. I've put

Re: [R] using ddply but preserving some of the outside data

2009-08-05 Thread jebyrnes
Interesting. While this will work for a single site, however, for multiple sites or other grouping variables, I'm left with the same problem of efficiently going from one data from to the other. David Winsemius wrote: library(zoo) ?rollmean David Winsemius, MD Heritage

[R] why is 0 not an integer?

2009-08-05 Thread Steve Jaffe
Why when I assign 0 to an element of an integer vector does the type change to numeric? Here is a particularly perplexing example: v - 0:10 v [1] 0 1 2 3 4 5 6 7 8 9 10 class(v) [1] integer v[1] - 0 class(v) [1] numeric #!! -- View this message in context:

Re: [R] Re ferencing columns and pulling selected data

2009-08-05 Thread Brian Diggs
PDXRugger wrote: Please consider the following inputs: PrsnSerialno-c(735,1147,2019,4131,4131,4217,4629,4822,4822,5979,5979,6128,6128,7004,7004, 7004,7004,7004,7438,7438,9402,9402,9402,10115,10115,11605,12693,12693,12693)

Re: [R] why is 0 not an integer?

2009-08-05 Thread Nikos Alexandris
On Wed, 2009-08-05 at 13:16 -0700, Steve Jaffe wrote: Why when I assign 0 to an element of an integer vector does the type change to numeric? Here is a particularly perplexing example: v - 0:10 v [1] 0 1 2 3 4 5 6 7 8 9 10 class(v) [1] integer v[1] - 0 try this: v -

Re: [R] problem with pattern matching

2009-08-05 Thread Rnewbie
Thank you very much for the answer. I just solved the problem by writing a loop for grep(), so that R runs through the ID list one by one. Probably it is not the ideal method, but still I can now proceed to further work. William Dunlap wrote: -Original Message- From:

[R] hi, i have a problem in R

2009-08-05 Thread Gina Liao
Hi, I'm new to R language. There is a problem I couldn't understand. Hope you can answer my question. when i type for (i in 1:10){ + print(sample(9,4,replace=T)) +} and it shows ten of four numbers and how do I do to calculate the frequencies in each list? I know there is

Re: [R] why is 0 not an integer?

2009-08-05 Thread Duncan Murdoch
On 8/5/2009 4:16 PM, Steve Jaffe wrote: Why when I assign 0 to an element of an integer vector does the type change to numeric? Because 0 is a numeric constant, not an integer constant. R doesn't check the value, only the type: it's just as if you assigned 3.14159 to that element as far as

Re: [R] mahalanobis distance

2009-08-05 Thread suzusa
Try: library(MASS) mahalanobis(x,y,ginv(S),inverted=TRUE) -- View this message in context: http://www.nabble.com/mahalanobis-distance-tp24569511p24831389.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] why is 0 not an integer?

2009-08-05 Thread Erik Iverson
First, this has nothing to do with 0. Assigning 1000 to an element of v would also have this effect. Two, the first element of a vector is indexed by 1, not 0. While what you wrote isn't a syntax error (v[0] - 0), it may be not doing what you think, but I don't know. Finally, the answer to

Re: [R] problem with pattern matching

2009-08-05 Thread Rnewbie
I have a list of IDs like this: AB1234 AB4567 AB8901 In my dataset, there are IDs like this: AB AB /// AB1234 AB4567 /// AB8901 /// AB I used grep(list$ID, dataset$ID, value=T) It returned only one match, which was the very first match AB /// AB1234. It seems once the first

Re: [R] multiple lty on same panel in xyplot

2009-08-05 Thread Jacob Wegelin
On Wed, 5 Aug 2009, Deepayan Sarkar wrote: On 8/5/09, Jacob Wegelin jacob.wege...@gmail.com wrote: I would like to use lattice graphics to plot multiple functions (or groups or subpopulations) on the same plot region, using different line types lty or colors col to distinguish the functions

Re: [R] Some SQL Challenges

2009-08-05 Thread Michael Yutzi
To insert values with SQL: INSERT INTO table_name VALUES (value1, value2, value3,...). To deal with those date problems Im almost sure that R has a Date Function somewhere in its manual. You should take a look. Just the best help I can give, sorry good look JoK LoQ wrote: Hi, Im

Re: [R] why is 0 not an integer?

2009-08-05 Thread John Kane
Pesumably because v[1] - 0 give a numeric result, then the rest of v is coerced into numeric. Observe v - 0:10 class(v) v[1] - as.integer(0) class(v[1]) class(v) --- On Wed, 8/5/09, Steve Jaffe sja...@riskspan.com wrote: From: Steve Jaffe sja...@riskspan.com Subject: [R] why is 0 not an

Re: [R] using ddply but preserving some of the outside data

2009-08-05 Thread Gabor Grothendieck
In particular, try this: library(zoo) a.wide - reshape(a.df, dir = wide, timevar = dates, idvar = sites) rollmean(as.zoo(t(a.wide[,-1])), 2) 1 56.855685 58.62981 95.14842 2 58.049821 58.81659 78.70020 3 11.199634 89.91179 76.22853 4 1.152741 43.6 93.03040 On Wed, Aug 5, 2009 at 3:05

Re: [R] why is 0 not an integer?

2009-08-05 Thread jim holtman
try x - 0 class(x) [1] numeric x - 0L class(x) [1] integer You have to explicitly indicate that you want integer. On Wed, Aug 5, 2009 at 4:16 PM, Steve Jaffesja...@riskspan.com wrote: Why when I assign 0 to an element of an integer vector does the type change to numeric? Here is a

Re: [R] Stacked plots with common x-axis and different y-axis

2009-08-05 Thread Jason Rupert
Jim, Thank you very much for providing this information. Within Plotrix does there also exist the possibility of having two plots share the same x-axis, but have one plot above the other plot. That is, essentially do the same thing as twoord.plot, but instead put the right y values in a

[R] ncdf package problem - put.var.ncdf

2009-08-05 Thread Steve Murray
Dear all, I am attempting to convert 10 NetCDF files into a single NetCDF file, due to the data input requirements of a model I hope to use. I am using the ncdf package, version 1.6. The data are global-scale water values, on a monthly basis for 10 years (ie. 120 months of data in total; at

[R] R: how import Excel data into R?

2009-08-05 Thread mauede
I recently downloaded an XLS file from a web site into a data.frame. You may want to try out the following: ?install.packages(gdata) library(gdata) ?read.xls Maura -Messaggio originale- Da: r-help-boun...@r-project.org per conto di Inchallah Yarab Inviato: mer 05/08/2009 17.56 A:

[R] Question with apply function

2009-08-05 Thread Noah Silverman
In my continuing quest to generate some summary data, I've come across some useful suggestions in pasts posts. The apply operation returns an error, and I can't figure out why. Can someone help me fix this? testlogdata - cbind(testlogdata, range_group=cut(testlogdata$lrm_score, breaks=c(.9,

[R] A question regarding R scoping

2009-08-05 Thread Ivo Shterev
I have a question related to scoping. Suppose we have 2 functions: f1 = function(i){i = 1} f2 = function(n){ i = length(n) f1(i) } In other words, I would like i=1 regardless of n. Is this possible without having f1 in the body of f2? Thanks in advance!

Re: [R] hi, i have a problem in R

2009-08-05 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gina Liao Sent: Wednesday, August 05, 2009 7:15 AM To: r-h...@stat.math.ethz.ch Subject: [R] hi, i have a problem in R Hi, I'm new to R language. There is a problem I

Re: [R] using ddply but preserving some of the outside data

2009-08-05 Thread jebyrnes
OK, I see how this would work for a rolling mean with continuous observations. However, my actual problem is a bit more complex. I have a number of observations, not necessarily evenly spaced. So, the data I'm working with looks somewhat more like what this would produce set.seed(2003)

[R] plotting points in random but different colors based on condition

2009-08-05 Thread per freem
hi all, suppose I have a file with several columns, and I want to plot all points that meet a certain condition (i.e. all points in columns A and B that have a value greater than such and such in column C of the data) in a new but random color. That is, I want all these points to be colored

Re: [R] using ddply but preserving some of the outside data

2009-08-05 Thread Gabor Grothendieck
Its not the evenly spaced that makes it work -- its that you want the same number of observations to contribute to each mean even if they are not equally spaced. In your case since you want different numbers of observations to contribute to each mean you will need a different approach:

Re: [R] plotting points in random but different colors based on condition

2009-08-05 Thread Juliet Hannah
Maybe this is helpful. Install ggplot2. #Create a small example x - seq(1:20) y - (2*x) + rnorm(length(x),0,1) id - rep(1:5,each=4) dat - data.frame(x,y,id) library(ggplot2) p - ggplot(dat,aes(x=x,y=y,colour=factor(id))) p - p + geom_point() p If this is not the correct structure, maybe

Re: [R] Question with apply function

2009-08-05 Thread Steve Lianoglou
On Aug 5, 2009, at 5:45 PM, Noah Silverman wrote: In my continuing quest to generate some summary data, I've come across some useful suggestions in pasts posts. The apply operation returns an error, and I can't figure out why. Can someone help me fix this? testlogdata - cbind(testlogdata,

Re: [R] A question regarding R scoping

2009-08-05 Thread Steve Lianoglou
Hi, On Aug 5, 2009, at 5:55 PM, Ivo Shterev wrote: I have a question related to scoping. Suppose we have 2 functions: f1 = function(i){i = 1} f2 = function(n){ i = length(n) f1(i) } In other words, I would like i=1 regardless of n. Is this possible without having f1 in the body of f2?

Re: [R] Stacked plots with common x-axis and different y-axis

2009-08-05 Thread Gabor Grothendieck
Try this: library(zoo) # ignore the fact that months have different lengths z - with(airquality, zoo(cbind(Wind, Temp), Month + (Day - 1)/31)) plot(z) # each on separate plot stacked above each other plot(z, screen = 1) # both on same plot library(lattice) xyplot(z) xyplot(z, screen = 1)

[R] creating MS Access query objects using RODBC

2009-08-05 Thread Tim Calkins
Hi - I'm trying to use R to create an MS Access query object. In particular, I would like to pass a given sql statement to a variety of Access files and have that sql statement saved as an Access Query in each db. Is this possible using R? I'm aware that I could use RODBC sqlQuery and write sql

[R] specify lattice black-and-white theme

2009-08-05 Thread Jacob Wegelin
Is there a simple way to specify a theme or trellis (lattice) parameters so that, in a multipanel (conditioned) plot, there is no color and in the strips there is no shading? This is the effect achieved on page 124 of Deepayan Sarkar's Lattice (figure 7.2). I managed to trick lattice into making a

Re: [R] multiple lty on same panel in xyplot

2009-08-05 Thread Deepayan Sarkar
On Wed, Aug 5, 2009 at 2:24 PM, Jacob Wegelinjacob.wege...@gmail.com wrote: On Wed, 5 Aug 2009, Deepayan Sarkar wrote: On 8/5/09, Jacob Wegelin jacob.wege...@gmail.com wrote: I would like to use lattice graphics to plot multiple functions (or groups  or subpopulations) on the same plot

Re: [R] specify lattice black-and-white theme

2009-08-05 Thread Deepayan Sarkar
On Wed, Aug 5, 2009 at 6:27 PM, Jacob Wegelinjacob.wege...@gmail.com wrote: Is there a simple way to specify a theme or trellis (lattice) parameters so that, in a multipanel (conditioned) plot, there is no color and in the strips there is no shading? This is the effect achieved on page 124 of

Re: [R] fitting a truncated power law

2009-08-05 Thread glen_b
Is k the count? What are x and y? are both measured? Don't the two k's in the exp term cancel? Is there a reference? glen_b wrote: Let me rephrase. You have some counts. You have some other measurement or measurements. Presumably you are trying to predict (fit) expected count in

Re: [R] hi, i have a problem in R

2009-08-05 Thread Gina Liao
Hi, I'm sorry i didn't say clearly. for (i in 1:10){ + print(sample(9,4,replace=T)) + } [1] 2 5 5 2 [1] 6 2 1 5 [1] 9 5 9 7 [1] 2 6 4 1 [1] 8 5 4 5 [1] 6 2 3 7 [1] 6 1 7 3 [1] 9 5 4 7 [1] 6 4 8 5 [1] 1 5 6 3 I mean when it shows these reults. Then, what should I do to show the top

[R] making scatter plot points fill semi-transparent

2009-08-05 Thread per freem
hi all, i have a simple scatter plot, and i'd like to make it so the scatter plot colors are slightly transparent. i see in a previous post that someone mentioned the alpha parameter, but i am not sure how it can be used with the 'plot' function [*]. for example, suppose i have:

Re: [R] hi, i have a problem in R

2009-08-05 Thread Steve Lianoglou
Hi Gina, On Aug 5, 2009, at 11:25 PM, Gina Liao wrote: Hi, I'm sorry i didn't say clearly. for (i in 1:10){ + print(sample(9,4,replace=T)) + } [1] 2 5 5 2 [1] 6 2 1 5 [1] 9 5 9 7 [1] 2 6 4 1 [1] 8 5 4 5 [1] 6 2 3 7 [1] 6 1 7 3 [1] 9 5 4 7 [1] 6 4 8 5 [1] 1 5 6 3 I mean when it

Re: [R] making scatter plot points fill semi-transparent

2009-08-05 Thread Steve Lianoglou
Hi, On Aug 5, 2009, at 11:48 PM, per freem wrote: hi all, i have a simple scatter plot, and i'd like to make it so the scatter plot colors are slightly transparent. i see in a previous post that someone mentioned the alpha parameter, but i am not sure how it can be used with the 'plot'

Re: [R] making scatter plot points fill semi-transparent

2009-08-05 Thread Gabor Grothendieck
Lattice graphics can do that: library(lattice) xyplot(0:20 ~ 0:20, alpha = 0:20/20, col = red, pch = 19, cex = 5) Google for HTML colors to find out more about the hex codes you are referring to. On Wed, Aug 5, 2009 at 11:48 PM, per freemperfr...@gmail.com wrote: hi all, i have a simple

[R] test of parallelism for ordinal regression?

2009-08-05 Thread Duncan Mackay
Hello, in order to test the parallelism assumption of ordinal regression, would it be appropriate to compare the likelihoods of a model fit by polr {MASS package} with a multinomial model fit by multinom {nnet package}? e.g. # dataframe ologit previously read from

<    1   2