[R] Duplicates among columns of a data frame

2008-12-15 Thread Andrew C. Ward
Dear list, I have a data frame of survey respondents, a little like this: set.seed(20081215) n - 100 dat - data.frame(id=1:100, addr1=sample(LETTERS, n, replace=TRUE), addr2=sample(LETTERS, n, replace=TRUE), addr3=sample(LETTERS, n, replace

Re: [R] Duplicates among columns of a data frame

2008-12-15 Thread Prof Brian Ripley
I think you mean duplicated *rows*, not columns, despite your subject line. See ?dublicated, which has a data.frame method. On Mon, 15 Dec 2008, Andrew C. Ward wrote: Dear list, I have a data frame of survey respondents, a little like this: set.seed(20081215) n - 100 dat - data.frame(id=1

[R] How to fetch specific part from a number of Text files?

2008-12-15 Thread megh
Hi all, I my c: drive I have possibly 1,000 notepad files, with .txt extension. They are named as the dates on which they were saved i.e. 1st file name is Volume_4-18-2008, 2nd one is Volume_4-21-2008, 3rd one Volume_4-22-2008 and so on Also, content of each file are in same format

Re: [R] problem with Surv

2008-12-15 Thread Richard . Cotton
I'm trying to estimate a tobit model with survrec function. I use the following code : reg-survreg(Surv(crs_prod,crs_prod=1)~SOLVA+log(AF088) +HHI+ACTIONNA,data=dat,dist=gaussian) I get this error message with R 2.7.2 Error in survreg(Surv(crs_prod, crs_prod = 1) ~ SOLVA + log(AF088) +

Re: [R] Help!

2008-12-15 Thread Uwe Ligges
Laura Harries wrote: Hi, I am trying to download the new version of R from Bristol University (the UK mirror). However when I have down loaded the files and am trying to 'run' them to install the software but Windows is telling me that the files are corrupted and to 'obtain a new version

[R] Rookie nls question

2008-12-15 Thread glenn roberts
First of many Rookie questions sorry: Finally broke free of Mathematica and gone for real OO programing, and up 2 grand a year to boot ! Problem concerns the use of nls function mostly but I have used an example from finance that is similar to my aim: Using an fOptions PlainVanillaOptions

[R] how to merge list of dataframes?

2008-12-15 Thread 江文恺
Dear all: I have a list of dataframes like this, i try to merge this lists of dataframes into one single dataframe, and keep ther column names as usual, how can i do this? i try lapply(aa,rbind), but it dose not work. Best regard! summary(aa) Length Class Mode [1,] 3

[R] Help!

2008-12-15 Thread Laura Harries
Hi, I am trying to download the new version of R from Bristol University (the UK mirror). However when I have down loaded the files and am trying to 'run' them to install the software but Windows is telling me that the files are corrupted and to 'obtain a new version of the programme'. I

Re: [R] how to merge list of dataframes?

2008-12-15 Thread baptiste auguie
have you tried do.call(rbind, aa) , or perhaps do.call(merge, aa) ? Hope this helps, baptiste On 15 Dec 2008, at 13:23, 江文恺 wrote: Dear all: I have a list of dataframes like this, i try to merge this lists of dataframes into one single dataframe, and keep ther column names as usual,

Re: [R] how to merge list of dataframes?

2008-12-15 Thread ONKELINX, Thierry
Try do.call(rbind, aa) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology

[R] help

2008-12-15 Thread zahid khan
Dear All suppose that a=7.5,if i need only integer part of a  that is 7 then what command i can use in R for this purpose. Zahid Khan Lecturer in Statistics Department of Mathematics Hazara University Mansehra. [[alternative HTML version deleted]]

Re: [R] opening a PDF document

2008-12-15 Thread Peter Dalgaard
Prof Brian Ripley wrote: On Sun, 14 Dec 2008, Dennis Fisher wrote: Colleagues, I am interesting in opening a PDF document via the command line from both Windows, OS X, and Linux ( R version 2.8.0). I found a command openPDF in Biobase. However, I would rather execute the command myself.

Re: [R] How can we predict differences in a slope, given that the random component was significant?

2008-12-15 Thread science22
Dieter wrote: It would be good if you could tell us how you found out that the random effects were significant. I must have missed something here. One of the models that I have fit looks like this: blueredminute - read.table(/Users/sachi/Desktop/blueredminute.txt, header=TRUE)

Re: [R] Testing predictive power of ARIMA model

2008-12-15 Thread Gerard M. Keogh
Sorry, but this gives me the shivers! Are all your time series linear? For each model you should check the residuals and their squares to see if they are uncorrelated (Box-ljung Chi-sq). Another useful check is to test for a trend in the coefficient of variation of the residuals. If the series

[R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Tubin
I hope someone can point out my stupid error, because I'm baffled. I am calculating a bunch of variable values and then placing them in a document using odfWeave tags. This is working very nicely for every spot except one. One of the values I calculate is traindev: traindev - if

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Sarah Goslee
I'd take a good look at trainlength, trainscores and traindev using str() and summary(), and print at least part of each to the screen. If the same line of code works with one dataset and not another, the problem is more likely your data than your code. If that doesn't help you figure it out,

Re: [R] [Rd] gregexpr - match overlap mishandled (PR#13391)

2008-12-15 Thread Greg Snow
-Original Message- From: Wacek Kusnierczyk [mailto:waclaw.marcin.kusnierc...@idi.ntnu.no] Sent: Sunday, December 14, 2008 5:39 AM To: Greg Snow Cc: R help Subject: Re: [Rd] gregexpr - match overlap mishandled (PR#13391) Greg Snow wrote: Controlling the pointer is going to be very

Re: [R] help

2008-12-15 Thread Tony Breyal
Hi Zahid,I think the following should work, though there's probably a dozen different ways to do what you want i think: a-7.5 as.integer(a) [1] 7 trunc(a) [1] 7 Hope that helps a little, Tony Breyal On 15 Dec, 07:11, zahid khan solo_...@yahoo.com wrote: Dear All suppose that a=7.5,if i need

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread David Winsemius
I think it because you are trying to use the if-else control construct, when you should be using the ifelse function: ?ifelse Try (perhaps): traindev - ifelse( (trainlength0), round(sd(trainscores, na.rm=T), 1) , ) You do seem to be mixing types, though, so perhaps you should use NA

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Tubin
Sarah Goslee says: I'd take a good look at trainlength, trainscores and traindev using str() and summary(), and print at least part of each to the screen. If the same line of code works with one dataset and not another, the problem is more likely your data than your code. If that doesn't help

[R] Distribution fitting

2008-12-15 Thread Fernando Bizuet
Hello R-helpers, I have a lot of series of data and I want to obtain the best probability distributions (and the distribution to estimate parameters) of each serie. Besides this paper http://cran.r-project.org/doc/contrib/Ricci-distributions-en.pdf, do you know if there are other papers that

[R] problem with Surv

2008-12-15 Thread justin bem
Dear all, I'm trying to estimate a tobit model with survrec function. I use the following code : reg-survreg(Surv(crs_prod,crs_prod=1)~SOLVA+log(AF088)+HHI+ACTIONNA,data=dat,dist=gaussian) I get this error message with R 2.7.2 Error in survreg(Surv(crs_prod, crs_prod = 1) ~ SOLVA +

Re: [R] how to create duplicated ID in multi-records per subject dataset

2008-12-15 Thread Henrique Dallazuanna
Try this: Lines - ID;record 1;20 ;30 ;25 2;26 ;15 3;21 x - read.table(textConnection(Lines), sep = ;, header = TRUE) library(zoo) x$ID - na.locf(x$ID) On Sun, Dec 14, 2008 at 11:56 PM, Zhixin Liu z...@efs.mq.edu.au wrote: Hi R helpers, If I have a dataset looks like: ID record 1

[R] Cumulative Incidence : Gray's test

2008-12-15 Thread K F Pearce
Hello everyone, I am a very new user of R and I have a query about the cuminc function in the package cmprsk. In particular I would like to verify that I am interpreting the output correctly when we have a stratification variable. Hypothetical example: group : fair hair, dark hair fstatus:

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Tubin
Unfortunately - no luck. Changing to the ifelse construction didn't fix the problem, and changing the to a zero or a NA also didn't help. Meanwhile, I have 4 other sd calculations on the same dataset, using the same construction, elsewhere in the document and code. None of them are giving me

Re: [R] Avoiding multiple outputs using RODBC package

2008-12-15 Thread Prof Brian Ripley
On Sun, 14 Dec 2008, Mark Wardle wrote: Hi. You don't need to download the whole of the output database table to look for an already generated answer. You can write a SQL query to do that instead. ie. give me any rows with these parameters... Get the database to do the work - it is what they

Re: [R] help

2008-12-15 Thread Henrique Dallazuanna
Try: trunc(a) On Mon, Dec 15, 2008 at 5:11 AM, zahid khan solo_...@yahoo.com wrote: Dear All suppose that a=7.5,if i need only integer part of a that is 7 then what command i can use in R for this purpose. Zahid Khan Lecturer in Statistics Department of Mathematics Hazara University

Re: [R] Help!

2008-12-15 Thread Duncan Murdoch
On 12/15/2008 8:15 AM, Laura Harries wrote: Hi, I am trying to download the new version of R from Bristol University (the UK mirror). However when I have down loaded the files and am trying to 'run' them to install the software but Windows is telling me that the files are corrupted and to

Re: [R] how to create duplicated ID in multi-records per subject dataset

2008-12-15 Thread Jagat.K.Sheth
You can also try ?rep and something like dat - read.table(textConnection(ID record 120 . 30 . 25 2 26 . 15 3 21 ),header=TRUE,na.strings=.) ind - !is.na(dat$ID) id - dat$ID[ind] reps - diff(c(seq_len(nrow(dat))[ind],nrow(dat)+1)) dat$new.id -

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Peter Dalgaard
David Winsemius wrote: I think it because you are trying to use the if-else control construct, when you should be using the ifelse function: ?ifelse Try (perhaps): traindev - ifelse( (trainlength0), round(sd(trainscores, na.rm=T),1) , ) Does anything change if you rename to (say) trainsd??

Re: [R] [ExternalEmail] Pearson Correlation Speed

2008-12-15 Thread Charles C. Berry
On Mon, 15 Dec 2008, Nathan S. Watson-Haigh wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nathan S. Watson-Haigh wrote: I'm trying to calculate Pearson correlation coefficients for a large matrix of size 18563 x 18563. The following function takes about XX minutes to complete, and I'd

[R] OT: (quasi-?) separation in a logistic GLM

2008-12-15 Thread Gavin Simpson
Dear List, Apologies for this off-topic post but it is R-related in the sense that I am trying to understand what R is telling me with the data to hand. ROC curves have recently been used to determine a dissimilarity threshold for identifying whether two samples are from the same type or not.

[R] cannot allocate vector of size... restructuring suggestion please...

2008-12-15 Thread tsunhin wong
Dear R Users, I was running some data analysis scripts and ran into this error: Error: cannot allocate vector of size 27.6 Mb Doing a memory.size(max=TRUE) will give me: [1] 1506.812 The current situation is: I'm working on a Windows Vista 32bit laptop with 4GB RAM (effectively 3GB I

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Tubin
renaming the variable does not help. I actually started with trainsd as the variable name. I believe that Sarah Goslee must be correct, and it's the data set I'm working from. Which moves my inquiry to the statement that establishes the dataset - I am combing through that now and will report

[R] newbie question on snow/Rmpi

2008-12-15 Thread Whit Armstrong
I have a network of four machines set up. I'm having trouble spawning my slaves on these machines. All the examples I have found so far use makeCluster with type=MPI, and I guess I'm missing some kind of cluster configuration in my environment variables because all my clusters are formed on the

Re: [R] Duplicates among columns of a data frame

2008-12-15 Thread Charles C. Berry
wrote: Dear list, I have a data frame of survey respondents, a little like this: set.seed(20081215) n - 100 dat - data.frame(id=1:100, addr1=sample(LETTERS, n, replace=TRUE), addr2=sample(LETTERS, n, replace=TRUE), addr3=sample(LETTERS, n, replace

Re: [R] [Rd] gregexpr - match overlap mishandled (PR#13391)

2008-12-15 Thread Wacek Kusnierczyk
Greg Snow wrote: mystr - paste(rep(1122, 10), collapse=) n - nchar(mystr) mystr2 - substr(rep(mystr,n), 1:n, n) tmp - regexpr(^11221122, mystr2) (tmp + 1:n - 1)[tmp0] [1] 1 5 9 13 17 21 25 29 33 attr(tmp,match.length)[tmp0] [1] 8 8 8 8 8 8 8 8 8

[R] R2winbugs : vectorization

2008-12-15 Thread Philip A. Viton
I'm new to bugs, so please bear with me. Can someone tell me if the following two models are doing the same thing? The reason I ask is that with the same data, the first (based on 4 separate coeffs a1--a4) takes about 50 secs, while the second (based on a vectorized form, a[]) takes about

Re: [R] How to fetch specific part from a number of Text files?

2008-12-15 Thread Charles C. Berry
On Mon, 15 Dec 2008, megh wrote: Hi all, I my c: drive I have possibly 1,000 notepad files, with .txt extension. They are named as the dates on which they were saved i.e. 1st file name is Volume_4-18-2008, 2nd one is Volume_4-21-2008, 3rd one Volume_4-22-2008 and so on Also,

Re: [R] cannot allocate vector of size... restructuring suggestion please...

2008-12-15 Thread tsunhin wong
Also,each data.frame of the 1500 working as data sources floating in the global environment is of a size ranging from 2000x36 to 9000x36 Please help...! THANKS!!! - John On Mon, Dec 15, 2008 at 1:12 PM, tsunhin wong thjw...@gmail.com wrote: Dear R Users, I was running some data analysis

Re: [R] cannot allocate vector of size... restructuring suggestion please...

2008-12-15 Thread Prof Brian Ripley
On Mon, 15 Dec 2008, tsunhin wong wrote: Dear R Users, I was running some data analysis scripts and ran into this error: Error: cannot allocate vector of size 27.6 Mb Doing a memory.size(max=TRUE) will give me: [1] 1506.812 The current situation is: I'm working on a Windows Vista 32bit

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Sarah Goslee
Nothing leaps out as obviously wrong to me. It may even be something earlier in the ODFWeave file that is causing the error. You said the code works at the command line, right? The next thing I'd do is try to make the smallest possible ODFWeave file that has the problem - make a copy, then start

Re: [R] How to fetch specific part from a number of Text files?

2008-12-15 Thread megh
Thanks Charles for this reply. I have started according to your suggestion and hopefully I can do it. In the mean time what I was thinking, instead of calling my text files by their names, is there any mechanism to call them by the order they are stored in that directory? Means, suppose, I have

Re: [R] Noobie question, regression across levels

2008-12-15 Thread Ben Bolker
RichardLang wrote: I've just started using R last week and am still scratching my head. I have a data set and want to run a separate regression across each level of a factor (treating each one separately). The data right now is arranged such that the value of the factor along which I

Re: [R] R2winbugs : vectorization

2008-12-15 Thread Ben Bolker
Philip A. Viton wrote: I'm new to bugs, so please bear with me. Can someone tell me if the following two models are doing the same thing? The reason I ask is that with the same data, the first (based on 4 separate coeffs a1--a4) takes about 50 secs, while the second (based on a

[R] convert opengis wkt to geometry?

2008-12-15 Thread Jeff Hamann
After writing some code (stupidly without checking to see if there was code to do this already) to generate PostGIS SQL insert statements for simple geometry (wkt), I didn't check see if there is already something available to convert WKT strings into some R package geometry (sp?). Does anyone

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Tubin
All interesting suggestions. Let's see... Running the code on a randomly-generated dataframe or a different real dataset still has the problem. A whole new document with only a single line \Sexpr{trainsd} seems to work just fine. If, in the actual project document, I use: test,

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Tubin
All interesting suggestions. Let's see... Running the code on a randomly-generated dataframe or a different real dataset still has the problem. A whole new document with only a single line \Sexpr{trainsd} seems to work just fine. If, in the actual project document, I use: test,

[R] mixed csv and csv2

2008-12-15 Thread Thomas Schwander
Dear all, I have a huge problem after downloading and exporting data from Reuters3000 XTra: I downloaded many many monthly, quarterly and yearly data. I do not know why, but after saving, I have mixed-data sets, i.e. files which can be imported as “read.csv” and others that are in the

Re: [R] R2winbugs : vectorization

2008-12-15 Thread plummer
Philip, If you are using WinBUGS 1.4, then the poor performance of the inprod function is a known problem. An inprod2 function was introduced in 1.4.3 to improve performance. See http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/contents.shtml#problems You might try using that. For WinBUGS problems,

Re: [R] How to fetch specific part from a number of Text files?

2008-12-15 Thread Charles C. Berry
On Mon, 15 Dec 2008, megh wrote: Thanks Charles for this reply. I have started according to your suggestion and hopefully I can do it. In the mean time what I was thinking, instead of calling my text files by their names, is there any mechanism to call them by the order they are stored in that

[R] Reading from Google Docs

2008-12-15 Thread Farrel Buchinsky
I saw a thread from September 24 in which Duncan Temple Lang told us: - The package currently has no Rd files, but there is a brief user's guide. The package is available from http://www.omegahat.org/RGoogleDocs I could not find it by using Tinn-R or RGui's package install tool. Then

Re: [R] Reading from Google Docs

2008-12-15 Thread Gustavo Carvalho
Hello, You can probably extract a .tar.gz using 7zip on Windows. Regards, Gustavo. On Mon, Dec 15, 2008 at 8:07 PM, Farrel Buchinsky fjb...@gmail.com wrote: I saw a thread from September 24 in which Duncan Temple Lang told us: - The package currently has no Rd files, but there is a brief

[R] Movement within a circle

2008-12-15 Thread Juliane Struve
Dear list,   I am trying to program semi-random movement within a circle, with no particles leaving the circle. I would like them to bounce back when they come to close to the wall, but I don't seem to be able to get this right.  Would somebody be able to give me a hint ? This is my code so

Re: [R] Reading from Google Docs

2008-12-15 Thread Prof Brian Ripley
On Mon, 15 Dec 2008, Farrel Buchinsky wrote: I saw a thread from September 24 in which Duncan Temple Lang told us: - The package currently has no Rd files, but there is a brief user's guide. The package is available from http://www.omegahat.org/RGoogleDocs I could not find it by using

Re: [R] Baffled: triggering error message with an sd result in odfWeave?

2008-12-15 Thread Peter Dalgaard
Tubin wrote: All interesting suggestions. Let's see... Running the code on a randomly-generated dataframe or a different real dataset still has the problem. A whole new document with only a single line \Sexpr{trainsd} seems to work just fine. If, in the actual project document, I use:

Re: [R] Reading from Google Docs

2008-12-15 Thread Farrel Buchinsky
Great. I have previously installed 7zip. It worked well. I installed the files. See below (way below). When I entered library(RGoogleDocs) it did not run. So I just ran auth.R Then I was able to run auth -getGoogleAuth(fjb...@gmail.com,mypassword) con = getConnection(auth) con$getDocs() all

Re: [R] Error: protect () : protection stack overflow

2008-12-15 Thread Prof Brian Ripley
No one seems to have mentioned that the size of the protection stack can be set when starting R. It worked for me starting R with --max-ppsize=10. I'm not sure that will do more that postpone the problem, but it may help. On Tue, 9 Dec 2008, Bert Gunter wrote: Apparently the former, as

Re: [R] newbie question on snow/Rmpi

2008-12-15 Thread Dirk Eddelbuettel
On Mon, Dec 15, 2008 at 01:16:46PM -0500, Whit Armstrong wrote: I have a network of four machines set up. I'm having trouble spawning my slaves on these machines. All the examples I have found so far use makeCluster with type=MPI, and I guess I'm missing some kind of cluster configuration

Re: [R] Movement within a circle

2008-12-15 Thread David Winsemius
On Dec 15, 2008, at 5:20 PM, Juliane Struve wrote: Dear list, I am trying to program semi-random movement within a circle, with no particles leaving the circle. I would like them to bounce back when they come to close to the wall, but I don't seem to be able to get this right. Would

Re: [R] How to fetch specific part from a number of Text files? [SEC=UNCLASSIFIED]

2008-12-15 Thread Augusto.Sanabria
Megh, You can capture all your external files into R using: All_files - dir(pattern=txt) Then read files one by one and insert the contents from section 2, say, in line 10, to section 3, say in line 40, into file cont: no_files - length(All_files) cont - vector(list,no_files) for(i in

Re: [R] Reading from Google Docs

2008-12-15 Thread Duncan Temple Lang
Farrel Buchinsky wrote: Great. I have previously installed 7zip. It worked well. I installed the files. See below (way below). When I entered library(RGoogleDocs) it did not run. So I just ran auth.R Then I was able to run auth -getGoogleAuth(fjb...@gmail.com,mypassword) con =

Re: [R] Reading from Google Docs

2008-12-15 Thread Farrel Buchinsky
When I rungetDocs(con) I get this error: Error in getDocs(con) : could not find function xmlParse Where should xmlParse be coming from? You had asked where I got the idea to enter con$getDocs(). I got it from run.html. But now that you bring the words In the future, we might to my attention I

Re: [R] Reading from Google Docs

2008-12-15 Thread Duncan Temple Lang
Farrel Buchinsky wrote: When I rungetDocs(con) I get this error: Error in getDocs(con) : could not find function xmlParse Where should xmlParse be coming from? From the XML package. You had asked where I got the idea to enter con$getDocs(). I got it from run.html. But now that you

Re: [R] Reading from Google Docs

2008-12-15 Thread Farrel Buchinsky
I have loaded the XML package. Should the function not be xmlTreeParse? Look at this library(XML) help(xmlParse) No documentation for 'xmlParse' in specified packages and libraries: you could try 'help.search(xmlParse)' help.search(xmlParse) Help files with alias or concept or title matching

Re: [R] Reading from Google Docs

2008-12-15 Thread Farrel Buchinsky
I took the liberty of replacing all the xmlParse in auth.R with xmlTreeParse. Alas still no joy. getDocs(con) Error in UseMethod(xpathApply) : no applicable method for xpathApply Farrel Buchinsky GrandCentral Tel: (412) 567-7870 On Mon, Dec 15, 2008 at 20:00, Farrel Buchinsky fjb...@gmail.com

[R] Semi-random movement inside a circle

2008-12-15 Thread Struve, Juliane
Dear list, I am trying to program semi-random movement within a circle, with no particles leaving the circle. I would like them to bounce back when they come to close to the wall, but I don't seem to be able to get this right. Would somebody kindly give me a hint ? This is my code so far,

[R] Using a covariance matrix as input to relaimpo package

2008-12-15 Thread Ku!Rt
I'm having trouble getting the relaimpo package to use a covariance matrix as input. I'm getting an error message that reads as follows: Error in eval(m$weights, data, parent.frame()) : numeric 'envir' arg not of length one I'm guessing there is something wrong with the structure of my

Re: [R] Population Decay in R

2008-12-15 Thread David Katz
barplot(5000*((1-.26)^(0:49))) jimdare wrote: Hi, I am new to R. I am trying to plot the decay of a population over time (0-50yrs). I have the initial population value (5000) and the mortality rate (0.26/yr) and I can't figure out how to apply this so I get a remaining population

[R] Application b-spline basis for polynomial splines

2008-12-15 Thread ARIF WIJAYA
Hai everbody,  Is there anyone have simple application b-spline in r language? I need it for make me understanding about b-spline for polynomial spline. thank u Arif  New Email addresses available on Yahoo! Get the Email name you#39;ve always wanted on the new @ymail and

[R] Is = now the same as - in assigning values

2008-12-15 Thread Petter Hedberg
I´m a PhD student at the University of Warsaw, and have started using R. In many books they specify to use - instead of = when assigning values, and this is also mentioned in older posts on the R website. However, it seams to me that some update has occured, becuase I continously get the same

[R] a query on repeated measures ANOVA

2008-12-15 Thread Gopa Nayak
Dear Prof Ripley I am writing to you regarding a query on reporting the results of the repeated measures ANOVA. I am a dphil student from the dept. of Education at Oxford. I have used the repeated measures design to analyse the effects of my intervention.I have a main effect of time(pre and post

[R] Population Decay in R

2008-12-15 Thread jimdare
Hi, I am new to R. I am trying to plot the decay of a population over time (0-50yrs). I have the initial population value (5000) and the mortality rate (0.26/yr) and I can't figure out how to apply this so I get a remaining population value each year. In excel (ignoring headings) I would put

Re: [R] Is = now the same as - in assigning values

2008-12-15 Thread Jorge Ivan Velez
Dear Petter, Take a look at this post: http://www.nabble.com/What-to-use-for-assignment,--%3D--or--to16521827.html#a16521827http://www.nabble.com/What-to-use-for-assignment,-%22-%3D-%22-or-%22-%3C--%22--to16521827.html#a16521827 HTH, Jorge On Mon, Dec 15, 2008 at 4:26 PM, Petter Hedberg

[R] converting a data-frame by a defined rule

2008-12-15 Thread Jörg Groß
Hi, I have a data frame with several columns. Now I want to transfer the data into a new variable (also a data frame), but I only want a part of the data, defined by a rule ... for example; I have following data frame: row1row2row3 x 2 3 x

[R] How to make a smooth ( linear ) CDF plot?

2008-12-15 Thread Mike Williamson
This question might seem silly, because I felt that it MUST be in the mailing list archives or help files somewhere, but I simply couldn't find it. I want to make some simple CDF (cumulative distribution function) plots to check whether distributions are Gaussian / normal. But in order

Re: [R] converting a data-frame by a defined rule

2008-12-15 Thread Jorge Ivan Velez
Dear Jörg, Try this: # Data DF=read.table(textConnection( row1row2row3 x 2 3 x 1 4 y 5 3 y 2 3),header=TRUE) closeAllConnections() # Splitting res=with(DF,split(DF,row1)) res

Re: [R] Is = now the same as - in assigning values

2008-12-15 Thread Gabor Grothendieck
In most cases - and = are the same yet its not always true so its safest to use - for assignment. Check this out: http://tolstoy.newcastle.edu.au/R/e4/help/08/06/12940.html On Mon, Dec 15, 2008 at 4:26 PM, Petter Hedberg ekologkons...@gmail.com wrote: I´m a PhD student at the University of

Re: [R] converting a data-frame by a defined rule

2008-12-15 Thread David Winsemius
Another method : DF[DF$row1 == x, ] row1 row2 row3 1x23 2x14 On Dec 15, 2008, at 8:51 PM, Jorge Ivan Velez wrote: Dear Jörg, Try this: # Data DF=read.table(textConnection( row1row2row3 x 2 3 x 1 4 y

Re: [R] OT: (quasi-?) separation in a logistic GLM

2008-12-15 Thread David Winsemius
If you look at the distribution of those with analogs==TRUE versus the whole groups it is not surprising that the upper range of Dij's result in a very low probability estimate: plot(density(dat$Dij)) lines(density(dat[dat$analogs == TRUE, 2])) Appears as though more than 25% of the

[R] Follow-up on openPDF command

2008-12-15 Thread Dennis Fisher
Colleagues, Several days ago, I queried about using the system command to open a PDF file. A number of people responded, each providing useful ideas. I integrated these ideas into a function that others can tailor to their needs: OPENPDF - function(PDFFILENAME) {

Re: [R] [ExternalEmail] Pearson Correlation Speed

2008-12-15 Thread Nathan S. Watson-Haigh
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Charles C. Berry wrote: On Mon, 15 Dec 2008, Nathan S. Watson-Haigh wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nathan S. Watson-Haigh wrote: I'm trying to calculate Pearson correlation coefficients for a large matrix of size 18563 x

[R] renaming factor-labels / add factors etc.

2008-12-15 Thread Jörg Groß
Hi, how can I change a defined factor-variable? Like adding levels, renaming existing levels or merge several levels of a factor to one level? For example; following factor-variable is given: x - factor(c(xyz1, abc1, xyz2, abc2)) How can I add the level fgh? And how can I merge xyz1

[R] Cointegration and ECM in Package {urca}

2008-12-15 Thread Yang Wan
Dear R Core Team, I am using package {urca} to do cointegration and estimate ECM model, but I have the following two problems: (1)I use ca.jo() to do cointegration first and can get the cointegration rank, alpha and beta. The next step is to test some restrictions on beta with

Re: [R] renaming factor-labels / add factors etc.

2008-12-15 Thread Peter Alspach
Jörg To add a level you could: x - factor(c(xyz1, abc1, xyz2, abc2)) x1 - factor(x, levels=c(levels(x), 'fgh')) summary(x) abc1 abc2 xyz1 xyz2 1111 summary(x1) abc1 abc2 xyz1 xyz2 fgh 11110 For the others, I tend to convert to a character, make the changes

Re: [R] renaming factor-labels / add factors etc.

2008-12-15 Thread David Winsemius
On Dec 15, 2008, at 10:15 PM, Peter Alspach wrote: Jörg To add a level you could: x - factor(c(xyz1, abc1, xyz2, abc2)) x1 - factor(x, levels=c(levels(x), 'fgh')) Could also use: levels(ff) - c(levels(ff), fgh) summary(x) abc1 abc2 xyz1 xyz2 1111 summary(x1) abc1 abc2 xyz1

[R] refer to next line within a data-frame an select cases

2008-12-15 Thread Jörg Groß
Hi, I have a problem sorting and selecting entries within a data-frame and I don't know if it is possible to solve it with R ... (probably yes, but I have no idea how). Following Data; row1row2 a 12 pos NA a 3 neg NA a

Re: [R] refer to next line within a data-frame an select cases

2008-12-15 Thread Gabor Grothendieck
grep for pos or neg reducing the data frame to the rows prior to those matched. With this reduced data frame pick out those row2 for which a is in row1: # input DF - data.frame(row1 = c(a, pos, a, neg, a, neg, a, pos), row2 = c(12, NA, 3, NA, 5, NA, 11, NA), stringsAsFactors = FALSE) # soln 1.

Re: [R] Is = now the same as - in assigning values

2008-12-15 Thread Wacek Kusnierczyk
Petter Hedberg wrote: I´m a PhD student at the University of Warsaw, and have started using R. In many books they specify to use - instead of = when assigning values, and this is also mentioned in older posts on the R website. However, it seams to me that some update has occured, becuase I

Re: [R] Is = now the same as - in assigning values

2008-12-15 Thread Wacek Kusnierczyk
Wacek Kusnierczyk wrote: Petter Hedberg wrote: I´m a PhD student at the University of Warsaw, and have started using R. In many books they specify to use - instead of = when assigning values, and this is also mentioned in older posts on the R website. However, it seams to me that some

Re: [R] Movement within a circle

2008-12-15 Thread andrew
The following has a bug in it, but it does a reasonable job. The bug occurs in the lines that says if(inner(xnew,xnew) R^2) xnew - x[n,] - eps ##error - sometimes x[n,] - eps is outside circle If it is changed to something like xnew - proj(x[n,] + eps) where proj is a projection function

[R] sliding window over a large vector

2008-12-15 Thread Chris Oldmeadow
Hi all, I have a very large binary vector, I wish to calculate the number of 1's over sliding windows. this is my very slow function slide-function(seq,window){ n-length(seq)-window tot-c() tot[1]-sum(seq[1:window]) for (i in 2:n) { tot[i]- tot[i-1]-seq[i-1]+seq[i] }