[R] help.search not working - returns readRDS(file) : unknown input format

2013-03-11 Thread Gustaf Rydevik
('',package=X-x,rebuild=T)) Now there is no error, but help.search cannot find anything - it seems as if the database is empty. Does anyone have experience with a similar error? Best regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +44(0)74 253 760 42 address:St John's hill 18/5 EH8 9UQ Edinburgh

Re: [R] Remove space from string

2012-01-13 Thread Gustaf Rydevik
-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Gustaf Rydevik, M.Sci. tel: +44(0)74 253 760 42 address:St John's hill 18/5 EH8 9UQ Edinburgh, UK skype:gustaf_rydevik [[alternative HTML version deleted

Re: [R] Fwd: WHO Anthro growth curve macros and R

2011-10-11 Thread Gustaf Rydevik
On Tue, Oct 11, 2011 at 1:21 AM, David Winsemius dwinsem...@comcast.netwrote: On Oct 10, 2011, at 4:48 PM, Gustaf Rydevik wrote: Hi all, some years ago, I sent a question to the mailing list regarding the WHO anthro macros. Since I've now received three mails asking how I solved it, I

[R] Fwd: WHO Anthro growth curve macros and R

2011-10-10 Thread Gustaf Rydevik
functions. Let me know if anyone gets problems in figuring out how to use the files. best regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +44(0)704 253 760 42 address:St John's hill 18/5 EH8 9UQ Edinburgh, UK skype:gustaf_rydevik __ R-help@r-project.org

Re: [R] [Rd] New errors with difftime()-objects in 2.11.1 (was Re: Request: difftime method for cut())

2010-06-23 Thread Gustaf Rydevik
On Wed, Jun 23, 2010 at 7:13 AM, Peter Dalgaard pda...@gmail.com wrote: Gustaf Rydevik wrote: Oh, I forgot to mention that the workaround of using as.double (or as.numeric) works fine, and I've done that. It's just that it can take quite a while (as in several hours) to figure out

[R] New errors with difftime()-objects in 2.11.1 (was Re: Request: difftime method for cut())

2010-06-22 Thread Gustaf Rydevik
On Thu, Jun 10, 2010 at 3:39 PM, Gustaf Rydevik gustaf.ryde...@gmail.com wrote: Hi all, The recent change in 2.11 that made as.numeric() return false on difftime-objects broke some of my code that calculated age classes of individuals using cut(). While this was no big thing to fix for me

Re: [R] New errors with difftime()-objects in 2.11.1 (was Re: Request: difftime method for cut())

2010-06-22 Thread Gustaf Rydevik
On Tue, Jun 22, 2010 at 7:50 PM, David Winsemius dwinsem...@comcast.net wrote: On Jun 22, 2010, at 1:33 PM, Gustaf Rydevik wrote: Cannot help you there, but have you looked at the help page for difftime? The as.double method returns the numeric value expressed in the specified units. Using

Re: [R] remove last char of a text string

2010-06-14 Thread Gustaf Rydevik
,nchar(orig.text)-1) Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] moving average on irregular time series

2010-06-04 Thread Gustaf Rydevik
Dear William and Gabor, Both solutions worked, and my problem is now solved. Many thanks to both of you! regards, Gustaf On Thu, Jun 3, 2010 at 10:23 AM, Gustaf Rydevik gustaf.ryde...@gmail.com wrote: Hi all, I wonder if there is any way to calculate a moving average on an irregular

Re: [R] ISO 8601 Weeks/Years on Windows with strptime

2010-06-03 Thread Gustaf Rydevik
part of the R development team, I'm not sure how to go about implementing it... Best regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list

[R] moving average on irregular time series

2010-06-03 Thread Gustaf Rydevik
be marked for removal. -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] R on the iPhone/iPad? Not so much....a GPL violation

2010-06-02 Thread Gustaf Rydevik
://blogs.mathworks.com/desktop/2010/05/24/introducing-matlab-mobile-%E2%80%93-an-iphone-app-to-connect-remotely-to-your-matlab/ If matlab can do it, then surely the R community can as well. Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE

Re: [R] p-values 2.2e-16 not reported

2010-05-19 Thread Gustaf Rydevik
of thinking about your problem? From a practical standpoint, I would be sceptical about the ability of most R-algorithms to generate theoretically valid p-values of such a small order. Best regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66

[R] A revised function for getting ISO week

2010-05-19 Thread Gustaf Rydevik
. Hopefully this will come in handy for someone searching the mailing list archives in the future. Best Regards, Gustaf # ## Inputs a date object, posix object, or 3 numbers and gives back the iso week. ## By Gustaf Rydevik, revised 2010 getweek-function(Y,M=NULL,D=NULL){ if(!class(Y

[R] Set encoding when load()-ing workspaces?

2010-05-02 Thread Gustaf Rydevik
up. I hope third time's a charm! Many thanks in advance, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

[R] Set encoding when load()-ing workspaces?

2010-05-02 Thread Gustaf Rydevik
Ripley rip...@stats.ox.ac.uk wrote: On Sun, 2 May 2010, Duncan Murdoch wrote: Gustaf Rydevik wrote: Hi all, I hope that there is someone that can help me out here. I am trying to load() a workspace on os x (R 2.11.0) that was saved in windows XP (R 2.9). In that workspace, there's

Re: [R] R loop.

2010-04-23 Thread Gustaf Rydevik
Leukemia V7 #20 Leukemia V8 #23 Leukemia V9 -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] R loop.

2010-04-23 Thread Gustaf Rydevik
On Fri, Apr 23, 2010 at 11:14 AM, mhalsham mhals...@bradford.ac.uk wrote: Hi Yes I have managed to read the file (Table2.txt) The command I have used a- read.table(table3.txt, fill=TRUE, header=FALSE) If I read the first row the result output will be like that. a[1,] Result would be    

Re: [R] Remove duplicated rows

2010-04-23 Thread Gustaf Rydevik
, This code is a bit ugly, but it works. Hope it helps. /Gustaf library(zoo) test-read.table(clipboard,header=T) test$code-paste(test$Name,test$Value,sep=) drop.ndx-rollapply(zoo(test$code),3,function(x)(x[2]%in%c(x[1],x[3]))) drop.ndx-c(FALSE,drop.ndx,FALSE) test[!drop.ndx,] -- Gustaf Rydevik

Re: [R] Assigning week numbers

2010-04-22 Thread Gustaf Rydevik
-1 } allweeks[i]-Week } SCHEDULE3$Week-allweeks[match(SCHEDULE3$DATE.,alldates)] Sys.setlocale(LC_TIME,My.locale) -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r

Re: [R] RNG

2010-04-21 Thread Gustaf Rydevik
not sure what you mean by downloaded There is a lot of random number generators built into R. To generate 10 random numbers between 0 and 1, try runif(10) Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik

Re: [R] Assigning Week Numbers

2010-04-21 Thread Gustaf Rydevik
On Tue, Apr 20, 2010 at 7:59 PM, Michael Hosack mhosa...@hotmail.com wrote: R experts, How could I extract the week number from a date vector (in Date class) such that week numbering (week 1...2...) begins (May 01) and ends (October 31) on the same specific dates each year? Week numbering

Re: [R] how can I plot the histogram like this using R?

2010-04-16 Thread Gustaf Rydevik
and provide commented, minimal, self-contained, reproducible code. Hi, Does this do what you want? temp-read.table(url(http://n4.nabble.com/file/n1965378/y1.txt;)) hist(temp$V1,breaks=seq(0,5.1,by=0.1)) abline(v=2.5,lty=2,lwd=2,col=red) Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703

Re: [R] Simplifying particular piece of code

2010-03-31 Thread Gustaf Rydevik
. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451

Re: [R] Simplifying particular piece of code

2010-03-31 Thread Gustaf Rydevik
)) func - function(.names){ apply(data, 1, MyFunc, ret=.names[2], stdev=.names[3]) } data.list-lapply(names.df, func) mrets-do.call(merge,c(list(data),data.list)) On Wed, Mar 31, 2010 at 12:33, Gustaf Rydevik gustaf.ryde...@gmail.com wrote: How about this (not tested, since you did

Re: [R] Adding minutes to 24 hour time

2010-03-17 Thread Gustaf Rydevik
-01,timeTxt)) new.Date-orig.date+mins*60 new.Date-strsplit(as.character(new.Date), ) new.Time-(sapply(new.Date,[,2)) return(new.Time) } addTime2(c(15:23,7:00),c(70,100)) Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE

Re: [R] two questions for R beginners

2010-03-01 Thread Gustaf Rydevik
the UseMethod function. /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] WHO Anthro growth curve macros and R

2009-12-28 Thread Gustaf Rydevik
kind, person try and open the Splus files, and save them in a R-readable format? I would be extremely grateful for any help on this. Best regards, Gustaf Rydevik -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik

Re: [R] String question

2009-12-23 Thread Gustaf Rydevik
other have posted: temp - paste(m1,m2,m3,sep=,)##Generate string nchar(gsub(([^,]),,temp))+1## Count commas in the string and add 1. Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik

Re: [R] Question About Repeat Random Sampling from a Data Frame

2009-12-21 Thread Gustaf Rydevik
seem to be missing is the ?apply family: mysamples.means-lapply(mysamples,function(x)mean(x[,1])) Hope that gets you on your way. If you want more help, I'd suggest including an example data set in your follow-up messages. /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451

Re: [R] What is the fastest way to see what are in an RData file?

2009-12-18 Thread Gustaf Rydevik
On Thu, Dec 17, 2009 at 4:33 PM, Peng Yu pengyu...@gmail.com wrote: On Thu, Dec 17, 2009 at 5:33 AM, Gustaf Rydevik gustaf.ryde...@gmail.com wrote: On Wed, Dec 16, 2009 at 10:13 PM, Peng Yu pengyu...@gmail.com wrote: Currently, I load the RData file then ls() and str(). But loading the file

Re: [R] What is the fastest way to see what are in an RData file?

2009-12-17 Thread Gustaf Rydevik
On Wed, Dec 16, 2009 at 10:13 PM, Peng Yu pengyu...@gmail.com wrote: Currently, I load the RData file then ls() and str(). But loading the file takes too long if the file is big. Most of the time, I only interested what the variables are in the the file and the attributes of the variables

Re: [R] How to find the significant digits of a number?

2009-12-16 Thread Gustaf Rydevik
-- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] write.csv and header

2009-12-15 Thread Gustaf Rydevik
(test.csv) cat(-) cat(\n) cat(This is \n a test of header) cat(\n) cat(-) cat(\n) sink() write.table(matrix(rnorm(100),nrow=10),file=test.csv,append=TRUE,sep=,) regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451

Re: [R] Literature analysis

2009-12-11 Thread Gustaf Rydevik
? Can you give an example of a couple of text files? Are they in a standardised format (i.e. bibTEX or similar)? /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik [[alternative HTML version deleted

Re: [R] grep() exclude certain patterns?

2009-12-09 Thread Gustaf Rydevik
Hi, Just a quick note regarding google and R: I use www.rseek.org almost exclusively, and it tends to give me the results I need. It is based on google, but uses a number of smart tricks to ferret out R-relevant information. /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451

Re: [R] savePlot for Mac and / or Linux?

2009-12-08 Thread Gustaf Rydevik
- ###Function by Gustaf Rydevik, 2009-12-03 gustaf.ryde...@gmail.com ## Created to facilitate easy changes in the file format of generated graphs. ## Gen.device() generates a device function that is a copy of an existing function, but ## with (possibly) new defaults

Re: [R] R help - IGARCH estimation

2009-10-19 Thread Gustaf Rydevik
/listinfo/r-help and send questions there instead of directly to me (who is not much of an R expert...) best regards, and good luck Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik [[alternative HTML version

Re: [R] Function to find prime numbers

2009-10-13 Thread Gustaf Rydevik
/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik [[alternative HTML version deleted

Re: [R] Matching in R

2009-04-27 Thread Gustaf Rydevik
and caliper options. -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

[R] Margins in lattice and device resolution

2009-04-17 Thread Gustaf Rydevik
(lab = as.character(unique(OrchardSprays$rowpos))), columns = 4, title = Row position)) dev.off() -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org

[R] utils lacking namespace?

2009-04-15 Thread Gustaf Rydevik
the error message she gets when starting R. Any ideas on what went wrong, and more importantly, how to fix it? Many thanks in advance, Gustaf Rydevik Ps: She's running R on a WinXP box, if that might be of relevance... Error : package 'utils' does not have a name space R

Re: [R] utils lacking namespace?

2009-04-15 Thread Gustaf Rydevik
On Wed, Apr 15, 2009 at 12:20 PM, Duncan Murdoch murd...@stats.uwo.ca wrote: Gustaf Rydevik wrote: Hi all, A colleague of mine tried to install the package EMV, which had been removed from CRAN. she ran into some kind of trouble, R locked up, and she closed the program. Now when she starts

Re: [R] same value in column--delete

2009-03-26 Thread Gustaf Rydevik
){ length(unique(x))==1 }) } monovaluedCols-is.monovalued(x) which(monovaluedCols) x[!monovaluedCols] /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R

Re: [R] modifying a built in function from the stats package (fixing arima)

2009-03-05 Thread Gustaf Rydevik
then must be stored. I.e, use arima-edit(arima) instead of just edit(arima) ,and changes should be stored. Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R

Re: [R] Have a function like the _n_ in R ? (Automatic count function )

2009-02-25 Thread Gustaf Rydevik
() [1] 6 ;) Hadley *headache*! I can't wrap my head around this one - too strange code! Could someone please give a hint on what's going on? How doesi- i+1 modify i permanently, seeing as i is defined as 0 to start with? /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451

Re: [R] Have a function like the _n_ in R ? (Automatic count function )

2009-02-25 Thread Gustaf Rydevik
On Wed, Feb 25, 2009 at 4:43 PM, Charles C. Berry cbe...@tajo.ucsd.edu wrote: On Wed, 25 Feb 2009, Gustaf Rydevik wrote: On Wed, Feb 25, 2009 at 3:30 PM, hadley wickham h.wick...@gmail.com wrote: And for completeness here's a function that returns the next integer on each call. n

Re: [R] an S idiom for ordering matrix by columns?

2009-02-19 Thread Gustaf Rydevik
mean something like this: test-matrix(sample(1:4,100,replace=T),ncol=10) test[do.call(order,data.frame(test)),] ? Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik

Re: [R] Alternate to for-loop

2009-02-16 Thread Gustaf Rydevik
distribution for rnorm if you want. /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Generating Numbers With Certain Distribution in R

2009-02-11 Thread Gustaf Rydevik
misplaced the parenthesis around (x-min(x)) Correct version is: x - rlnorm(1e6,meanlog=1,sdlog=1) ## pick any parameters you like y - round((x-min(x))/diff(range(x))*19+1) /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik

Re: [R] How to comment in R

2009-02-11 Thread Gustaf Rydevik
). Granted, you have to deal with latex code to get nice output, but latex is a GoodThing (tm). /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing

Re: [R] Beginner-how to down size a large sample

2009-02-11 Thread Gustaf Rydevik
$group==1,] dataSet.0-dataSet[dataSet$group==0,] sampled.1-dataSet.1[sample(1:nrow(dataSet.1),100),] sampled.0-dataSet.0[sample(1:nrow(dataSet.0),100),] newdataSet-rbind(sampled.1,sampled.0) /Gustaf (a please, would have been nice) -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451

Re: [R] Counting session days

2009-02-09 Thread Gustaf Rydevik
(table(ActiveDays)) Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Selectively Removing objects

2009-02-02 Thread Gustaf Rydevik
Nonfunctions separately messed things up.] Hi Paulo, The following should do it. test-function(x)x^2 test2-5 test3-77 ls() rm(list=ls()[ sapply(ls(), function(x){ class(get(x))!=function }) ]) ls() Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451

Re: [R] ifelse help?

2009-01-20 Thread Gustaf Rydevik
. Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] two-sample test of multinomial proportion

2009-01-20 Thread Gustaf Rydevik
regarding variance of H1/H3 in the two groups, so I don't think it is correct. I've tried using a bootstrap approach on the ratio of the two proportions, but there must be a smarter way. Any help is much appreciated! Best regards, Gustaf Rydevik data and bootstrap attempt ### multi.data

Re: [R] two-sample test of multinomial proportion

2009-01-20 Thread Gustaf Rydevik
On Tue, Jan 20, 2009 at 4:08 PM, Gustaf Rydevik gustaf.ryde...@gmail.com wrote: Hi all, This is perhaps more a statistics question than an R question, but I hope it's OK anyhow. I have some data (see below) with the number of tests positive to subtype H1 of a virus, the number of tests

[R] data frames with å, ä, and ö (=n on-ASCII-characters) from windows to mac os x

2009-01-16 Thread Gustaf Rydevik
, Värmlands län, Västerbottens län, Västernorrlands län, Västmanlands län, Västra Götalands län, Örebro län, Östergötlands län), class = factor)), .Names = c(LANKOD, Län), class = data.frame, row.names = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)) -- Gustaf Rydevik

[R] reshape, direction=long: multiple row names not allowed

2009-01-14 Thread Gustaf Rydevik
. It took me a fair time before figuring out that it was the id-column that caused problems. Perhaps something to fix, or at least give a more informative error message? Best regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE

Re: [R] reshape, direction=long: multiple row names not allowed

2009-01-14 Thread Gustaf Rydevik
On Wed, Jan 14, 2009 at 3:07 PM, hadley wickham h.wick...@gmail.com wrote: On Wed, Jan 14, 2009 at 5:51 AM, Gustaf Rydevik gustaf.ryde...@gmail.com wrote: Hi all, for some reason I always get stuck spending hours when trying to use reshape or the Reshape package. Heaven knows why. My latest

[R] getting ISO week

2008-12-11 Thread Gustaf Rydevik
=Wn)) } -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] getting ISO week

2008-12-11 Thread Gustaf Rydevik
? /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] question involving loops from intro level R programming class

2008-11-28 Thread Gustaf Rydevik
version deleted]] Hi, Nice little brain teaser! Not too difficult, but requires a bit of creative thinking... You might wanna have a look at, for example, ?diag, ?uniroot, or ?polyroot. regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm

Re: [R] Finding Stopping time

2008-11-27 Thread Gustaf Rydevik
]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Gustaf Rydevik, M.Sci. tel: +46(0

Re: [R] Simple rep() question duplicating times and dates.

2008-11-05 Thread Gustaf Rydevik
) TimeFrame-data.frame(time) TimeFrame$dates-rep(dates,each=24) Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Gustaf Rydevik
Hi Leon, unique(x) or duplicated(x) should work, depending on what you want. Best, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Gustaf Rydevik
On Wed, Oct 29, 2008 at 3:45 PM, Erik Iverson [EMAIL PROTECTED] wrote: Leon Yee wrote: Gustaf Rydevik wrote: Hi Leon, unique(x) or duplicated(x) should work, depending on what you want. Best, Gustaf Hi, Thank you all. Actually, I have a data frame or matrix, whose first

[R] Automatically adjust text size in plot

2008-10-24 Thread Gustaf Rydevik
-- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

Re: [R] Combining all possible values of variables into a new...

2008-10-20 Thread Gustaf Rydevik
Suggestions? How about the following? x-c(1,0,0,1,0,0,1,0,0,1) y-c(1,3,2,3,2,1,2,3,2,3) z-c(1,2,1,2,1,2,1,2,1,2) d-as.data.frame(cbind(x,y,z)) xyz.comb-interaction(x,y,z,lex.order=T) d$myvar-match(xyz.comb,levels(xyz.comb)) /Gustaf Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget

Re: [R] Reading Data

2008-10-07 Thread Gustaf Rydevik
to be variable names. 3) read.table(data.txt,skip=1) ## If there are no headers, and you want to ignore the date regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help

Re: [R] Problem with Grep Under Loop

2008-10-06 Thread Gustaf Rydevik
, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] function in R

2008-10-02 Thread Gustaf Rydevik
don't know C, I've never tried it out more than having a quick look. But it's there if you want it. Regards, Gustaf Rydevik -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help

Re: [R] Question about multiple regression

2008-09-09 Thread Gustaf Rydevik
turns up http://www.clusterondemand.com/ for example. Anyhow, good luck with your project! I'm sure the R list would be very interested to hear of how you solved your problem. Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE

Re: [R] Coefficients of Logistic Regression from bootstrap - how to get them?

2008-07-31 Thread Gustaf Rydevik
doing. The better option would be to either study some more statistics yourself, or find a statistician that can do your analysis for you, and trust him to do it right. Anyhow, good luck with your research. Best regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451

Re: [R] Simple... but...

2008-07-23 Thread Gustaf Rydevik
, Shubha There should be nicer ways, but this does it: x-c(4,2,2) y-c(1,5,3) c(matrix(c(x,y),byrow=T,nrow=2)) /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r

Re: [R] [Fwd: Re: Coefficients of Logistic Regression from bootstrap - how to get them?]

2008-07-23 Thread Gustaf Rydevik
-- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

Re: [R] Coefficients of Logistic Regression from bootstrap - how to get them?

2008-07-23 Thread Gustaf Rydevik
in the article's method section,estimating the parameters of a model *when you already know which variables to include*.It is the way this step is conducted that I am sceptical about. Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE

Re: [R] Non-normal data issues in PhD software engineering experiment

2008-07-10 Thread Gustaf Rydevik
. Is that so? Answers to the above questions might be good to bring to your meeting with the statistics faculty. Good luck with your research, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik

[R] Question: Beginner stuck in a R cycle

2008-07-08 Thread Gustaf Rydevik
. Another way is to use ?lapply and ?unlist: myD$Pr_mean-unlist(lapply(as.character(myD$code),function(x) mean(myD$value[myD$code==x]))) Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik -- Gustaf Rydevik, M.Sci. tel

Re: [R] Migrating from S-Plus to R - Exporting Tables

2008-07-03 Thread Gustaf Rydevik
) ##excluding actual rownames, adding them as a column. } close(output) - It seems as if you can't get it to write row.names, since that is a restricted name in a dataframe, but hopefully RowNames is good enough. /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66

[R] tiff()-bug (was re:Preparing high quality figures with tiff as end result)

2008-06-25 Thread Gustaf Rydevik
R GUI has encountered a problem and needs to close. Can anyone else out there reproduce this, so I can file a bug report? Best, Gustaf Rydevik --- sessionInfo() R version 2.7.1 (2008-06-23) i386-pc-mingw32 locale: LC_COLLATE=Swedish_Sweden.1252;LC_CTYPE

Re: [R] tiff()-bug (was re:Preparing high quality figures with tiff as end result)

2008-06-25 Thread Gustaf Rydevik
On Wed, Jun 25, 2008 at 10:16 AM, Uwe Ligges [EMAIL PROTECTED] wrote: Gustaf Rydevik wrote: Hi all, A while back I sent a message concerning working with tiff-files, and mentioned that I encountered a bug in 2.7.0. This bug still occurs in 2.7.1, and is reproducable on a separate

Re: [R] tiff()-bug (was re:Preparing high quality figures with tiff as end result)

2008-06-25 Thread Gustaf Rydevik
] wrote: On Wed, 25 Jun 2008, Peng Jiang wrote: Hi , Gustaf i don't know why but it works pretty well on a mac. with completely different code. Gustaf Rydevik has mentioned this before -- it never fails for me on Windows and hence one would not expect there to be a change in 2.7.1. Only

Re: [R] R help

2008-06-24 Thread Gustaf Rydevik
dear Xu, does: library(urca) example(ur.ers) ers.gnp str(ers.gnp) [EMAIL PROTECTED] ,do what you want? (this reminds me that I have to learn S4 sometime) best, Gustaf Rydevik On Tue, Jun 24, 2008 at 3:52 AM, Xu, Ke-Li [EMAIL PROTECTED] wrote: Dear Sir/Madam, I found your email address

Re: [R] ifelse and vs

2008-06-18 Thread Gustaf Rydevik
ifelse takes a vector as argument. isince only gives a single value, ifelse(r0 g 0,log(r/g),NA) will only return NA, which then is recycled by transform. When using , ifelse returns a vector, and this vector is appended to the data frame. /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051

[R] Preparing high quality figures with tiff as end result

2008-05-23 Thread Gustaf Rydevik
this. So basically my question is: How should I go about generating graphics that will look as nice as possible given the above constraints? Many thanks in advance, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik

Re: [R] Preparing high quality figures with tiff as end result

2008-05-23 Thread Gustaf Rydevik
On Fri, May 23, 2008 at 4:40 PM, Gustaf Rydevik [EMAIL PROTECTED] wrote: Hi all, I'm currently preparing some figures that will be submitted to PloS One. In their guidelines they state that they will only accept figures in tiff or eps format, with the warning that eps figures

[R] Change the position of panel strips in a lattice plot.

2008-04-08 Thread Gustaf Rydevik
, instead of above? I've been looking through the lattice documentation and the list archive but have not found such a thing. Many thanks in advance, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik

Re: [R] Loop for in R to generate several variables

2008-04-07 Thread Gustaf Rydevik
) { Yind = L0 + L1*X1 + L2*X2 + L3*X3 + K*Cind + n } Any suggestions? Thank you. look up ?assign and ?get, i.e: for (ind in 1:10) { assign(paste(Y,ind,sep=),L0 + L1*X1 + L2*X2 + L3*X3 + get(paste(C,ind,sep=))+ n) } regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451

Re: [R] Make plots with GNUplot. Have anyone tried that?

2008-03-03 Thread Gustaf Rydevik
report I strongly encourage you to try out ?Sweave. It has certainly helped to streamline my workflow. Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r

Re: [R] Avoiding overplotting of text.

2008-02-26 Thread Gustaf Rydevik
it be possible to add one of these algorithms as an option to the regular text()? Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https

[R] Avoiding overplotting of text.

2008-02-25 Thread Gustaf Rydevik
of the time some of the labels end up unreadable. --- -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] Cox model

2008-02-13 Thread Gustaf Rydevik
then be further analysed. A much smaller and easier problem to solve, no? /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https

Re: [R] Cox model

2008-02-13 Thread Gustaf Rydevik
On Feb 13, 2008 3:06 PM, Gustaf Rydevik [EMAIL PROTECTED] wrote: On Feb 13, 2008 2:37 PM, Matthias Gondan [EMAIL PROTECTED] wrote: Hi Eleni, The problem of this approach is easily explained: Under the Null hypothesis, the P values of a significance test are random variables, uniformly

Re: [R] How does do.call() work??

2008-01-25 Thread Gustaf Rydevik
as arguments. /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] histogram with NAs

2008-01-18 Thread Gustaf Rydevik
)) sample.data-as.character(sample.data) sample.data[is.na(sample.data)]- NA sample.data-factor(sample.data) plot(sample.data) # /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R

[R] An R is slow-article

2008-01-09 Thread Gustaf Rydevik
Hi all, Reading the wikipedia page on R, I stumbled across the following: http://fluff.info/blog/arch/0172.htm It does seem interesting that the C execution is that much slower from R than from a native C program. Could any of the more technically knowledgeable people explain why this is so?

Re: [R] R help

2008-01-09 Thread Gustaf Rydevik
-- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

Re: [R] Tutorial for Basic Stats

2007-12-10 Thread Gustaf Rydevik
, and you'll find a nice pdf by J. Verzani. /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Extracting clusters from Data Frame

2007-12-10 Thread Gustaf Rydevik
=Cluster[3,c.size])+1)] Not the neatest solution, but I'm sure someone here can improve on it. /Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ R-help@r-project.org mailing

  1   2   >