Re: [R] could I remove or move points in locator() based on plot()?
Thanks. I have tried put.points.demo, it helps, maybe some more modify then it would be suitable for me. Thank you again. 2013/8/3 Greg Snow <538...@gmail.com> > The function "put.points.demo" in the TeachingDemos package allows you to > add points, delete points, and move points on a scatterplot (and also > computes some summaries based on the points). > > It actually uses "locator" behind the scenes and redraws the plot each > time, but it gives the effect. If that does not do what you want, you may > be able to modify the function (pure R code) to do what you need. > > > On Fri, Aug 2, 2013 at 3:26 AM, Klot Lee wrote: > >> Hi, >> The function locator() allows me to add points by mouse on function plot() >> I have draft. But the points can not be edit once I have made the click. >> How can I remove or just move the points I made on the draft? >> >> I use the locator function like this: >> >> > plot(1,1) >> > locator(type="o") >> >> >> Thanks. >> >> [[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.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > > -- > Gregory (Greg) L. Snow Ph.D. > 538...@gmail.com > -- Stand Alone Complex [[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.html and provide commented, minimal, self-contained, reproducible code.
[R] Singular fit error with R rlm function
Has anyone used the rlm regression function. I am using a factor variable as part of this regression. If the number of occurrences of any factor is 0 or 1 it complains with the error that 'x' is singular: singular fits are not implemented in 'rlm' The droplevels function removes 0 occurrence factors, is there a way to eliminate ones that have occurrence of 1. [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] could I remove or move points in locator() based on plot()?
Maybe I have to white a function for the purpose base on loacator. Thanks for the reply. 2013/8/3 David Carlson > You cannot move or edit them interactively, but you can save > the locations of those points by using: > > > a <- locator(type="o") > > # e.g. click on three locations > > > a > $x > [1] 0.8559376 1.1778126 1.2340626 > > $y > [1] 1.2256976 1.2501162 0.8402324 > > You could now delete or modify the points and then use lines() > or points() to add them to a new graph. > > > plot(1, 1) > > lines(a, type="o") > > points(a, pch=16, col="red") > > - > David L Carlson > Associate Professor of Anthropology > Texas A&M University > College Station, TX 77840-4352 > > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Daniel > Guetta > Sent: Friday, August 2, 2013 12:23 PM > To: David Winsemius > Cc: R-help@r-project.org > Subject: Re: [R] could I remove or move points in locator() > based on plot()? > > Depending on the complexity of your graphic, you could also > just re-draw > the entire thing every time you want to make a change. > > Daniel > > > On Fri, Aug 2, 2013 at 10:17 AM, David Winsemius > wrote: > > > > > On Aug 2, 2013, at 2:26 AM, Klot Lee wrote: > > > > > Hi, > > > The function locator() allows me to add points by mouse on > function > > plot() > > > I have draft. But the points can not be edit once I have > made the click. > > > How can I remove or just move the points I made on the > draft? > > > > You cannot. The plotting model for base graphics is > indelible ink. The > > best you could do would be to plot white on top of black. > > > > -- > > David. > > > > > > I use the locator function like this: > > > > > >> plot(1,1) > > >> locator(type="o") > > > > > > > > > Thanks. > > > > > > [[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.html > > > and provide commented, minimal, self-contained, > reproducible code. > > > > David Winsemius > > Alameda, CA, USA > > > > __ > > 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. > > > > [[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.html > and provide commented, minimal, self-contained, reproducible > code. > > __ > 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. > -- Stand Alone Complex [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Internalization of help pages
Tomáš 1. Your concern is valid, especially now that R has become so widely used throughout the world. But language translation is hard. 2. Warning and error messages are short, and relatively trivial to translate. 3. There are tens of thousands of Help pages in thousands of packages, most separately maintained. I would guess that the best option would be to try to run the files through a mature, open source translator, if such exists. However, I'm ignorant of such matters. And my understanding is that at present, even the best may not be adequate (Help files have to accurate in exact detail). Best, Bert On Fri, Aug 2, 2013 at 2:54 PM, Tomáš Greif wrote: > Is it possible to translate help files? I see there are some localization > options for GUI, but not for help. I think this would be really helpful for > users who don't have English as their primary language. > > Because all the online help is created from text files, it should be not > that difficult to maintain different language versions (e.g. to mark them > as not valid when primary documentation in English changes). > > Regards, > > Tomas Greif > > [[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.html > and provide commented, minimal, self-contained, reproducible code. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ 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.
[R] Internalization of help pages
Is it possible to translate help files? I see there are some localization options for GUI, but not for help. I think this would be really helpful for users who don't have English as their primary language. Because all the online help is created from text files, it should be not that difficult to maintain different language versions (e.g. to mark them as not valid when primary documentation in English changes). Regards, Tomas Greif [[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.html and provide commented, minimal, self-contained, reproducible code.
[R] access the tcl history stream in tcltk
Hello, Does anyone have a clue about how dump tcl's history stream out to a file from R pointers to tcl? This should be accessible via "tcl("history",...) but the stream seems to be always empty. library(tcltk) #Load tcltk tcl("history","nextid") #should be 1, and it is a1<-tclVar("1") tclvalue(a1)<-2 tcl("history","nextid") #Should be 3, but alas, it is 1. tcl("history","info")#Sadly, tcl has no history .Tcl("history nextid") #No joy here either. Thanks, in advance, for any tips or clues. Best, Chris Marcum -- Staff Scientist - Methodologist Social Network Methods Section National Human Genome Research Institute National Institutes of Health [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] (no subject)
On 08/02/2013 01:29 PM, Babu Guha wrote: I have a comma delimited file with 62 fields of which some are comments. There are about 1.5 million records/lines. Sme of the fields which has comments and which i do not need have 40 characters. Of the 62 fields, I will need at most 12 fields. What's best way to read in the fields I need. If I read the entire file at once I will run out of memory. Could anyone please suggest some solution? Hi Babu, Assuming that you know which fields you want, you could process the file line by line: # say your file is "mydata.csv" and you want lines 1 to 12 mycon<-file("mydata.csv",open="r") # assume you have exactly 1.5 million lines mydata<-matrix(NA,nrow=150,ncol=12) inputline<-"start" lineindex<-1 while(nchar(inputline)) { # read a line inputline<-readLines(mycon,1) if(nchar(inputline)) { mydata[lineindex,]<- unlist(sapply(strsplit(inputline,","),"[",1:12)) lineindex<-lineindex+1 } } close(mycon) Jim __ 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.
Re: [R] How to download this data?
That URL is an HTTPS (secure HTTP), not an HTTP. The XML parser cannot retrieve the file. Instead, use the RCurl package to get the file. However, it is more complicated than that. If you look at source of the HTML page in a browser, you'll see a jsessionid and that is a session identifier. The following retrieves the content of your URL and then parses it and extracts the value of the jsessionid. Then we create the full URL to the actual data page (which is actually in the HTML content but in JavaScript code) library(RCurl) library(XML) rawOrig = getURLContent("https://www.theice.com/productguide/ProductSpec.shtml?specId=219#expiry";) rawDoc = htmlParse(rawOrig) tmp = getNodeSet(rawDoc, "//@href[contains(.,\040'jsessionid=')]")[[1]] jsession = gsub(".*jsessionid=([^?]+)?.*", "\\1", tmp) u = sprintf("https://www.theice.com/productguide/ProductSpec.shtml;jsessionid=%s?expiryDates=&specId=219";, jsession) doc = htmlParse(getURLContent(u)) tbls = readHTMLTable(doc) data = tbls[[1]] dim(data) I did this quickly so it may not be the best way or completely robust, but hopefully it gets the point across and does get the data. D. On 8/2/13 2:42 PM, Ron Michael wrote: > Hi all, > > I need to download the data from this web page: > > https://www.theice.com/productguide/ProductSpec.shtml?specId=219#expiry > > I used the function readHTMLTable() from package XML, however could not > download that. > > Can somebody help me how to get the data onto my R window? > > Thank you. > > __ > 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. > __ 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.
Re: [R] using "rollapply" to calculate a moving sum or running sum?
Try the filter() function. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Anika Masters > Sent: Friday, August 02, 2013 2:48 PM > To: arun > Cc: R help > Subject: Re: [R] using "rollapply" to calculate a moving sum or running sum? > > This is not critical, but I am curious to learn. Are there any > suggestions for speeding up the process to calculate a moving row sum? > (Ideally from within R, as opposed to suing C, etc.) > Using rollapply on a matrix of 45,000 rows and 400 columns takes 83 minutes. > > date() > mymatrix <- matrix(data=1:45000, nrow=45000, ncol=400) > temp <- t(rollapply(t(mymatrix), width=12, FUN=sum, by.column=T, > fill=NA, partial=FALSE, align="left")) > date() > > On Thu, Jun 27, 2013 at 2:41 PM, arun wrote: > > Hi, > > Try: > > library(zoo) > > > > > rollapply(t(mymatrix),width=12,FUN=sum,by.column=T,fill=NA,partial=FALSE,align="left" > ) > > # [,1] [,2] [,3] [,4] [,5] > > #[1,] 342 354 366 378 390 > > #[2,] 402 414 426 438 450 > > #[3,] 462 474 486 498 510 > > #[4,] 522 534 546 558 570 > > #[5,] 582 594 606 618 630 > > #[6,] 642 654 666 678 690 > > #[7,] 702 714 726 738 750 > > #[8,] 762 774 786 798 810 > > #[9,] 822 834 846 858 870 > > #[10,] NA NA NA NA NA > > #[11,] NA NA NA NA NA > > #[12,] NA NA NA NA NA > > #[13,] NA NA NA NA NA > > #[14,] NA NA NA NA NA > > #[15,] NA NA NA NA NA > > #[16,] NA NA NA NA NA > > #[17,] NA NA NA NA NA > > #[18,] NA NA NA NA NA > > #[19,] NA NA NA NA NA > > #[20,] NA NA NA NA NA > > A.K. > > > > > > > > - Original Message - > > From: Anika Masters > > To: R help > > Cc: > > Sent: Thursday, June 27, 2013 3:00 PM > > Subject: [R] using "rollapply" to calculate a moving sum or running sum? > > > > #using "rollapply" to calculate a moving sum or running sum? > > > > #I am tryign to use rollapply to calcualte a moving sum? #I tried > > rollapply and get the error message > > #"Error in seq.default(start.at, NROW(data), by = by) : > > # wrong sign in 'by' argument" > > > > #example: > > > > mymatrix <- ( matrix(data=1:100, nrow=5, ncol=20) ) > > mymatrix_cumsum <- ( matrix(data=NA, nrow=5, ncol=20) ) > > w=12 > > for(i in 1: (ncol(mymatrix)-w+1) ) { > > mymatrix_cumsum[ , i] <- apply(X=mymatrix[, i:(i+w-1)] , MARGIN=1, > > FUN=sum, na.rm=T) > > } > > > > #How might I use the "rollapply" function instead? > > > > rollapply(mymatrix, 12, sum) > > > > rollapply(data = mymatrix, width = 12, FUN=sum, by.column =T, fill = > > NA, partial = FALSE, align = "left" ) > > > > __ > > 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. > > > > __ > 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. __ 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.
Re: [R] using "rollapply" to calculate a moving sum or running sum?
This is not critical, but I am curious to learn. Are there any suggestions for speeding up the process to calculate a moving row sum? (Ideally from within R, as opposed to suing C, etc.) Using rollapply on a matrix of 45,000 rows and 400 columns takes 83 minutes. date() mymatrix <- matrix(data=1:45000, nrow=45000, ncol=400) temp <- t(rollapply(t(mymatrix), width=12, FUN=sum, by.column=T, fill=NA, partial=FALSE, align="left")) date() On Thu, Jun 27, 2013 at 2:41 PM, arun wrote: > Hi, > Try: > library(zoo) > > rollapply(t(mymatrix),width=12,FUN=sum,by.column=T,fill=NA,partial=FALSE,align="left") > # [,1] [,2] [,3] [,4] [,5] > #[1,] 342 354 366 378 390 > #[2,] 402 414 426 438 450 > #[3,] 462 474 486 498 510 > #[4,] 522 534 546 558 570 > #[5,] 582 594 606 618 630 > #[6,] 642 654 666 678 690 > #[7,] 702 714 726 738 750 > #[8,] 762 774 786 798 810 > #[9,] 822 834 846 858 870 > #[10,] NA NA NA NA NA > #[11,] NA NA NA NA NA > #[12,] NA NA NA NA NA > #[13,] NA NA NA NA NA > #[14,] NA NA NA NA NA > #[15,] NA NA NA NA NA > #[16,] NA NA NA NA NA > #[17,] NA NA NA NA NA > #[18,] NA NA NA NA NA > #[19,] NA NA NA NA NA > #[20,] NA NA NA NA NA > A.K. > > > > - Original Message - > From: Anika Masters > To: R help > Cc: > Sent: Thursday, June 27, 2013 3:00 PM > Subject: [R] using "rollapply" to calculate a moving sum or running sum? > > #using "rollapply" to calculate a moving sum or running sum? > > #I am tryign to use rollapply to calcualte a moving sum? #I tried > rollapply and get the error message > #"Error in seq.default(start.at, NROW(data), by = by) : > # wrong sign in 'by' argument" > > #example: > > mymatrix <- ( matrix(data=1:100, nrow=5, ncol=20) ) > mymatrix_cumsum <- ( matrix(data=NA, nrow=5, ncol=20) ) > w=12 > for(i in 1: (ncol(mymatrix)-w+1) ) { > mymatrix_cumsum[ , i] <- apply(X=mymatrix[, i:(i+w-1)] , MARGIN=1, > FUN=sum, na.rm=T) > } > > #How might I use the "rollapply" function instead? > > rollapply(mymatrix, 12, sum) > > rollapply(data = mymatrix, width = 12, FUN=sum, by.column =T, fill = > NA, partial = FALSE, align = "left" ) > > __ > 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. > __ 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.
[R] How to download this data?
Hi all, I need to download the data from this web page: https://www.theice.com/productguide/ProductSpec.shtml?specId=219#expiry I used the function readHTMLTable() from package XML, however could not download that. Can somebody help me how to get the data onto my R window? Thank you. __ 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.
Re: [R] R Job taking longer in Linux than in Windows
On 02.08.2013 22:14, alina andrei wrote: Hello, I am running an R job on a Windows 7 machine, having 4 cores and 16GB RAM , R 3.0.1, and it takes 1.5 hours to complete. I am running the same job in R on a Linux enviroment (Platform: x86_64-redhat-linux-gnu (64-bit)) with huge amounts of memory: 40 cores and .5 TB RAM., and the job takes 3h and 15min to complete (no other concurrent jobs). The job uses the glmnet package to perform model selection on a simulated data set having 1 million records and 150 variables. My questions are: 1. Why R doesn't take advantage of the avaialble RAM? 2. Are there any changes that we can apply to the R configuration file in order to see superior performance? My expectations are that the Linux enviroment would performe a lot better when compared to the Windows enviroment. Probably the problem has not been parallelized and uses only 1 core? And 1 core on your Linux machine is probably slower than one core of your Windows machine? Or the different machines have different loads? Uwe Ligges Any help in sorting out these issues is much appreciated. Thank you in advance! Alina [[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.html and provide commented, minimal, self-contained, reproducible code. __ 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.
Re: [R] Removing null vector that is not in .csv file data
Hi, you could try going in your spreadsheet and delete columns/rows that are seemingly empty (delete a lot a of them), then try again. Sometimes in your spreadsheet you enter values then you delete them. This leaves the cells "active" and when you save the csv file, it writes some commas with nothing between them to account for those "active" cells. If you delete the rows/columns with possible active cells (which you can't know because they are empty, hence the need to delete a lot of them) you remove them from the data and the csv file doesn't have to account for those empty cells. I hope this helps for future files! Cheers JM __ 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.
Re: [R] lme: object is not a matrix
Hi, make sure your data is in a data frame: Data <- data.frame(t,can2p,code) just specify in which object you find those specific variables by using object$ before each one. I hope this solve the problem. If not, post your script, it's really hard to work with only an error message! Cheers JM __ 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.
Re: [R] problem about mean function in ffbase package
Le jeudi 01 août 2013 à 00:10 +0800, Chaos Chen a écrit : > Hi all, > > I experienced some unmatched result using mean function in ffbase package > and cannot figure out what's wrong. > > I have a simulated ff vector with 10 numbers inside and want to > calculate its mean. But the results are quite different. > > With mean( ) function in ffbase package, the mean is 152.6858. > But with R's mean( ) or adding sum from chunks directly, I got 667.5595 > > any idea ? Thank you in advance! Could you provide a fully reproducible example with a shorter vector (I cannot create such a large vector on my box)? Use set.seed() so that runif() gives exactly the same values. >From quick tests here, the problem does not appear. Regards > Bayes Chen > > # F1 is an ffdf , F1$X1 is an ff vector > > length(F1$X1) > [1] 10 > > # Use mean() function in ffbase package > > mean(F1$X1) > [1] 152.6858 > > > X2 = F1$X1[] #X2 is now an non-ff vector > > length(X2) > [1] 10 > > mean(X2) # R's original mean function for ordinary vectors > [1] 667.5595 > > # calculate sum and then mean by chunks > > chunks = chunk(F1$X1, by=500) > > sumx = 0 > > for (i in chunks) { > + sumx = sumx + sum(F1$X1[i]) > + } > > sumx/length(F1$X1) > [1] 667.5595 > > --- below are some other trials > > X2 = F1$X1[1:100] > > mean(X2) > [1] 59.43149 > > mean(as.ff(X2)) > [1] 59.43149 > > > X2 = F1$X1[1:1] > > mean(X2) > [1] 59.41978 > > mean(as.ff(X2)) > [1] 59.42128 > > > X2 = F1$X1[1:5] > > mean(X2) > [1] 60.53615 > > mean(as.ff(X2)) > [1] 57.72168 > > > X2 = F1$X1[1:75000] > > mean(X2) > [1] 59.37562 > > mean(as.ff(X2)) > [1] 57.81179 > > > X2 = F1$X1[1:9] > > mean(X2) > [1] 57.0867 > > mean(as.ff(X2)) > [1] 57.44862 > > > X3 = F1$X1[9:10] > > mean(X3) > [1] 6161.814 > > mean(as.ff(X3)) > [1] 6161.797 > [[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.html > and provide commented, minimal, self-contained, reproducible code. __ 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.
[R] Error executing R CMD check --as-cran caused by missing Maintainer field
Hello, while checking a small package I wrote (http://cran.r-project.org/web/packages/tipom/) before submitting a new version, I was blocked by an error in the "checking CRAN incoming feasibility" section of R CMD check --as-cran, as pasted below: steko@ganymede:~/code$ LC_ALL=C R CMD check --as-cran tipom * using log directory '/home/steko/code/tipom.Rcheck' * using R version 3.0.1 (2013-05-16) * using platform: i486-pc-linux-gnu (32-bit) * using session charset: ASCII * checking for file 'tipom/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'tipom' version '1.0.1' * checking CRAN incoming feasibility ...Error in if (!all(m_m_1 == m_d_1)) { : missing value where TRUE/FALSE needed Execution halted The error occurs using R 3.0.1 on both Debian and Fedora (distribution packages). I understand it is caused by some missing information in the DESCRIPTION file. With some trial and error, following some clues found at https://github.com/hadley/devtools/issues/209, I could figure out it was missing the "Maintainer" field. However, in the "Writing R extensions" manual I read that > Fields Author and Maintainer can be auto-generated from Authors@R, and may be omitted if the latter is provided I am indeed using Authors@R so in the end I am slightly confused. What is the correct way to deal with these fields? Thank you in advance Stefano -- Stefano Costa http://www.iosa.it/ Open Archaeology __ 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.
[R] How to index each loop results
*Hi R Users, * *I was trying to write a simple function for data imputation. I need to index the results from each step and combine it with some data of the original dataset for the next step, until the end. I attached a sample data and the work-well R code function I wrote, but the function is rather applied easily for all kind of data. Can somebody generalize my 'pace.imp' function? * * run the attached sample data using the following function: pred<-matrix(c(rep(0, 11), rep(1,7), rep(0, 72)), 9, 9, byrow=T) rownames(pred)<-colnames(pred)<-paste("PR", 1:9) impace<-function(data, time, imp, i, pred, m){ library(mice) if (sum(is.na(data[data[, time]<=i, imp]))>=1) {compl<-complete(mice(data[data[, time]<=i, ], pred=pred, m=m))} else {compl=data[data[, time]<=i, ]} return(compl) } pace.imp<-function(data, time, imp, pred, m){ C1<-impace(data, time, imp, 1, pred, m) R1<-rbind(C1, data[data[, time]==(1+1),]) C2<-impace(R1, time, imp, 2, pred, m) R2<-rbind(C2, data[data[, time]==(1+2),]) C3<-impace(R2, time, imp, 3, pred, m) R3<-rbind(C3, data[data[, time]==(1+3),]) C4<-impace(R3, time, imp, 4, pred, m) R4<-rbind(C4, data[data[, time]==(1+4),]) C5<-impace(R4, time, imp, 5, pred, m) R5<-rbind(C5, data[data[, time]==(1+5),]) C6<-impace(R5, time, imp, 6, pred, m) R6<-rbind(C6, data[data[, time]==(1+6),]) C7<-impace(R6, time, imp, 7, pred, m) R7<-rbind(C7, data[data[, time]==(1+7),]) C8<-impace(R7, time, imp, 8, pred, m) R8<-rbind(C8, data[data[, time]==(1+8),]) C9<-impace(R8, time, imp, 9, pred, m) R9<-rbind(C9, data[data[, time]==(1+9),]) C10<-impace(R9, time, imp, 10, pred, m) R10<-rbind(C10, data[data[, time]==(1+10),]) C11<-impace(R10, time, imp, 11, pred, m) return(C11) } Pace<-pace.imp(test, time=4, imp=2, pred, 10) * *Thanks, * *David * "PR 1" "PR 2" "PR 3" "PR 4" "PR 5" "PR 6" "PR 7" "PR 8" "PR 9" "694" 1196 1 2 1 237 3 4 3 4 "731" 1225 NA 1 1 281 1 2 2 3 "739" 1228 0 2 1 261 2 2 1 1 "758" 1024 NA 1 1 462 1 2 1 1 "766" 1083 0 1 1 307 2 3 2 2 "88" 1067 NA 1 2 412 2 2 1 1 "119" 1090 NA 1 2 347 1 2 1 1 "196" 1132 0 2 2 319 3 2 1 1 "222" 1139 0 1 2 318 3 3 2 2 "251" 1153 0 2 2 329 2 2 2 2 "358" 1199 NA 2 2 201 1 2 1 1 "397" 1214 NA 1 2 290 1 2 1 1 "458" 1007 NA 2 2 317 1 2 2 3 "479" 1018 1 1 2 259 2 3 3 4 "496" 1022 0 1 2 410 1 1 1 1 "528" 1045 NA 1 2 304 1 2 1 1 "571" 1085 NA 1 2 308 1 2 2 3 "593" 1117 0 1 2 444 2 2 1 1 "601" 1119 0 2 2 344 3 2 1 1 "644" 1147 0 1 2 253 4 4 1 1 "659" 1167 0 1 2 224 2 2 1 1 "680" 1181 0 1 2 303 3 2 3 2 "695" 1196 NA 2 2 252 1 3 1 1 "732" 1225 NA 1 2 321 1 2 1 1 "740" 1228 0 2 2 348 2 2 1 1 "759" 1024 0 1 2 482 2 2 3 2 "767" 1083 NA 1 2 356 1 2 1 1 "120" 1090 0 1 3 446 4 2 2 2 "197" 1132 0 2 3 330 3 2 1 1 "223" 1139 0 1 3 332 2 4 3 3 "252" 1153 0 2 3 348 1 2 1 1 "359" 1199 NA 2 3 235 1 2 3 2 "398" 1214 0 1 3 332 1 2 1 1 "459" 1007 0 2 3 326 2 3 1 1 "480" 1018 0 1 3 272 2 2 3 3 "497" 1022 NA 1 3 431 1 1 1 1 "529" 1045 0 1 3 377 1 2 1 1 "572" 1085 0 1 3 326 2 2 1 1 "602" 1119 0 2 3 375 2 2 1 1 "645" 1147 0 1 3 303 1 2 1 1 "660" 1167 1 1 3 246 2 3 1 1 "681" 1181 NA 1 3 366 2 2 1 1 "696" 1196 0 2 3 274 3 2 1 1 "741" 1228 0 2 3 368 1 2 1 1 "768" 1083 0 1 3 375 1 2 2 2 "198" 1132 NA 2 4 422 1 2 1 1 "224" 1139 NA 1 4 345 1 2 1 1 "253" 1153 0 2 4 386 1 2 2 2 "360" 1199 NA 2 4 258 1 2 1 1 "399" 1214 0 1 4 348 1 2 1 1 "460" 1007 NA 2 4 335 1 3 2 4 "481" 1018 0 1 4 319 2 2 2 2 "498" 1022 0 1 4 467 1 2 1 1 "530" 1045 NA 1 4 500 2 2 2 2 "573" 1085 0 1 4 383 1 2 1 1 "603" 1119 0 2 4 457 2 2 1 1 "646" 1147 0 1 4 326 2 3 1 1 "661" 1167 0 1 4 255 1 3 1 1 "697" 1196 NA 2 4 288 1 2 1 1 "769" 1083 1 1 4 479 1 2 1 1 "225" 1139 NA 1 5 442 1 2 1 1 "254" 1153 0 2 5 406 2 2 1 1 "361" 1199 NA 2 5 280 1 2 1 1 "400" 1214 NA 1 5 357 1 2 1 1 "461" 1007 0 2 5 340 2 3 2 2 "482" 1018 0 1 5 326 1 2 1 1 "574" 1085 0 1 5 472 4 2 1 1 "647" 1147 0 1 5 387 2 3 1 1 "662" 1167 0 1 5 284 2 3 1 1 "698" 1196 0 2 5 296 2 2 1 1 "362" 1199 0 2 6 304 3 2 2 2 "462" 1007 1 2 6 396 2 3 3 2 "483" 1018 0 1 6 344 4 3 4 2 "663" 1167 0 1 6 296 2 2 1 1 "699" 1196 NA 2 6 311 1 2 1 1 "363" 1199 NA 2 7 334 1 2 1 1 "484" 1018 0 1 7 367 1 4 3 2 "664" 1167 0 1 7 314 2 2 1 1 "700" 1196 0 2 7 373 2 2 1 1 "485" 1018 0 1 8 386 2 2 1 1 "665" 1167 0 1 8 359 2 2 1 1 "701" 1196 NA 2 8 386 1 2 1 1 "486" 1018 0 1 9 411 2 2 1 1 "666" 1167 NA 1 9 401 1 2 1 1 "487" 1018 0 1 10 432 2 2 3 3 "488" 1018 0 1 11 500 2 2 1 1 __ 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
Re: [R] problem about mean function in ffbase package
Le jeudi 01 août 2013 à 00:10 +0800, Chaos Chen a écrit : > Hi all, > > I experienced some unmatched result using mean function in ffbase package > and cannot figure out what's wrong. > > I have a simulated ff vector with 10 numbers inside and want to > calculate its mean. But the results are quite different. > > With mean( ) function in ffbase package, the mean is 152.6858. > But with R's mean( ) or adding sum from chunks directly, I got 667.5595 > > any idea ? Thank you in advance! Could you provide a fully reproducible example with a shorter vector (I cannot create such a large vector on my box)? Use set.seed() so that runif() gives exactly the same values. >From quick tests here, the problem does not appear. Regards > Bayes Chen > > # F1 is an ffdf , F1$X1 is an ff vector > > length(F1$X1) > [1] 10 > > # Use mean() function in ffbase package > > mean(F1$X1) > [1] 152.6858 > > > X2 = F1$X1[] #X2 is now an non-ff vector > > length(X2) > [1] 10 > > mean(X2) # R's original mean function for ordinary vectors > [1] 667.5595 > > # calculate sum and then mean by chunks > > chunks = chunk(F1$X1, by=500) > > sumx = 0 > > for (i in chunks) { > + sumx = sumx + sum(F1$X1[i]) > + } > > sumx/length(F1$X1) > [1] 667.5595 > > --- below are some other trials > > X2 = F1$X1[1:100] > > mean(X2) > [1] 59.43149 > > mean(as.ff(X2)) > [1] 59.43149 > > > X2 = F1$X1[1:1] > > mean(X2) > [1] 59.41978 > > mean(as.ff(X2)) > [1] 59.42128 > > > X2 = F1$X1[1:5] > > mean(X2) > [1] 60.53615 > > mean(as.ff(X2)) > [1] 57.72168 > > > X2 = F1$X1[1:75000] > > mean(X2) > [1] 59.37562 > > mean(as.ff(X2)) > [1] 57.81179 > > > X2 = F1$X1[1:9] > > mean(X2) > [1] 57.0867 > > mean(as.ff(X2)) > [1] 57.44862 > > > X3 = F1$X1[9:10] > > mean(X3) > [1] 6161.814 > > mean(as.ff(X3)) > [1] 6161.797 > [[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.html > and provide commented, minimal, self-contained, reproducible code. __ 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.
[R] R Job taking longer in Linux than in Windows
Hello, I am running an R job on a Windows 7 machine, having 4 cores and 16GB RAM , R 3.0.1, and it takes 1.5 hours to complete. I am running the same job in R on a Linux enviroment (Platform: x86_64-redhat-linux-gnu (64-bit)) with huge amounts of memory: 40 cores and .5 TB RAM., and the job takes 3h and 15min to complete (no other concurrent jobs). The job uses the glmnet package to perform model selection on a simulated data set having 1 million records and 150 variables. My questions are: 1. Why R doesn't take advantage of the avaialble RAM? 2. Are there any changes that we can apply to the R configuration file in order to see superior performance? My expectations are that the Linux enviroment would performe a lot better when compared to the Windows enviroment. Any help in sorting out these issues is much appreciated. Thank you in advance! Alina [[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.html and provide commented, minimal, self-contained, reproducible code.
[R] CSPADE error: system invocation error
Hi Sue & Michael, I'm running into the same situation, i first tried everything with my own data and it didn't work, and then i tried with zaki.txt and i got the same error Here is my sessioninfo: > sessionInfo() R version 3.0.1 (2013-05-16) Platform: i386-w64-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252 LC_NUMERIC=C [5] LC_TIME=French_France.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] arulesSequences_0.2-4 arules_1.0-14 Matrix_1.0-12 lattice_0.20-15 loaded via a namespace (and not attached): [1] grid_3.0.1 tools_3.0.1 Have you guys resolved the problem? Do you know where does it come from? Thank you in advance, Cen -- Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message, you should destroy this message. For more information on WPP's business ethical standards and corporate responsibility policies, please refer to WPP's website. [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] could I remove or move points in locator() based on plot()?
The function "put.points.demo" in the TeachingDemos package allows you to add points, delete points, and move points on a scatterplot (and also computes some summaries based on the points). It actually uses "locator" behind the scenes and redraws the plot each time, but it gives the effect. If that does not do what you want, you may be able to modify the function (pure R code) to do what you need. On Fri, Aug 2, 2013 at 3:26 AM, Klot Lee wrote: > Hi, > The function locator() allows me to add points by mouse on function plot() > I have draft. But the points can not be edit once I have made the click. > How can I remove or just move the points I made on the draft? > > I use the locator function like this: > > > plot(1,1) > > locator(type="o") > > > Thanks. > > [[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.html > and provide commented, minimal, self-contained, reproducible code. > -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] could I remove or move points in locator() based on plot()?
You cannot move or edit them interactively, but you can save the locations of those points by using: > a <- locator(type="o") # e.g. click on three locations > a $x [1] 0.8559376 1.1778126 1.2340626 $y [1] 1.2256976 1.2501162 0.8402324 You could now delete or modify the points and then use lines() or points() to add them to a new graph. > plot(1, 1) > lines(a, type="o") > points(a, pch=16, col="red") - David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Daniel Guetta Sent: Friday, August 2, 2013 12:23 PM To: David Winsemius Cc: R-help@r-project.org Subject: Re: [R] could I remove or move points in locator() based on plot()? Depending on the complexity of your graphic, you could also just re-draw the entire thing every time you want to make a change. Daniel On Fri, Aug 2, 2013 at 10:17 AM, David Winsemius wrote: > > On Aug 2, 2013, at 2:26 AM, Klot Lee wrote: > > > Hi, > > The function locator() allows me to add points by mouse on function > plot() > > I have draft. But the points can not be edit once I have made the click. > > How can I remove or just move the points I made on the draft? > > You cannot. The plotting model for base graphics is indelible ink. The > best you could do would be to plot white on top of black. > > -- > David. > > > > I use the locator function like this: > > > >> plot(1,1) > >> locator(type="o") > > > > > > Thanks. > > > > [[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.html > > and provide commented, minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > > __ > 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. > [[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.html and provide commented, minimal, self-contained, reproducible code. __ 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.
Re: [R] R runs on Windows Server 2012?
Hi Jeff- Thanks for your input. I will try to provide a little more detail. First, it is useful to know that I know very little about high-performance computing with R or in general. We occasionally run models that take a lot of processor time. In the past I have used quad-core desktops and the foreach package to speed up the computation on parallelizable parts of these models. My goal with the sever is to be able to speed up computation some (a lot) more. I am envisioning that we would mostly use the server as a compute node, but it seems possible that we might occasionally want to interact directly with R as installed on the server itself (including graphics) via Remote Desktop. Really what I am looking for is for someone who has experience with R on servers, with Windows Server 2012 and maybe other operating systems, to give me some guidance on the kinds of capabilities and limitations that you lay out hypothetically - e.g. "it will work fine with WS2012 as long as you don't try to work with graphics", or "it works just as it would on Windows7", or "there are lots of issues, you may want to rethink your OS", or whatever. Thanks Chris -Original Message- From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] Sent: Friday, August 02, 2013 11:30 AM To: Chris Solomon; r-help@r-project.org Subject: Re: [R] R runs on Windows Server 2012? The FAQ may seem vague to you, but your question seems vague to me. I don't run R on any Windows Server, so I cannot answer your question, but there is more than one way to run R on any server and you have not mentioned how you want it to run. For example, you might run it via Remote Terminal in "interactive" mode, in which case the video settings of the client may affect graphics functionality. Or, you may want to use it as a compute node for parallel computation, leaving graphics generation to your client node. Or, you may want to use it as a network service that generates graphics files non-interactively and serves them via a web page. I suggest you clarify your definition of "run" to prompt a more helpful response from the list. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Chris Solomon wrote: >Hi- > >Can someone confirm whether R runs on the Windows Server 2012 OS, and >if so whether there are any significant differences from running on >e.g. Windows 7 that I ought to be aware of? > >The R for Windows FAQ (URL below) seems to indicate that running on >Windows Server 2012 is possible, but the text is a little vague and I >haven't been able to find any clear answers on the mailing list >archives. We are considering spending a chunk of money on a small >server and I want to be very sure that R will run before we do. > >URL for relevant FAQ: >http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-install >-R-for-Windows_003f > >Thanks >Chris > > >* >Dr. Chris Solomon >Dept. of Natural Resource Sciences >McGill University > >__ >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. __ 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.
Re: [R] lme: object is not a matrix
R is not splus. Read ?lme. Bert Sent from my iPhone -- please excuse typos. On Aug 2, 2013, at 5:45 AM, "Puschner, Bernd" wrote: > Dear all, > > > > when running in R a simple lme call (3 variables in data set) which > works perfectly fine in S-PLUS, I keep getting the error message > > > > " Error in model.frame.default(formula = ~t + can2p + code, data = list( > : > > object is not a matrix" > > > > Any help would be very much appreciated. > > > > Thanks. > > > > Bernd > > > > >[[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.html > and provide commented, minimal, self-contained, reproducible code. __ 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.
Re: [R] Removing null vector that is not in .csv file data
Hi, You could remove it by: vec1<- c( "","1003PI_pilot0101", "1003PI_pilot0102","1003PI_pilot0103", "1003PI_pilot0104", "1003PI_pilot0105", "1003PI_pilot0107") vec1[vec1!=""] #[1] "1003PI_pilot0101" "1003PI_pilot0102" "1003PI_pilot0103" "1003PI_pilot0104" #[5] "1003PI_pilot0105" "1003PI_pilot0107" #or vec1[nchar(vec1)>0] #[1] "1003PI_pilot0101" "1003PI_pilot0102" "1003PI_pilot0103" "1003PI_pilot0104" #[5] "1003PI_pilot0105" "1003PI_pilot0107" Without a reproducible example, it would be difficult to comment how you got that. A.K. Hello all, I am a super R novice, using it for work. I loaded a seemingly normal .csv file into R, and in one of the variables, a null vector was added. this is what it looks like. [1] "" "1003PI_pilot0101" "1003PI_pilot0102" "1003PI_pilot0103" "1003PI_pilot0104" "1003PI_pilot0105" "1003PI_pilot0107" However, when I check the head, it looks completely normal, and the first piece of data is "1003PI_pilot0101". How do I remove this null vector? And why is it there in the first place? There is nothing in the original .csv data file that indicates a blank or anything out of the ordinary. Sorry if this is a super dumb question. I just want to get my work done. __ 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.
Re: [R] could I remove or move points in locator() based on plot()?
Depending on the complexity of your graphic, you could also just re-draw the entire thing every time you want to make a change. Daniel On Fri, Aug 2, 2013 at 10:17 AM, David Winsemius wrote: > > On Aug 2, 2013, at 2:26 AM, Klot Lee wrote: > > > Hi, > > The function locator() allows me to add points by mouse on function > plot() > > I have draft. But the points can not be edit once I have made the click. > > How can I remove or just move the points I made on the draft? > > You cannot. The plotting model for base graphics is indelible ink. The > best you could do would be to plot white on top of black. > > -- > David. > > > > I use the locator function like this: > > > >> plot(1,1) > >> locator(type="o") > > > > > > Thanks. > > > > [[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.html > > and provide commented, minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > > __ > 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. > [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Regression Column names instead of numbers
You could try: set.seed(25) mt1<- matrix(sample(c(NA,1:40),20*200,replace=TRUE),ncol=200) colnames(mt1)<- paste0("X",1:200) set.seed(487) mt2<- matrix(sample(c(NA,1:80),20*200,replace=TRUE),ncol=200) colnames(mt2)<- colnames(mt1) res<-lapply(colnames(mt1),function(x) {x1<-data.frame(mt1[,x],mt2[,x]); colnames(x1)<-paste0(c("mt1","mt2"),x); summary(lm(as.formula(paste(colnames(x1)[1],"~",colnames(x1)[2],sep="")),data=x1))}) res [[1]] Call: lm(formula = as.formula(paste(colnames(x1)[1], "~", colnames(x1)[2], sep = "")), data = x1) Residuals: Min 1Q Median 3Q Max -16.799 -8.821 -1.059 8.414 19.544 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 14.7292 6.2952 2.34 0.031 * mt2X1 0.1302 0.1342 0.97 0.345 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 11.53 on 18 degrees of freedom Multiple R-squared: 0.04967, Adjusted R-squared: -0.003127 F-statistic: 0.9408 on 1 and 18 DF, p-value: 0.3449 [[2]] Call: lm(formula = as.formula(paste(colnames(x1)[1], "~", colnames(x1)[2], sep = "")), data = x1) Residuals: Min 1Q Median 3Q Max -17.641 -6.809 -2.255 5.235 19.684 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.7745 5.1715 0.730 0.4754 mt2X2 0.2635 0.1155 2.283 0.0356 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 10.15 on 17 degrees of freedom (1 observation deleted due to missingness) Multiple R-squared: 0.2346, Adjusted R-squared: 0.1896 F-statistic: 5.21 on 1 and 17 DF, p-value: 0.0356 A.K. - Original Message - From: TMiller To: r-help@r-project.org Cc: Sent: Friday, August 2, 2013 11:16 AM Subject: [R] Regression Column names instead of numbers Hi guys I am new to R and I am currently trying to do a regression: I have two matrices with 200 time series each. In order to achieve a loop, I used the following command: sapply(1:200, function(x) summary(lm(formula=matrix1[,x]~matrix2[,x]))) Each column/time series has a unique name, in case of Matrix 1 I have 200 cities, in case of Matrix 2 I have 200 stocks. However, if I run the command I get the following result: [[1]] Call: lm(formula = matrix1[, x] ~ matrix2[, x]) Residuals: Min 1Q Median 3Q Max -134.9 -68.6 -32.8 33.2 261.2 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 525.2356 69.8059 7.52 9.1e-10 *** matrix2[, x] 0.0640 0.0161 3.98 0.00023 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 113 on 50 degrees of freedom (41 observations deleted due to missingness) Multiple R-squared: 0.24, Adjusted R-squared: 0.225 F-statistic: 15.8 on 1 and 50 DF, p-value: 0.000226 [[2]] Call: lm(formula = matrix1[, x] ~ matrix2[, x]) Residuals: Min 1Q Median 3Q Max -914.9 -393.3 -76.9 243.3 1304.7 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.33e+03 1.88e+02 17.70 < 2e-16 *** matrix2[, x] 4.10e-01 7.87e-02 5.21 3.4e-06 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 531 on 51 degrees of freedom (40 observations deleted due to missingness) Multiple R-squared: 0.348, Adjusted R-squared: 0.335 F-statistic: 27.2 on 1 and 51 DF, p-value: 3.4e-06 Instead of the X's in the call response, I'd like to have the column name (city and stock). Is this by any means possible? Thanks in advance for your help. Best Tom -- View this message in context: http://r.789695.n4.nabble.com/Regression-Column-names-instead-of-numbers-tp4672904.html Sent from the R help mailing list archive at Nabble.com. __ 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. __ 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.
Re: [R] could I remove or move points in locator() based on plot()?
On Aug 2, 2013, at 2:26 AM, Klot Lee wrote: > Hi, > The function locator() allows me to add points by mouse on function plot() > I have draft. But the points can not be edit once I have made the click. > How can I remove or just move the points I made on the draft? You cannot. The plotting model for base graphics is indelible ink. The best you could do would be to plot white on top of black. -- David. > > I use the locator function like this: > >> plot(1,1) >> locator(type="o") > > > Thanks. > > [[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.html > and provide commented, minimal, self-contained, reproducible code. David Winsemius Alameda, CA, USA __ 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.
Re: [R] Regression Column names instead of numbers
Hello David Thanks for your answer. It works with the number in the double bracket above each of the regression results. However, the x's still remain in the call formula. I really appreciate any help Best Tom -- View this message in context: http://r.789695.n4.nabble.com/Regression-Column-names-instead-of-numbers-tp4672904p4672920.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Forest plot with sub group analyses
No attachments came through. Either include the code and the data in the email---see ?dupt for a way to include the data or include the files as .txt files. John Kane Kingston ON Canada > -Original Message- > From: wngich...@gmail.com > Sent: Fri, 2 Aug 2013 10:45:33 +0200 > To: r-help@r-project.org > Subject: [R] Forest plot with sub group analyses > > Greetings. > > I am conducting a meta analyses that has Beta and SE values. > > I am wondering how to place the command to split the analyses. Could you > assist me to develop the command within the syntax? I would also like to > add the N and Year values in the plot. I would like my plot to look like > the one below: > > http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups#code > > I attach here in an example of the syntax I have come up with so far and > csv file I am using. > > I look forward to your response and thank you in advance. > > > > Regards, > > > Wanjiku N Gichohi > __ > 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. Share photos & screenshots in seconds... TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if1 Works in all emails, instant messengers, blogs, forums and social networks. __ 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.
[R] Creating a model with fixed and random variables
I am trying to recreate a model that would mimic results a peer obtained using SAS, but in R. The goal of this model would be to determine if there is any variation among parental sets and lines (essentially is there a significant p-value for the variables “set” and “line”). The problems I am having are: 1) The usage of nested data “Line%in%Set” 2) Having to have both fixed and random variables Fixed=Set Random=Line and Block 3) Results I have obtained usually contain significant Blocking effects. Code I have used thus far without being able to replicate the data includes: Fm<-lmer(Score~(1|Line%in%Set)+Set+(1|Block)) (I figured out how to get a p-value, but it didn't yield the same results as those obtained in SAS) Model<-lm(Score~Line%in%Set+Set+Block) Overall, I realize that I might be completely off in the way I am attempting to create this model and any suggestions will be extremely helpful! Also, if it would be more helpful I can add a dput() of my data. -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-model-with-fixed-and-random-variables-tp4672905.html Sent from the R help mailing list archive at Nabble.com. __ 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.
[R] could I remove or move points in locator() based on plot()?
Hi, The function locator() allows me to add points by mouse on function plot() I have draft. But the points can not be edit once I have made the click. How can I remove or just move the points I made on the draft? I use the locator function like this: > plot(1,1) > locator(type="o") Thanks. [[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.html and provide commented, minimal, self-contained, reproducible code.
[R] HiPLARb installation failed when magma-lib included
Hi all, I am trying to install HiPLARb package but I am running into an error. Any help would be greatly appreciated. I used the installer available from their website (http://www.hiplar.org/hiplar-b-installation.html) and followed their instructions. The installer finished without showing warnings or errors, but HiPLARb is not installed when I try to load it in R. So, I tried to do install HiPLARb package manually and it is installed correctly if I do R CMD INSTALL --configure-args="--with-lapack=-L/home/caf/mylibs/lib\ -lopenblas --with-plasma-lib=/home/caf/mylibs --with-cuda-home=/usr/local/cuda " HiPLARb_0.1.3.tar.gz but if I try to include magma R CMD INSTALL --configure-args="--with-lapack=-L/home/caf/mylibs/lib\ -lopenblas --with-magma-lib=/home/caf/mylibs --with-plasma-lib=/home/caf/mylibs --with-cuda-home=/usr/local/cuda " HiPLARb_0.1.3.tar.gz I get the error Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/caf/R.2.15.2-patched/lib/R/library/HiPLARb/libs/HiPLARb.so': /home/caf/mylibs/lib/libmagmablas.so: undefined symbol: cudaMemcpyFromSymbol Info about the system Ubuntu 12.04.2 LTS NVIDIA Quadro K4000 CUDA 5.5 R 2.15.2, hwloc, MAGMA and PLASMA where both downloaded and installed by HiPLARb installer Any help much appreciated, Clara __ 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.
[R] Forest plot with sub group analyses
Greetings. I am conducting a meta analyses that has Beta and SE values. I am wondering how to place the command to split the analyses. Could you assist me to develop the command within the syntax? I would also like to add the N and Year values in the plot. I would like my plot to look like the one below: http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups#code I attach here in an example of the syntax I have come up with so far and csv file I am using. I look forward to your response and thank you in advance. Regards, Wanjiku N Gichohi __ 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.
[R] lme: object is not a matrix
Dear all, when running in R a simple lme call (3 variables in data set) which works perfectly fine in S-PLUS, I keep getting the error message " Error in model.frame.default(formula = ~t + can2p + code, data = list( : object is not a matrix" Any help would be very much appreciated. Thanks. Bernd [[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.html and provide commented, minimal, self-contained, reproducible code.
[R] cannot base64decode string which is base64encode in R
Hi, I'm struggling with encode/decode strings in R. Don't know why the second example below would fail. Thanks in advance for your help. succeed: s <- "saf" x <- base64encode(s) y <- base64decode(x, "character") fail: s <- "safs" x <- base64encode(s) y <- base64decode(x, "character") [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rms plot.Predict when type="p"
Mike, 2 out of 3 of your requests are handled simply. I've tidied up your code and show how to include extra parameters into the plot( ) call below. The request to change plotting symbol color for each factor level is not consistent with the lattice philosophy for non-superposed variables (here on the x-axis) where the labels tell all. The last 2 lines in the code uses superpositioning for group but the col argument affects the color of confidence bands; I didn't look into that further. Frank Harrell -- require(rms) n = 30 group = factor(sample(c('a','b','c'), n, TRUE)) x1= runif(n) dat = data.frame(group, x1, y = as.numeric(group) + 0.2*x1 + rnorm(n) ) d <- datadist(dat) ; options(datadist="d") f <- ols(y ~ x1 + group, data=dat) p <- Predict(f, group) plot(p, ~group, nlines=TRUE, type='p', ylab='fitted Y', xlab='Treatment', pch=4, lwd=3) p <- Predict(f, x1=seq(0,1,by=.1), group) plot(p, ~ x1, groups='group', col=3:1) -- Hi all, I'm trying to change the pch, color, lty, and lwd in a type="p" plot produced by plot.Predict in the rms package. What I'm shooting for is a separate plotting symbol symbol color for each level of a factor (and also to manage the line width for the CIs). Here's what I hope is a working example #make up some data . . . Mike Babyak Department of Psychiatry and Behavioral Sciences __ 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.
Re: [R] Regression Column names instead of numbers
It depends on how fancy you want to get. A quick fix would be pairs <- paste0(colnames(matrix1), ".", colnames(matrix2)) # lapply will be faster since you are returning a list results <- lapply(1:200, function(x) summary(lm(formula=matrix1[,x]~matrix2[,x]))) names(results) <- pairs results The results will now be separated by labels that indicate the city.stock. - David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of TMiller Sent: Friday, August 2, 2013 10:17 AM To: r-help@r-project.org Subject: [R] Regression Column names instead of numbers Hi guys I am new to R and I am currently trying to do a regression: I have two matrices with 200 time series each. In order to achieve a loop, I used the following command: sapply(1:200, function(x) summary(lm(formula=matrix1[,x]~matrix2[,x]))) Each column/time series has a unique name, in case of Matrix 1 I have 200 cities, in case of Matrix 2 I have 200 stocks. However, if I run the command I get the following result: [[1]] Call: lm(formula = matrix1[, x] ~ matrix2[, x]) Residuals: Min 1Q Median 3QMax -134.9 -68.6 -32.8 33.2 261.2 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 525.235669.80597.52 9.1e-10 *** matrix2[, x] 0.0640 0.01613.98 0.00023 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 113 on 50 degrees of freedom (41 observations deleted due to missingness) Multiple R-squared: 0.24, Adjusted R-squared: 0.225 F-statistic: 15.8 on 1 and 50 DF, p-value: 0.000226 [[2]] Call: lm(formula = matrix1[, x] ~ matrix2[, x]) Residuals: Min 1Q Median 3QMax -914.9 -393.3 -76.9 243.3 1304.7 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.33e+03 1.88e+02 17.70 < 2e-16 *** matrix2[, x]4.10e-01 7.87e-025.21 3.4e-06 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 531 on 51 degrees of freedom (40 observations deleted due to missingness) Multiple R-squared: 0.348, Adjusted R-squared: 0.335 F-statistic: 27.2 on 1 and 51 DF, p-value: 3.4e-06 Instead of the X's in the call response, I'd like to have the column name (city and stock). Is this by any means possible? Thanks in advance for your help. Best Tom -- View this message in context: http://r.789695.n4.nabble.com/Regression-Column-names-instead-of-numbers-tp4672904.html Sent from the R help mailing list archive at Nabble.com. __ 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. __ 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.
Re: [R] Forest plot with sub-group analyses
On Aug 2, 2013, at 5:20 AM, Michael Dewey wrote: > At 18:19 01/08/2013, wanjiku gichohi wrote: >> Greetings. >> >> I am conducting a meta analyses that has Beta and SE values. >> >> I am wondering how to place the command to split the analyses. Could you >> assist me to develop the command within the syntax? I would also like to >> add the N and Year values in the plot. I would like my plot to look like >> the one below: >> >> http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups#code >> >> I attach here in an example of the syntax I have come up with so far and >> csv file I am using. > > This did not come through to here. You need to read the posting guide to see > what sorts of attachment are permitted. I think the Posting Guide would be more helpful if it specifically warned Rhelp posters that neither .csv nor .R files will be recognized as plain text files by the mail server. In my several years of experience reading Rhelp and observing failures-to-include, files uniformly need to be renamed with a .txt extension if they are to make it through to the list, even if they appear to be ordinary "text files" in your editor. -- David. > > >> I look forward to your response and thank you in advance. >> >> >> >> Regards, >> >> -- >> Wanjiku N Gichohi >> Tel: +254723766517 / +31645272661 >> Email: wanjiku_nyaw...@yahoo.com / wngich...@gmail.com > > Michael Dewey > i...@aghmed.fsnet.co.uk > http://www.aghmed.fsnet.co.uk/home.html > > __ > 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. David Winsemius Alameda, CA, USA __ 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.
Re: [R] Write-table and dynamic access path
Or ?file.path for a more OS- independent approach. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Jim Holtman wrote: >?paste > >Sent from my iPad > >On Aug 2, 2013, at 6:20, Robert U wrote: > >> Dear R-users, >> >> I am quite sure this is a beginner question, but i cannot manager to >find the answer on the Internet... >> >> >> I am using write.table function inside some kind of loop. I'd like to >write my tables in different folders without having to change the path >inside the function every time, but rather by including a variable >inside the path. For example, i have 5 folders (named 1,2,3,4,5) , i >have a variable that get values from 1 to 5 during my loop, I'd like to >insert this variable� inside the pathway specified in the write.table >so that the table are "automatically' saved in the proper folder... But >I cannot manage to find the correct syntax for this to happen!! >> >> Any tips ? >> >> Best regards >> >>[[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.html >> and provide commented, minimal, self-contained, reproducible code. > >__ >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. __ 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.
Re: [R] R runs on Windows Server 2012?
The FAQ may seem vague to you, but your question seems vague to me. I don't run R on any Windows Server, so I cannot answer your question, but there is more than one way to run R on any server and you have not mentioned how you want it to run. For example, you might run it via Remote Terminal in "interactive" mode, in which case the video settings of the client may affect graphics functionality. Or, you may want to use it as a compute node for parallel computation, leaving graphics generation to your client node. Or, you may want to use it as a network service that generates graphics files non-interactively and serves them via a web page. I suggest you clarify your definition of "run" to prompt a more helpful response from the list. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Chris Solomon wrote: >Hi- > >Can someone confirm whether R runs on the Windows Server 2012 OS, and >if so whether there are any significant differences from running on >e.g. Windows 7 that I ought to be aware of? > >The R for Windows FAQ (URL below) seems to indicate that running on >Windows Server 2012 is possible, but the text is a little vague and I >haven't been able to find any clear answers on the mailing list >archives. We are considering spending a chunk of money on a small >server and I want to be very sure that R will run before we do. > >URL for relevant FAQ: >http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-install-R-for-Windows_003f > >Thanks >Chris > > >* >Dr. Chris Solomon >Dept. of Natural Resource Sciences >McGill University > >__ >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. __ 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.
[R] Regression Column names instead of numbers
Hi guys I am new to R and I am currently trying to do a regression: I have two matrices with 200 time series each. In order to achieve a loop, I used the following command: sapply(1:200, function(x) summary(lm(formula=matrix1[,x]~matrix2[,x]))) Each column/time series has a unique name, in case of Matrix 1 I have 200 cities, in case of Matrix 2 I have 200 stocks. However, if I run the command I get the following result: [[1]] Call: lm(formula = matrix1[, x] ~ matrix2[, x]) Residuals: Min 1Q Median 3QMax -134.9 -68.6 -32.8 33.2 261.2 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 525.235669.80597.52 9.1e-10 *** matrix2[, x] 0.0640 0.01613.98 0.00023 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 113 on 50 degrees of freedom (41 observations deleted due to missingness) Multiple R-squared: 0.24, Adjusted R-squared: 0.225 F-statistic: 15.8 on 1 and 50 DF, p-value: 0.000226 [[2]] Call: lm(formula = matrix1[, x] ~ matrix2[, x]) Residuals: Min 1Q Median 3QMax -914.9 -393.3 -76.9 243.3 1304.7 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.33e+03 1.88e+02 17.70 < 2e-16 *** matrix2[, x]4.10e-01 7.87e-025.21 3.4e-06 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 531 on 51 degrees of freedom (40 observations deleted due to missingness) Multiple R-squared: 0.348, Adjusted R-squared: 0.335 F-statistic: 27.2 on 1 and 51 DF, p-value: 3.4e-06 Instead of the X's in the call response, I'd like to have the column name (city and stock). Is this by any means possible? Thanks in advance for your help. Best Tom -- View this message in context: http://r.789695.n4.nabble.com/Regression-Column-names-instead-of-numbers-tp4672904.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] GO TO function in R
No. We figured this out in 1968. http://dl.acm.org/citation.cfm?doid=362929.362947 On Fri, Aug 2, 2013 at 3:20 AM, David Winsemius wrote: > > On Aug 1, 2013, at 6:58 PM, Peter Maclean wrote: > >> Does R has a GO TO function? For example, I want to run this script at a >> given interval and save the results. >> > > Generally communication is more effective if you make your goals clear in a > natural language (English in the case of this mailing list) first. > >> #Step one >> a <- Sys.time() >> b <- paste("Figure_", a, sep = " ") >> shape <- as.numeric(a)/1 >> scale <- as.numeric(a)/100 >> #I want to save the file using "b" object (above) as a file name >> #However it is saved as b.pdf >> pdf("f:/b.pdf") #How to save the file using "b" above? > > Perhaps: > > pdf(file=paste0("f:/", b, ".pdf")) > >> par(mfrow=c(2,1)) >> x <- sort(rgamma(100, shape=shape, scale = scale)) >> y <- dgamma(x, shape=shape, scale = scale) >> par(mfrow=c(2,1)) >> plot(x, y, type="l",col="red", lwd=5) >> >> #Step 2 >> Sys.sleep(2) # For Quick results in the model it is one hour >> shape <- (as.numeric(Sys.time()))/1 >> scale <- (as.numeric(Sys.time()))/100 >> x <- sort(rgamma(100, shape=shape, scale = scale)) >> y <- dgamma(x, shape=shape, scale = scale) >> plot(x, y, type="b",col=" dark red", lwd=5) >> dev.off() >> #Step 3 >> Sys.sleep(2) #Again in the model it is one hour > > # "it"? It would help if you explained what "it" is. > >> #I Want to go back to step 1 to start over again >> > > I think is a measure of my success in training my mind to think functionally > that I cannot conceive of how I would use GOTO as a function. > > (Using `replicate`, I can imagine.) > > -- > David. >> >> Sincerely, >> >> Peter Maclean >> Department of Economics >> UDSM >> [[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.html >> and provide commented, minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > > __ > 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. __ 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.
[R] verbose=1 setting in lmer gives no iteration results
I am using R version 3.0.1 (2013-05-16) on Platform: x86_64-w64-mingw32/x64 (64-bit) and lme4_0.9911-3. I run the following code from Douglas Bates "lme4: Mixed-effects modeling with R" (June 25, 2010) pg 14 and do not get any iteration information. I get the same results if I use verbose=TRUE or verbose=1L. > lmer(Yield~1|Batch,Dyestuff,REML=FALSE,verbose=1) Linear mixed model fit by maximum likelihood ['lmerMod'] Formula: Yield ~ 1 | Batch Data: Dyestuff AIC BIC logLik deviance 333.3271 337.5307 -163.6635 327.3271 Random effects: Groups Name Variance Std.Dev. Batch (Intercept) 1388 37.26 Residual 2451 49.51 Number of obs: 30, groups: Batch, 6 Fixed effects: Estimate Std. Error t value (Intercept) 1527.50 17.69 86.33 I noticed this in the structure of the output: ..@ optinfo:List of 4 .. ..$ optimizer: chr "Nelder_Mead" .. ..$ control :List of 1 .. .. ..$ verbose: int 0 .. ..$ conv : num 0 .. ..$ warnings : list() Please advise me on how to obtain iteration information with lmer. Thanks, Roy Robertson [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Editing code in a function? related to allowing zero weights in lmer()
To close the thread, I wanted to post my solution to this issue. Searching some other help threads, I found this: https://stat.ethz.ch/pipermail/r-help/2008-August/171321.html So, here's what I did: I got at the script for lmerFrames by doing this: edit(lme4:::lmerFrames) then edited the code to allow zero weights, and assigned it to a new function: my.lmerFrames<-function (...} and then did this: library(R.utils) reassignInPackage("lmerFrames", pkgName="lme4", my.lmerFrames) Voila, things execute, no error. Note also that R.utils requires some additional packages (R.oo, R.methodsS3 before you can use it. On Fri, Aug 2, 2013 at 12:03 AM, Mike Rennie wrote: > Indeed- thanks for the tips to get me going. This just kicks things up a > notch for me, having happily used packages without wanting to tinker with > them till now. > > Cheers. > > > On Thu, Aug 1, 2013 at 11:57 PM, Bert Gunter wrote: > >> 1. ?"::" >> >> 2. ?getAnywhere >> >> 3. Please consult the "R language definition" manual -- or even "An >> Introduction to R" -- to learn about R programming. It **is** a >> programming language, you know! >> >> Cheers, >> Bert >> >> On Thu, Aug 1, 2013 at 8:54 PM, Mike Rennie >> wrote: >> > Hi folks, >> > >> > I've not before had to edit code right in a function, but I think I need >> > to. I am using lmer() and want to use a model that uses zero weights. I >> > found this thread from 2009: >> > >> > https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q1/001995.html >> > >> > but I'm unsure of how I would actually go about editing the code in the >> > package. >> > >> > Part of the problem is that I can't even find lmerFrames(). I can see it >> > being called in lmer, but if I just type in >> > >> > lmerFrames >> > >> > or >> > >> > fix(lmerFrames) >> > >> > I get nothing. >> > >> > The note from Doug Bates is that the function is "hidden"- is there a >> trick >> > to getting at these hidden functions to edit them? >> > >> > Any thoughts or suggestions welcome. >> > >> > Cheers, >> > >> > -- >> > Michael Rennie, Research Scientist >> > Fisheries and Oceans Canada, Freshwater Institute >> > Winnipeg, Manitoba, CANADA >> > >> > [[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.html >> > and provide commented, minimal, self-contained, reproducible code. >> >> >> >> -- >> >> Bert Gunter >> Genentech Nonclinical Biostatistics >> >> Internal Contact Info: >> Phone: 467-7374 >> Website: >> >> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm >> > > > > -- > Michael Rennie, Research Scientist > Fisheries and Oceans Canada, Freshwater Institute > Winnipeg, Manitoba, CANADA > -- Michael Rennie, Research Scientist Fisheries and Oceans Canada, Freshwater Institute Winnipeg, Manitoba, CANADA [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] optim with(out) box constraints!
It's possibly the L in L-BFGS-B that is more interesting for some problems, namely for the "Limited Memory", so running without bounds can make sense. Unfortunately, the version of L-BFGS-B in R is from the 1990s, and Nocedal et al. released an update in 2011. Maybe someone will want to work on putting that into the distributed R. I'll be happy to kibbitz off-list to see what can be done. The types of algorithms that compete for low-memory (i.e., when you have 1000s of parameters) are the CG codes -- Rcgmin is better than CG by a long shot for most problems, and I was involved in both -- and truncated Newton methods, of which I only know of one version in nloptr that in the very limited tests I've done seems not to be as speedy as I'd anticipate (there's also an lbfgs in that package -- not tried). I'm slowly working on getting an all-R truncated Newton code up so different options could be tried. If it's the B you need, then Rcgmin, Rvmmin (essentially optim:BFGS) work with gradients, as does nlminb, while dfoptim:nmkb or dfoptim:hjkb or minqa:bobyqa (also bobyqa in nloptr, again I've no more than tried one example) are available for no-derivative case, and possibly some other routines. JN On 13-08-02 06:00 AM, r-help-requ...@r-project.org wrote: Message: 36 Date: Fri, 02 Aug 2013 10:38:51 +0200 From: Uwe Ligges To: Anera Salucci Cc:"r-help@r-project.org" Subject: Re: [R] optim with(out) box constraints! Message-ID:<51fb701b.70...@statistik.tu-dortmund.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 02.08.2013 10:10, Anera Salucci wrote: >Hello R users, > >Does optimizing a function using optim with method= "L-BFGS-B" and without box constraints lead to "L-BFGS" optimization in R? Sort of, but the question is why this would be beneficial with today's computers ... Best, Uwe Ligges __ 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.
Re: [R] Forest plot with sub-group analyses
At 18:19 01/08/2013, wanjiku gichohi wrote: Greetings. I am conducting a meta analyses that has Beta and SE values. I am wondering how to place the command to split the analyses. Could you assist me to develop the command within the syntax? I would also like to add the N and Year values in the plot. I would like my plot to look like the one below: http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups#code I attach here in an example of the syntax I have come up with so far and csv file I am using. This did not come through to here. You need to read the posting guide to see what sorts of attachment are permitted. I look forward to your response and thank you in advance. Regards, -- Wanjiku N Gichohi Tel: +254723766517 / +31645272661 Email: wanjiku_nyaw...@yahoo.com / wngich...@gmail.com Michael Dewey i...@aghmed.fsnet.co.uk http://www.aghmed.fsnet.co.uk/home.html __ 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.
Re: [R] Creating DAGS with plate notation in R
Thanks Sacha. The code works well although, as you alluded, the plates are being drawn after some positional fine tuning. I was hoping that the plates could come out automatically as they do in graphviz. Possibly, whenever you get to it, your package can alleviate that. Cheers. On Thu, Aug 1, 2013 at 7:11 AM, Sacha Epskamp wrote: > Here is a way to do it with qgraph. Requires lots of manual placement > though. I have been asked before to write a package to do these kind of > graphics automatically from R given some model. Might do it eventually :) > > library("qgraph") > > # Placement of nodes: > Layout <- matrix(c( > 1,1, > 2,1, > 3,1, > 4,1, > 3,0),,2,byrow=TRUE) > > # Graph structure: > E <- matrix(c( > 1,2, > 2,3, > 3,4, > 5,4),,2,byrow=TRUE) > > # Labels: > Lab <- > list(expression(alpha),expression(theta),expression(z),expression(w),expression(beta)) > > # Colors: > Col <- c(rep("white",4),"gray") > > pdf("Model.pdf",width=6, height = 4) > # Open plot: > par(mar=c(0,0,0,0)) > plot(1,type="n",xlim=c(0.5,5),ylim=c(-1,3)) > > # add graph: > qgraph(E, layout = Layout, labels = Lab, color = Col, plot = FALSE, >rescale = FALSE) > > # Add boxes: > rect(1.6,0.4,4.6,2) > rect(2.6, 0.6, 4.4, 1.6 ) > > # Add labels: > text(3.1, 1.9, "M") > text(3.5, 1.5, "N") > dev.off() > > > --- > Sacha Epskamp, MSc > Department of Psychological Methods > University of Amsterdam > Weesperplein 4, room 2.05 > 1018 XA Amsterdam > The Netherlands > http://www.sachaepskamp.com > > > 2013/7/2 Raghu Naik > >> The image did not come through as pointed out by a list member. I have >> attached a pdf image file; the link is >> >> http://stackoverflow.com/questions/3461931/software-to-draw-graphical-models-in-plate-notation >> . >> >> Cheers. >> >> Raghu >> >> >> On Tue, Jul 2, 2013 at 9:42 AM, Raghu Naik wrote: >> >> > I am trying to create a directed graph with plate notation (like the one >> > shown below) in R. >> > >> > [image: The output image] >> > Could someone direct to me an example code that will get me started. >> > >> > I could not see any reference to plate notations in igraph, qgraph >> > packages though I may be wrong. >> > >> > The above figure made in graphviz by a poster on stackoverflow. >> > >> > I am not sure if this can be replicated in Rgraphviz - I was not able to >> > get there. >> > >> > I would appreciate any help. >> > >> > Thanks. >> > >> > Raghu >> > >> >> __ >> 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. >> >> > [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Write-table and dynamic access path
?paste Sent from my iPad On Aug 2, 2013, at 6:20, Robert U wrote: > Dear R-users, > > I am quite sure this is a beginner question, but i cannot manager to find the > answer on the Internet... > > > I am using write.table function inside some kind of loop. I'd like to write > my tables in different folders without having to change the path inside the > function every time, but rather by including a variable inside the path. For > example, i have 5 folders (named 1,2,3,4,5) , i have a variable that get > values from 1 to 5 during my loop, I'd like to insert this variable� inside > the pathway specified in the write.table so that the table are > "automatically' saved in the proper folder... But I cannot manage to find the > correct syntax for this to happen!! > > Any tips ? > > Best regards > >[[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.html > and provide commented, minimal, self-contained, reproducible code. __ 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.
[R] Write-table and dynamic access path
Dear R-users, I am quite sure this is a beginner question, but i cannot manager to find the answer on the Internet... I am using write.table function inside some kind of loop. I'd like to write my tables in different folders without having to change the path inside the function every time, but rather by including a variable inside the path. For example, i have 5 folders (named 1,2,3,4,5) , i have a variable that get values from 1 to 5 during my loop, I'd like to insert this variable inside the pathway specified in the write.table so that the table are "automatically' saved in the proper folder... But I cannot manage to find the correct syntax for this to happen!! Any tips ? Best regards [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] readBin into a data frame
I find the hexView package quite helpful for this. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Uwe Ligges wrote: > > >On 01.08.2013 10:36, Zhang Weiwu wrote: >> Hello. readBin is designed to read a batch of data with the same >spec, >> e.g. read 1 floats into a vector. In practise I read into data >> frame, not vector. For each data frame, I need to read a integer and >a >> float. >> >> for (i in 1:1000) { >> dataframe$int[i] <- readBin(con, integer(), size=2) >> dataframe$float[i] <- readBin(con, numeric(), size=4) >> } > > >Ideally one would read bunches of identical types within R. This seems >not to be possible here, hence I'd suggest to read it via some C code. > >Best, >Uwe Ligges > > > >> >> And I need to read 100 such data files, ending up with a for loop in >a >> for loop. Something feels wrong here, as it is being said if you use >> double-FOR you are not speaking R. >> >> What is the R way of doing this? I can think of writing the content >of >> the loop into a function, and vectorize it -- But, the result would >be a >> list of list, not exactly data-frame, and the list grows >incrementally, >> which is inefficient, since I know the size of my data frame at the >> outset. I am a new learner, not speaking half of R vocabulary, kindly >> provide some hint please:) >> >> Best. >> >> __ >> 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. > >__ >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. __ 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.
Re: [R] X11 and printing/copying graphics from mac
On 02/08/2013 06:54, Marlin Keith Cox wrote: Hello all, I frequently use R, but recently have switched to a mac. When creating a new graphic, I have used X11() for a new graphics window and have always (when I used my PC) have been able to copy or print from this With which OS? graphic window. With my mac, it does not allow me to copy or print. Having multiple graphic windows is a must as well as being able to print or copy from them. Thanks ahead of time. Please post Mac-specific comments to R-sig-mac. But a short answer is to use quartz() not X11(): the former is the native OS X device. Keith M. Keith Cox, Ph.D. Principal MKConsulting 17105 Glacier Hwy Juneau, AK 99801 U.S. 907.957.4606 [[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.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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.
Re: [R] skipping columns in read.table; was: (no subject)
On 02.08.2013 05:29, Babu Guha wrote: I have a comma delimited file with 62 fields of which some are comments. There are about 1.5 million records/lines. Sme of the fields which has comments and which i do not need have 40 characters. Of the 62 fields, I will need at most 12 fields. What's best way to read in the fields I need. If I read the entire file at once I will run out of memory. Could anyone please suggest some solution? See ?read.table and its argument colClasses: read.table(file, colClasses=c("numeric", "NULL", "factor")) Will read the first column as a numeric one, skip the second column and take the thirs one as a factor. Best, Uwe Ligges Thanks, Babu. [[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.html and provide commented, minimal, self-contained, reproducible code. __ 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.
Re: [R] optim with(out) box constraints!
On 02.08.2013 10:10, Anera Salucci wrote: Hello R users, Does optimizing a function using optim with method= "L-BFGS-B" and without box constraints lead to "L-BFGS" optimization in R? Sort of, but the question is why this would be beneficial with today's computers ... Best, Uwe Ligges [[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.html and provide commented, minimal, self-contained, reproducible code. __ 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.
Re: [R] Correlation Loops in time series
Thanks David, that went perfectly fine. Best Tom -- View this message in context: http://r.789695.n4.nabble.com/Correlation-Loops-in-time-series-tp4672732p4672879.html Sent from the R help mailing list archive at Nabble.com. __ 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.
[R] optim with(out) box constraints!
Hello R users, Does optimizing a function using optim with method= "L-BFGS-B" and without box constraints lead to "L-BFGS" optimization in R? [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] readBin into a data frame
On 01.08.2013 10:36, Zhang Weiwu wrote: Hello. readBin is designed to read a batch of data with the same spec, e.g. read 1 floats into a vector. In practise I read into data frame, not vector. For each data frame, I need to read a integer and a float. for (i in 1:1000) { dataframe$int[i] <- readBin(con, integer(), size=2) dataframe$float[i] <- readBin(con, numeric(), size=4) } Ideally one would read bunches of identical types within R. This seems not to be possible here, hence I'd suggest to read it via some C code. Best, Uwe Ligges And I need to read 100 such data files, ending up with a for loop in a for loop. Something feels wrong here, as it is being said if you use double-FOR you are not speaking R. What is the R way of doing this? I can think of writing the content of the loop into a function, and vectorize it -- But, the result would be a list of list, not exactly data-frame, and the list grows incrementally, which is inefficient, since I know the size of my data frame at the outset. I am a new learner, not speaking half of R vocabulary, kindly provide some hint please:) Best. __ 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. __ 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.
Re: [R] Kolmogorov-Smirnov Test
Hi Peter, Thank you so much for your explaination. I draw histogram before that, so maybe that warning messages are meant for that. From: peter dalgaard Cc: "r-help@r-project.org" Sent: Friday, August 2, 2013 3:11 PM Subject: Re: [R] Kolmogorov-Smirnov Test On Aug 2, 2013, at 03:24 , Roslina Zakaria wrote: > Dear r-users, > > I am using KS test to test the goodness of fit for my data and the got the > following output. However, I don't understand about the "warning messages". > What does it mean by "horizontals" is not a graphical parameter" > It's "horizontal", but I don't think this is coming from ks.test, which isn't supposed to do anything with graphics (unless you modified it). Would you by any chance have a graphics device open, for which you have been setting parameters? Also, I think there is a buglet in which R warnings are sometimes delayed, so it may came from a previous command. I don't think it would happen twice, though. -pd > Thank you so much for any help given and it is very much appreciated. > > >> ks.test(compare[,1], compare[,2]) > Two-sample Kolmogorov-Smirnov test > data: compare[, 1] and compare[, 2] > D = 0.0755, p-value = 2.238e-05 > alternative hypothesis: two-sided > Warning messages: > 1: "horizontals" is not a graphical parameter > 2: "horizontals" is not a graphical parameter > 3: "horizontals" is not a graphical parameter > 4: "horizontals" is not a graphical parameter > 5: "horizontals" is not a graphical parameter > 6: "horizontals" is not a graphical parameter > 7: In ks.test(compare[, 1], compare[, 2]) : > cannot compute correct p-values with ties >> ks.test(compare[,1], compare[,2]) > Two-sample Kolmogorov-Smirnov test > data: compare[, 1] and compare[, 2] > D = 0.0755, p-value = 2.238e-05 > alternative hypothesis: two-sided > Warning messages: > 1: "horizontals" is not a graphical parameter > 2: "horizontals" is not a graphical parameter > 3: "horizontals" is not a graphical parameter > 4: "horizontals" is not a graphical parameter > 5: "horizontals" is not a graphical parameter > 6: "horizontals" is not a graphical parameter > 7: In ks.test(compare[, 1], compare[, 2]) : > cannot compute correct p-values with ties > [[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.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com [[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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Kolmogorov-Smirnov Test
On Aug 2, 2013, at 03:24 , Roslina Zakaria wrote: > Dear r-users, > > I am using KS test to test the goodness of fit for my data and the got the > following output. However, I don't understand about the "warning messages". > What does it mean by "horizontals" is not a graphical parameter" > It's "horizontal", but I don't think this is coming from ks.test, which isn't supposed to do anything with graphics (unless you modified it). Would you by any chance have a graphics device open, for which you have been setting parameters? Also, I think there is a buglet in which R warnings are sometimes delayed, so it may came from a previous command. I don't think it would happen twice, though. -pd > Thank you so much for any help given and it is very much appreciated. > > >> ks.test(compare[,1], compare[,2]) > Two-sample Kolmogorov-Smirnov test > data: compare[, 1] and compare[, 2] > D = 0.0755, p-value = 2.238e-05 > alternative hypothesis: two-sided > Warning messages: > 1: "horizontals" is not a graphical parameter > 2: "horizontals" is not a graphical parameter > 3: "horizontals" is not a graphical parameter > 4: "horizontals" is not a graphical parameter > 5: "horizontals" is not a graphical parameter > 6: "horizontals" is not a graphical parameter > 7: In ks.test(compare[, 1], compare[, 2]) : > cannot compute correct p-values with ties >> ks.test(compare[,1], compare[,2]) > Two-sample Kolmogorov-Smirnov test > data: compare[, 1] and compare[, 2] > D = 0.0755, p-value = 2.238e-05 > alternative hypothesis: two-sided > Warning messages: > 1: "horizontals" is not a graphical parameter > 2: "horizontals" is not a graphical parameter > 3: "horizontals" is not a graphical parameter > 4: "horizontals" is not a graphical parameter > 5: "horizontals" is not a graphical parameter > 6: "horizontals" is not a graphical parameter > 7: In ks.test(compare[, 1], compare[, 2]) : > cannot compute correct p-values with ties > [[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.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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.