[R] How to write % in pie chart?

2012-08-11 Thread Manish Gupta
HI, I am plotting one pie chart and need to write % inside it. How can i write % inside it as show in figure below. http://r.789695.n4.nabble.com/file/n4640078/pie_chart.png Regards -- View this message in context: http://r.789695.n4.nabble.com/How-to-write-in-pie-chart-tp4640078.html Sent

[R] Using R as Shared Library

2012-08-11 Thread Thorsten Jolitz
Hi List, I find the following .so file in the R folder of my Arch Linux machine: ,-- | usr/lib/R/lib/libR.so `-- I copied it to my home folder and changed permissons from root to my personal user and then tried to call R functions from a different languag

[R] qpcR propagate problem

2012-08-11 Thread Robert Keams Valenzuela
I am using the propagate function of the qpcR package to estimate the standard error for an expression. This expression is simple enough that I am able to calculate the first-order propagation of error, which is what the documentation on propagate states that it does. However, the results are not

[R] Changing character into date solved

2012-08-11 Thread Erin Hodgess
Here it is: zz <- strptime(zip.df$Time,"%Y-%m-%d %H:%M:%S") > plot(zz,zip.df$TempC,type="l") > Woo Hoo! Thanks though! Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __

[R] Changing character into date

2012-08-11 Thread Erin Hodgess
Dear R People: I have a column in a data frame that has date and time (one per minute), such as "2012-08-09 22:23:00 2012-08-09 22:24:00" etc. What is the best way to change that into numeric dates to be used as an x-axis, please? I've been looking at as.Date and as.Date.numeric, but those are f

Re: [R] What's wrong with my code?

2012-08-11 Thread Berend Hasselman
stephenxqy wrote > > It is a complex function, functions are quoted frequently, you may read > from bottom up > The independent variable for final fit is q > > %%Rg0 is a function of L and b > Rg0sq<-function(L,b)L*b/6*(1-3/2*b/L+3/2*(b/L)^2-3/4*(b/L)^3*(1-exp(-2*L/b))) > > %%alpha is a defined

Re: [R] Fill pattern for Boxplots?

2012-08-11 Thread Greg Snow
The fill patterns date back to when the main way to get quality graphs was using a pen plotter. Filling a rectangle with color using a pen plotter took a long time and often resulted a soggy hole in the paper, so the fill lines were preferred back then. Now with high resolution screens and printe

[R] "Masked by GlobalEnv"

2012-08-11 Thread Ashok Parmar
hello everyone, i am getting problems in graph plotting. When i attach file after adding color attributes in my data set. i got problem of "GlobalEnv" and masked the followings. Like this >attach(machm) The following object(s) are masked _by_ '.GlobalEnv': coll, sp The following object(s) ar

Re: [R] All combinations possible in a mutliple regression

2012-08-11 Thread Greg Snow
Look at the leaps function in the leaps package. It will compute the Cp statistic which is a function of AIC. On Thu, Aug 9, 2012 at 7:28 AM, zel7223 wrote: > Hi, > > I want to use four independent variables to predict the output of one > dependent variable using a linear model lm. I want to com

Re: [R] Stopping all code execution when ANY error occurs (OR error handling without try/tryCatch)

2012-08-11 Thread enocko
Hi, thanks for the ideas, folks. I'm on Windows 7, R 2.15.0 x64, RStudio 0.97.71. I do appreciate your time... I would like to say my goal of dealing with errors without R's error trapping tools is not nonsensical given that those tools are cumbersome and not well-suited to the development phase

Re: [R] replace funcion

2012-08-11 Thread David L Carlson
Or if you want to use recode (which you forgot to mention is in package car): set.seed(1) df1<- c(sample(1:12, 50, replace=TRUE)) # sample data library(car) recode(df1, "c(1, 2, 3, 4, 11, 12)='invierno'; 5:10='verano'") -- David L Carlson Associate Pro

Re: [R] replace funcion

2012-08-11 Thread arun
HI, Try this: set.seed(1)  df1<-data.frame(colA=sample(1:100,n,replace=TRUE)) numbers1<-c(1,2,3,4,11,12)  numbers2<-c(5,6,7,8,9,10)  df1$colA[df1$colA%in%numbers1]<-"invierno"  df1$colA[df1$colA%in%numbers2]<-"verano"  head(df1,10) colA 1  27 2  38 3  58 4  91 5  21 6   

Re: [R] help counting in data

2012-08-11 Thread jim holtman
use 'dput' to enclose your data. I think 'cut' is what you want: > dput(x) c(0, 1.179, 3.729, 9.418, 18.01, 29.746, 58.662, 131.566, 2323.7 ) > dput(y) c(5.79, 1579.52, 2323.7, 68.85, 426.07, 110.29, 108.29, 1067.6, 17.05, 22.66, 21.02, 175.88, 139.07, 144.12, 20.46, 43.4, 194.9, 47.3, 7.74, 0.4,

Re: [R] replace funcion

2012-08-11 Thread arun
HI, I guess this should also work. set.seed(1)  df1<-data.frame(colA=sample(1:100,n,replace=TRUE)) numbers1<-c(1,2,3,4,11,12)  numbers2<-c(5,6,7,8,9,10) df1[df1$colA%in%numbers1,]<-"invierno" df1[df1$colA%in%numbers2,]<-"verano" #or set.seed(1)  df1<-data.frame(colA=sample(1:100,n,replace=TRUE))

Re: [R] help counting in data

2012-08-11 Thread arun
HI, Not sure whether this is what you wanted. dat3<-c(5.79, 1579.52, 2323.70, 68.85,  426.07,  110.29, 108.29, 1067.60,  17.05, 22.66,  21.02,  175.88,  139.07,  144.12, 20.46,  43.40, 194.90, 47.30,  7.74, 0.40,   82.85, 9.88, 89.29,  215.10, 1.75,  0.79, 15.93,  3.91,  0.27,  0.69,  100.58,

Re: [R] Parsing large XML documents in R - how to optimize the speed?

2012-08-11 Thread Erdal Karaca
If this is an option for you: An xml database can handle (very) huge xml files and let you query nodes very efficiently. Then, you could query the xml databse from R (using REST) to do your statistics. There are some open source xquery/xml databases available. 2012/8/11 Frederic Fournier > Hell

Re: [R] help counting in data

2012-08-11 Thread Rui Barradas
Hello, Post your data using dput(). Copy the output of dput(X) and paste it in a post. Anyway, you can try the following. sum( leftaj <= X & X <= rightaj ) Hope this helps, Rui Barradas Em 11-08-2012 14:59, hafida escreveu: Hi i have this data X [1]5.79 1579.52 2323.70 68.85 4

Re: [R] replace funcion

2012-08-11 Thread Rui Barradas
Hello, Try the following, using index vectors, not recode(). inx <- datos.mx1[, 7] %in% 5:10 datos.mx1[inx, 7] <- "verano" datos.mx1[!inx, 7] <- "invierno" Hope this helps, Rui Barradas Em 11-08-2012 20:10, Dominic Roye escreveu: Hello everybody, I would like to replace or recode a list of

[R] Imputing data below detection limit

2012-08-11 Thread aynumazi
Hello, I'm trying to impute data below detection limit (with multiple detection limits) so i need just a method or a code for imputation and then extract the complete dataset to do the analyses. Is there any package which could do that simply as i'm a beginner in R Thank you -- View this messa

[R] replace funcion

2012-08-11 Thread Dominic Roye
Hello everybody, I would like to replace or recode a list of numbers between 1 and 12 (total 100). I have tried to make it with recode, but i have two types of replacements. For 1,2,3,4,11,12 => invierno and for 5,6,7,8,9 and 10 => verano. recode(datos.mx1[,7], "1='invierno'; 2='invierno'; 3='in

Re: [R] plotting profile likelihood curves

2012-08-11 Thread adw11
oops, Line 5 of the code should read: glm2<-glm(lot2 ~ log(u), data=clotting, family=Gamma) -- View this message in context: http://r.789695.n4.nabble.com/plotting-profile-likelihood-curves-tp4639947p4640047.html Sent from the R help mailing list archive at Nabble.com.

[R] unsued argument

2012-08-11 Thread stephenxqy
It is a complex function, functions are quoted frequently, you may read from bottom up The independent variable for final fit is q %%Rg0 is a function of L and b Rg0sq<-function(L,b)L*b/6*(1-3/2*b/L+3/2*(b/L)^2-3/4*(b/L)^3*(1-exp(-2*L/b))) %%alpha is a defined function alpha<-function(x)(1+(x/3.

Re: [R] choosing multiple columns

2012-08-11 Thread arun
HI, Try this: dat1<-as.data.frame(matrix(rnorm(50,5),ncol=10)) colnames(dat1)<-paste0("OFB",1:10) #to select first 8 columns - easy method dat1[,1:8] #2nd method wanted<-paste0("OFB",1:8) dat1[,colnames(dat1)%in%wanted] #3rd method #regular expression to select 3rd, 5th columns dat1[grep("[[:al

Re: [R] Parsing large XML documents in R - how to optimize the speed?

2012-08-11 Thread Duncan Temple Lang
Hi Frederic You definitely want to be using xmlParse() (or equivalently xmlTreeParse( , useInternalNodes = TRUE)). This then allows use of getNodeSet() I would suggest you use Rprof() to find out where the bottlenecks arise, e.g. in the XML functions or in S4 code, or in your code th

Re: [R] How do I find the apparent magnitude of a galaxy from a FITS file?

2012-08-11 Thread andrej
> > sos::findFn('fits astronomical') >found 4 matches; retrieving 1 page Alright I installed SOS, but in the line below "found 4 matches; retrieving 1 page" R spit out the following: "Error in print.findFn(list(Count = 1, MaxScore = 1, TotalScore = 1, Package = "FITSio", : could not find fun

[R] Submission

2012-08-11 Thread he chen
To someone who may concern, I want to continue the submission. of r-help list. Thanks a lot! Chen -- Best Regards, Yours, Chen He PhD Candidate Institute of Population Research Peking University, Beijing, China [[alternative HTML version deleted]] _

[R] help counting in data

2012-08-11 Thread hafida
Hi >i have this data > X [1]5.79 1579.52 2323.70 68.85 426.07 110.29 108.29 1067.60 17.05 22.66 [11] 21.02 175.88 139.07 144.12 20.46 43.40 194.90 47.307.74 0.40 [21] 82.859.88 89.29 215.101.750.79 15.933.910.27 0.69 [31] 100.58 2

[R] Ylim problem - plot.correlog, ncf package

2012-08-11 Thread Pyhrell
Hi, I'm doing cross-correlation correlograms with the ncf package. I have four study sites ; four correlograms. I'd like to get the same y scale for the four of them... only, using "ylim=c(-1,1)" does not change the y scale never and I don't know why. I tried with plot() too. Is there another

[R] cannot allocate a vector of size error, what explodes the the memory consumption?

2012-08-11 Thread Martin Ivanov
Dear R users, I keep getting the message "Error: cannot allocate a vector of size 543.2 Mb" on my 64 bit Linux machine with 4 Gb of memory. I studied the problem and it occurs at the last lines of my code: .. a <- laply(.); save(a, file= "file.RData"); rm(a); "a" is a 4-d arra

Re: [R] Trouble with Spatial Data Example Script

2012-08-11 Thread David L Carlson
That is it. If you are going to use source() change spplot(gadm, "language", col.regions=col, main="Swiss Language Regions") To print(spplot(gadm, "language", col.regions=col, main="Swiss Language Regions")) --- David > -Original Message- > From: R. Michael Weylandt [mailto:mi

Re: [R] Alternating between "for loops"

2012-08-11 Thread Rui Barradas
Hello, I'm not sure it works, but try the following. for(j in which(dtp)){ for (q in 1:N){ if(y[q, j] %in% c("d", "D")) break [...etc...] and in the other loop the same, for (j in which(!dtp)) { for (q in 1:N) { if(y[q, j] %in% c("d", "D")) break [...etc...] Em 10-08-2012

Re: [R] Trouble with Spatial Data Example Script

2012-08-11 Thread R. Michael Weylandt
I have no experience with spplot() or maps in general, but might this be more or less tied to R FAQ 7.22? Michael On Sat, Aug 11, 2012 at 12:00 PM, Lorenzo Isella wrote: > Hello, > The situation is a bit odd. > If I open an R session and I paste there the script, then it does work. > However, if

Re: [R] Trouble with Spatial Data Example Script

2012-08-11 Thread Lorenzo Isella
Hello, The situation is a bit odd. If I open an R session and I paste there the script, then it does work. However, if I save it as a text file and then I run it with the source("myfile.R") command, then I fall back to the case that started this thread i.e. I see nothing. Does anybody have a

Re: [R] Time Series Have Date Show Days of the Week

2012-08-11 Thread G See
Alternatively, xts has a convenience function for this .indexwday(SPY) will give weekdays as numbers with Sunday being 0 and Saturday being 6. There are also several similar functions .indexDate(x) .indexday(x) .indexmday(x) .indexwday(x) .indexweek(x) .indexmon(

Re: [R] Function definition: where is the error in the "for" loop?

2012-08-11 Thread Dr. Holger van Lishaut
Am 11.08.2012, 01:18 Uhr, schrieb Rui Barradas : [...] The solution is obviously to write 'for', with lowercase 'f'. Hope this helps, Dear Mr Barradas, indeed it did help, thank you very much! Best regards Holger van Lishaut __ R-help@r-project.o

Re: [R] Function definition: where is the error in the "for" loop?

2012-08-11 Thread Dr. Holger van Lishaut
Am 11.08.2012, 01:18 Uhr, schrieb Rui Barradas : [...] The solution is obviously to write 'for', with lowercase 'f'. Hope this helps, Dear Mr Barradas, indeed it did help, thank you very much! Best regards Holger van Lishaut __ R-help@r-project.o

Re: [R] How do I find the apparent magnitude of a galaxy from a FITS file?

2012-08-11 Thread David L Carlson
Actually you could find it with RSiteSearch("FITS") which comes with base R as the first hit: 1. R: Read a single data set from a FITS file (score: 51) Author: unknown Date: Wed, 22 Feb 2012 19:25:09 -0500 Read a single data set from a FITS file Description Usage Arguments Details Valu

Re: [R] How do I find the apparent magnitude of a galaxy from a FITS file?

2012-08-11 Thread Michael Weylandt
On Aug 11, 2012, at 6:34 AM, andrej wrote: > > [2] I obtained R (actually R64) from the following website: > http://cran.cnr.berkeley.edu/bin/macosx/ > > I guess it didn't come with an 'sos' package. I assume it's here: > http://cran.r-project.org/web/packages/sos/index.html > > and when I d

Re: [R] Function definition: where is the error in the "for" loop?

2012-08-11 Thread David L Carlson
There is no command "For" in R. It is "for" and R is case sensitive. -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-

Re: [R] Batch Mode for Windows

2012-08-11 Thread FJ M
I have a batch file to run R commands in a text file and an output file that I use. "C:\Program Files\R\R-2.13.2\bin\x64\R.exe" CMD BATCH "C:\Users\Frank\Documents\R\Scripts\TLT_2012.txt" "C:\Users\Frank\Documents\R\Scripts\TLT_2012.out" PAUSE I worked in an environment that you had to

Re: [R] Problem when creating matrix of values based on covariance matrix

2012-08-11 Thread Boel Brynedal
Hi, thanks for the reply. I am not assuming that the supplied covariance vector in any way captures the 'true' covariance matrix of the population, but thats not what I am after either. I just want to simulate data that has a similar covariance as that covariance matrix. And the numbers are so huge

Re: [R] How to add values on bar of groouped bar plot using mtext?

2012-08-11 Thread Uwe Ligges
On 11.08.2012 04:55, Manish Gupta wrote: How to write values on bars using mtext? Grouped Bar Plot counts <- table(mtcars$vs, mtcars$gear) barplot(counts, main="Car Distribution by Gears and VS",xlab="Number of Gears", col=c("darkblue","red"),legend = rownames(counts), beside=TRUE, horiz=TRUE)

Re: [R] Problem when creating matrix of values based on covariance matrix

2012-08-11 Thread Bert Gunter
Sampling error? Do you realize how large a sample size you would need to precisely estimate an 8000 x 8000 covariance matrix? Probably exceeds the number of stars in our galaxy... Numerical issues may also play a role, but I am too ignorant on this aspect to offer advice. Finally, this is reall

Re: [R] Stopping all code execution when ANY error occurs (OR error handling without try/tryCatch)

2012-08-11 Thread Uwe Ligges
Easy: Wrap your code into a function. A function by default exits on the first error. Best, Uwe Ligges On 11.08.2012 10:07, enocko wrote: Hi all, I often run a bunch of code with Run Selection, and, after it's done running, I find there have been like 20 errors, all due to an error that o

Re: [R] Stopping all code execution when ANY error occurs (OR error handling without try/tryCatch)

2012-08-11 Thread Bert Gunter
1. You probably need to tell us on what platform (OS, version) you are running, as requested by the posting guide. 2. To me, it sounds like your question is: How can I avoid using the error trapping tools built into R but still trap errors. If so, pretty nonsensical, no? 3. But maybe someone else

Re: [R] stopping rule in hierarchical Clustering

2012-08-11 Thread Uwe Ligges
On 11.08.2012 06:19, eliza botto wrote: Dear R users, Is there a way to apply a “stopping rule” in hierarchical Clustering? I have a data and I want to find the optimal number of clusters while doing hierarchical clustering. I would be deeply obliged if someone, whoever applied stopping rule

[R] Problem when creating matrix of values based on covariance matrix

2012-08-11 Thread Boel Brynedal
Hi, I want to simulate a data set with similar covariance structure as my observed data, and have calculated a covariance matrix (dimensions 8368*8368). So far I've tried two approaches to simulating data: rmvnorm from the mvtnorm package, and by using the Cholesky decomposition (http://www.cereb

Re: [R] How do I find the apparent magnitude of a galaxy from a FITS file?

2012-08-11 Thread andrej
[1] Oh, that kind of duplicate... I thought you meant duplicate in that someone else had already asked how to use R to analyze FITS images. Well every time I post, I get the "Mailing List Subscription Reminder." I suppose you want me to just click on "I'm already a subscriber" and just post here th

[R] Stopping all code execution when ANY error occurs (OR error handling without try/tryCatch)

2012-08-11 Thread enocko
Hi all, I often run a bunch of code with Run Selection, and, after it's done running, I find there have been like 20 errors, all due to an error that occurred early in my code, which caused problems from there on. (I must then scroll up through lots of code to find it.) What I would like is for R

Re: [R] Trouble with Spatial Data Example Script

2012-08-11 Thread John Kane
As David Carlson mentioned earlier your script is working well for me. sessionInfo() R version 2.15.1 (2012-06-22) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_CA.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=e

Re: [R] choosing multiple columns

2012-08-11 Thread Ista Zahn
On Sat, Aug 11, 2012 at 8:51 AM, Sachinthaka Abeywardana wrote: > I should have mentioned that I do not know the number index of the columns, > but regardless, thanks for the responses Right, so use my first method. This does not depend on the position of the columns. Best, Ista > > > On Sat, A

Re: [R] choosing multiple columns

2012-08-11 Thread Sachinthaka Abeywardana
I should have mentioned that I do not know the number index of the columns, but regardless, thanks for the responses On Sat, Aug 11, 2012 at 10:46 PM, Ista Zahn wrote: > Hi Sachin, > > There are at least two ways. The safer way is to use a regular > expression to find the matching columns, like

Re: [R] choosing multiple columns

2012-08-11 Thread Ista Zahn
Hi Sachin, There are at least two ways. The safer way is to use a regular expression to find the matching columns, like this: a <- initial_data[grep("^OFB[0-9]+", names(initial_data))] Alternatively, if you know that the columns you want are the first 8 you can select them by position, like this

Re: [R] choosing multiple columns

2012-08-11 Thread John Kane
mydata[ , 1:8] Or let's say you only one the 4th, 6th and 8th columns mydata[ , c(4,6,8)] and so on. There are several good intro's available on the R website that will walk you through this type of thing. If you're a recovering SAS or SPSS user this paper may be of real help www.et.bs.eh

Re: [R] Batch Mode for Windows

2012-08-11 Thread Uwe Ligges
On 10.08.2012 22:59, sharx wrote: Hi, I have researched batch mode for windows and could not find anything that worked. I know the code should be $ R CMD BATCH inputfile.R outputfile.Rout or R outputfile.Rout Almost right, see below. I tried these without success. I need detailed, step b

[R] choosing multiple columns

2012-08-11 Thread Sachinthaka Abeywardana
Hi all, I have a data frame that has the columns OFB1, OFB2, OFB3,... OFB10. How do I select the first 8 columns efficiently without typing each and every one of them. i.e. I want something like: a<-data.frame(initial_data$OFB1-10) #i know this is wrong, what would be the correct syntax? Thanks

Re: [R] device "mismatch", coordinates trouble with X11 and pdf devices

2012-08-11 Thread peter dalgaard
On Aug 11, 2012, at 07:53 , Paul Johnson wrote: > Greetings. > > I'm trying to understand a problem on a Dell Laptop. Details below, > also uploaded the R working example that I pasted below. The difference is not in locator() but in the circles, which in turn is due to different aspect ratio