[R] how to identify autocorrelation in Pearson Correlation Coefficient

2010-06-08 Thread elaine kuo
Dear, I computed pearson correlation coefficient between annual precipitation and temperature in a grid system. It is doubtful that there should be autocorrelation which might inflate the P-coefficient. Please kindly suggest any possible methods to filter autocorrelation. Thanks Elaine

[R] duplicated() and unique() problems

2010-06-08 Thread christiaan pauw
Hi everybody I have found something (for me at least) strange with duplicated(). I will first provide a replicable example of a certain kind of behaviour that I find odd and then give a sample of unexpected results from my own data. I hope someone can help me understand this. Consider the

Re: [R] as.integer

2010-06-08 Thread aledanda
probelm solved: data - read.table(pdvspt.txt, header = T, dec = ,) It was the coma, now I have everything in numeric. Thanks a lot for the support! Ale -- View this message in context: http://r.789695.n4.nabble.com/as-integer-tp2245987p2246989.html Sent from the R help mailing list archive

Re: [R] Matrix to database -- best practices/efficiency?

2010-06-08 Thread Jonathan Greenberg
Its a race! I decided to go ahead and time everyone's results, and all of the method's (except mine) are around the same speed. I ran them a few times and Gabor's application of melt() tends to be a tad bit faster than the other two, although that is far from conclusive -- do these methods share

Re: [R] Adding in Missing Data

2010-06-08 Thread Jeff08
Thanks, That thread talks about adding values to NA. However, the problem with my data is that the missing data points aren't even in the data.frame. The method I think of is using a loop to check ID by ID, if the date column contains all elements of unique(Returns.names$date_), and if not add

[R] Please help me

2010-06-08 Thread Xiongqing Zhang
Dear Mr. or Ms.,   I used the R-software to run the zero-inflatoin negative binomial model (zeroinfl()) .   Firstly, I introduced one dummy variable to the model as an independent variable, and I got the estimators of parameters. But the results are not satisfied to me. So I introduced three

[R] how to read CSV file in R?

2010-06-08 Thread dhanush
I tried to read a CSV file in R. The file has about 100,000 records and 75 columns. When used read.delim, I got this error. I am using R ver 10.1. los-read.delim(file.csv,header=T,sep=,) Warning message: In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : Reached total

Re: [R] Adding in Missing Data

2010-06-08 Thread Jeff08
Hey All, I have just recently thought of a completely different way to accomplish my analysis (requiring different type of coding) Instead of going in and filling in data, I could remove any dates not shared by ALL the id's. I was thinking about accomplishing this using merge(~~), do you think

Re: [R] as.integer

2010-06-08 Thread aledanda
Hi, thanks for your reply. I attached the example. I tried your suggestion: data[is.factor(data)] - lapply(data[is.factor(data)], function(x) as.numeric(as.character(x))) But I still have the var as factors. I'm thinking now, in the txt file the decimals numbers are separated with a coma.

[R] problem with if else statement

2010-06-08 Thread Peter Lercher
Dear colleagues, What did I not understand ? -my intention I want to create a new variable: In plain language: If someone is taking anithypertensive treatment (med.hyper==1) table(med.hyper) med.hyper 0 1 472 97 I want to subtract 5 mmHg (rr.dia.2m-5) from the measured diastolic blood

[R] cross-validation

2010-06-08 Thread azam jaafari
Hi   I want to do leave-one-out cross-validation for multinomial logistic regression in R. I did multinomial logistic reg. by package nnet in R. How I do validation? by which function? response variable has 7 levels   please help me   Thanks alot Azam [[alternative HTML version

Re: [R] problem with if else statement

2010-06-08 Thread Rafael Björk
Hi Peter! The 'if' function operate on a single logical expression, while you provided a vector. What your code does at present is subtract 5 from all values in rr.dia.2m if the first value in med.hyper is 1 and otherwise simply returns all values as is. Since you have no reproducible data, it's

Re: [R] problem with if else statement

2010-06-08 Thread Martyn Byng
Hi, You are using if/then/else which is a logical control statement and so doesn't return a value, see ?if for details. You are probably looking for the ifelse function. Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of

[R] NWS PACKAGE (netWorkSpace)

2010-06-08 Thread wesley mathew
Dear All I have some problem about *netWorkSpace command.*.I am following the nws tutorial. My operating system is windows XP and R version is 2.11.1. My intention is to share data between different programs. I hope NWS package is good for distributed and parallel data transfer. First I started

Re: [R] ols function in rms package

2010-06-08 Thread Mark Seeto
On 06/06/2010 10:49 PM, Mark Seeto wrote: Hello, I have a couple of questions about the ols function in Frank Harrell's rms package. Is there any way to specify variables by their column number in the data frame rather than by the variable name? For example, library(rms) x1-

Re: [R] Polar coordinate

2010-06-08 Thread Jim Lemon
On 06/07/2010 10:05 PM, ogbos okike wrote: Greetings to you all. I have two datasets - Time and magnitude. For a particular location, the magnitude of the parameter varies with time. I wish to obtain a polar coordinate distribution of time (0-24h) and magnitudes so as to visualize how

[R] Odp: duplicated() and unique() problems

2010-06-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.06.2010 08:44:39: Hi everybody I have found something (for me at least) strange with duplicated(). I will first provide a replicable example of a certain kind of behaviour that I find odd and then give a sample of unexpected results from my

Re: [R] problem with if else statement

2010-06-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.06.2010 11:46:17: Hi, You are using if/then/else which is a logical control statement and so doesn't return a value, see ?if for details. You are probably looking for the ifelse function. Or use possibility of easy conversion logical

Re: [R] cross-validation

2010-06-08 Thread Joris Meys
As far as my knowledge goes, nnet doesn't have a built-in function for crossvalidation. Coding it yourself is not hard though. Nnet is used in this book : http://www.stats.ox.ac.uk/pub/MASS4/ , which contains enough examples on how to do so. See also the crossval function in the bootstrap

Re: [R] how to read CSV file in R?

2010-06-08 Thread Joris Meys
That will be R 2.10.1 if I'm correct. For reading in csv files, there's a function read.csv who does just that: los - read.csv(file.csv,header=T) But that is just a detail. You have problems with your memory, but that's not caused by the size of your dataframe. On my system, a matrix with

Re: [R] cross-validation

2010-06-08 Thread Max Kuhn
Install the caret package and see ?train. There is also: http://cran.r-project.org/web/packages/caret/vignettes/caretTrain.pdf http://www.jstatsoft.org/v28/i05/paper Max On Tue, Jun 8, 2010 at 5:34 AM, azam jaafari azamjaaf...@yahoo.com wrote: Hi I want to do leave-one-out

Re: [R] Please help me

2010-06-08 Thread Joris Meys
First, read the posting guides. Then, supply us with a bit more information, like the package you used, example code that reproduces the error, information about the data, the complete error message, the traceback (use the function traceback() right after you got the error). Otherwise we ain't

Re: [R] Adding in Missing Data

2010-06-08 Thread Petr PIKAL
Hi Hm, maybe you can first make a sequence of all required dates and ids, construct empty data frame with all possible dates, merge your existing data frame with empty one just to fill in all dates, get rid of duplicated dates and ids if necessary and finally use na.locf from zoo library to

[R] scatterplot function - double check: dashed lines

2010-06-08 Thread K F Pearce
Hello everyone, This is just a quick double check. It concerns the 'scatterplot function' in R. I have 6 curves and I wish to represent each of them by a different kind of line (their colour must be black). The curves are derived from the cuminc function...the coordinates of which are in

Re: [R] duplicated() and unique() problems

2010-06-08 Thread christiaan pauw
Thanks for your help Petr I think I understand better now. Masechaba$unique[which(is.na(unique(Masechaba$PROPDESC))==FALSE)]=TRUE ^^^ This seems to be strange. At first sight I am puzzlet what result I shall expect from such

[R] add one point to contourplot()

2010-06-08 Thread biostat book
Hi All, I want to add one point to contourplot().  I used contourplot() in my code like contourplot(z ~ a + b |c, data) I understand there is plot.axes argument for filled.contour(), but it  did not work for my code. I also tried plot() and text() for contourplot(), but got this error: plot.new

Re: [R] duplicated() and unique() problems

2010-06-08 Thread Felix Andrews
On Tuesday, June 8, 2010, christiaan pauw cjp...@gmail.com wrote: Hi everybody I have found something (for me at least) strange with duplicated(). I will first provide a replicable example of a certain kind of behaviour that I find odd and then give a sample of unexpected results from my own

Re: [R] Desolve package: How to pass thousand of parameters to C compiled code?

2010-06-08 Thread Ben Bolker
cmmu_mile at yahoo.com writes: Hi, I have used DeSolve package for my ODE problem regarding infectious disease transmission and currently am trying to pass lots (roughly a thousand) of model parameters to the C compiled model (I have to use C compiled code instead of R code purely

[R] partial solutions to: if else statement problem

2010-06-08 Thread Peter Lercher
Thank you to all for your help! I received two equal alternative solutions that bypassed elegantly the problem from peter.l.e.koni...@gmail.com and rafael.bj...@gmail.com rr.dia2.corr - rr.dia.2m rr.dia2.corr[which(med.hyper == 1)] - rr.dia.2m[which(med.hyper == 1)] - 5 From

Re: [R] ols function in rms package

2010-06-08 Thread Frank E Harrell Jr
On 06/08/2010 05:29 AM, Mark Seeto wrote: On 06/06/2010 10:49 PM, Mark Seeto wrote: Hello, I have a couple of questions about the ols function in Frank Harrell's rms package. Is there any way to specify variables by their column number in the data frame rather than by the variable name?

[R] Odp: partial solutions to: if else statement problem

2010-06-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.06.2010 14:21:10: Thank you to all for your help! I received two equal alternative solutions that bypassed elegantly the problem from peter.l.e.koni...@gmail.com and rafael.bj...@gmail.com rr.dia2.corr - rr.dia.2m

Re: [R] Very OT: World Cup Statistics

2010-06-08 Thread R Heberto Ghezzo, Dr
The only goals I remember are that the Hand of God was at 6 min second period and the Goal of the Century at 11 min second period The others dont count. HG From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Paul

[R] glm output for binomial family

2010-06-08 Thread Enrico Colosimo
Hello, I am having some trouble running a very simple example. I am running a logistic regression entering the SAME data set in two different forms and getting different values for the deviance residual. Just look with this naive data set:

Re: [R] Sweave glm.fit

2010-06-08 Thread Jimmy Söderly
Thanks for the advice. I found the function : summary(mcmc(x)), from the coda package. 2010/6/4 Gavin Simpson gavin.simp...@ucl.ac.uk On Thu, 2010-06-03 at 23:44 +0200, Jimmy Söderly wrote: Thanks for your help. Does it have something to do with the mcmc package, the coda package, or

[R] Problem installing Rmpi

2010-06-08 Thread Paco Pastor
Hi everyone I want to install Rmpi to use R in parallel mode in a Linux cluster (Ubuntu, Hardy Heron). It seems to be properly installed but a problem appears when loading Rmpi library. R version 2.11.1 (2010-05-31) library(Rmpi) Error: package 'Rmpi' was built before R 2.10.0: please

[R] Deleting duplicate values in a correlation matrix

2010-06-08 Thread Matthew DiLeo
I have a large correlation matrix that I'm trying to convert to a list of every connection (edge) between every two nodes with its accompanying correlation value (for Cytoscape). I figured out how to do this and to remove the connections that nodes have to themselves but I can't figure out how to

[R] Getting started

2010-06-08 Thread Andrew Kelly
Hi,) I am just getting started with R but have hit an early snag. I am working through Crawley (2008) The R Book and on page 6, 'Significance Stars', I am trying to enter the commands given. However, 'Gain.txt' does not seem to have been downloaded when I downloaded the R programme. I have

[R] constructing a contingency table (ftable, table)

2010-06-08 Thread stefan.d...@gmail.com
Dear all, an hopefully quick table question. I have the following data: Two objects that are 2*9 matrix with nine column names (Dis1, ..., Dis9) and the row names (2010,2020). The content are frequencies (numeric). In want to create a table that is along the lines of ftable(UCBAdmissions) and

Re: [R] Getting started

2010-06-08 Thread Gabor Grothendieck
The author's site is here: http://www.bio.ic.ac.uk/research/mjcraw/therbook/ and you can read the file right off his site like this: URL - http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/Gain.txt; gg - read.table(URL, header = TRUE) On Tue, Jun 8, 2010 at 9:37 AM, Andrew Kelly

Re: [R] Deleting duplicate values in a correlation matrix

2010-06-08 Thread Henrique Dallazuanna
Try this: m - matrix(Corr, ncol = 3, dimnames = list(unique(NodesRow), unique(NodesCol))) m[col(m) == row(m) | upper.tri(m)] - NA subset(as.data.frame.table(m), !is.na(Freq)) On Tue, Jun 8, 2010 at 10:29 AM, Matthew DiLeo mv...@cornell.edu wrote: I have a large correlation matrix that I'm

Re: [R] Problem installing Rmpi

2010-06-08 Thread Uwe Ligges
On 08.06.2010 15:17, Paco Pastor wrote: Hi everyone I want to install Rmpi to use R in parallel mode in a Linux cluster (Ubuntu, Hardy Heron). It seems to be properly installed but a problem appears when loading Rmpi library. R version 2.11.1 (2010-05-31) library(Rmpi) Error: package

[R] setting up zoo objects from a data frame

2010-06-08 Thread Erin Hodgess
Dear R People: I have the following data frame: str(dog.df) 'data.frame': 7 obs. of 2 variables: $ V1: Factor w/ 3 levels 1/1/2000,1/2/2000,..: 1 1 1 2 2 3 3 $ V2: Factor w/ 3 levels cat,dog,tree: 2 1 3 1 3 2 3 dog.df V1 V2 1 1/1/2000 dog 2 1/1/2000 cat 3 1/1/2000 tree 4

[R] setting up zoo objects from a data frame: solved.

2010-06-08 Thread Erin Hodgess
Here is a particular way to solve the problem: test3 - seq(from=as.Date(1/1/2000,%m/%d/%Y),to=as.Date(1/3/2000, + %m/%d/%Y),length=3) test3 [1] 2000-01-01 2000-01-02 2000-01-03 zoo(table(dog.df$V1,dog.df$V2)[,1],order=test3) 2000-01-01 2000-01-02 2000-01-03 1 1 0

Re: [R] setting up zoo objects from a data frame

2010-06-08 Thread Stefan Grosse
Am 08.06.2010 16:52, schrieb Erin Hodgess: I would like to set up 3 time series; one for dog, one for cat, one for tree, such that each runs from 1/1/2000 to 1/3/2000, with 0 if there is no entry for the day. Before using zoo or zooreg you should transform your data.frame as such as

[R] Symbols in R

2010-06-08 Thread wenjun zheng
Hi R Users, I want to distinguish different condition by different symbols by pch in function grid.points, but the symbols needed should be with solid or hollow, in this way only 21 to 25 in pch worked, is there any other symbols could be used like this? or does it exist any other way to draw

Re: [R] setting up zoo objects from a data frame: solved.

2010-06-08 Thread Stefan Grosse
Am 08.06.2010 17:04, schrieb Erin Hodgess: Here is a particular way to solve the problem: If you solve your own problem then please reply to your own message otherwise things get confused. How should one know what your problem was without knowing your first e-mail - if you reply your own

[R] TS model

2010-06-08 Thread Ted Byers
I am looking at a new project involving time series analysis. I know I can complete the tasks involving VARMA using either dse or mAr (and I think there are a couple others that might serve). However, there is one task that I am not sure of the best way to proceed. A simple example illustrates

[R] R- Package - fdth

2010-06-08 Thread Enio Jelihovschi
We wish to announce the new package: fdth - Frequency Distribution Table and Associated Histogram. The package contains a a set of high level function which easily allows the user to make a frequency distribution table (fdt) and its associated plots. The fdt can be formatted in many ways which

Re: [R] setting up zoo objects from a data frame

2010-06-08 Thread Gabor Grothendieck
The first time I posted this it got held up for approval so I am trying it again. Hopefully this time it gets through right away. As with your prior post we can use read.zoo(..., split=...). Alternatives are reshape and reshape::cast. # read data into DF Lines - V1 V2 1 1/1/2000 dog 2

Re: [R] glm output for binomial family

2010-06-08 Thread Douglas Bates
On Tue, Jun 8, 2010 at 7:10 AM, Enrico Colosimo enrico...@gmail.com wrote: Hello,  I am having some trouble running a very simple example. I am running a logistic regression entering the SAME data set in two different forms and getting different values for the deviance residual. Just look

[R] GMM: The covariance matrix of the coefficients is singular

2010-06-08 Thread Fernando Martinez
Hi All, I'm trying to estimate some parameters in my model via GMM using the function gmm(), but I keep getting the message The covariance matrix of the coefficients is singular. I've changed the moment conditions and the initial value of the parameters, and I still get this message. Are the

Re: [R] constructing a contingency table (ftable, table)

2010-06-08 Thread Joris Meys
I could get something close to what you asked using a little hack, emulating a table using an array based on your two matrices : test - matrix(rpois(18,10),ncol=9,nrow=2) colnames(test) - paste(Dis,1:9,sep=) rownames(test) - c(2010,2020) test2 - matrix(rpois(18,10),ncol=9,nrow=2) colnames(test2)

[R] Convert a data frame to a 2D array?

2010-06-08 Thread A Huang
Hi there, I've read a file into a data frame. The data is n rows by m columns, all values are numbers. Is there a way to convert the data frame to a 2D array? I tried as.array(), but got some error messages. Thanks A. Huang [[alternative HTML version deleted]]

Re: [R] Convert a data frame to a 2D array?

2010-06-08 Thread Joshua Wiley
Hi, Does this work? array(data=unlist(yourdataframe), dim=c(n,m)) Josh On Tue, Jun 8, 2010 at 9:07 AM, A Huang mytechfo...@yahoo.com wrote: Hi there, I've read a file into a data frame. The data is n rows by m columns, all values are numbers. Is there a way to convert the data frame to

Re: [R] Convert a data frame to a 2D array?

2010-06-08 Thread Joris Meys
test - data.frame(x=1:10,y=1:10) as.array(as.matrix(test)) does the job too Cheers On Tue, Jun 8, 2010 at 6:07 PM, A Huang mytechfo...@yahoo.com wrote: Hi there, I've read a file into a data frame. The data is n rows by m columns, all values are numbers. Is there a way to convert the data

Re: [R] add one point to contourplot()

2010-06-08 Thread Thomas Stewart
Because contourplot comes from the lattice package, I think you'll want to look at these help pages: + help(trellis.focus) + help(lpoints) Below, I've used the example from help(contourplot) to demonstrate how one might add points and text to a lattice plot. -tgs #

Re: [R] Help with seting up comparison

2010-06-08 Thread Greg Snow
You really need to do some studying on mixed effects models. Some resources are at: http://lme4.r-forge.r-project.org/ Your formula below is wrong, you fit only the intercept as a fixed effect and you are fitting a random slope on animal by day for the random effect, which does not make much

Re: [R] Symbols in R

2010-06-08 Thread Greg Snow
The my.symbols function (TeachingDemos package) allows for defining your own symbols to use in plots using base graphics (see ms.filled.polygon for an example), there is also panel.my.symbols which works with lattice (possibly with general grid, but I have not tested it that way). Those may

[R] Need help in multi-dimensional clustering

2010-06-08 Thread kapil mahant
Hi All , For an academic project I am trying to do the following Step 1 ) Draw and cluster a N ( lets say 3 ) column dataset by dbscan algorithm using R-project’s fpc package ( let say they are training clusters ) , Using dbscan as number of clusters are not know

Re: [R] Convert a data frame to a 2D array?

2010-06-08 Thread A Huang
Thank you. It works like a charm. A. Huang From: Joshua Wiley jwiley.ps...@gmail.com Cc: r-help@r-project.org Sent: Tue, June 8, 2010 9:19:19 AM Subject: Re: [R] Convert a data frame to a 2D array? Hi, Does this work? array(data=unlist(yourdataframe),

[R] hypergeometric series in R

2010-06-08 Thread Arnau Mir
Hello. Somebody knows how to compute generalized hypergeometric series in R? (see http://functions.wolfram.com/HypergeometricFunctions/HypergeometricPFQ/02/ to understand what I mean) Thanks in advance, Arnau. __ R-help@r-project.org mailing list

Re: [R] Symbols in R

2010-06-08 Thread Bert Gunter
Mount soapbox; begin rant { ... However I think it should be added that rarely does this work with more than about a half dozen different symbols: a viewer of a graphic simply cannot keep the distinctions straight -- or often even decode them. Using color to distinguish groups is typically more

[R] POSIXlt objects

2010-06-08 Thread Luis Felipe Parra
Hello I am using POSIXlt date format and I am having the following problem, I've got two dates called FechaIni and FechaFin, one in 2008 and the other in 2009 but when I do FechaIni$year and FechaFin$year to call the year I am getting the smae year for both. FechaIni [1] 2008-11-13 UTC FechaFin

Re: [R] POSIXlt objects

2010-06-08 Thread Erik Iverson
Luis Felipe Parra wrote: Hello I am using POSIXlt date format and I am having the following problem, I've got two dates called FechaIni and FechaFin, one in 2008 and the other in 2009 but when I do FechaIni$year and FechaFin$year to call the year I am getting the smae year for both. FechaIni

Re: [R] Symbols in R

2010-06-08 Thread Ted Harding
On 08-Jun-10 18:00:18, Bert Gunter wrote: Mount soapbox; begin rant { ... However I think it should be added that rarely does this work with more than about a half dozen different symbols: a viewer of a graphic simply cannot keep the distinctions straight -- or often even decode them. Using

Re: [R] constructing a contingency table (ftable, table)

2010-06-08 Thread stefan.d...@gmail.com
Hi Joris, thanks for your help. I just had to alter it slightly (basically just transposing): tmp - array(rbind(t(test),t(test2)), dim=c(9,2,2), dimnames=list(colnames(test),rownames(test),c(Test,Test2))) ftable(tmp) Thanks again! Best, Stefan On Tue, Jun 8, 2010 at 5:46

[R] Rsymphony

2010-06-08 Thread Kaveh Vakili
Hi list, I have two question relating to the Rsymphony package: a) is there a way to use 'warm starts' ? i.e. if i successively call Rsymphony_solve_LP() with only one constraints change, does it perform the optimization from the simplex-origin or does it uses the previously found solution

Re: [R] ols function in rms package

2010-06-08 Thread Mark Seeto
On 06/08/2010 05:29 AM, Mark Seeto wrote: On 06/06/2010 10:49 PM, Mark Seeto wrote: Hello, I have a couple of questions about the ols function in Frank Harrell's rms package. Is there any way to specify variables by their column number in the data frame rather than by the variable

Re: [R] scatterplot function - double check: dashed lines

2010-06-08 Thread Greg Snow
While it is possible to set your own dash patterns as you show below, it is unlikely that the resulting graph will be very meaningful. Most people cannot keep the detailed dash patterns separate, and if they need to refer to a legend then it makes it even harder (See Bert Gunter's rant on the

Re: [R] hypergeometric series in R

2010-06-08 Thread Ben Bolker
Arnau Mir arnau.mir at uib.es writes: Hello. Somebody knows how to compute generalized hypergeometric series in R? (see http://functions.wolfram.com/HypergeometricFunctions/HypergeometricPFQ/02/ to understand what I mean) library(sos) findFn(generalized hypergeometric function) -

[R] more dates and data frames

2010-06-08 Thread Erin Hodgess
Dear R People: So thanks to your help, I have the following: dog3.df - read.delim(c:/Users/erin/Documents/dog1.txt,header=FALSE,sep=\t) dog3.df V1 V2 1 1/1/2000 dog 2 1/1/2000 cat 3 1/1/2000 tree 4 1/1/2000 dog 5 1/2/2000 cat 6 1/2/2000 cat 7 1/2/2000 cat 8 1/2/2000

[R] GEE: estimate of predictor with high time dependency

2010-06-08 Thread Sachi Ito
Hi, I'm analyzing my data using GEE, which looks like below: interact - geeglm(L ~ O + A + O:A, + data = data1, id = id, + family = binomial, corstr = ar1) summary(interact) Call: geeglm(formula = lateral ~ ontask + attachment + ontask:attachment, family = binomial, data =

Re: [R] GEE: estimate of predictor with high time dependency

2010-06-08 Thread Charles C. Berry
On Tue, 8 Jun 2010, Sachi Ito wrote: Hi, I'm analyzing my data using GEE, which looks like below: interact - geeglm(L ~ O + A + O:A, + data = data1, id = id, + family = binomial, corstr = ar1) summary(interact) Call: geeglm(formula = lateral ~ ontask + attachment + ontask:attachment,

[R] iterating over groups of columns

2010-06-08 Thread 09wkj
I am mainly a Java/C++ programmer, so my mind is used to iterating over data with for loops. After a long break, I am trying to get back into the R mindset, but I could not find a solution in the documentation for the applys, aggregate, or by. I have a data.frame where each row is an entry

[R] partial matches across rows not columns

2010-06-08 Thread RCulloch
Hi R users, I am trying to omit rows of data based on partial matches an example of my data (seal_dist) is below: A quick break down of my coding and why I need to answer this - I am dealing with a colony of seals where for example A1 is a female with pup and A1.1 is that female's pup, the

Re: [R] more dates and data frames

2010-06-08 Thread Henrique Dallazuanna
Try this: xtabs( ~ V1 + V2, transform(dog3.df, V1 = factor(V1, levels = as.character(seq(min(dog3.df$V1), max(dog3.df$V1), by = days) On Tue, Jun 8, 2010 at 4:52 PM, Erin Hodgess erinm.hodg...@gmail.comwrote: Dear R People: So thanks to your help, I have the following: dog3.df -

[R] cor.test() -- how to get the value of a coefficient

2010-06-08 Thread Ekaterina Pek
Hi, all. Yet another beginner to R : ) I wonder, how it's possible to get the value of a coefficient from the object produced by cor.test() ? cor.test(a, b, method=spearman) Spearman's rank correlation rho data: a and b S = 21554.28, p-value = 2.496e-11 alternative hypothesis: true

Re: [R] cor.test() -- how to get the value of a coefficient

2010-06-08 Thread Joris Meys
result - cor.test(a,b,method=spearman) result$estimate Cheers Joris On Tue, Jun 8, 2010 at 10:40 PM, Ekaterina Pek ekaterina@gmail.com wrote: Hi, all. Yet another beginner to R : ) I wonder, how it's possible to get the value of a coefficient from the object produced by cor.test() ?

Re: [R] cor.test() -- how to get the value of a coefficient

2010-06-08 Thread Erik Iverson
Ekaterina Pek wrote: Hi, all. Yet another beginner to R : ) I wonder, how it's possible to get the value of a coefficient from the object produced by cor.test() ? cor.test(a, b, method=spearman) You can always assign the value of a function to a variable, and then use ?str to see the

Re: [R] iterating over groups of columns

2010-06-08 Thread Jannis
you should have found a solution for that in the help page of apply. just run min.values = apply(the.data,1,min) the '1' marks the direction (e.g. whether apply is applied to rows or columns), it could be a 2 as well. Check that yourself in the apply documentation. Then run

Re: [R] more dates and data frames

2010-06-08 Thread Gabor Grothendieck
Once again my message got held up for moderator approval so I am deleting it and trying again. Hopefully this one goes through. In general, we will get the simplest usage if we match the problem to the appropriate OO class. In this case we are using time series so it is advantageous to use a time

Re: [R] partial matches across rows not columns

2010-06-08 Thread jim holtman
Is this what you are looking for: # assume females start with A # extract first part if female from ID x.id - sub((A[[:digit:]]+).*, \\1, x$ID) # now see if this pattern matches first part of TO_ID x.match - x.id == substring(x$TO_ID, 1, nchar(x.id)) # here are the ones that would be

[R] type conversion with apply or not

2010-06-08 Thread Horace Tso
Folks, i thought it should be straightforward but after a few hours poking around, I decided it's best to post my question on this list. I have a data frame consisting of a (large) number of date columns, which are read in from a csv file as character string. I want to convert them to Date

Re: [R] type conversion with apply or not

2010-06-08 Thread William Dunlap
The short answer is, don't use apply() on data.frame's. Use lapply to loop over the columns of a data.frame. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Horace Tso Sent: Tuesday, June 08, 2010 2:19 PM To:

[R] restructuring by output for use with write.table

2010-06-08 Thread Steve_Friedman
Hello, vegMeans - by(SoilVegHydro[3:37] , SoilVegHydro$Physiogomy, mean) vegSD - by(SoilVegHydro[3:37] , SoilVegHydro$Physiogomy, sd) write.table(vegMeans, file=A:\\Work_Area\\Steve\\Hydrology_Data\\data\\vegMeans.txt) Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors

Re: [R] type conversion with apply or not

2010-06-08 Thread Henrique Dallazuanna
You need lapply here: df[2:3] - lapply(df[2:3], as.Date, '%m/%d/%Y') On Tue, Jun 8, 2010 at 6:19 PM, Horace Tso horace@pgn.com wrote: Folks, i thought it should be straightforward but after a few hours poking around, I decided it's best to post my question on this list. I have a

Re: [R] type conversion with apply or not

2010-06-08 Thread Horace Tso
Guys, many thanks. lapply works. Did not occur to me as I thought lapply returns a list and the receiving entity is a data frame. H -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Tuesday, June 08, 2010 2:22 PM To: Horace Tso; r-help@r-project.org Subject:

Re: [R] partial matches across rows not columns

2010-06-08 Thread Jannis
I did not go too deep into your zoology problem ;-) but as far as I understood you, you want to omit all rows where ID and TO_ID are A1 and A1.1, (or A2) correct? If the data you send us is all the data and if there do not occour any different situations the following should be sufficient:

Re: [R] restructuring by output for use with write.table

2010-06-08 Thread Phil Spector
Not much to go on, but you might find vegMeans = aggregate(SoilVegHydro[3:37],SoilVegHydro['Physiogomy'],mean) and vegSd = aggregate(SoilVegHydro[3:37],SoilVegHydro['Physiogomy'],sd) more suitable for your needs. (Not run because I don't know what SoilVegHydro is.)

Re: [R] restructuring by output for use with write.table

2010-06-08 Thread Joris Meys
don't forget to make the by option a list : vegMeans = aggregate(SoilVegHydro[3:37],list(SoilVegHydro['Physiogomy']),mean) and vegSd = aggregate(SoilVegHydro[3:37],list(SoilVegHydro['Physiogomy']),sd) see also ?aggregate on a side note, it would be handy if that transformation to a list would

[R] Efficiency question

2010-06-08 Thread Worik R
Given the following snippet m.nf.xts - xts(rep(0, length(index(m.xts))), order.by=index(m.xts)) Does R know to cache the index(m.xts) or is it more efficient to say... m.i - index(m.xts) m.nf.xts - xts(rep(0, length(m.i)), order.by=index(m.i)) ? cheers Worik [[alternative HTML

[R] how to ignore rows missing arguments of a function when creating a function?

2010-06-08 Thread edmund jones
Hi, I am relatively new to R; when creating functions, I run into problems with missing values. I would like my functions to ignore rows with missing values for arguments of my function) in the analysis (as for example is the case in STATA). Note that I don't want my function to drop rows if

Re: [R] iterating over groups of columns

2010-06-08 Thread 09wkj
In the code fragment, I used 'by' to actually compute the min value (part of the statement with the eval) - and I agree that an apply would work there wonderfully. However, my hope was to use an apply for the subsetting of the data.frame's columns, so that I could then use an apply to compute

[R] Logical vector question

2010-06-08 Thread Worik R
If I create a vector thusly v1 - runif(20, min=0, max=1) v1 [1] 0.9754443 0.6306228 0.3238158 0.3175769 0.6791534 0.6956507 0.3840803 [8] 0.1421328 0.8592398 0.4388306 0.9472040 0.4727435 0.5645302 0.7391616 [15] 0.6116199 0.2727754 0.2657867 0.5261744 0.8764804 0.2032126 And I want to

Re: [R] more dates and data frames

2010-06-08 Thread Bill.Venables
Here is one way ... DF4 - cast(formula=Date~V2,data=DF3,value=X1,fill=0) d - with(DF4, seq(min(Date), max(Date), by = 1)) ### full set m - as.Date(setdiff(d, DF4$Date)) ### missing dates if(length(m) 0) { extras - cbind(data.frame(Date = m), cat = 0, dog = 0, tree = 0)

Re: [R] Logical vector question

2010-06-08 Thread Joshua Wiley
Hello, This should work v1 - runif(20, min=0, max=1) v2 - v1 .3 | v1 .7 #you just need one | not two HTH, Josh On Tue, Jun 8, 2010 at 3:38 PM, Worik R wor...@gmail.com wrote: If I create a vector thusly v1 - runif(20, min=0, max=1) v1  [1] 0.9754443 0.6306228 0.3238158 0.3175769

Re: [R] Logical vector question

2010-06-08 Thread Jorge Ivan Velez
Try v1.3 | v1 .7 HTH, Jorge On Tue, Jun 8, 2010 at 6:38 PM, Worik R wrote: If I create a vector thusly v1 - runif(20, min=0, max=1) v1 [1] 0.9754443 0.6306228 0.3238158 0.3175769 0.6791534 0.6956507 0.3840803 [8] 0.1421328 0.8592398 0.4388306 0.9472040 0.4727435 0.5645302

[R] Run Rscript.exe, how to capture error message?

2010-06-08 Thread A Huang
Hi there, I use Rscript.exe for batch run (actually it is used in ASP.net code) c:C:\Program Files\R\R-2.10.1\bin\Rscript.exe test.r xxx.txt Where test.r is the r program and xxx.txt is a file name test.r will read in, it comes from a web form. This works fine, when the file is in required

Re: [R] geom_ribbon removes missing values

2010-06-08 Thread Paul Murrell
Hi grid.polygon() can do multiple polygons in a single call, but rather than using NA's to separate sub-polygons, it uses an 'id' argument (or an 'id.lengths' argument) to identify sub-polygons within the vectors of x- and y-values (see the examples in ?grid.polygon). So a ggplot2 patch

Re: [R] Intra-Class correlation psych package missing data

2010-06-08 Thread William Revelle
Ross, My apologies, I just discovered your email (from April) to the R-help list serve asking about ICC in psych. ICC does not remove missing data but rather lets the ANOVA handle it. It is probably more appropriate work on complete cases (as does the icc in the irr package). that is

  1   2   >