[R] How to repeat replication

2012-11-30 Thread Kamontip Srihaset
Dear all, I generate data under IRT mdel. I conducted 1000 replications. When I run, some replication was not fit with my model. So, replications were fit model were less than 1000 replication. If I want its run until 1000 replicaions. How shouldI write functin. Thank you, Kamontip

Re: [R] How to subtract the counter i in for loop?

2012-11-30 Thread Berend Hasselman
On 30-11-2012, at 07:18, C W wrote: thanks, Berend. Both of your code works great. Is there a function that can do it? Something like this: x - matrix(NA, nrow=15, ncol=2) for(i in 1:15){ x[i,] - sample(c(NA, 20, 77), 2, prob=c(0.2, 0.3, 0.4)) } x [,1] [,2] [1,]

Re: [R] googleVis plot and knitr/sweave

2012-11-30 Thread Gergely Daróczi
Just a lame question: is there any chance to generate SVG maps with googleVis and import that in LaTeX? Best, Gergely On Fri, Nov 30, 2012 at 2:02 AM, Yihui Xie x...@yihui.name wrote: Then you can take a look at the ggmap (on CRAN) or snippets package (on Simon's RFroge:

Re: [R] Little's Chi Square test for MCAR?

2012-11-30 Thread Jose Iparraguirre
If you mean Little's Chi Sq test in particular, go to the BaylorEdPsych package. Regards, José José Iparraguirre Chief Economist Age UK -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sileshi Melesse Sent: 30 November 2012 05:57

[R] [R-pkgs] kernlab 0.9-15 on CRAN

2012-11-30 Thread Alexandros Karatzoglou
kernlab package version 0.9-15 has been posted on CRAN, it contains several improvements and fixes along with new features e.g. variance estimation for Gaussian Process regression. cheers Alexandros ___ R-packages mailing list

Re: [R] worldmap_region/country problem

2012-11-30 Thread Roger Bivand
anna.fechner at de.pwc.com writes: Dear R community, I'm trying to graphically illustrate my data with a worlmap. Unfortunately, my data is partly on country basis and partly on regional basis (e.g. certain African countries are aggregated to one region). I am using the package

[R] CreateThread failure since R 2.15.2 (32-bit)

2012-11-30 Thread Martin Studer
Dear R users developers, I coming across the following issue since R 2.15.2 32-bit (running on Windows XP 32.bit; some output left out for conciseness): setInternet2(TRUE) require(rJava) .jinit() getCRANmirrors() system(ls , intern = TRUE) Error in system(ls, intern = TRUE) : CreateThread

[R] help on stacking matrices up

2012-11-30 Thread Andras Farkas
Dear All,   #I have the following code   Dose-1000 Tinf -0.5 INTERVAL -8 TIME8 -matrix(c((0*INTERVAL):(1*INTERVAL))) TIME7 -matrix(c((0*INTERVAL):(2*INTERVAL))) TIME6 -matrix(c((0*INTERVAL):(3*INTERVAL))) TIME5 -matrix(c((0*INTERVAL):(4*INTERVAL))) TIME4 -matrix(c((0*INTERVAL):(5*INTERVAL))) TIME3

Re: [R] Confidence intervals for estimates of all independent variables in WLS regression

2012-11-30 Thread Rui Barradas
Hello, You don't have to exchange 'object' by the name of your model, you call the function with the name of your model: x - 1:20 y - x + rnorm(20) fit - lm(y ~ x) ci_lm(fit) beta lowerupper (Intercept) 0.6741130 -0.9834827 2.331709 x 0.9575906 0.8192171

[R] log-scale xy-plots

2012-11-30 Thread Stefan Stagge
Hello R-Users, Hello R-help-team. I found a nice way to create a xy-plot with a single log-axis (e.g. the y-axis). This is often needed to show biological data. First attach the desired dataset you want to plot. Now use the following commands: plot(x,y,log=y, yaxt=n, ylim=c(0.1,10), ... )

[R] xts indexed with Date class

2012-11-30 Thread Giles
Hi I see a changed behaviour in xts indexed on class Date in the latest versions, versus 2. It seems to be related to changes to/from daylight savings time, happens those weekends. Is it not intended that class Date be used like this, or is this new behaviour incorrect? Giles Example:

[R] missed values

2012-11-30 Thread Vasilchenko Aleksander
Hello I have dataframe 101 2008-07 0.2898966 102 2008-08 0.3101667 103 2008-09 0.3730476 104 2008-10 0.2717037 105 2008-11 0.1344286 106 2008-12 0.1375000 107 2009-01 0.1781000 108 2009-02 0.2146667 109 2009-03 0.2808235 110 2009-04 0.4326250 111 2009-05 0.3420741 112 2009-06 0.2675238 113 2009-07

[R] TSCov function from RTAQ package

2012-11-30 Thread billycorg
Hi R Users! I am having some difficulties in using the TSCov function from RTAQ package that should calculate the two time scale realized volatility (Zhang et al, 2005). Let's suppose I have tick by tick data, let's say aaa and bbb. If I write in R: /stock1=aaa$PRICE stock2=bbb$PRICE

[R] subgroup-based quantiles

2012-11-30 Thread R Kozarski
Dear R users, given the patient sample with their Gender and Age GENDER Age [1,] 2 45 [2,] 1 58 [3,] 1 54 [4,] 2 71 [5,] 2 64 ... I would like to create an another column which groups the patients wrt Gender specific Age quantiles, following

[R] Shipping densitty

2012-11-30 Thread suuz
-- View this message in context: http://r.789695.n4.nabble.com/Shipping-densitty-tp4651404.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

[R] Oracle database connction from R in Linux

2012-11-30 Thread sasidhar M
Hi, This is sasi. I installed R 64 bit and oracle client 64 bit in fedora 17. After R is working fine. Oracle database also working fine. but problem is, If i try to connect oracle from R its not connecting. So, pls guide me how to connect from R to oracle. how, i tried:-- odbcinst.ini file

[R] Changing the base of geom_bar in ggplot

2012-11-30 Thread Werner
Hi, this is likely very easy to do but I don't find the right terms to search for the solution. I want to show in a bar chart how much different categories deviate from the average percentage change. Thus, in the following example I would like to set the zero line or base or whatever it is

[R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread Henry Smith
Hello, Everyone. Does anyone know how to create a Nightingale’s Rose chart by using R? Hopefully, the graph could be displayed like this: http://mbostock.github.com/protovis/ex/crimea-rose.html Thanks a lot. Kind regards, Henry [[alternative HTML version deleted]]

[R] Generating sequences of dates

2012-11-30 Thread Vasilchenko Aleksander
Hello, I have the starting date in UNIX_TIME LONG number (number of milliseconds since 1970 jan 1st). Is there a way to generete the sequence of dates with monthly interval in POSIXct format like 2000-01-01 2000-02-01 2000-03-01 etc Thanks [[alternative HTML version deleted]]

Re: [R] missed values

2012-11-30 Thread arun
HI, Use, ?na.omit() na.omit(data) A.K. - Original Message - From: Vasilchenko Aleksander vasilchenko@gmail.com To: r-help@r-project.org Cc: Sent: Friday, November 30, 2012 7:07 AM Subject: [R] missed values Hello I have dataframe 101 2008-07 0.2898966 102 2008-08 0.3101667 103

[R] how to separate stuck row elements?

2012-11-30 Thread Jaime Otero Villar
Hi, I was wondering if it's possible to separate elements in multiple rows that actually should appear in different columns. I have a file where in certain lines there are elements not separated, and they certainly should appear in different columns (an example of the file is attached).

Re: [R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread Rui Barradas
Hello, Take a look at the graph in http://gallery.r-enthusiasts.com/graph/Rose_diagram,97 Hope this helps, Rui Barradas Em 30-11-2012 12:24, Henry Smith escreveu: Hello, Everyone. Does anyone know how to create a Nightingale’s Rose chart by using R? Hopefully, the graph could be displayed

Re: [R] Generating sequences of dates

2012-11-30 Thread Rui Barradas
Hello, Try the following. Y - 2000:2001 M - 1:12 D - 1 x - expand.grid(Y, M, D) Dates - sort(as.Date(apply(x, 1, paste, collapse = -))) Hope this helps, Rui Barradas Em 30-11-2012 12:26, Vasilchenko Aleksander escreveu: Hello, I have the starting date in UNIX_TIME LONG number (number of

Re: [R] how to separate stuck row elements?

2012-11-30 Thread Rui Barradas
Hello, Try the following. x - scan(text= -100 -100-3456-3456-3456-100 -100 23 -3456-3456-189 34 56 78 -100 34 56 21 44 65 78 , what = ) fun - function(x){ f - function(.x){ if(grepl(-[[:digit:]]+, .x)){ g - gregexpr(-[[:digit:]]+, .x) .y -

Re: [R] Deleting certain observations (and their imprint?)

2012-11-30 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Stodola, Kirk Sent: Thursday, November 29, 2012 5:32 PM To: r-help@r-project.org Subject: [R] Deleting certain observations (and their imprint?) I'm manipulating a large

Re: [R] help on stacking matrices up

2012-11-30 Thread PIKAL Petr
Hi try to make your example easier and reproducible. I get CONCF -matrix(c(CONC1+CONC2+CONC3+CONC4+CONC5+CONC6+CONC7+CONC8)) Error in CONC1 + CONC2 : non-conformable arrays so I cannot understand what shall the final plot look like. Regards Petr -Original Message- From:

Re: [R] how to separate stuck row elements?

2012-11-30 Thread Berend Hasselman
On 30-11-2012, at 13:55, Jaime Otero Villar wrote: Hi, I was wondering if it's possible to separate elements in multiple rows that actually should appear in different columns. I have a file where in certain lines there are elements not separated, and they certainly should appear in

Re: [R] bootstrapped cox regression (rms package)

2012-11-30 Thread Frank Harrell
Thanks Eric. It would be good to show your entire script next time as stated in the posting guidance. Regarding matching with SPSS please describe the bootstrapping algorithm used there. In rms I do the unconditional bootstrap, i.e., I sample with replacement from the rows of the raw data. And

Re: [R] Changing the base of geom_bar in ggplot

2012-11-30 Thread Jeff Newmiller
I think your request is internally inconsistent: you want units of percent but you want to show the average(I assume you intend mean)? You can subtract the mean from each value and then divide by the mean, then subtract 1, then multiply by 100. You inherently lose visibility to what the mean

[R] subset data frame by variable with missing value

2012-11-30 Thread ramoss
Hello, I have a variable in a data frame that contains NA values. I just want to subset so that I get the obs where that variable is missing. In SAS I would do: data missing; set test; if myvalue=' '; run; How can I perform this simple task in R? Thanks in advance for your help. --

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread Marc Schwartz
On Nov 30, 2012, at 9:27 AM, ramoss ramine.mossad...@finra.org wrote: Hello, I have a variable in a data frame that contains NA values. I just want to subset so that I get the obs where that variable is missing. In SAS I would do: data missing; set test; if myvalue=' '; run; How

[R] For loop

2012-11-30 Thread bibek sharma
Hello user, I have large data containing subject id, time and response where subjects are measured repeatedly. However some time are duplicates. I only want data with unique time points per id. I mean if time is repeated, then take only one. Here is a sample data. id timeres 1 2

Re: [R] help on stacking matrices up

2012-11-30 Thread PIKAL Petr
Hi Andras Now it works but I suppose you shall simplify or explain it a bit more. CONC7-c(rep(0,3),CONC7) CONC8-c(rep(0,6),CONC8) CONC6+CONC7+CONC8 [,1] [1,] 0.00 [2,] 2.330056 [3,] 2.133774 [4,] 1.954027 [5,] 4.119477 [6,] 3.772456 [7,] 3.454667 [8,] 5.493705 [9,] 5.030920 [10,]

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread PIKAL Petr
Hi see ?is.na x -sample(c(1:3, NA), 20, replace=T) x [1] 2 NA 2 3 3 3 3 2 3 NA 3 2 1 2 NA 3 3 3 2 2 y-rnorm(20) y[is.na(x)] [1] 0.1600417 1.3264063 -0.6175832 Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread Milan Bouchet-Valat
Le vendredi 30 novembre 2012 à 07:27 -0800, ramoss a écrit : Hello, I have a variable in a data frame that contains NA values. I just want to subset so that I get the obs where that variable is missing. In SAS I would do: data missing; set test; if myvalue=' '; run; How can I

Re: [R] Generating sequences of dates

2012-11-30 Thread Jagat.K.Sheth
?seq.Date seq(as.Date(2000-01-01), len=5, by=1 mon) [1] 2000-01-01 2000-02-01 2000-03-01 2000-04-01 2000-05-01 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Vasilchenko Aleksander Sent: Friday, November 30, 2012 6:27 AM

Re: [R] For loop

2012-11-30 Thread Jessica Streicher
Hello Bikek, please use dput() next time to provide the data, its easier to use that. also: looking at the data provided, how would you want to decide which value of the non-unique times to retain? Just take the first one? They aren't all the same. On 30.11.2012, at 16:59, bibek sharma wrote:

Re: [R] how to separate stuck row elements?

2012-11-30 Thread arun
Hi, Try this: Lines--100 -100-3456-3456-3456-100 -100 23 -3456-3456-189 34 56 78 -100 34 56 21 44 65 78 res-unlist(strsplit(gsub(\\-, -,Lines),\n)) res1-do.call(rbind,lapply(lapply(split(res,seq_along(res)),function(x) unlist(strsplit(x, ))),function(x) as.numeric(x[x!=])))  res1 ##  [,1]  [,2] 

Re: [R] For loop

2012-11-30 Thread arun
Hi, Try this: dat1-read.table(text= id    time res 1    2    0.64 1    3    0.78 1    3    6.5 1    3    4.5 1    4    4 1    5    3.4 2    10    5.7 2    11    5.8 2    11    9.3 2    11    3.4 2    12    3.4 2    13    6.7 3    3    5.6 3    3    3.4 3    4    2.3 3    5    5.6 3    12   

Re: [R] For loop

2012-11-30 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of bibek sharma Sent: Friday, November 30, 2012 5:00 PM To: R-help@r-project.org Subject: [R] For loop Hello user, I have large data containing subject id, time and

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread ramoss
I found the answer; Its mymissing - subset(mydata,is.na(myvar)) -- View this message in context: http://r.789695.n4.nabble.com/subset-data-frame-by-variable-with-missing-value-tp4651439p4651440.html Sent from the R help mailing list archive at Nabble.com.

[R] Standard errors for predictions of zero-inflated models

2012-11-30 Thread Lee, Laura
Dear all, I am using the zeroinfl() function from the pscl package to develop a zero-inflated Poisson GLM. I would like to calculate the standard errors of predicted values. I've tried code posted in a previous discussion on this topic

Re: [R] googleVis plot and knitr/sweave

2012-11-30 Thread Michael Friendly
On 11/29/2012 2:53 PM, Filoche wrote: Dear R users. I'm currently making a report with knitr (RStudio) where I would like to plot a googleVis map. However, the map generated is an HTML file which I don't know how to integrate it in my report. So my question is how to include a map generated

Re: [R] For loop

2012-11-30 Thread Jessica Streicher
You could use the duplicated function maybe: mtest id time value [1,] 13 1 [2,] 13 2 [3,] 12 3 [4,] 11 4 [5,] 21 5 [6,] 23 6 [7,] 23 7 [8,] 23 8 duplicated(mtest[,1:2]) [1] FALSE TRUE FALSE FALSE FALSE FALSE TRUE

Re: [R] how to separate stuck row elements?

2012-11-30 Thread arun
Hi, You could also try this: Lines--100 -100-3456-3456-3456-100 -100 23 -3456-3456-189 34 56 78 -100 34 56 21 44 65 78 Lines1-readLines(textConnection(Lines))  res1-unlist(strsplit(gsub([-], -,Lines2), ))  matrix(as.numeric(res1[res1!=]),nrow=length(Lines1),byrow=TRUE)     [,1]  [,2]  [,3]  [,4] 

Re: [R] help on stacking matrices up

2012-11-30 Thread PIKAL Petr
Hi ifelse shall work just fine. x-1:10 a-rnorm(10) b-rnorm(10)+100 tinf-5 ifelse(xtinf, a,b) [1] -0.32157732 -0.11065857 0.07127818 0.35928359 100.06200507 [6] 98.77752570 100.92743376 99.73918386 99.79837539 101.32640626 It is only your value of Tinf which is 0.5 compared to TIME

Re: [R] missed values

2012-11-30 Thread arun
Hi, May be this helps: dat1-read.table(text= ---data--- ,header=TRUE,stringsAsFactors=FALSE) library(zoo)  dat1$date-as.yearmon(dat1$date,format=%Y-%m) lm1-lm(value~date,dat1) dat2-data.frame(date=dat1[,1])  dat1$fit-predict(lm1,newdata=dat2)  

[R] Reading .gsheet within R

2012-11-30 Thread Luca Meyer
Hello R-experts, I would like to know if there is a solution to read files with extension .gsheet directly into R - see http://www.fileinfo.com/extension/gsheet for more info on this file format. Thank you, Luca Mr. Luca Meyer www.lucameyer.com R 2.15.1 Mac OS X 10.8.2

[R] repeating matrices in a list

2012-11-30 Thread Anser Chen
Suppose I have the following square, non-negative matrices g=matrix(c(0,2,4,0.25,0,0,0,0.6,0),3,3,byrow=T); I want to create a list where this matrix is repeated multiple times. if I do this brute force (manually), using env - list(g,g,g) works fine. Yields [[1]] [,1] [,2] [,3] [1,]

Re: [R] repeating matrices in a list

2012-11-30 Thread Sarah Goslee
You are so close: rep(list(g), 3) [[1]] [,1] [,2] [,3] [1,] 0.00 2.04 [2,] 0.25 0.00 [3,] 0.00 0.60 [[2]] [,1] [,2] [,3] [1,] 0.00 2.04 [2,] 0.25 0.00 [3,] 0.00 0.60 [[3]] [,1] [,2] [,3] [1,] 0.00 2.04 [2,] 0.25 0.00 [3,] 0.00 0.60

Re: [R] repeating matrices in a list

2012-11-30 Thread arun
Hi, Try this: lapply(1:3,function(x) g) A.K. - Original Message - From: Anser Chen anser.c...@gmail.com To: r-help@r-project.org Cc: Sent: Friday, November 30, 2012 12:50 PM Subject: [R] repeating matrices in a list Suppose I have the following  square, non-negative matrices

[R] what is the cost in cv.glm?

2012-11-30 Thread mael
Hi, I have a question regarding the cv.glm function in the package boot. What is exactly the cost? Is it the threshold value for an estimated value to be classified as either 0 or 1? I have troubles understanding the explanation in R. Lets say I want all estimations 0.65 to be classified as 1s

Re: [R] help on stacking matrices up

2012-11-30 Thread Andras Farkas
Petr,   sorry, here is a better example that should work:  Dose-200 Tinf -0.5 INTERVAL -3 TIME8 -matrix(c((0*INTERVAL):(1*INTERVAL))) TIME7 -matrix(c((0*INTERVAL):(2*INTERVAL))) TIME6 -matrix(c((0*INTERVAL):(3*INTERVAL))) CDURINF6 -((Dose/Tinf)*(1/(0.088*76.9)))*(1-exp(-0.088*TIME6)) CAFTINF6

[R] can't integrate in loop

2012-11-30 Thread faeriewhisper
Hi guys! I have to compute something and i don't know what i'm doing wrong. my code is a bit complex, but imagine that is something like this: a = c(1 2 3 4) ia = length(a) x = seq(1,100,length=0.1) ib = length(x) for(j in 1:ia) { H = function(x) {sen(x) + a[j]} for(i in 1:ib) {

[R] loop function and integrate?

2012-11-30 Thread faeriewhisper
Hi guys! I have to compute something and i don't know what i'm doing wrong. my code is a bit complex, but imagine that is something like this: a = c(1,2,3,4) ia = length(a) x = seq(1,100,length=0.1) ib = length(x) int1 = numeric(ib) b = numeric(ib) for(j in 1:ia) { H = function(x)

[R] Help regarding calendar heatmap

2012-11-30 Thread sharan kumar
Hi, I would like to create calendarheat map with Hours of day on Y axis and Date on X axis. Is there any function to do so? Can someone help me with reference. Thanks Sharan [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread arun
Hi, YOu could also use: set.seed(5) dat1-data.frame(col1=sample(c(1:4,NA),10,replace=TRUE),col2=runif(10,0,1))  dat1[!complete.cases(dat1),] #  col1  col2 #3   NA 0.3184040 #8   NA 0.8878698 #9   NA 0.5549226 A.K. - Original Message - From: ramoss ramine.mossad...@finra.org To:

Re: [R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread Henry Smith
Hi, thanks a lot. The package from your link seems could plot only one type of variable. If I have following three variables:If I have following three variables: a b c 1 3 7 8 2 5 4 1 3 5 1 7 4 3 1 5 5 1 7 3 6 7 1 1 7 1 1 1 8 3 3 2 Do you have any idea how to plot it by using variable

Re: [R] help on stacking matrices up

2012-11-30 Thread Andras Farkas
Petr,   thanks for the solution, putting the zeros in there makes it work just how I want it. Also, thanks for picking up on the error in my code below... I did not notice that it only changes the 1st value, and yes, your assumption is right: there is a chance where more values should be

[R] flip heatmap (pheatmap)

2012-11-30 Thread DebKV
When plotting a heatmap with heatmap.2 the shortest euclidean distance cluster is plotted in the top left corner of the heatmap http://r.789695.n4.nabble.com/file/n4651430/heatmap.2.jpeg when plotting the same data with pheatmap the very same cluster is in the bottom right corner

[R] segfault debugging

2012-11-30 Thread Donatella Quagli
Hello everybody, I have written a script with two inline cfunctions. The script crashes from time to time with:    *** caught segfault ***   address 0x10, cause 'memory not mapped' The crashs happen within R code after the cfunctions were executed. Nevertheless I think that the pointers in my

Re: [R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread Henry Smith
Dear Dennis, Many thanks! Yes, ggplot2 could be used to illustrate a simple rose chart (category + one type variable) If I have a data frame like this: DF - data.frame(month = factor(month.abb, levels = month.abb), freq1 = rpois(12, 80),freq2=rpois(12, 80),freq3=rpois(12, 80))

Re: [R] googleVis plot and knitr/sweave

2012-11-30 Thread Filoche
Thank you Michael. I'll try that. Maybe I can find a solution to convert the HTML file into a let's say SVG file. Regards, Phil -- View this message in context: http://r.789695.n4.nabble.com/googleVis-plot-and-knitr-sweave-tp4651341p4651463.html Sent from the R help mailing list archive at

Re: [R] googleVis plot and knitr/sweave

2012-11-30 Thread Filoche
Thank everyone for the answers. I looked into ggmap but could not find how to plot a map that would like this: http://www.google.ca/trends/explore#q=flu I looked into get_map but it can only be of this type: maptype = c(terrain, satellite, roadmap, hybrid, toner, watercolor) Any suggestions

Re: [R] loop function and integrate?

2012-11-30 Thread faeriewhisper
Now i've managed to do this: funcs - list() funcs[] # loop through to define functions for(i in 1:ib-1){ # Make function name funcName - paste( 'func', i, sep = '' ) # make function func = paste('function(x){sin(x + a[', i,'])))}',sep = '') funcs[[funcName]] =

[R] qbinom

2012-11-30 Thread jaybell
a=c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) b=c(0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1) cor(a,b)= -1 a'=qbinom(a, 1, 0.5) b'=qbinom(b, 1, 0.5) why cor(a',b') becomes -0.5 ? -- View this message in context: http://r.789695.n4.nabble.com/qbinom-tp4651460.html Sent from the R help

Re: [R] subgroup-based quantiles

2012-11-30 Thread Rui Barradas
Hello, If you want Age quantiles by gender, you have to split the data by gender, apply the same code then recombine the result. fun - function(x){ Age_group - cut(x[, Age], labels=c(1:10), breaks=quantile(x[, Age], seq(0,1,.1)), include.lowest = TRUE) cbind(x,

Re: [R] repeating matrices in a list

2012-11-30 Thread arun
HI, You could also use: res1-sapply(1:3,function(x) g,simplify=FALSE) #or res2-replicate(3,g,simplify=FALSE)  identical(res1,res2) #[1] TRUE A.K. - Original Message - From: Anser Chen anser.c...@gmail.com To: r-help@r-project.org Cc: Sent: Friday, November 30, 2012 12:50 PM Subject:

Re: [R] loop function and integrate?

2012-11-30 Thread Rui Barradas
Hello, Your code doesn't run without initializing 'ss' to something. And I've made some changes, but I don't understand what you are trying to do. See comments inline. a = c(1,2,3,4) ia = length(a) x = seq(1, 100, by=0.1) # It was 'length = 0.1' (!) ib = length(x) ss - numeric(ia) #

Re: [R] loop function and integrate?

2012-11-30 Thread Berend Hasselman
On 30-11-2012, at 16:08, faeriewhisper wrote: Hi guys! I have to compute something and i don't know what i'm doing wrong. my code is a bit complex, but imagine that is something like this: a = c(1,2,3,4) ia = length(a) x = seq(1,100,length=0.1) ib = length(x) int1 =

Re: [R] can't integrate in loop

2012-11-30 Thread Jessica Streicher
Thats not a very precise question. I'll try anyway.. - if you use c, you need to separate the values by commas - i think you mean seq(1,100,0.1), otherwise x only has one value - function sen is not defined - If you call int(1), upper will be 1, not x[i] - why are you making a function and

Re: [R] loop function and integrate?

2012-11-30 Thread Berend Hasselman
On 30-11-2012, at 19:34, Berend Hasselman wrote: On 30-11-2012, at 16:08, faeriewhisper wrote: Hi guys! I have to compute something and i don't know what i'm doing wrong. my code is a bit complex, but imagine that is something like this: a = c(1,2,3,4) ia = length(a) x =

Re: [R] segfault debugging

2012-11-30 Thread Duncan Murdoch
On 30/11/2012 12:02 PM, Donatella Quagli wrote: Hello everybody, I have written a script with two inline cfunctions. The script crashes from time to time with: *** caught segfault *** address 0x10, cause 'memory not mapped' The crashs happen within R code after the cfunctions were

Re: [R] qbinom

2012-11-30 Thread Peter Langfelder
On Fri, Nov 30, 2012 at 9:47 AM, jaybell stephe...@yahoo.com.tw wrote: a=c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) b=c(0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1) cor(a,b)= -1 a'=qbinom(a, 1, 0.5) b'=qbinom(b, 1, 0.5) why cor(a',b') becomes -0.5 ? On my computer the correlation is

Re: [R] xts indexed with Date class

2012-11-30 Thread arun
Hi, You could try this: Sys.setenv(TZ=GMT) a-as.Date(15423:15426) x-xts(seq_along(a),a)  print(index(x)) #[1] 2012-03-24 2012-03-25 2012-03-26 2012-03-27  print(as.numeric(index(x))) #[1] 15423 15424 15425 15426 A.K. - Original Message - From: Giles giles.heyw...@cantab.net To:

Re: [R] subgroup-based quantiles

2012-11-30 Thread Rui Barradas
Hello, Arun's code is much better. Rui Barradas Em 30-11-2012 18:50, arun escreveu: Hi, You could also try ?ave() dat$Age_group-ave(dat$Age,dat$GENDER,FUN=function(x){cut(x,labels=1:10,breaks=quantile(x,seq(0,1,.1)),include.lowest=TRUE)}) dat # GENDER Age Age_group #1 2 45 1

Re: [R] Nightingale’s Rose chart-any suggestion?

2012-11-30 Thread John Kane
I think this does it. require(reshape2) df1 - melt(DF, id=month) ggplot(df1, aes(x = month, y = value, fill = variable)) + theme_bw() + geom_bar(stat = identity) + coord_polar() John Kane Kingston ON Canada -Original Message- From: henry.helsi...@gmail.com

Re: [R] subgroup-based quantiles

2012-11-30 Thread arun
Hi, You could also try ?ave() dat$Age_group-ave(dat$Age,dat$GENDER,FUN=function(x){cut(x,labels=1:10,breaks=quantile(x,seq(0,1,.1)),include.lowest=TRUE)})  dat #  GENDER Age Age_group #1  2  45 1 #2  1  58    10 #3  1  54 1 #4  2  71    10 #5  2  64  

Re: [R] bootstrapped cox regression (rms package)

2012-11-30 Thread Eric Claus
Hi Frank, My apologies for not posting the entire script - I have repasted it below. library(rms) library(foreign) temp=read.spss('coxdata.sav', to.data.frame=T) formula=Surv(months, recidivate) ~ fac1 + fac2 + fac3 + fac4 + fac5 + fac6 + fac7 + fac8 fit=cph(formula, data=temp, x=T, y=T)

Re: [R] loop function and integrate?

2012-11-30 Thread faeriewhisper
hello guys! thank u for the help, but u didnt understood what i need. 1st, it is a[i] cuz i want to sum 1 + x[i], for all i's not j. but i've solved it! :) like i said, my code is more complex, but, if you need to integrate several functions in a loop, thats what you should do: w2 =

[R] Choleski decomposition

2012-11-30 Thread jaybell
m - matrix(nrow=5, ncol=5) m - ifelse(row(m)==col(m), 1, 0.2) c - chol(m)# Choleski decomposition u - matrix(rnorm(2000*5), ncol=5) uc - u %*% c cr - pnorm(uc) cr - qbinom(cr,1,0.5) cor(cr) I expected that the cor(cr) to be 0.2

Re: [R] Choleski decomposition

2012-11-30 Thread David Winsemius
On Nov 30, 2012, at 10:34 AM, jaybell wrote: m - matrix(nrow=5, ncol=5) m - ifelse(row(m)==col(m), 1, 0.2) c - chol(m)# Choleski decomposition u - matrix(rnorm(2000*5), ncol=5) uc - u %*% c cr - pnorm(uc) cr - qbinom(cr,1,0.5) cor(cr)

Re: [R] bootstrapped cox regression (rms package)

2012-11-30 Thread Frank Harrell
It will be crucial to know the details of the test statistic and P-value calculations from SPSS. It's also running anova on both the bootcov and the original fits to see if SPSS is ignoring the bootstrap when computing the covariance matrix. Frank Eric Claus wrote Hi Frank, My apologies for

[R] Line numbers with errors and warnings?

2012-11-30 Thread Worik R
Is it possible to get a line number with an error report? I have a long script and an error: Error in `[.xts`(x, xsubset) : subscript out of bounds It would be very helpful, and save a lot of time, if there was some indication in the error message which line the error was. I can find it using

Re: [R] Line numbers with errors and warnings?

2012-11-30 Thread jim holtman
One thing that I do when I have a long script is to put progress report messages. These have some comments so I can chart the progress and also print out the current CPU and memory usage so I can also isolate where potential problems might be. This will help narrow down the section of code where

Re: [R] Line numbers with errors and warnings?

2012-11-30 Thread David Winsemius
On Nov 30, 2012, at 1:22 PM, Worik R wrote: Is it possible to get a line number with an error report? I have a long script and an error: Error in `[.xts`(x, xsubset) : subscript out of bounds It would be very helpful, and save a lot of time, if there was some indication in the error

[R] (no subject)

2012-11-30 Thread bibek sharma
Hello R usuer, The code given below superimposes a pie diagram on another plot containing some points. However, I would like to center the pie diagram on the xy location on the plot, but not on the center. is there any way to re-center pic diagram. Any suggestion or better alternative are highly

Re: [R] Reading .gsheet within R

2012-11-30 Thread Rui Barradas
Hello, Package sos does a good job at finding things available for R. library(sos) findFn('gsheet') found 0 matches x has zero rows; nothing to display. Warning message: In findFn(gsheet) : HIT not found in HTML; processing one page only. So I guess there's nothing yet. Hope this helps,

Re: [R] (no subject)

2012-11-30 Thread William Dunlap
Try subplot() from the TeachingDemos package. E.g., plot(c(1,2,3), c(1,3,2), xlim=c(0,5), ylim=c(0,10)) subplot(pie(1:5), x=4, y=6) abline(h=6, v=4) subplot(pie(1:5), x=1, y=8, size=c(0.5, 0.5)) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message-

Re: [R] Reading .gsheet within R

2012-11-30 Thread Marc Schwartz
Hi, I don't know if the information is still current, but there were some discussions a while back pertaining to reading Google Docs documents in R. There is a blog post here from David Smith that might be helpful:

[R] Workarounds to Rd file name conflict when extending a S4 method of some other package

2012-11-30 Thread Janko Thyson
Dear list, // IN SHORT // What are possible workarounds to consolidate documentation for S4 methods that are scattered across different packages (generic and some custom methods in one package, additional custom methods in another package) in a *single* Rd help file while using package

Re: [R] qbinom

2012-11-30 Thread jaybell
sorry, I repost the question again a=c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) b=c(0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1) cor(a,b)= -1 pa=qbinom(a, 1, 0.5) pb=qbinom(b, 1, 0.5) cor(pa,pb)=-0.8 but when pa=qbinom(a,10,0.5) pb=qbinom(b,10,0.5) cor(pa,pb) becomes -1 again

[R] protentially serious R error

2012-11-30 Thread liuxf
Hi guy, I have recently encountered a problem while I was just trying to generate some random numbers with the function rnorm, the problem is shown below: case 1 rnorm(20*0.2) [1] -1.2765922 -0.5732654 -1.2246126 -0.4734006 case 2### * rnorm(20*(1-0.8)) [1]

[R] quantreg installation and conflicts with R 2.15.2

2012-11-30 Thread Brian S Cade
I recently lost the partitions on my hard drive (second time in 6 months) so I had to have our IT folks image all my files over to a new drive. I completely reinstalled R (now 2.15.2) and all my libraries to my computer (Dell Latitude running Windows 7). A few of my previous workspaces

Re: [R] How to add widgets of gWidgets to widgets of rgtk2 ???

2012-11-30 Thread jverzaniNWBKZ
For this it would be best to insert an intermediate group container, as its add method allows you to add the RGtk2 widgets. Something like: library(gWidgets) options(guiToolkit=RGtk2) library(RGtk2) w - gwindow() lyt - glayout(cont=w) lyt[1,1] - (g - ggroup(cont=lyt)) widget - gtkButton(click

Re: [R] subgroup-based quantiles

2012-11-30 Thread R Kozarski
Dear Arun and Rui, thank you for replying, your commands are very helpful. Before you replied, Ive solved the issue with the following approach (for quartiles): myFun - function(x, GENDER) { x.male - cut(x, labels=c(1:4), breaks=quantile(split(x,GENDER) $ '1', seq(0,1,.25),

[R] Fw: quantreg installation and conflicts with R 2.15.2

2012-11-30 Thread Brian S Cade
Just noticed that I get a similar error about object 'kronecker' in Matrix package when trying to load lme4. So this is a more pervasive problem. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 80526-8818 email:

[R] Training, Validation and Test Sets and LDA with MASS package

2012-11-30 Thread Roberto
Hi all, please, can someone give me an example of LDA with MASS package with training, validation and test sets? I never used it, so I need and example to avoid to make errors. Thank you very much. Best, Roberto -- View this message in context:

Re: [R] protentially serious R error

2012-11-30 Thread Sarah Goslee
Potentially serious? Only to you: this looks like R FAQ 7.31 striking again. Here's a hint: identical(20*(1-0.8), 4) and another rnorm(round(20*(1-0.8))) Sarah On Fri, Nov 30, 2012 at 4:05 PM, liuxf li...@math.mcmaster.ca wrote: Hi guy, I have recently encountered a problem while I was

Re: [R] protentially serious R error

2012-11-30 Thread Ted Harding
[See in-line below] On 30-Nov-2012 21:05:23 liuxf wrote: Hi guy, I have recently encountered a problem while I was just trying to generate some random numbers with the function rnorm, the problem is shown below: case 1 rnorm(20*0.2) [1] -1.2765922 -0.5732654 -1.2246126

  1   2   >