[R] Understand Rcode- subset

2015-08-24 Thread Jhon Grey
Hi! I am facing a problem in understanding the R-Code Suppose I have a dataset named- transact with its values like following: customer_ID shopping_pt record_type 1000 1 0 1000 2 0 1000 3 0 1000 4 0 1000 5 0

Re: [R] Understand Rcode- subset

2015-08-24 Thread Thierry Onkelinx
Posting in HTML mangles up your code, making it hard to read. Please resend your question in plain text and make the code reproducible. See http://adv-r.had.co.nz/Reproducibility.html for more details on that. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for

[R] Calculate the area under a curve

2015-08-24 Thread CarstenH
Hi all I need to calculate the area under a curve (integral) for the following data pairs: Depth SOC 22.50.143 28.50.165 34.50.131 37.50.134 40.50.138 43.50.107 46.50.132 49.50.175 52.50.087 55.50.117 58.50.126 61.5

Re: [R] Compute RowMeans from mulple files

2015-08-24 Thread Bert Gunter
Note that, in general, rowMeans(x) is preferable to apply(x,1,mean) Consult ?rowMeans for details. Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Mon, Aug 24, 2015 at 2:20 AM, Jim Lemon

[R] lsqlin in R package pracma

2015-08-24 Thread Wang, Xue, Ph.D.
Hi R developers, I am looking for a R version of Matlab function lsqlin. I came across R pracma package which has a lsqlin function. Compared with Matlab lsqlin, the R version does not allow inequality constraints. I am wondering if this functionality will be available in future. And I would

Re: [R] Metafor and forest(); not showing 'ilab' and text

2015-08-24 Thread Viechtbauer Wolfgang (STAT)
I cannot reproduce the issue with 'ilab' not being shown when using 'subset'. My guess is that the values for 'ilab.xpos' specified are actually outside of the plotting region. After you have drawn the forest plot, try: par(usr)[1:2] to see what the default limits actually are. Then use 'xlim'

Re: [R] Multrix-vector multiplication

2015-08-24 Thread MacQueen, Don
I would suggest you look into the Matrix package. Here's an example that illustrates what I suspect is the root cause of your issue: x - matrix(1:4, ncol=2) class(x) [1] matrix y1 - x[,1] class(y1) [1] integer y1 [1] 1 2 y2 - x[,1,drop=FALSE] class(y2) [1] matrix y2 [,1] [1,]1

[R] Metafor and forest(); not showing 'ilab' and text

2015-08-24 Thread Marco Colagrossi
Hello folks, I have a couple of issues with the metafor package, specifically with the forest graphs. I am currently conducting a Meta-Analysis in economics throughout the metafor package. My meta-analysis has the specific of having different cases from single studies, and this proven to be

Re: [R] Calculate the area under a curve

2015-08-24 Thread Charles Determan
Hi Carsten, This list is meant to help you solve specific coding problems. What have you tried? A quick google search will provide several packages including caTools, ROCR, AUC, pROC. Look in to some of them, try them out and report back if you have problems 'using' a function instead of just

Re: [R] Calculate the area under a curve

2015-08-24 Thread Jeff Newmiller
Read ?predict, paying particular attention to the newdata argument. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go...

Re: [R] Metafor and forest(); not showing 'ilab' and text

2015-08-24 Thread Michael Dewey
Dear Marco Comments inline On 24/08/2015 15:03, Marco Colagrossi wrote: Hello folks, I have a couple of issues with the metafor package, specifically with the forest graphs. I am currently conducting a Meta-Analysis in economics throughout the metafor package. My meta-analysis has the

Re: [R] Understand Rcode- subset

2015-08-24 Thread Thierry Onkelinx
# logical vector, TRUE when record_type equals 1 id - transact$record_type == 1 # lagged vector of id. TRUE is shifted one position ahead id.lag - c(id[2:length(id)], FALSE) sub - transact[id.lag, ] # have a look at the row numbers transact[id, ] sub Best regards, ir. Thierry Onkelinx Instituut

Re: [R] Understand Rcode- subset

2015-08-24 Thread John Kane
Just to second Thierry's point, your HTML post is basically unreadable. Please repost as plain text. John Kane Kingston ON Canada -Original Message- From: butt_its...@hotmail.com Sent: Mon, 24 Aug 2015 16:30:31 +0530 To: r-help@r-project.org Subject: [R] Understand Rcode- subset

Re: [R] Calculate the area under a curve

2015-08-24 Thread David Winsemius
On Aug 24, 2015, at 7:23 AM, Jeff Newmiller wrote: Read ?predict, paying particular attention to the newdata argument. I agree that reading help pages is needed but need both the ?predict page and the ?integrate page. I think proximate cause of the error is that `integrate` is not getting an

Re: [R] Calculate the area under a curve

2015-08-24 Thread William Dunlap
This is partly a bug in the AUC package and partly a problem with you not reading or understanding the the help file for the auc function in that package. help(auc) says auc(x, min = 0, max = 1) Arguments: x: an object produced by one of the functions ‘sensitivity’,

Re: [R] Metafor and forest(); not showing 'ilab' and text

2015-08-24 Thread Marco Colagrossi
I tried to upload the file once again. I tweaked it a bit, now my code is: forest(pc, var, ci95m, ci95p, slab = authoryear, psize=1, subset=(pub==1), xlim = c(-16, 6), ilab = cbind(SIMdv, SIMiv), ilab.xpos = c(-7.5, -5.5), cex = 0.75) op - par(cex=.75, font=2)

Re: [R] Calculate the area under a curve

2015-08-24 Thread Greg Snow
An alternative to your approach is to pass your data to the approxfun or splinefun functions and then use the integrate function on the result. On Mon, Aug 24, 2015 at 3:10 AM, CarstenH cah...@gmx.de wrote: Hi all I need to calculate the area under a curve (integral) for the following data

Re: [R] Calculate the area under a curve

2015-08-24 Thread CarstenH
Hi Charles I am new in R and would like to learn/use it in the beginning for easy operations. I already used google for houres and did not find a solution for this in my eyes easy calculation process. I spent long time with reading forums, package handbooks, and tried and error but always failed.

Re: [R] Understand Rcode- subset

2015-08-24 Thread Jhon Grey
Hi! Thanks for pointing out the mistake. I am resubmitting my question as follows: Hi!I am facing a problem in understanding the R-CodeSuppose I have a transactional dataset named- transact with its values like following:customer_ID

Re: [R] Understand Rcode- subset

2015-08-24 Thread Jhon Grey
Can you please explain elaborately! I understood that TRUE has been shifted ahead. But unfortunately did not understand the code- as how using logical vector it was shifted ? # lagged vector of id. TRUE is shifted one position aheadid.lag - c(id[2:length(id)], FALSE)It shifted ahead twice using

Re: [R] plotting over a raster image with control over location and orientation

2015-08-24 Thread Greg Snow
For base plotting functions (not grid) then you may be interested in the updateusr function in the TeachingDemos package. If you can find the current coordinates of 2 points on the 1st plot (the background image) that are not in the same horizontal or vertical line (use the locator function if

Re: [R] Understand Rcode- subset

2015-08-24 Thread Jeff Newmiller
The first id was ignored (d[2:length(id)]) and the last id in id.lag was set to FALSE. Because the values are in new positions even though the same number of id values are kept, a lag (shift) has been created that takes effect when id.lag is used as an index into transact.

[R] problem with accents and Catalan characters (for ex. ç) using geocode function (ggmap)

2015-08-24 Thread Marc Marí Dell'Olmo
Dear all, I'm trying to geocode addresses (of Catalonia) with accents and Catalan characters (as for example ç). I'm using the geocode function (package ggmap), but I obtain some Google INVALID_REQUEST when the addresses have these characters. For example: geocode(Carrer Veneçuela, 10, 08019

Re: [R-es] librerías ecuaciones estructurales

2015-08-24 Thread Pedro Concejero Cerezo
Para hacer an�lisis de ecuaciones estructurales adem�s de sem tienes lavaan: http://lavaan.ugent.be/ http://www.r-bloggers.com/first-steps-with-structural-equation-modeling/ Hay m�s paquetes relacionados con estos modelos y con path analysis en el apartado correspondiente de la task view

Re: [R] Compute RowMeans from mulple files

2015-08-24 Thread Jim Lemon
Hi Peter, I think your problem is that your calculations occur after the end of the loop. What you probably want is something like this: yr_means-mam_means-jf_means- jja_means-ond_means-rep(NA,length(prec_files)) for (i in 1:length(prec_files)) { prec_data-read.delim(prec_files[i],

[R] Package dismo: Extracting sensitivity and specificity from gbm.step() object

2015-08-24 Thread Johannes Radinger
Dear R-User! This is a question to all of you that are familiar with the 'dismo' package, in particular we are interested in the gbm.step() function to create a boosted regression tree model in R. From the model output object we can use the $cv.statistics to get information on the

Re: [R] [FORGED] Re: plotting over a raster image with control over location and orientation

2015-08-24 Thread Paul Murrell
Hi The main problem with the code you have below is that it mixes drawing based on the 'graphics' package with drawing based on the 'grid' package and those packages do not mix easily. I am not clear on what you want as your final result, but I wonder whether you need to just set up the

Re: [R] Date as Integer

2015-08-24 Thread Shivi82
Hi John, Sorry but if this sounds really as a newbie question. I looked at the data as you suggested using glimpse(name of the dataset) and then View(dput(head(ak,20))) to capture it as a table. Is there an option where i can save this view table share along. I used dput but that would not