Re: [R] Assigning a function to the 'times' argument of rep()

2012-02-12 Thread Berend Hasselman
On 13-02-2012, at 06:37, Berend Hasselman wrote: > > On 13-02-2012, at 04:56, z2.0 wrote: > >> Question: >> >> I'm trying to use paste() with rep() to reformat a series of values as zip >> codes. e.g., if column 1 looks like: >> >> 52775 >> 83111 >> 99240 >> 4289 >> 112 >> 57701 >> 20001 >>

Re: [R] Assigning a function to the 'times' argument of rep()

2012-02-12 Thread Jorge I Velez
?formatC HTH, Jorge.-* * On Sun, Feb 12, 2012 at 10:56 PM, z2.0 <> wrote: > Question: > > I'm trying to use paste() with rep() to reformat a series of values as zip > codes. e.g., if column 1 looks like: > > 52775 > 83111 > 99240 > 4289 > 112 > 57701 > 20001 > > I want rows 4 and 5 to read, > >

Re: [R] Assigning a function to the 'times' argument of rep()

2012-02-12 Thread Berend Hasselman
On 13-02-2012, at 04:56, z2.0 wrote: > Question: > > I'm trying to use paste() with rep() to reformat a series of values as zip > codes. e.g., if column 1 looks like: > > 52775 > 83111 > 99240 > 4289 > 112 > 57701 > 20001 > > I want rows 4 and 5 to read, > > "04289" > "00112" This might hel

[R] Assigning a function to the 'times' argument of rep()

2012-02-12 Thread z2.0
Question: I'm trying to use paste() with rep() to reformat a series of values as zip codes. e.g., if column 1 looks like: 52775 83111 99240 4289 112 57701 20001 I want rows 4 and 5 to read, "04289" "00112" My thought was this: > perry_frame$zip <- ifelse(nchar(as.character(perry_frame$zip))<

[R] Any package for best subset selection on random effects model?

2012-02-12 Thread zbleach
Hi Pros, I know leaps() computes the best subset selection for linear model, and the bestglm() computes the best subset selection for generalized linear model. Is there any package for best subset selection on random effects model, or mixed effects model? Thank you so much. -- View this mess

[R] best subset selection on random effects model

2012-02-12 Thread Tao Zhang
Hi, I know leaps() computes the best subset selection for linear model, and the bestglm() computes the best subset selection for generalized linear model. Is there any package for best subset selection on random effects model, or mixed effects model? Thank you so much. Tao [[alterna

Re: [R] Writing output into a file

2012-02-12 Thread Suranga Kasthurirathne
Hi, Thank you very much for sharing these ideas. I really appreciate them. Let me go try them out :-) On Mon, Feb 13, 2012 at 4:37 AM, Rui Barradas wrote: > Hello > > One way is > > # Write the file > save(myList, file="test1.bin") > > # Reload the data, under the same name, 'myList' > load(f

Re: [R] Is it possible or has it been done?

2012-02-12 Thread R. Michael Weylandt
This might be a little astray, but it's certainly doable on Android devices: http://rwiki.sciviews.org/doku.php?id=getting-started:installation:android Michael On Sun, Feb 12, 2012 at 6:35 PM, Steve Lianoglou wrote: > Hi, > > On Sun, Feb 12, 2012 at 6:24 PM, Keith Weintraub wrote: >> A port of

Re: [R] how to extract p values in svyglm

2012-02-12 Thread David Winsemius
On Feb 12, 2012, at 6:39 PM, Tanu Soni wrote: summary(result) Call: svyglm(Injury ~ seat, sD, family = quasibinomial(link = "logit")) Survey design: svydesign(~1, prob = NULL, strata = Data[, 1], weights = Data[, 4], data = Data, fpc = ~fPc) Coefficients: Estimate Std. Error t

Re: [R] ANCOVA post-hoc test

2012-02-12 Thread David Winsemius
On Feb 12, 2012, at 7:39 AM, Evagelopoulos Thanasis wrote: Could you please help me on the following ANCOVA issue? This is a part of my dataset: sampling dist h 1wi 200 0.8687212 2wi 200 0.8812909 3wi 200 0.8267464 4wi0 0.8554508 5wi0

Re: [R] finding and describing missing data runs in a time series

2012-02-12 Thread R. Michael Weylandt
Not at a computer to test this but perhaps rle(is.na(x)) might help. Michael On Feb 12, 2012, at 7:36 PM, "Durant, James T. (ATSDR/DTEM/PRMSB)" wrote: > Hi - > > I am trying to find and describe missing data in a time series. For instance, > in the library openair, there is a data frame c

Re: [R] ANCOVA post-hoc test

2012-02-12 Thread Richard M. Heiberger
I am at my machine now. The subset of the data you sent has only two groups and doesn't have a significant interaction. Therefore I can't talk about specifics for your example. The glht test you did compared the means of the sampling factor ignoring the dist covariate. Your description said you

Re: [R] Error in apply(x2, 1, diff) : dim(X) must have a positive length

2012-02-12 Thread David Winsemius
On Feb 12, 2012, at 7:05 PM, hithit168 wrote: Anyone knows hat might be the cause of this error? Thanks for any help! library(MASS) dif.mns = function(x2,tr1=.2,tr2=.3){ + #generates four different 'means' using + #difference scores from x2, an n x 2 matrix + #for use w/ bootstrap comparis

Re: [R] Warnings from script - where?

2012-02-12 Thread R. Michael Weylandt
options(error=browser) or options(error=recover) will be of great help if you don't know them already. Michael On Feb 12, 2012, at 7:41 PM, Noah Silverman wrote: > Solved my own question: > > options(warnings=2) will turn all warnings into errors. That should halt > execution and allow m

Re: [R] How to see a R function's code

2012-02-12 Thread Duncan Murdoch
On 12-02-11 5:19 PM, Colstat wrote: I was wondering how do I actually see what's inside a function, say, density of t distribution, dt()? I know for some, I can type the function name inside R and the code will be displayed. But for dt(), I get dt function (x, df, ncp, log = FALSE) { if

Re: [R] Warnings from script - where?

2012-02-12 Thread Noah Silverman
Solved my own question: options(warnings=2) will turn all warnings into errors. That should halt execution and allow me to examine what happened. -- Noah Silverman UCLA Department of Statistics 8208 Math Sciences Building Los Angeles, CA 90095 On Feb 12, 2012, at 4:38 PM, Noah Silverman wrote

[R] Warnings from script - where?

2012-02-12 Thread Noah Silverman
Hi, Next challenge today. I have a script that I call within R: source("foo.R") When it finishes, I get the dreaded output: "There were 50 or more warnings (use warnings() to see the first 50)" So, I type warnings() and get a nice list. (Same error repeatedly, so probably something I'm usin

Re: [R] Reading in csv with footer

2012-02-12 Thread Rolf Turner
On 13/02/12 13:05, Noah Silverman wrote: Hi, I have a CSV file that is formatted well, except that the last line is a "summary" not is CSV format. Toy example: label_1, label_2, label_3 1,2,3 3,2,4 2,3,4 Total Rows: 3 When I try to import this into R with: d<- read.table("foo.csv", header=

[R] finding and describing missing data runs in a time series

2012-02-12 Thread Durant, James T. (ATSDR/DTEM/PRMSB)
Hi - I am trying to find and describe missing data in a time series. For instance, in the library openair, there is a data frame called "mydata": library(openair) head(mydata) date ws wd nox no2 o3 pm10so2 co pm25 1 1998-01-01 00:00:00 0.60 280 285 39 1 29 4.7225 3.3725 NA

Re: [R] Reading in csv with footer

2012-02-12 Thread William Dunlap
That prints nicely, but the first column in the result got turned into a factor: > d <- head(read.csv(textConnection(Lines)), -1) > str(d) 'data.frame': 3 obs. of 3 variables: $ label_1: Factor w/ 4 levels "1","2","3","Total Rows: 3": 1 3 2 $ label_2: int 2 2 3 $ label_3: int 3

Re: [R] Reading in csv with footer

2012-02-12 Thread Noah Silverman
Nice one!!! Tanks. -- Noah Silverman UCLA Department of Statistics 8208 Math Sciences Building Los Angeles, CA 90095 On Feb 12, 2012, at 4:26 PM, Henrique Dallazuanna wrote: > This works for me: > > Lines <- "label_1, label_2, label_3 > 1,2,3 > 3,2,4 > 2,3,4 > Total Rows: 3" > > d <- head(rea

Re: [R] Reading in csv with footer

2012-02-12 Thread Noah Silverman
Thanks Steve, Your suggestion about nrows seems like the easiest. Thanks! -- Noah Silverman UCLA Department of Statistics 8208 Math Sciences Building Los Angeles, CA 90095 On Feb 12, 2012, at 4:23 PM, Steve Lianoglou wrote: > Hi, > > On Sun, Feb 12, 2012 at 7:05 PM, Noah Silverman > wrote:

[R] Error in apply(x2, 1, diff) : dim(X) must have a positive length

2012-02-12 Thread hithit168
Anyone knows hat might be the cause of this error? Thanks for any help! >library(MASS) > dif.mns = function(x2,tr1=.2,tr2=.3){ + #generates four different 'means' using + #difference scores from x2, an n x 2 matrix + #for use w/ bootstrap comparisons + diffs = apply(x2,1,diff) + mn1=m

Re: [R] Reading in csv with footer

2012-02-12 Thread Henrique Dallazuanna
This works for me: Lines <- "label_1, label_2, label_3 1,2,3 3,2,4 2,3,4 Total Rows: 3" d <- head(read.csv(textConnection(Lines)), -1) closeAllConnections() On Sun, Feb 12, 2012 at 10:05 PM, Noah Silverman wrote: > Hi, > > I have a CSV file that is formatted well, except that the last line is a

[R] dotplots with error bars

2012-02-12 Thread Colin Wahl
Does anyone have any recommendations for producing dotplots with error bars? Are there packages available for this? I searched far and wide and cannot find a suitable option. I am trying to produce publication-quality figures for my thesis results. Dotplots (Cleveland dotplots) are a much better f

Re: [R] Writing output into a file

2012-02-12 Thread Rui Barradas
Hello One way is # Write the file save(myList, file="test1.bin") # Reload the data, under the same name, 'myList' load(file="test1.bin") Another way is a bit more complicated # Open a file connection and write the list to it (using comma as separator) fileCon <- file("test2.txt", open="wt") l

Re: [R] Reading in csv with footer

2012-02-12 Thread Steve Lianoglou
Hi, On Sun, Feb 12, 2012 at 7:05 PM, Noah Silverman wrote: > Hi, > > I have a CSV file that is formatted well, except that the last line is a > "summary" not is CSV format. > > Toy example: > > label_1, label_2, label_3 > 1,2,3 > 3,2,4 > 2,3,4 > Total Rows: 3 > > When I try to import this into R

Re: [R] how to plot a nice legend?

2012-02-12 Thread Duncan Murdoch
On 12-02-11 9:07 PM, Jonas Stein wrote: Wrong? Nothing. You told R to put the legend at c(1,3) so it did. If you want it elsewhere you need to specify that. legend(-1,3, legend=c("one", "two"), inset=-1, xpd=NA) maybe, or some other location? ok that works fine. Now i understand how to use it.

[R] Reading in csv with footer

2012-02-12 Thread Noah Silverman
Hi, I have a CSV file that is formatted well, except that the last line is a "summary" not is CSV format. Toy example: label_1, label_2, label_3 1,2,3 3,2,4 2,3,4 Total Rows: 3 When I try to import this into R with: d <- read.table("foo.csv", header=T, sep=",") It fails to import properly b

[R] how to extract p values in svyglm

2012-02-12 Thread Tanu Soni
summary(result) Call: svyglm(Injury ~ seat, sD, family = quasibinomial(link = "logit")) Survey design: svydesign(~1, prob = NULL, strata = Data[, 1], weights = Data[, 4], data = Data, fpc = ~fPc) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -4.256875 0.001421

Re: [R] Is it possible or has it been done?

2012-02-12 Thread Steve Lianoglou
Hi, On Sun, Feb 12, 2012 at 6:24 PM, Keith Weintraub wrote: > A port of R to iOS? Technically it is certainly possible. Legally, I don't think so. This question has been posed several times already, so you can find discussions about this issue by searching this list as well as R-sig-mac (gmane

Re: [R] Is it possible or has it been done?

2012-02-12 Thread Roy Mendelssohn
http://tolstoy.newcastle.edu.au/R/e11/help/10/08/6132.html HTH, -Roy On Feb 12, 2012, at 3:24 PM, Keith Weintraub wrote: > A port of R to iOS? > > Thanks for your time, > KW > > -- > > > [[alternative HTML version deleted]] > > __ > R-help@

[R] Is it possible or has it been done?

2012-02-12 Thread Keith Weintraub
A port of R to iOS? Thanks for your time, KW -- [[alternative HTML version deleted]] __ 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.htm

Re: [R] Writing output into a file

2012-02-12 Thread Alfredo Alessandrini
Hi, could you paste the results? Alfredo 2012/2/12 Suranga Kasthurirathne : > Hi everyone, > > I'm an R newbie working with the poLCA module. I achieved my target without > having to bother anyone, but It seems that I've got stuck at the last > minute. > > My problem is simple. I need to write

[R] Writing output into a file

2012-02-12 Thread Suranga Kasthurirathne
Hi everyone, I'm an R newbie working with the poLCA module. I achieved my target without having to bother anyone, but It seems that I've got stuck at the last minute. My problem is simple. I need to write my results into a file. My results are in the shape of a list (unbalanced columns) I've cons

Re: [R] object not found - Can not figure out why I get this error: Error in NROW(yCoordinatesOfLines) : object 'low' not found

2012-02-12 Thread ilai
Ah, scoping rules... Consider: f <- function(x,...) plot(x,xlim=c(low,high),...) f(1:10,low=2,high=9) # "Error ... object 'low' not found " But: f <- function(x,low,high,...) plot(x,xlim=c(low,high),...) f(1:10,2,9,col=2) # beautiful red points [low,high] Sorry I can't be more specific but ne

Re: [R] Install the rugarch-package

2012-02-12 Thread nserdar
Without space 'rugarch' -- View this message in context: http://r.789695.n4.nabble.com/Install-the-rugarch-package-tp3911903p4381876.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] Counting the loop-round of a "for"-loop

2012-02-12 Thread jolo999
It seems to work. Simple and effective! Thanks! -- View this message in context: http://r.789695.n4.nabble.com/Counting-the-loop-round-of-a-for-loop-tp4381319p4381780.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.or

Re: [R] [R-sig-DB] Reading data from a worksheet on the Internet

2012-02-12 Thread CIURANA EUGENE (R)
On Sun, 12 Feb 2012 16:24:58 -0200, Nilza BARROS wrote: > I really appreciate your help. I definitively need a reusable program since > I have been asking to someone to extract these data from the Internet > everyday. That's the reason why I am trying to do a program to do that > Related to t

Re: [R] ANCOVA post-hoc test

2012-02-12 Thread Rmh
ancova in HH is a wrapper for aov that displays a set of lattice plots. the problem you are seeing is probably that glht ignores covariates (with an appropriate message) unless you specify an optional argument. I will reply in more detail when i am at my computer. in the meantime, look at ?glht

Re: [R] Sample function in R

2012-02-12 Thread Petr Savicky
On Sun, Feb 12, 2012 at 01:57:18PM -0500, SUPAKORN LAOHAPITAKVORN wrote: > This is what I got: > > > sessionInfo() > R version 2.14.1 (2011-12-22) > Platform: x86_64-pc-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_United States.1252 > [2] LC_CTYPE=English_United States.1252 > [3] LC_

Re: [R] Sample function in R

2012-02-12 Thread Etienne B. Racine
Supakorn, Try: rm(sample) #then sample(x) Etienne 2012/2/12 SUPAKORN LAOHAPITAKVORN > This is what I got: > > > sessionInfo() > R version 2.14.1 (2011-12-22) > Platform: x86_64-pc-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_United States.1252 > [2] LC_CTYPE=English_United States.

Re: [R] Sample function in R

2012-02-12 Thread SUPAKORN LAOHAPITAKVORN
This is what I got: > sessionInfo() R version 2.14.1 (2011-12-22) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252

Re: [R] Get identical results for parallel and sequential?

2012-02-12 Thread slbfelix
Sorry. That was my first time to post, I was not sure if it worked or not. Libo -- View this message in context: http://r.789695.n4.nabble.com/Get-identical-results-for-parallel-and-sequential-tp4380110p4381648.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] How to import time-series data

2012-02-12 Thread Gabor Grothendieck
On Sun, Feb 12, 2012 at 12:35 PM, RichardSmith wrote: > > Gabor Grothendieck wrote >> >> Something seems to have gone wrong in the posting since we can't see >> the sample data that seems to be intended to be part of the post. > Sorry, I posted via Nabble using the 'raw' command, which got strippe

Re: [R] DF grouping

2012-02-12 Thread karthicklakshman
Dear Petr Savicky, Thank you very much for the solution. your script really worked for my DF, and yes as per your guess , its always ---> DF[i, "col2"] == DF[i+1, "col1"] Regards, karthick -- View this message in context: http://r.789695.n4.nabble.com/DF-grouping-tp4381310p4381646.html Sent fr

Re: [R] Install the rugarch-package

2012-02-12 Thread Prof Brian Ripley
On 12/02/2012 18:19, nserdar wrote: I got the same error on MAC Lion Error in as.environment(pos) : no item called "newtable" on the search list In addition: Warning message: In objects(newtable, all.names = TRUE) : ‘newtable’ converted to character string Error: package/namespace load fai

Re: [R] Get identical results for parallel and sequential?

2012-02-12 Thread Dirk Eddelbuettel
On 12 February 2012 at 19:13, Uwe Ligges wrote: | Please do not double post. And also do not cross-post: the same questions had been sent to (as well as answered at) the R-SIG-HPC list. Double-posting and cross-posting is impolite. Dirk -- "Outside of a dog, a book is a man's best friend. Ins

Re: [R] [R-sig-DB] Reading data from a worksheet on the Internet

2012-02-12 Thread Henrique Dallazuanna
Try the readHTMLTable function in package XML: sheet2 <- readHTMLTable(" http://www.mar.mil.br/dhn/chm/meteo/prev/dados/pnboia/sc1201_arquivos/sheet002.htm";, skip.rows = 2) head(sheet2[[1]]) On Sun, Feb 12, 2012 at 4:24 PM, Nilza BARROS wrote: > Hi, > > I really appreciate your help. I defini

Re: [R] updating one's own package

2012-02-12 Thread Wet Bell Diver
Thanks Uwe, that is really helpful. -Peter Op 11-2-2012 19:20, Uwe Ligges schreef: On 11.02.2012 13:49, Wet Bell Diver wrote: Win7 x64, R2.14.1 Dear list, I would like to get into the habbit of creating a package for each project. That way I can package my project-specific functions and

Re: [R] Sample function in R

2012-02-12 Thread Jorge I Velez
Hi, The following is what I get: > x =1:12 > x [1] 1 2 3 4 5 6 7 8 9 10 11 12 > sample(x) [1] 9 6 12 5 3 4 1 11 8 7 10 2 > sample(x, size = 2) [1] 9 4 What's the output of sessionInfo() and ls() ? Perhaps you have a different "sample" function in your workspace? HTH, Jorge

Re: [R] ANCOVA post-hoc test

2012-02-12 Thread peter dalgaard
Inline below On Feb 12, 2012, at 13:39 , Evagelopoulos Thanasis wrote: [...] > > Because there exist significantly different regression slopes, I did a post > hoc test with glht() to find out between which samplings: > >> summary(glht(mod, linfct=mcp(sampling="Tukey"))) > I believe this compa

Re: [R] Sample function in R

2012-02-12 Thread R. Michael Weylandt
sessionInfo()? Can you replicate this behavior in a R --vanilla session? This seems very odd and I presume you've overwritten sample() somewhere in your workspace. Michael On Sun, Feb 12, 2012 at 12:52 PM, SUPAKORN LAOHAPITAKVORN wrote: > Hi, > Can anyone help me with the sample () in R? > > If

Re: [R] [R-sig-DB] Reading data from a worksheet on the Internet

2012-02-12 Thread Nilza BARROS
Hi, I really appreciate your help. I definitively need a reusable program since I have been asking to someone to extract these data from the Internet everyday. That's the reason why I am trying to do a program to do that Related to the url I sent, I have just realized that although I had written

Re: [R] Install the rugarch-package

2012-02-12 Thread nserdar
I got the same error on MAC Lion Error in as.environment(pos) : no item called "newtable" on the search list In addition: Warning message: In objects(newtable, all.names = TRUE) : ‘newtable’ converted to character string Error: package/namespace load failed for 'rug arch' Regards, Serdar -

[R] Sample function in R

2012-02-12 Thread SUPAKORN LAOHAPITAKVORN
Hi, Can anyone help me with the sample () in R? If I sample from x, I should get one integer. Can anyone tell me what's wrong here? > x =1:12 > sample(x) [1] 6.5 And, I cannot get the sample with size = 2 > sample(x, size = 2) Error in sample(x, size = 2) : unused argument(s) (size = 2) > sample

[R] Diallele codes

2012-02-12 Thread Brijesh Angira
Howdy!!! I am a plant breeding Ph.D. student. I am trying to solve a diallele cross with R. Can anyone help with codes? Thank you Brijesh __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide h

Re: [R] How to import time-series data

2012-02-12 Thread RichardSmith
Gabor Grothendieck wrote > > Something seems to have gone wrong in the posting since we can't see > the sample data that seems to be intended to be part of the post. Sorry, I posted via Nabble using the 'raw' command, which got stripped out it seems. Here's a small sample of the data... plant,ap

Re: [R] Longitudinal Factor Analysis

2012-02-12 Thread ilai
?factanal There is also package sem (structural equations model) by John Fox. I'm sure there are more (maybe more fitting your situation) but these two came to mind first... Cheers On Sun, Feb 12, 2012 at 6:51 AM, Gregory Gilbert wrote: > I have a data set in the format below. I would like to

Re: [R] plotting dates, incorrectly scaled x-axis?

2012-02-12 Thread Uwe Ligges
On 12.02.2012 11:09, Christof Kluß wrote: Hi, I want to plot with axis.Date(), but something is scaled incorrectly. The red vertical line in is put on a totally wrong position. (sample below) Do you have an idea what I'm doing wrong? Thx Christof x11(width=30, height=20) x<-seq(as.Date("2

Re: [R] Get identical results for parallel and sequential?

2012-02-12 Thread Uwe Ligges
Please do not double post. Uwe Ligges On 11.02.2012 23:20, slbfelix wrote: Hi All, I have a question about R parallel computing by using snowfall. How can I set the seeds on parallel workers to get the same result as sequential mode? For example: sfSapply(c(1,1),rnorm) [1] 1.823082 -2.2

Re: [R] R Parallel question

2012-02-12 Thread Uwe Ligges
On 11.02.2012 23:12, slbfelix wrote: Hi All, I have a question about R parallel computing by using snowfall. How can I set the seeds on parallel workers to get the same result as sequential mode? For example: sfSapply(c(1,1),rnorm) [1] 1.823082 -2.222052 rnorm(2) [1] -0.5179967 -1.0807

Re: [R] Vector manipulation

2012-02-12 Thread syrvn
Great Dimitris. It helps indeed! Thanks a lot! -- View this message in context: http://r.789695.n4.nabble.com/Vector-manipulation-tp4381586p4381614.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https

Re: [R] Vector manipulation

2012-02-12 Thread Jorge I Velez
Hi mentor_, Try c(sapply(vec[-1], function(x) c(vec[1], x))) # [1] 2 4 2 6 2 9 2 10 HTH, Jorge.- On Sun, Feb 12, 2012 at 12:54 PM, syrvn <> wrote: > Hello, > > > I am stuck with the following problem. Consider the vector: > > vec <- c(2,4,6,9,10) > > I now want to use R to manipulate t

Re: [R] Vector manipulation

2012-02-12 Thread Dimitris Rizopoulos
One way is: vec <- c(2,4,6,9,10) c(rbind(vec[1], vec[-1])) I hope it helps. Best, Dimitris On 2/12/2012 6:54 PM, syrvn wrote: Hello, I am stuck with the following problem. Consider the vector: vec<- c(2,4,6,9,10) I now want to use R to manipulate the vector as follows: [1] 2, 4, 2, 6,

[R] Vector manipulation

2012-02-12 Thread syrvn
Hello, I am stuck with the following problem. Consider the vector: vec <- c(2,4,6,9,10) I now want to use R to manipulate the vector as follows: [1] 2, 4, 2, 6, 2, 9, 2, 10 In words, the first element of the vector should be placed in front of each following number. Which R commands do I nee

Re: [R] DF grouping

2012-02-12 Thread Petr Savicky
On Sun, Feb 12, 2012 at 07:07:26AM -0800, karthicklakshman wrote: > Hello Members, > > I need to group a data.frame in a a specific way, like shown below, > > DF raw is like this, > > id col1 col2 score > 1 A B 40 > 2 B C 55 > 3 C D 4000 > 4 D E1

Re: [R] multiple histograms from a dataframe

2012-02-12 Thread ilai
On Sat, Feb 11, 2012 at 9:10 PM, David Winsemius wrote: > > On Feb 11, 2012, at 6:25 PM, Adel ESSAFI wrote: > >> >> >> Le 11 février 2012 02:33, David Winsemius a écrit >> : >> >> On Feb 10, 2012, at 7:05 PM, Adel ESSAFI wrote: >> >> >> what can I do to draw to figures together using lattice? > >

Re: [R] Counting the loop-round of a "for"-loop

2012-02-12 Thread Ista Zahn
Hi, You can initialize a counter and update it in the loop. An silly example (unrelated to yours because it was not reproducible) of this technique is: x <- matrix( , ncol = 2, nrow = 26) n <- 0 for(i in letters) { n <- n+1 x[n,] <- c(i, n) } Best, Ista On Sunday, February 12, 2012 07:

Re: [R] AMOVA error: 'bin' must be numeric or a factor

2012-02-12 Thread Ben Bolker
Hanne Ballestad bio.uio.no> writes: > I am trying to analyse my data using amova > (http://www.oga-lab.net/RGM2/func.php?rd_id=pegas:amova): > > My input to R is a DNA sequence file, format=fasta > dna<- read.dna("XX.fasta", format="fasta") #left other options as > default > d<

Re: [R] How to import time-series data

2012-02-12 Thread Gabor Grothendieck
On Sun, Feb 12, 2012 at 10:52 AM, RichardSmith wrote: > Sorry for this very basic question. I have time-series data, laid out as a > table (in csv) like this: > > > > That is, the first column is the sample ID, and subsequent columns are the > data at time interval in days since the start. In Exce

Re: [R] plotting dates, incorrectly scaled x-axis?

2012-02-12 Thread Ted Harding
On 12-Feb-2012 Ted Harding wrote: > On 12-Feb-2012 Christof Kluß wrote: >> Hi, >> >> I want to plot with axis.Date(), but something is scaled incorrectly. >> The red vertical line in is put on a totally wrong position. >> (sample below) >> >> Do you have an idea what I'm doing wrong? >> >> Thx >

[R] DF grouping

2012-02-12 Thread karthicklakshman
Hello Members, I need to group a data.frame in a a specific way, like shown below, DF raw is like this, id col1 col2 score 1 A B 40 2 B C 55 3 C D 4000 4 D E100 5 E F300 I want the out put as List [1] A B C [2] D E [3] F Basicall

[R] How to import time-series data

2012-02-12 Thread RichardSmith
Sorry for this very basic question. I have time-series data, laid out as a table (in csv) like this: That is, the first column is the sample ID, and subsequent columns are the data at time interval in days since the start. In Excel, this is a very normal way to lay out time-series data, but I ca

Re: [R] Install the rugarch-package

2012-02-12 Thread liweichen0817
Yes, I have updated all my packages. My initial guess was that there may be some packages conflicting with rug arch so I uninstalled R and all the bundles I had. I reinstalled R and installed rugarch first, but I still got the same error message. -- View this message in context: http://r.789695.

[R] Longitudinal Factor Analysis

2012-02-12 Thread Gregory Gilbert
I have a data set in the format below. I would like to perform a factor analysis on BM1-BM20 as they are 20 biomechanical measurements of the trial (hitting a baseball). However, my observations are not independent and, I assume, I have to account for this. I have consulted the R literature via RSe

[R] Counting the loop-round of a "for"-loop

2012-02-12 Thread jolo999
Dear all, i have daily stock prices for more than 10 years and want to compute annual volatilities for certain dates during this period. Since i have found no "easy" way to work with time data, the data presents itself in the structure TIme Index - Stock Price 1 - 15,6 2 - 17 ... ... 2010 - 28 2

Re: [R] readLines vs scan

2012-02-12 Thread Gabor Grothendieck
On Sun, Feb 12, 2012 at 10:35 AM, Bert Gunter wrote: > Folks: > > Suppose I wish to input a text file with variable length lines and > possible whitespace as is and then parse the resulting character > vector in R. Each line of text is terminated with "\n" (newline > character). > > Is there any r

Re: [R] Install the rugarch-package

2012-02-12 Thread Uwe Ligges
Have you run update.packages() already? Uwe Ligges On 11.02.2012 23:02, liweichen0817 wrote: I have problem installing rugarch, too. I use R 2.14.1 on Mac OS X 10.7.3. When I tried to load rugauch, I got the bellowing error message: Loading required package: Rcpp Loading required package: R

[R] readLines vs scan

2012-02-12 Thread Bert Gunter
Folks: Suppose I wish to input a text file with variable length lines and possible whitespace as is and then parse the resulting character vector in R. Each line of text is terminated with "\n" (newline character). Is there any reason to prefer one or the other of: scan (filename, what ="a",sep

Re: [R] how to plot a nice legend?

2012-02-12 Thread John Kane
Have a lookt at the package ggplot2 I believe it will give you something like the image you link to. Simple example: -- library(ggplot2) mydata <- data.frame(a=1:10, b=1:10, c=letters[1:10]) ggplot(mydata, aes(a,b, co

[R] ANCOVA post-hoc test

2012-02-12 Thread Evagelopoulos Thanasis
Could you please help me on the following ANCOVA issue? This is a part of my dataset: sampling dist h 1wi 200 0.8687212 2wi 200 0.8812909 3wi 200 0.8267464 4wi0 0.8554508 5wi0 0.9506721 6wi0 0.8112781 7wi 400 0.868721

Re: [R] [R-sig-DB] Reading data from a worksheet on the Internet

2012-02-12 Thread CIURANA EUGENE (R)
On Sat, 11 Feb 2012 22:49:07 -0200, Nilza BARROS wrote: > I have to read data from a worksheet that is available on the Internet. I > have been doing this by copying the worksheet from the browser. > But I would like to be able to copy the data automatically using the url > command. > > But

Re: [R] how to plot a nice legend

2012-02-12 Thread Bretschneider SIG-R
Dear Jonas Stein, You may add a line defining a large margin to harbour the legend, such as: par(mai=c(0.5, 0.5, 0.5, 1.8)) # enlarged right margin plot(1:10) legend("right", legend=c("one", "two"), inset=-0.2, xpd=NA) Kind regards, Franklin Bretschneider -- Dept

Re: [R] Counting occurences of variables in a dataframe

2012-02-12 Thread Kai Mx
Amazing. Thanks everybody for the help. I have about 12,000 rows of data with up to 50 reccurrences, but it seems to work like a charm. Best, Kai On Sun, Feb 12, 2012 at 8:11 AM, Petr Savicky wrote: > On Sat, Feb 11, 2012 at 04:05:25PM -0500, David Winsemius wrote: > > > > On Feb 11, 2012, at

Re: [R] plotting dates, incorrectly scaled x-axis?

2012-02-12 Thread Ted Harding
On 12-Feb-2012 Christof Kluß wrote: > Hi, > > I want to plot with axis.Date(), but something is scaled incorrectly. > The red vertical line in is put on a totally wrong position. > (sample below) > > Do you have an idea what I'm doing wrong? > > Thx > Christof > > > x11(width=30, height=20) >

[R] plotting dates, incorrectly scaled x-axis?

2012-02-12 Thread Christof Kluß
Hi, I want to plot with axis.Date(), but something is scaled incorrectly. The red vertical line in is put on a totally wrong position. (sample below) Do you have an idea what I'm doing wrong? Thx Christof x11(width=30, height=20) x<-seq(as.Date("2010-02-27"), as.Date("2011-03-28"),"month") y

[R] plotting dates, incorrectly scaled x-axis?

2012-02-12 Thread Christof Kluß
Hi, I want to plot with axis.Date(), but something is scaled incorrectly. The red vertical line in is put on a totally wrong position. (sample below) Do you have an idea what I'm doing wrong? Thx Christof x11(width=30, height=20) x<-seq(as.Date("2010-02-27"), as.Date("2011-03-28"),"month") y

Re: [R] Embed R code in online database

2012-02-12 Thread Barry Rowlingson
On Sat, Feb 11, 2012 at 5:49 PM, Jokel Meyer wrote: > Dear R-List! > > I would like to embed R code in an online database such as i.e. a google > spreadsheet in way that users can add data to the database and that R's > calculations are updated automatically and i.e. given out in the > spreadsheet

[R] The forecasting of images

2012-02-12 Thread Ross Bowden
Hi everyone. Are there any packages in R that can be used for short-term forecasting of a sequence of images? Black and white photos of the visible sky are taken say every 5 minutes indicating the presence or otherwise of clouds in each pixel. There doesn't appear to be an obvious modelling sol