Re: [R] Performing stats on group of observations

2013-06-25 Thread Bert Gunter
... trying to figure it out ?? Not sure what that means.Have you read An Introduction to R.? If not, do so now. In any case, ?ave is made for what you want, I think (simpler than ?by). As in (if df is your data frame): ave(df$NoFlights,df$Week, FUN= mean) Or, better yet, using ?with and noting

[R] SP package

2013-06-25 Thread Dr. Alireza Zolfaghari
Hi list, I would like to write the function [R_point_in_polygon_sp] in c# as I found it a very efficiently written code due to its high speed calculation. I queried the function name by using sp::point.in.polygon, but could not get source code. Would someone let me know how to get the source code

[R] return output to console for copying as input

2013-06-25 Thread nevil amos
I want to print a vector of strings to the console formatted as if it were input X-c(a,b,c) X [1] a b c what I would like to get is the.function(X) a,b,c what is the function? cheers Nevil amos [[alternative HTML version deleted]] __

Re: [R] SP package

2013-06-25 Thread Rui Barradas
Hello, R is open source. You can download the source code for package sp. http://cran.r-project.org/web/packages/sp/index.html Hope this helps, Rui Barradas Em 25-06-2013 08:06, Dr. Alireza Zolfaghari escreveu: Hi list, I would like to write the function [R_point_in_polygon_sp] in c# as I

Re: [R] return output to console for copying as input

2013-06-25 Thread Rui Barradas
Hello, Maybe ?cat cat(X, \n) (But it doesn't put the vector elements between quotes.) Hope this helps, Rui Barradas Em 25-06-2013 08:14, nevil amos escreveu: I want to print a vector of strings to the console formatted as if it were input X-c(a,b,c) X [1] a b c what I would like to get

[R] x-labels in barplots

2013-06-25 Thread alfonso . carfora
Hi, I need to generate a barplot in in which the x-labels must to be perpendiculars to the x-axis in my data have a list of probability values correspondings to a list of Countries. In the barplot the name of each Country, under each bar, appears parallel to the x axis. Is possibile

[R] Time of day

2013-06-25 Thread Rguy
Is there a simple way to obtain the time of day in R? I want the time of day for computational purposes, not for display. I want to be able to create code like the following: if (time_of_day = 22:00 time_of_day = 06:00) then X otherwise Y I realize I could parse a date/time object and extract

Re: [R] packages for input messages

2013-06-25 Thread Francesco Miranda
I need something like the writeln in C. I need to make error messages Date: Mon, 24 Jun 2013 18:20:13 -0400 Subject: Re: [R] packages for input messages From: sarah.gos...@gmail.com To: kicco1...@hotmail.it CC: r-help@r-project.org It sounds like ?stop is what you're looking for. Sarah

Re: [R] return output to console for copying as input

2013-06-25 Thread Enrico Schumann
On Tue, 25 Jun 2013, nevil amos nevil.a...@gmail.com writes: I want to print a vector of strings to the console formatted as if it were input X-c(a,b,c) X [1] a b c what I would like to get is the.function(X) a,b,c what is the function? the.function - function(x) cat(paste0(\,

Re: [R] Time of day

2013-06-25 Thread Prof Brian Ripley
On 25/06/2013 06:59, Rguy wrote: Is there a simple way to obtain the time of day in R? I want the time of day for computational purposes, not for display. I want to be able to create code like the following: if (time_of_day = 22:00 time_of_day = 06:00) then X otherwise Y which will not parse

Re: [R] Time of day

2013-06-25 Thread Enrico Schumann
On Tue, 25 Jun 2013, Rguy r...@123mail.org writes: Is there a simple way to obtain the time of day in R? I want the time of day for computational purposes, not for display. I want to be able to create code like the following: if (time_of_day = 22:00 time_of_day = 06:00) then X otherwise Y

Re: [R] packages for input messages

2013-06-25 Thread Berend Hasselman
On 25-06-2013, at 10:19, Francesco Miranda kicco1...@hotmail.it wrote: I need something like the writeln in C. I need to make error messages Does C have a writeln? Have a look at cat: ?cat Berend Date: Mon, 24 Jun 2013 18:20:13 -0400 Subject: Re: [R] packages for input messages From:

[R] How to include ifelse condition to adjust QPLOT font size

2013-06-25 Thread Gundala Viswanath
I have a data which I plot using this code. Attached is the plot _BEGIN_ library(ggplot2) dat.m - read.delim(http://dpaste.com/1269939/plain/,sep=;) colnames(dat.m) - c(ensg,mirna_hgc,variable,value) dat.m.y - subset(dat.m,dat.m$variable==y) qplot(value,data=dat.m.y, geom=bar, origin=-0.05,

Re: [R] x-labels in barplots

2013-06-25 Thread Rui Barradas
Hello, Use graphic parameter las = 2. See the help for ?par. Hope this helps, Rui Barradas Em 25-06-2013 07:03, alfonso.carf...@uniparthenope.it escreveu: Hi, I need to generate a barplot in in which the x-labels must to be perpendiculars to the x-axis in my data have a list of probability

[R] Fetch and merge from a data set

2013-06-25 Thread Nico Met
Dear all, I would like to fetch a list (data1) of entities from a big data file (data) and merged together. for example: data is the file from where I want to extract dput(data) structure(list(NAME = structure(c(6L, 6L, 7L, 6L, 6L, 7L, 6L, 7L, 3L, 5L, 3L, 3L, 3L, 3L, 4L, 3L, 3L, 4L, 3L, 3L, 3L,

Re: [R] Fetch and merge from a data set

2013-06-25 Thread Rui Barradas
Hello, I'm not sure I understand, but it seems as simple as merge(data1, data) Hope this helps, Rui Barradas Em 25-06-2013 10:34, Nico Met escreveu: Dear all, I would like to fetch a list (data1) of entities from a big data file (data) and merged together. for example: data is the file

Re: [R] How to include ifelse condition to adjust QPLOT font size

2013-06-25 Thread Blaser Nello
If you want the size to depend on the data, then size needs to be inside aes(...). For instance: stat_bin(aes(label = sprintf(%.01f, (..count../288)*100), size=ifelse(..count..0, 2.5, 0)) ,color=red, vjust=-0.5, angle=0, geom=text) A better approach would be not to plot the unnecessary things at

Re: [R] Fetch and merge from a data set

2013-06-25 Thread Nico Met
Many thanks Rui, However If I want to extract only first column (data1) from data file, then how Can I do it? Thanks again Nico On Tue, Jun 25, 2013 at 11:43 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, I'm not sure I understand, but it seems as simple as merge(data1, data)

Re: [R] Fetch and merge from a data set

2013-06-25 Thread Rainer Schuermann
Is merge( data[1], data1 ) what you want? On Tuesday 25 June 2013 12:00:23 Nico Met wrote: Many thanks Rui, However If I want to extract only first column (data1) from data file, then how Can I do it? Thanks again Nico On Tue, Jun 25, 2013 at 11:43 AM, Rui Barradas

[R] any news about resetting last.warning - warnings()

2013-06-25 Thread Knut Krueger
Hi to all, I need a possibility do delete the last warning to write the suitable warning (not the last warning from minutes ago) into a file. I found a lot of treats but no really solution. Regards Knut __ R-help@r-project.org mailing list

[R] Issue with Imports in NAMESPACE

2013-06-25 Thread Søren Højsgaard
Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have

[R] Calculate geometric mean with tapply

2013-06-25 Thread Shane Carey
Hi, I am trying to calculate the geometric mean with tapply. This is the formula I am using: exp(tapply(log(data$value), data$group, mean)) However, it returns the arithmetic mean. Any ideas? Thanks -- Shane [[alternative HTML version deleted]]

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Duncan Murdoch
On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports:

Re: [R] Lexical scoping is not what I expect

2013-06-25 Thread Duncan Murdoch
On 13-06-24 9:22 PM, David Kulp wrote: Indeed, I misread / misunderstood. I think it's a difficult concept that's hard to explain and the example wasn't great. But thanks all for straightening me out! It seems like a really natural definition to me, but I'm used to it. Once you get used to it

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Søren Højsgaard
Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). Thanks! Søren -Original Message- From: Duncan Murdoch

Re: [R] Calculate geometric mean with tapply

2013-06-25 Thread Rui Barradas
Hello, You can write a function gmean and tapply it to your data. gmean - function(x, na.rm = FALSE){ if(na.rm) x - x[!is.na(x)] n - length(x) prod(x)^(1/n) } tapply(data$value, data$group, gmean) Hope this helps, Rui Barradas Em 25-06-2013 11:58, Shane Carey

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Duncan Murdoch
On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). It is mentioned that they can be exported. The

Re: [R] Calculate geometric mean with tapply

2013-06-25 Thread Shane Carey
Thanks for your help, put I've tried that and it still gives me back the mean when I use it within tapply for some reason On Tue, Jun 25, 2013 at 12:17 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, You can write a function gmean and tapply it to your data. gmean - function(x, na.rm

Re: [R] Problem with dea.boot under R 3.0.1

2013-06-25 Thread Vera
... we used the following syntax: b.x1a.y1-dea.boot(x1a,y1,NREP=1000,RTS=vrs, ORIENTATION=in) Vera -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-dea-boot-under-R-3-0-1-tp4669964p4670271.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Fetch and merge from a data set

2013-06-25 Thread arun
HI, Try this: merge(data,data1[NAME]) A.K. - Original Message - From: Nico Met nicome...@gmail.com To: Rui Barradas ruipbarra...@sapo.pt Cc: R help r-help@r-project.org Sent: Tuesday, June 25, 2013 6:00 AM Subject: Re: [R] Fetch and merge from a merge(dat1[NAME],dat2) data set Many

Re: [R] Calculate geometric mean with tapply

2013-06-25 Thread PIKAL Petr
Hm -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Shane Carey Sent: Tuesday, June 25, 2013 1:25 PM To: Rui Barradas Cc: r-help@r-project.org Subject: Re: [R] Calculate geometric mean with tapply Thanks for your help,

Re: [R] SP package

2013-06-25 Thread Albin Blaschka
Hello, or, simply input at the R-prompt point.in.polygon - without any brackets or so, but with the sp-package loaded...? HTH, Albin Am 25.06.2013 09:28, schrieb Rui Barradas: Hello, R is open source. You can download the source code for package sp.

Re: [R] Calculating an index of colocation for a large dataset

2013-06-25 Thread Adams, Jean
Bree, You should cc r-help on all correspondence so that the thread of conversation is maintained for all readers. And you shouldn't attach any files. If you want to share some data, used dput(). For example, dput(head(whale)) dput(head(prey)) Give this code a try ... Note that I don't know

Re: [R] Unique matching of two sets of multidimensional data

2013-06-25 Thread Adams, Jean
You could give 1-nearest neighbor classification a try. For example, a - data.frame(person=1:10, ht=rnorm(10, mean=5, sd=1), wt=rnorm(10, mean=180, sd=30), bp=rnorm(10, mean=120, sd=10)) meas.err - data.frame(ht=rnorm(10, sd=0.1), wt=rnorm(10, sd=3), bp=rnorm(10, sd=1)) b - (a[, -1] +

[R] do.call environment misunderstanding

2013-06-25 Thread Dan Murphy
I am having difficulty understanding the envir argument of do.call. The help page says envir an environment within which to evaluate the call. so I thought that in the following toy example x would be found in the environment e and f would return 4 via do.call: e - new.env() e$x - 2 f -

[R] error in VaR calculation

2013-06-25 Thread G Girija
Hi, I am your member. Pl help me with the solution. rgds [[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

[R] error in VaR calculation

2013-06-25 Thread G Girija
The code is as follows: monthreturns-read.zoo('monthlyReturn date.csv',sep=,,header=T) monthreturns-as.xts(monthreturns,order.by =index(monthreturns),frequency=NULL)*W0 head(monthreturns) dim(monthreturns) portnames-c('acc','cipla','cmc','idbi','ifci') portfolio names (5 stocks)

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread luke-tierney
On Tue, 25 Jun 2013, Duncan Murdoch wrote: On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). It

Re: [R] do.call environment misunderstanding

2013-06-25 Thread Duncan Murdoch
On 25/06/2013 9:32 AM, Dan Murphy wrote: I am having difficulty understanding the envir argument of do.call. The help page says envir an environment within which to evaluate the call. so I thought that in the following toy example x would be found in the environment e and f would return 4 via

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Martin Morgan
On 06/25/2013 01:19 PM, Duncan Murdoch wrote: On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). It

Re: [R] Calculate geometric mean with tapply

2013-06-25 Thread Shane Carey
Sorry, my fault. a problem with the data I was working with. Whoopsadaisey. Thanks all. Cheers On Tue, Jun 25, 2013 at 1:50 PM, PIKAL Petr petr.pi...@precheza.cz wrote: Hm -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Søren Højsgaard
R CMD check does complain and I had to add \alias{maxClique} in an .Rd file (I did it this way to prevent downstream packages from failing). Regards Søren -Original Message- From: luke-tier...@uiowa.edu [mailto:luke-tier...@uiowa.edu] Sent: 25. juni 2013 15:50 To: Duncan Murdoch Cc:

[R] A question on vector

2013-06-25 Thread Christofer Bogaso
Hello again, I have found that, in a vector if many elements have same names then calling those elements with their names does not look complete. Here is 1 example: My_Vector - c(a = 'a', a = 'b') then, My_Vector['a'] a a I was expecting both elements should be shown up. Is there any

Re: [R] A question on vector

2013-06-25 Thread David Carlson
My_Vector[names(My_Vector)==a] - David L Carlson Associate Professor of Anthropology Texas AM 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 Christofer

Re: [R] error in VaR calculation

2013-06-25 Thread Joshua Ulrich
r != R (you mis-typed the first argument to VaR). This works: library(PerformanceAnalytics) data(sample_matrix) x - Return.calculate(as.xts(sample_matrix)) VaR(R=x, p=0.99, method=historical) Best, -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com On Tue, Jun 25,

[R] creat raster from XYZ

2013-06-25 Thread Shane Carey
Hi, I have a data set consisting of XYZ data. the dimensions are 22427 rows by 3 columns. I try to use rasterFromXYZ from the raster package but I get the following error: Error in rasterFromXYZ(DATA) : x cell sizes are not regular Any help would be appreciated. Thanks -- Shane

Re: [R] Calculate geometric mean with tapply

2013-06-25 Thread arun
May be this also works:  exp(mean(log(abs(x #[1] 0.4985282 A.K. - Original Message - From: PIKAL Petr petr.pi...@precheza.cz To: Shane Carey careys...@gmail.com Cc: r-help@r-project.org r-help@r-project.org Sent: Tuesday, June 25, 2013 8:50 AM Subject: Re: [R] Calculate geometric

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Prof Brian Ripley
On 25/06/2013 14:50, luke-tier...@uiowa.edu wrote: On Tue, 25 Jun 2013, Duncan Murdoch wrote: On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not

[R] having trouble installing RDieHarder

2013-06-25 Thread Mikhail Umorin
Hello, I am having trouble installing the package from CRAN. As the package compiles I get: * installing *source* package ‘RDieHarder’ ... ** package ‘RDieHarder’ successfully unpacked and MD5 sums checked checking for gcc... gcc checking for C compiler default output file name...

Re: [R] do.call environment misunderstanding

2013-06-25 Thread Dan Murphy
So the trick is to put the function f into e and define its environment to be e: e - new.env() e$f - function() x^2 environment(e$f) - e e$x - 2 do.call(f, list(), envir = e) [1] 4 Thanks, Duncan. On Tue, Jun 25, 2013 at 6:49 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 25/06/2013

Re: [R] Calculate geometric mean with tapply

2013-06-25 Thread Shane Carey
I got it to work, sorry my fault, there was a problem with the data. Thanks On Tue, Jun 25, 2013 at 4:13 PM, arun smartpink...@yahoo.com wrote: May be this also works: exp(mean(log(abs(x #[1] 0.4985282 A.K. - Original Message - From: PIKAL Petr petr.pi...@precheza.cz

[R] How can C++ read the R object written into socket with saveRDS or save

2013-06-25 Thread Rong lI Li
Hi, all, Recently, I met one issue when using socket between R C++ to transmit R object. Would you pls help give me some suggestions? Many thanks! [Background]: I create a socket connection between R C++ binary first, and then, want to use saveRDS() or save() in R to save the object into

Re: [R] Fwd: Questions about working with a dataframe

2013-06-25 Thread John Kane
Hi, welcome to R Try using the function str() on both files so str(WWA) and str(oWWA) and compare the structures that you get. Probably one of the varables you defined when creating the original WWA data set has changed from a character variable to a factor or vis versa. It is a good idea to

Re: [R] Fwd: Questions about working with a dataframe

2013-06-25 Thread David Winsemius
On Jun 25, 2013, at 8:57 AM, John Kane wrote: Hi, welcome to R Try using the function str() on both files so str(WWA) and str(oWWA) and compare the structures that you get. Probably one of the varables you defined when creating the original WWA data set has changed from a character

Re: [R] Loops

2013-06-25 Thread bett kimutai
Dear All, I  have spent most of my time trying to figure out how to simulate the number of breaks in a pipe using monte carlo simulation. i have 20,000 individual pipes that i have to run, and for each pipe i have to run 1000 times while checking some conditions and therefore, i have to use a

Re: [R] Fwd: Questions about working with a dataframe

2013-06-25 Thread John Kane
Ouch. My apologies David, after reading the message I didn't bother to look at the txt file. John Kane Kingston ON Canada -Original Message- From: dwinsem...@comcast.net Sent: Tue, 25 Jun 2013 09:09:15 -0700 To: jrkrid...@inbox.com Subject: Re: [R] Fwd: Questions about working

Re: [R] how to add any extra word to existing column heading in R

2013-06-25 Thread John Kane
names(height) - paste0(names(height),.D1) It would be better if you supplied the data using dput() Have a lookt at https://github.com/hadley/devtools/wiki/Reproducibility for some suggestions on forming a good question. John Kane Kingston ON Canada -Original Message- From:

Re: [R] do.call environment misunderstanding

2013-06-25 Thread Duncan Murdoch
On 25/06/2013 11:56 AM, Dan Murphy wrote: So the trick is to put the function f into e and define its environment to be e: Putting f into e, and defining the environment of f to be e solve different problems. Your toy example has both problems so it's a reasonable solution there, but most

[R] confidence interval in rpart

2013-06-25 Thread puja makkar
Hi, I am using rpart with method=anova.Can we compute 95% confidence intervals and prediction interval for the predicted mean at each node? Thanks, Puja [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Duncan Murdoch
On 25/06/2013 1:03 PM, Duncan Murdoch wrote: On 25/06/2013 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)).

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Duncan Murdoch
On 25/06/2013 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). Yes, from the followup discussion it's clear

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Bryan Hanson
By chance is any of this related to what I'll call the 'depends relay' discussed in this SO post? http://stackoverflow.com/a/8638902/633251 (see the 'caveat' to Josh O'Brien's answer, which also links back to another answer by Martin Morgan). This issue has happened to me and the symptoms are

[R] R CMD BATCH Unicode

2013-06-25 Thread Ned Harding
Hey, I am looking for some help using Unicode with R CMD BATCH on windows. In particular I would like my input and output files to be UTF-8 encoded. My command line looks like this: r CMD BATCH --encoding=UTF-8 in.txt out.txt in.txt is utf-8 encoded and contains: print(éíôåëëåãåâáè)

[R] Stopping execution of running program in R

2013-06-25 Thread kathleen askland
Hello, Can anyone tell me how I can stop execution of a running program in R. I am using Revolution R Enterprise v. 6.2. There is no STOP button and both ESC and Ctrl+C do not work. Thank you for your suggestions. Kathleen --- Kathleen Askland, MD Assistant Professor Department of Psychiatry

[R] Heatmap with error message: `x' must be a numeric matrix

2013-06-25 Thread Gitte Brinch Andersen
Hi I am trying to do a heatmap, but I can't see what I am doing wrong. I get the error message: `x' must be a numeric matrix, but as far as I know I have changed my data into a matrix. The dataset I have in my example of my run is only a small part. I have around 1000 rows in total. I have

Re: [R] R CMD BATCH Unicode

2013-06-25 Thread Ned Harding
Just to clarify: The encoding didn't come through in the email. print(éíôåëëåãåâáè) is meant to be a bunch of random greek characters. Ned. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ned Harding Sent: Tuesday, June 25, 2013

Re: [R] Stopping execution of running program in R

2013-06-25 Thread Duncan Murdoch
On 25/06/2013 2:34 PM, kathleen askland wrote: Hello, Can anyone tell me how I can stop execution of a running program in R. I am using Revolution R Enterprise v. 6.2. There is no STOP button and both ESC and Ctrl+C do not work. Thank you for your suggestions. You will need to ask Revolution

Re: [R] Heatmap with error message: `x' must be a numeric matrix

2013-06-25 Thread Rui Barradas
Hello, Your data has commas as decimal points, R uses the period. So the data is read in as strings, not numbers. You can change this by using argument 'dec' of read.table: ?read.table read.table(...etc..., dec = ,) Or you can replace the commas with periods: data[] - sapply(data,

[R] censor=FALSE and id options in survfit.coxph

2013-06-25 Thread Andrews, Chris
all at once if that change can be made. Chris # # CODE # create data set.seed(20130625) n - 100 # sample size x - rbinom(n, 1, 0.5) # covariate z - rep(0, n) # start time y - rexp(n, exp(x)) # event time e - y 2 # censor at 2 y - pmin(y, 2) # observation time

[R] Correct scaling of axis in persp3d plot

2013-06-25 Thread Ivanov Ruporvrich
Hi, I want to format my axis in my persp3d plot. With my data, which I attached I created a persp3d plot with the following code, which I summarized from different code snippets I found: library(rugarch)library(rgl)library(fGarch)fd -as.data.frame(modelfit,which ='density')color

[R] Loops

2013-06-25 Thread bett kimutai
Dear All, I  have spent most of my time trying to figure out how to simulate the number of breaks in a pipe using Monte Carlo simulation. i have 20,000 individual pipes that i have to run, and for each pipe i have to run 1000 times while checking some conditions and therefore, i have to use a

Re: [R] Calculating an index of colocation for a large dataset

2013-06-25 Thread Bree W
My apologies for cross-posting and for failing to reply to r-help. I'll get the hang of it. This code seems to be getting me quite close, but I've encountered the following error. Error in compute(dat, depths, fish, zoop) : attempt to apply non-function -- View this message in context:

Re: [R] Correct scaling of axis in persp3d plot

2013-06-25 Thread David Winsemius
On Jun 25, 2013, at 12:40 PM, Ivanov Ruporvrich wrote: Hi, I want to format my axis in my persp3d plot. With my data, which I attached You may have attached it ... but you probably didn't read the information about what would be accepted by the mail server. Read the listinfo page linked

[R] Psych package: Error in biplot.psych(sample.mod) : Biplot requires factor/component scores:

2013-06-25 Thread Simon Kiss
Hello: I'm trying to construct a biplot from the psych package. The underlying data frame looks just like sample.data, below. I turned it into a polychoric correlation matrix sample.cor, below, as it is derived from a series of Likert (ordinal) items. All are positive, I just used negative

Re: [R] Loops

2013-06-25 Thread Law, Jason
Not sure what you're trying to do, but it looks like most of what you're attempting to do in the code can be done just using vectors rather than loops, at least the inner loop. For example: k - 1.15 l - exp((1 / k) * (7.16 - 0.44 + 0.12 - 0.016)) z - (log(1 / p) * l)^k See ifelse for how to

Re: [R] Legal issue help

2013-06-25 Thread Dr. T. Imam
Hi, Thank you very much for your replies. Regards, Dr. T. Imam On Sun, Jun 23, 2013 at 10:24 PM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 23/06/2013 12:59, Uwe Ligges wrote: On 23.06.2013 01:50, Dr. T. Imam wrote: Hi, I am new to this forum, and hopefully am sending the post to

Re: [R] do.call environment misunderstanding

2013-06-25 Thread Dan Murphy
My problem is to evaluate a function/model whose definition and parameters (I'll put x into the arguments) and other data are saved by someone else in an Rdata file, but I don't know the function name, definition or data. Nevertheless, I need to save whatever functional values/model solutions are

[R] Comparing each level of a factor to the global mean

2013-06-25 Thread Shaun Jackman
Hi, I've used `lm` to create a linear model of a continuous variable against a factor variable with four levels using an example R data set (see below). By default, it uses a treatment contrast matrix that compares each level of the factor variable with the first reference level (three

Re: [R] Loops

2013-06-25 Thread bett kimutai
Thanks for you response. The issue is that I need to run a thousand simulations for each pipe (2) and then get an average of the values that are below the condition I have set. When I ran the code, I only get just a thousand values meaning it gives me values for a single pipe. How can I

Re: [R] do.call environment misunderstanding

2013-06-25 Thread David Winsemius
On Jun 25, 2013, at 6:05 PM, Dan Murphy wrote: My problem is to evaluate a function/model whose definition and parameters (I'll put x into the arguments) and other data are saved by someone else in an Rdata file, but I don't know the function name, definition or data. Nevertheless, I need to