Re: [R] histogram of time-stamp data

2012-07-17 Thread e-letter
On 16/07/2012, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Em 16-07-2012 22:45, e-letter escreveu: On 16/07/2012, r-help-requ...@r-project.org r-help-requ...@r-project.org wrote: -- Message: 77 Date: Mon, 16 Jul 2012 10:48:39 +0100 From:

Re: [R] histogram of time-stamp data

2012-07-17 Thread Rui Barradas
Hello, That's not the error I've had. You must be aware that read.table creates a data.frame and therefore the object 'timestamps' is NOT holding time stamps, it's holding a vector, 'V1', of time stamps. timestamps - read.table(text= 12:19:00 09:30:00 16:56:00 01:56:00 10:44:00 10:31:00

Re: [R] Imposing more than one condition to if

2012-07-17 Thread Rui Barradas
Hello, My code couldn't find the right input columns because your real data has different names, it could only find the example dataset's names. And there's another problem, my code would give correct answers with a limted number of possible inputs and fail with real data. Corrected: f -

Re: [R] enquiry

2012-07-17 Thread Rui Barradas
Hello, Sorry, but I'm not at my computer and will be away from it for 2 or 3 days, so I can't install package XLConnect and see what's going on. Heve you tried the functions to get sheets first? (by number, maybe.) Rui Barradas Em 16-07-2012 22:30, Erdal Karaca escreveu: Just tried

[R] Problem creation tensor

2012-07-17 Thread Peppe Ricci
Hi guys, I need some help to analyzing my data. I start to describe my data: I have 21 matrices, every matrix on the rows has users and on columns has items, in my case films. Element of index (i, j) represent the rating expressed by user i about item j. I have a matrix for each of professions.

[R] subsetting without losing the attributes

2012-07-17 Thread MK
Hi, How do I use the subset function without losing the attributes? For example, test.df - data.frame(a = rnorm(100), b = runif(100), c = rexp(100)) attr(test.df[, 1], units) - c(cm) attr(test.df[, 2], units) - c(kg) attr(test.df[, 3], units) - c(ha) ## We want this behavior str(test.df[, a,

[R] how to create table with file link in Rd File

2012-07-17 Thread purushothaman
Hi how to create table with file link in Rd File Thanks B.Purushothaman -- View this message in context: http://r.789695.n4.nabble.com/how-to-create-table-with-file-link-in-Rd-File-tp4636740.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] how to create table with file link in Rd File

2012-07-17 Thread Jessica Streicher
I think you need to elaborate a bit. At least I get no idea of what you want from that one sentence. On 17.07.2012, at 13:44, purushothaman wrote: Hi how to create table with file link in Rd File Thanks B.Purushothaman -- View this message in context:

Re: [R] how to create table with file link in Rd File

2012-07-17 Thread purushothaman
Hi, i need to create table like this --- module name class namefunction name

Re: [R] how to create table with file link in Rd File

2012-07-17 Thread Eik Vettorazzi
Hi, I think \tabular does what you want, see see http://cran.r-project.org/doc/manuals/R-exts.html#Lists-and-tables hth. Am 17.07.2012 14:45, schrieb purushothaman: Hi, i need to create table like this

Re: [R] how to create table with file link in Rd File

2012-07-17 Thread Jessica Streicher
Try again please, so you have a table/dataframe or some such with 4(?) columns: module_name, class_name, function_name and function_description I guess under the second line shall be an example of data in the table, but i cannot see what belongs to what column. If you have an example table

Re: [R] how to create table with file link in Rd File

2012-07-17 Thread Jessica Streicher
Oh, i think i get it now, you're talking about formatting a table in a documentation file? On 17.07.2012, at 14:45, purushothaman wrote: Hi, i need to create table like this

Re: [R] how to create table with file link in Rd File

2012-07-17 Thread purushothaman
Yes your right , pls tell how do format table in Rd files Thanks B.Purushothama -- View this message in context: http://r.789695.n4.nabble.com/how-to-create-table-with-file-link-in-Rd-File-tp4636740p4636747.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] variable (column) in a data frame

2012-07-17 Thread Paulo Barata
Dear Frans and Peter, Yes, the notation df[,'var'] is able to catch a non-existent variable var inside a data frame df. But the notation df$var isn't. So we have this situation, where two different notations, which (as far as I understand) perform the same action, have different kinds of

Re: [R] Cost Effectiveness Example

2012-07-17 Thread Marc Schwartz
On Jul 16, 2012, at 6:55 PM, Noah Silverman wrote: Hello, I'm tasked with putting together a cost effectiveness analysis on a proposed medical treatment. The standard suggested by someone is an expensive commercial package names TreeAge Pro which looks like its just a fancy GUI on top

[R] NA instead of time stamp

2012-07-17 Thread Yolande Tra
I was wondering why I get NA instead of the timestamp in the following. Thanks. dataDir - file.path(wd) localRaw - read.csv(file.path(dataDir,LOCAL.csv), as.is=T,stringsAsFactors = FALSE) localRaw[1:2,] Year Month Day hour minute second Temp1mab Temp7mab Temp14mab Salinity1mab 1 200910

Re: [R] variable (column) in a data frame

2012-07-17 Thread Sarah Goslee
Hi, On Tue, Jul 17, 2012 at 10:40 AM, Paulo Barata paulo.bar...@ensp.fiocruz.br wrote: Dear Frans and Peter, Yes, the notation df[,'var'] is able to catch a non-existent variable var inside a data frame df. But the notation df$var isn't. So we have this situation, where two different

Re: [R] variable (column) in a data frame

2012-07-17 Thread Bert Gunter
Inline below. -- Bert On Tue, Jul 17, 2012 at 7:40 AM, Paulo Barata paulo.bar...@ensp.fiocruz.brwrote: Dear Frans and Peter, Yes, the notation df[,'var'] is able to catch a non-existent variable var inside a data frame df. But the notation df$var isn't. So we have this situation, where

[R] comparing three vectors

2012-07-17 Thread arunkumar1111
Hi I 've a data a=c(10,20,30) b=c(100,200,300) c=c(50,60,70) I want to compare a[1]=c[1]b[1],.. How to compare for all the records - Thanks in Advance Arun -- View this message in context: http://r.789695.n4.nabble.com/comparing-three-vectors-tp4636728.html Sent from the R

[R] How to use a text in an object of class character position to create a vector with the text as name

2012-07-17 Thread benji
Hello, titletool-read.csv(TotalCSVData.csv,header=FALSE,sep=,) class(titletool) [1] data.frame titletool[1,1] [1] Experiment name : CONTROL DB AD_1 t-titletootl[1,1] t [1] Experiment name : CONTROL DB AD_1 class(t) [1] character now i want to create an object (vector) with the name

[R] TRUE/FALSE

2012-07-17 Thread cm
Any reason I'd get an error like this? Error in if (round(pos[o + 1]) == (pos[o + 1] - 0.4)) { : missing value where TRUE/FALSE needed but when i do it individually, out of the for loop, (round(pos[o+1])==(pos[o+1]-.4) ) 65 TRUE -- View this message in context:

Re: [R] comparing three vectors

2012-07-17 Thread andrija djurovic
Hi. Try this: a=c cb Andrija On Tue, Jul 17, 2012 at 9:02 AM, arunkumar akpbond...@gmail.com wrote: Hi I 've a data a=c(10,20,30) b=c(100,200,300) c=c(50,60,70) I want to compare a[1]=c[1]b[1],.. How to compare for all the records - Thanks in Advance Arun

[R] about dpik

2012-07-17 Thread chester123
Thanks in advance here. I use dpik() function to calculate the bandwidth h. Following is the related code: h-dpik(x,scalest=minim,level=2L,kernel=normal,canonical=FALSE,gridsize=401L,range.x=range(x),truncate=TRUE) But there is warning messages: 1: In bkfe(gcounts, 6L, alpha, range.x = c(sa,

Re: [R] how to create table with file link in Rd File

2012-07-17 Thread Jessica Streicher
Yepp, that makes much more sense, look at Eiks post for an answer. I'm terribly sorry, i confused Rd with RData. On 17.07.2012, at 15:18, Jessica Streicher wrote: Oh, i think i get it now, you're talking about formatting a table in a documentation file? On 17.07.2012, at 14:45,

[R] Building a web risk calculator based on Cox PH--definitive method for calculating probability?

2012-07-17 Thread vokey588
Hello all, I am a medical student and as a capstone for my summer research project I am going to create a simple online web calculator for users to input their relevant data, and a probability of relapse within 5 years will be computed and returned based on the Cox PH model I have developed. The

[R] simulating survival data according to covariate values

2012-07-17 Thread Andres LaCortadora
Hi, I'd like to simulate survival times according to continuous covariate values. Suppose we have a continuos covariate whose value of zero corresponds to a mean survival time of 180 days and whose value of 0.5 corresponds to a mean survival time of 240 days. How can I use this information to

Re: [R] How to use a text in an object of class character position to create a vector with the text as name

2012-07-17 Thread Sarah Goslee
In general, you use assign() to do that, but having object names containing spaces should be avoided. mytext - Experiment name : CONTROL DB AD_1 mytext [1] Experiment name : CONTROL DB AD_1 mytext - sub(Experiment name : , , mytext) mytext [1] CONTROL DB AD_1 assign(mytext, 1:10) ls() [1]

Re: [R] TRUE/FALSE

2012-07-17 Thread Sarah Goslee
What's pos? What's o? What is your loop looping over? Where's your reproducible example provided using dput()? And more generally, have you read R FAQ 7.31 and the posting guide? Most likely either o is wrong, or there are NA values in pos, but we have no way to diagnose that. Sarah On Tue,

Re: [R] Confidence interval for Support Vector Regression

2012-07-17 Thread João Oliveirinha
Have you found a solution for this? I am also trying to find a way to retrieve the confidence intervals for the predictions. Best regards, João Oliveirinha On Sunday, October 30, 2011 7:04:03 PM UTC, Muhammed Akbulut wrote: Hi, Is it possible to calculate confidence intervals for support

[R] Threshold Quantile Regression code CRASHES in R

2012-07-17 Thread Christos Michalopoulos
I am working on a two stage threshold quantile regression model in R, and my aim is to estimate the threshold of the reduced-form equation (call it rhohat), and the threshold of the structural equation (call it qhat), in two stages. On the first stage, i estimate rhohat by quantile

[R] Stats question: Comparison of the same individuals during two exposure times

2012-07-17 Thread natalie.vanzuydam
Hi, I'm hoping that someone will be able to help. I would like to compare how covariates associate with the risk of a binary outcome during two periods. Period 1 will be non-exposure to a treatment and period 2 will be exposure to a treatment. The same individuals will be examined in each

[R] bestglm - number of variables

2012-07-17 Thread pieniu
Hello, I have a question concerning the bestglm procedure (function that finds the best subset of explanatory variables for the variable we want to model by checking all possible models), available in the package bestglm. When I use the function for a database that has over 45 variables (that is

[R] complexity of operations in R

2012-07-17 Thread Johan Henriksson
Hello! I am optimizing my code in R and for this I need to know a bit more about the internals. It would help tremendously if someone could link me to a page with O()-complexities of all the operations. In this particular case, I need something like a linked list with O(1) insertLast/First

[R] aligning image with bar plot in the same plot

2012-07-17 Thread Tiago R M
Dear Mailing list, I want to plot a matrix using image() and on its side I want to give information to every line of the matrix using colors. I tried to use barplot, but cannot align the two plots. Code below. I succeed in doing what I want using another image() plot, but was wondering whether

[R] Script help: Determining Time Difference between two data points.

2012-07-17 Thread APOCooter
I have the following data (a subset of the real data set): structure(list(Date = structure(c(1209625080, 1209641460, 1209652500, 1209676800, 1209682860, 1209692100, 1209706980, 1209722580, 1209726300, 1209739620, 1209762780, 1209765720, 1209770520, 1209791040, 1209812580, 1209829920,

Re: [R] {Link Suspeito} Re: variable (column) in a data frame

2012-07-17 Thread Paulo Barata
Dear Bert and Sarah, Thank you very much for your clarifications on this matter. I will have to study more closely the way extracting subsets of data structures is performed, and I will change my programming habits accordingly. Best regards, Paulo Barata

[R] R2WinBUGS

2012-07-17 Thread PRAGYA SUR
Dear R users, Can anyone tell me why I might get the error message the array index is greater than the upper bound for t in WinBUGS ? t is a vector I have defined. I have checked repeatedly that the array index for t does match with the upper bound till which the loop is run. I

Re: [R] Stats question: Comparison of the same individuals during two exposure times

2012-07-17 Thread Bert Gunter
I would STRONGLY recommend that you talk to your local statistician. Further: 1. R-help is not a statistical consulting forum 2. Remote statistical consulting is very risky due to the inherent difficulty in communicating all essential context of the problem and data. You have been warned! --

Re: [R] histogram of time-stamp data

2012-07-17 Thread e-letter
On 17/07/2012, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, That's not the error I've had. You must be aware that read.table creates a data.frame and therefore the object 'timestamps' is NOT holding time stamps, it's holding a vector, 'V1', of time stamps. Was not aware of the

Re: [R] Script help: Determining Time Difference between two data points.

2012-07-17 Thread William Dunlap
Does this do what you want? firstInRun - function(x) c(TRUE, x[-1] != x[-length(x)]) lastInRun - function(x) c(x[-1] != x[-length(x)], TRUE) f - function(data, condition) { + with(data, data.frame(startDate = Date[firstInRun(condition)], + endDate =

[R] R CMD build/check on Windows 7

2012-07-17 Thread Bert Gunter
Folks: sessionInfo() R version 2.15.0 (2012-03-30) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base

Re: [R] NA instead of time stamp

2012-07-17 Thread John Kane
I think that you need to supply some data with your question. Use dput() to output your data or a subset of it and paste the output into the email See ?dput for more information. Probably a subset of the data would be sufficient. Something like dput(head(localRaw, 50) should be fine.

Re: [R] Power analysis for Cox regression with a time-varying covariate

2012-07-17 Thread Greg Snow
One quick (though probably not canned) approach to get a feel for what an analysis might be like is to analyze a sample data set (from the survival package, a textbook, or a past analysis). Choose something that has some similarity to the planned study. Now look at the widths of the confidence

Re: [R] R CMD build/check on Windows 7

2012-07-17 Thread Prof Brian Ripley
On 17/07/2012 18:20, Bert Gunter wrote: Folks: sessionInfo() R version 2.15.0 (2012-03-30) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5]

[R] Nonparametric correlation with covariate

2012-07-17 Thread wnjiang
I am hoping to run a non-parametric correlation with a covariate. Unfortunately, for the two correlation I am running, one is not normally distributed and the other is categorical data. Therefore, I cannot use partial correlation for these two analysis. Any help would be greatly appreciated!

Re: [R] comparing three vectors

2012-07-17 Thread arun
Hi, Try this: dat1-data.frame(a,b,c) dat1[a=c bc,abc_check]-TRUE dat1    a   b  c abc_check 1 10 100 50  TRUE 2 20 200 60  TRUE 3 30 300 70  TRUE #or dat1-within(dat1,{abc_check-ifelse(a=c bc,TRUE,FALSE)})  dat1    a   b  c abc_check 1 10 100 50  TRUE 2 20 200 60  TRUE 3

Re: [R] NA instead of time stamp

2012-07-17 Thread arun
Hello, I think there is some mistake in the format. Try this: dat1-data.frame(Year=rep(2009,2),Month=rep(10,2),Day=rep(5,2),hour=rep(0,2),minute=c(0,15),second=c(11.288,11.258)) ###Your code  DateTime-with(dat1,paste(Year,Month,Day,hour,minute)) DateTime #[1] 2009 10 5 0 0  2009 10 5 0 15  

Re: [R] R CMD build/check on Windows 7 -- Please ignore

2012-07-17 Thread Bert Gunter
I will repost on R-devel. -- Bert On Tue, Jul 17, 2012 at 10:32 AM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 17/07/2012 18:20, Bert Gunter wrote: Folks: sessionInfo() R version 2.15.0 (2012-03-30) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United

Re: [R] R2WinBUGS

2012-07-17 Thread Michael Weylandt
Reproducible code? The error seems to be rather clear. Also, this seems more of a BUGS question than an R question. Michael On Jul 17, 2012, at 11:06 AM, PRAGYA SUR pragya1...@gmail.com wrote: Dear R users, Can anyone tell me why I might get the error message the array

Re: [R] How to use a text in an object of class character position to create a vector with the text as name

2012-07-17 Thread R. Michael Weylandt
On Tue, Jul 17, 2012 at 10:55 AM, Sarah Goslee sarah.gos...@gmail.com wrote: In general, you use assign() to do that, but having object names containing spaces should be avoided. mytext - Experiment name : CONTROL DB AD_1 mytext [1] Experiment name : CONTROL DB AD_1 mytext - sub(Experiment

Re: [R] R2WinBUGS

2012-07-17 Thread Uwe Ligges
On 17.07.2012 19:58, Michael Weylandt wrote: Reproducible code? The error seems to be rather clear. Also, this seems more of a BUGS question than an R question. Indeed, the reproducible code is somthing for a BUGS mailing list. just a guess: The typical row vs. column confusion in BUGS.

Re: [R] How to use a text in an object of class character position to create a vector with the text as name

2012-07-17 Thread Sarah Goslee
On Tue, Jul 17, 2012 at 2:23 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Tue, Jul 17, 2012 at 10:55 AM, Sarah Goslee sarah.gos...@gmail.com wrote: In general, you use assign() to do that, but having object names containing spaces should be avoided. mytext - Experiment name :

Re: [R] Warning message with read.csv.sql

2012-07-17 Thread Uwe Ligges
On 13.07.2012 14:00, Gabor Grothendieck wrote: On Thu, Jul 12, 2012 at 8:17 AM, Bharat Warule bwar...@gmail.com wrote: Hello, I am using read.csv.sql first time for reading the large data file.If I am ran this code that showns warning “closing unused connection”. Is it I am missing any

Re: [R] Imposing more than one condition to if

2012-07-17 Thread Santiago Guallar
Thank for your time, Rui.   Now, I get this error message: Error en rbind(deparse.level, ...) : numbers of columns of arguments do not match   Apparently, some columns have missing values and rbind doesn't work. I tried: require(plyr) do.call(rbind.fill, by(z, z$date, f))   Then the code runs

Re: [R] problem with installing R pacakges

2012-07-17 Thread Uwe Ligges
On 16.07.2012 14:45, Kishor Tappita wrote: Dear R- Users, I am unable to install R packages over the internet. Below is my session information. My guess is that this may be a proxy issue. I have set the http_proxy_user : my user id(network id) : password (machine password) . Maybe not

Re: [R] duplicate couples (time-id) Problem

2012-07-17 Thread Uwe Ligges
On 12.07.2012 17:38, Saint wrote: Hi! Would be grateful if somebody helped me understand this error message after trying to run a panel data: PanelData - read.xls(/Users/Bahman/Desktop/Taylor rule/Data/PanelData2.xls) attach(PanelData) # Panel Data regresson for all countrys. Answer -

Re: [R] aligning image with bar plot in the same plot

2012-07-17 Thread Uwe Ligges
Insert par(yaxs=i) after you are finsihed with the image. See ?par for details what is does. Uwe Ligges On 17.07.2012 13:13, Tiago R M wrote: Dear Mailing list, I want to plot a matrix using image() and on its side I want to give information to every line of the matrix using colors. I

Re: [R] Power analysis for Cox regression with a time-varying covariate

2012-07-17 Thread Marc Schwartz
Hi Greg and Paul, I had initially contemplated a solution similar to Greg's, which is simulation. However, I might just throw out, that if based upon Terry's comments, time varying covariates do not impact the power/sample size considerations for the Cox model, then Schoenfeld's 1983 article

Re: [R] aligning image with bar plot in the same plot

2012-07-17 Thread Luís F
Dear Uwe, Dear List, This is exactly it. I knew there had to be an easier way. And I had even looked up in par for it! Knowledge is a beautiful thing; thank you so much. On Tue, Jul 17, 2012 at 4:28 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: Insert par(yaxs=i) after you are

Re: [R] Threshold Quantile Regression code CRASHES in R

2012-07-17 Thread Thomas Lumley
On Tue, Jul 17, 2012 at 2:00 AM, Christos Michalopoulos mixalopoulo...@hotmail.com wrote: I am working on a two stage threshold quantile regression model in R, and my aim is to estimate the threshold of the reduced-form equation (call it rhohat), and the threshold of the structural

Re: [R] NA instead of time stamp

2012-07-17 Thread Rui Barradas
Hello, Print DateTime, and see what's wrong. When you paste(), you use the order ymd HM with space as separator but when you try to convert to POSIXct you pass a wrong format, not the one created by paste(). Solution: as.POSIXct(DAteTime, format=%Y %m %d %H %M) Hope this helps, Rui

Re: [R] Imposing more than one condition to if

2012-07-17 Thread Santiago Guallar
Thank for your time, Rui.   Now,  I get this error message: Error en rbind(deparse.level, ...) :   numbers of columns of arguments do not match Apparently, some columns have missing values and  rbind doesn't work. I tried: require(plyr) do.call(rbind.fill, by(z, z$date, f))   Then the code runs

[R] Maximum Likelihood estimation of KB distribution

2012-07-17 Thread chamilka
Hi, The following distribution is known as Kumaraswamy binomial Distribution. http://r.789695.n4.nabble.com/file/n4636782/kb.png For a given data I need to estimate the paramters (alpha and beta) of this distribution(Known as Kumaraswamy binomial Distribution, A Binomial Like Distribution). For

[R] Need Help in a Combinatorial Optimzation Problem

2012-07-17 Thread Chandramouli Banerjee
Dear Community, I have a problem I am trying to code in R. Suppose there are 7 products and each have a ROI value attached to it. There are 400 representatives who calls 150,000 customers with these product detailing and achieve sales through the calls. There is a cost per call and revenue

[R] Table/Frame - output

2012-07-17 Thread jcrosbie
I would like to output a nicely formatted data frame to a bitmap. Is this possible in R? -- View this message in context: http://r.789695.n4.nabble.com/Table-Frame-output-tp4636790.html Sent from the R help mailing list archive at Nabble.com. __

[R] about different bandwidths in one graph

2012-07-17 Thread chester123
Thank you in advance. Now I want to make comparison of the different bandwidth h in a normal distribution graph. This is the table of bandwidth h: thumb rule (normal)--0.00205; thumb rule(Epanech.)--0.00452; Plug-in (normal)--0.0009; Plug-in(Epanech.)--0.002. this is the condition: N=1010 data

[R] Installing packages from RProfile.site file

2012-07-17 Thread abhisarihan
I am trying to install custom packages upon starting R. A lot of the code that is written by us right now is available for editing to the users. To try and protect the code, I am packaging the production level code and having the users install it on their machine during start up. However, when I

Re: [R] Script help: Determining Time Difference between two data points.

2012-07-17 Thread APOCooter
Yes! That does exactly what I want it to. Thank you so much. One question, though, is it possible that the time difference be in hours instead of seconds (other than dividing by 3600)? Looking at the code, I don't know what I would change. Does this do what you want? firstInRun -

[R] edf's higher than 1

2012-07-17 Thread wshadish
Simon, in your recent reply to me, you noted that EDF=1 corresponds to a straight line fit. Does the edf always indicate the polynomial exponent directly? We ask because Hothorn and Everitt said Roughly, the complexity of a cubic spline is about the same as a polynomial of degree one less than

Re: [R] complexity of operations in R

2012-07-17 Thread Johan Henriksson
thanks for the link! I should read it through. that said, I didn't find any good general solution to the problem so here I post some attempts for general input. maybe someone knows how to speed this up. both my solutions are theoretically O(n) for creating a list of n elements. The function to

Re: [R] Need Help in a Combinatorial Optimzation Problem

2012-07-17 Thread Bert Gunter
Homework? -- we don't do homework here. -- Bert On Tue, Jul 17, 2012 at 11:13 AM, Chandramouli Banerjee banerjee.chandramo...@gmail.com wrote: Dear Community, I have a problem I am trying to code in R. Suppose there are 7 products and each have a ROI value attached to it. There are 400

Re: [R] Script help: Determining Time Difference between two data points.

2012-07-17 Thread William Dunlap
Look at ?as.numeric.difftime z - f(d, d$Score 150) elapsedTime - z$endDate - z$startDate units(elapsedTime) [1] secs as.numeric(elapsedTime, units=hours) [1] 7.616667 0.00 192.70 4.37 62.97 0.00 12.50 0.00 as.numeric(elapsedTime,

Re: [R] Table/Frame - output

2012-07-17 Thread Greg Snow
There are functions that allow for the plotting of text and R objects that could be used to plot to a bitmap. Look at the 'addtable2plot' function in the plotrix package and the textplot function in the gplots package (look for alternative spellings if you don't find them based on those exact

Re: [R] Table/Frame - output

2012-07-17 Thread andrija djurovic
Hi. You should check function addtable2plot from plotrix package. Also, here is an example of modified addtable2plot function that I sometimes use. This function is probably to far from perfect but, maybe, it will give you some ideas how to solve your problem: t2p - function(x=par(usr)[1],y=

[R] remove from listserv

2012-07-17 Thread Courtney Saltonstall Couch
Could you please remove my email from the listserv? Thanks, Courtney -- -- Courtney Saltonstall Couch Ph.D. Candidate Corson Hall E323 Department of Ecology and Evolutionary Biology Cornell University Ithaca, NY 14853 Office: 607-254-4296 [[alternative HTML version deleted]]

Re: [R] R-help Digest, Vol 113, Issue 20

2012-07-17 Thread Francois Maurice
Hi,   I'm using write.table() to export dataframe to Excel. All works fine except that I want to export the variable labels instead of variable names.    I can see the labels in the R consol using attr(), but I just don't know how to use the labels instead of the names.   Thanks,   François

[R] Variable labels

2012-07-17 Thread Francois Maurice
Hi,   I'm using write.table() to export dataframe to Excel. All works fine except that I want to export the variable labels instead of variable names.  I can see the labels in the R consol using attr(), but I just don't know how to use the labels instead of the names. Thanks, François

[R] problem with function

2012-07-17 Thread Hermann Norpois
Dear list, I have a problem with defining a function (see below) to read my testfile (see testfile). My function only returns mydata I wish to work with attr(mydata, 'fc') as well (for labelling a plot). Principally it works if I do not insist on this function but it would be much easer if it is

Re: [R] Script help: Determining Time Difference between two data points.

2012-07-17 Thread William Dunlap
By the way, here is a related function I wrote in response to an R-help question a while back that finds sequences that start when a signal rises about a certain threshold and end when the signal drops below a lower threshold. This avoids hysteresis-like problems. f1 - function(x,

[R] Finding the column with the maximum value by row

2012-07-17 Thread Christopher Desjardins
Hi, Let's say I have the following data: a=matrix(c(1,2,4,4,2,1,1,2,4),nrow=3,byrow=T) a [,1] [,2] [,3] [1,]124 [2,]421 [3,]124 What syntax should I use to get R to tell me the column that corresponds to the maximum value for each row? For my

Re: [R] Finding the column with the maximum value by row

2012-07-17 Thread R. Michael Weylandt
apply(a, 1, which.max) Apply the which.max() function to the matrix a row-wise (1) Michael On Tue, Jul 17, 2012 at 5:03 PM, Christopher Desjardins cddesjard...@gmail.com wrote: Hi, Let's say I have the following data: a=matrix(c(1,2,4,4,2,1,1,2,4),nrow=3,byrow=T) a [,1] [,2] [,3]

Re: [R] remove from listserv

2012-07-17 Thread Rolf Turner
On 18/07/12 07:58, Courtney Saltonstall Couch wrote: Could you please remove my email from the listserv? You have to do that yourself. See: https://stat.ethz.ch/mailman/listinfo/r-help cheers, Rolf Turner __ R-help@r-project.org

[R] weighted mean by week

2012-07-17 Thread Dimitri Liakhovitski
Hello! I wrote a code that works, but it looks ugly to me - it's full of loops. I am sure there is a much more elegant and shorter way to do it. Thanks a lot for any hints! Dimitri # I have a data frame: x-data.frame(group=c(group1,group2,group1,group2), myweight=c(0.4,0.6,0.4,0.6),

Re: [R] OT: Where's the new Tukey?

2012-07-17 Thread Kjetil Halvorsen
Venables Ripley: Modern Applied Statistics with S (fourth Edition) (known as MASS) Kjetil On Sat, Jul 14, 2012 at 4:01 PM, Larry White ljw1...@gmail.com wrote: I'm looking for a single book that provides a deep, yet readable introduction to applied data analysis for general readers. I'm

Re: [R] weighted mean by week

2012-07-17 Thread David Freedman
The plyr package is very helpful for this: library(plyr) ddply(x ,.(myweek), summarize, m1=weighted.mean(var1,myweight), m2=weighted.mean(var2,myweight)) -- View this message in context: http://r.789695.n4.nabble.com/weighted-mean-by-week-tp4636814p4636816.html Sent from the R help mailing

Re: [R] Problem creation tensor

2012-07-17 Thread Kjetil Halvorsen
Amusing that someone named RICCI is asking about tensors (sorry!) Kjetil On Tue, Jul 17, 2012 at 6:31 AM, Peppe Ricci peppepega...@gmail.com wrote: Hi guys, I need some help to analyzing my data. I start to describe my data: I have 21 matrices, every matrix on the rows has users and on

[R] tweaking forest plot (metafor package)

2012-07-17 Thread eesteves
Dear All, I'm having trouble tweaking a forest plot made using the R meta-analysis package metafor. I did the analysis based upon the correlation coeff from studies and plotted the corresponding forest plot easily q2-rma(yi,vi,mods=cbind(grupo),data=qim) q2 forest

[R] Kernel smoothing (ks package)

2012-07-17 Thread Gary Dong
Dear R users, I'm trying to determine local population centers in a region through kernel smoothing. What I have is population density in each neighborhood, which can be presented as point density. So in my data set “pop”, I have three columns for about 1000 neighborhoods: x (x coordinate), y (y

Re: [R] subsetting without losing the attributes

2012-07-17 Thread Peter Ehlers
Inline On 2012-07-17 04:16, MK wrote: Hi, How do I use the subset function without losing the attributes? You don't. At least not without modifying subset.data.frame(). The key sentence on the ?Extract help page is this: Subsetting (except by an empty index) will drop all attributes

[R] ggplot2 qplot pch not working anymore

2012-07-17 Thread Stephen Sefick
Is there a way to use a continuous variable to pch in qplot? I believe this worked in previous version. I need to specify certain values of a shape for particular points so that multiple graphs all show the same shapes for the same streams. I have gone to the original data and added a pch

Re: [R] about different bandwidths in one graph

2012-07-17 Thread Peter Ehlers
On 2012-07-17 11:15, chester123 wrote: Thank you in advance. Now I want to make comparison of the different bandwidth h in a normal distribution graph. This is the table of bandwidth h: thumb rule (normal)--0.00205; thumb rule(Epanech.)--0.00452; Plug-in (normal)--0.0009;

Re: [R] ggplot2 qplot pch not working anymore

2012-07-17 Thread Stephen Sefick
I'm sorry I didn't give the correct code, or explaination; the shape=pch doesn't work anymore. For example this used to work, but no longer can accept continuous values: #example code a - 1:10 b - 1:10 pch - 1:10 q - data.frame(a,b,pch) qplot(a,b, shape=pch) many thanks, Stephen Sefick

Re: [R] weighted mean by week

2012-07-17 Thread Dimitri Liakhovitski
Thanks a lot, David. Indeed, it's much shorter. Unfortunately, in my real task I am dozens and dozens of variables like var1 and var2 so that manually specifying things like in m1=weighted.mean(var1,myweight) would take a lot of code and a very long time. Dimitri On Tue, Jul 17, 2012 at 6:34 PM,

Re: [R] weighted mean by week

2012-07-17 Thread David Freedman
If there are many variables, I'd then suggest the data.table package: library(data.table) dt=data.table(x) dt[,lapply(.SD, function(x)weighted.mean(x,myweight)), keyby=c('group', 'myweek')] The '.SD' is an abbreviation for all the variables in the data table (excluding the grouping variables).

Re: [R] weighted mean by week

2012-07-17 Thread Dimitri Liakhovitski
David, many thanks. Did something get ommitted from your line?: ddply(x ,.(myweek), summarize, m1=weighted.mean(var1,myweight), m2=weighted.mean(var2,myweight)) Because it just reproduces x - in a somewhat different order... Thank you! Dimitri On Tue, Jul 17, 2012 at 9:22 PM, David Freedman

[R] Defining a variable outside of optim or differential equation solver.

2012-07-17 Thread Tjun Kiat Teo
This is applicable to either using optim or the differential equation solver or any similar solver Suppose I want to use the differential equation solver and this is my code d-y[2] vdpol-function(t,y) { list(c(1, d, 3, 4 ) }

Re: [R] weighted mean by week

2012-07-17 Thread David Freedman
Honestly, I wasn't sure what you wanted to do with 'group'. Here it is with the 'group' variable deleted library(data.table) dt=data.table(x[,-1]) dt[,lapply(.SD, function(x)weighted.mean(x,myweight)), keyby='myweek'] -- View this message in context:

[R] Regression Identity

2012-07-17 Thread darnold
Hi, I see a lot of folks verify the regression identity SST = SSE + SSR numerically, but I cannot seem to find a proof. I wonder if any folks on this list could guide me to a mathematical proof of this fact. Thanks. David. -- View this message in context:

Re: [R] Lavaan Package - How to Extract Residuals in Data Values

2012-07-17 Thread Ed Merkle
Dear Emily, The lavaan package is typically used to fit models with latent variables, and these models are typically fit to the covariance matrix (and not necessarily to the raw data). Thus, it is usually not straightforward to get data residuals from the fitted models. In your case, it

Re: [R] ggplot2 qplot pch not working anymore

2012-07-17 Thread Ben Bolker
Stephen Sefick sas0025 at auburn.edu writes: I'm sorry I didn't give the correct code, or explaination; the shape=pch doesn't work anymore. For example this used to work, but no longer can accept continuous values: #example code a - 1:10 b - 1:10 pch - 1:10 q -

  1   2   >