[R] scaling loess curves

2015-09-06 Thread Bogdan Tanasa
Dear all, please could you advise about a method to scale 2 plots of LOESS curves. More specifically, we do have 2 sets of 5C data, and the loess plots reflect the relationship between INTENSITY and DISTANCE (please see the R code below). I am looking for a method/formula to scale these 2 LOESS p

Re: [R] [FORGED] Handling "NA" in summation

2015-09-06 Thread Jeff Newmiller
That you choose to interpret an income level of NA as zero could mean that the value was encoded incorrectly or could mean that that the income of that person was never reviewed and theirs might have represented a significant additional amount of income. If you believe it was encoded improperly

Re: [R] [FORGED] Handling "NA" in summation

2015-09-06 Thread Sarah Goslee
I think given the previous confusion and lack of clarity in this description as well, you really need to give us a. sample data using dput() b. what you expect the result to be c. what code you've tried, including how you've attempted using the sum() function that several of us have recommended. S

Re: [R] [FORGED] Handling "NA" in summation

2015-09-06 Thread Olu Ola via R-help
Hello, I need to first apologize for the error in my first question dataframe$A = 20 dataframe$B = NA dataframe$A + dataframe$B actually  returns NA You quite understand my point of view. This is a household level data where you need to compute the total income of each household member before

[R] 回覆﹕ 回覆﹕ How to get filter probabilities from msmFit() of package MSwM?

2015-09-06 Thread 王柏元
I think I find the way to extract smoothed probabilities from msmFit(). In the MSM.lm-class, we could use mod.msm@Fit@smoProb to extract the smoothed probabilities, also, we could use mod.msm@Fit@filtProb to extract the filter probabilities. Best Regards Paul Wang pywan...@yahoo.com.tw

Re: [R] Handling "NA" in summation

2015-09-06 Thread Dan D
# it's not clear what your question is, but here's a stab in the dark at a solution! ind<- !is.na(dataframe$A) & !is.na(dataframe$B) dataframe$A[ind] + dataframe$B[ind] - Dan P.S. I'm sure there are ways to do this using one of R's functions for automatically removing NA's (na.rm = T), but unle

Re: [R] Handling "NA" in summation

2015-09-06 Thread ce
Sorry I misunderstood questions . I think original poster wants result to be 0 , right ? Then dataframe$A[ is.na(dataframe$B) ] <- 0 dataframe$B[ is.na(dataframe$B) ] <- 0 is this case you would lose dataframe$A data or dataframe$A + ( dataframe$B[ is.na(dataframe$B) ] <- -1*dataframe$A )

Re: [R] Handling "NA" in summation

2015-09-06 Thread Jeff Newmiller
So you have decided that NA==0 and Inf == 0... if that is really what you want then it looks like that is what you got. If you don't like the fact that you are mucking with your data, then make a copy of the data first and muck with that. Blegh. -

Re: [R] [FORGED] Handling "NA" in summation

2015-09-06 Thread Rolf Turner
On 07/09/15 10:22, Olu Ola via R-help wrote: Hello, I am currently working with a dataframe which has some missing values represented by "NA". whenever, I add two columns in which at least one of the pair of an observation is "NA", the sum returns zero. That is for the same observation, if dataf

Re: [R] groups Rank

2015-09-06 Thread Sarah Goslee
Please use dput() to provide data, rather than expecting people to open random attachments. Besides, there are multiple options for getting data into R, and we need to know exactly what you did. dput() is faster and easier. What have you tried? Did you look at aggregate() as I suggested? Sarah O

Re: [R] Handling "NA" in summation

2015-09-06 Thread Sarah Goslee
I'm not quite sure how you get zero from that situation. Do you expect the answer to be 20? How about: > dataframe <- data.frame(A=20, B=NA) > dataframe$A + dataframe$B [1] NA > ?sum > sum(dataframe$A, dataframe$B, na.rm=TRUE) [1] 20 Sarah On Sun, Sep 6, 2015 at 6:48 PM, ce wrote: > > > I

Re: [R] Handling "NA" in summation

2015-09-06 Thread Jeff Newmiller
That is not how R works. 20+NA is NA, which is not the same as zero. This is not optional behaviour. I notice that you put quotes around the NA if those really are there then you should be getting an error. You need to assemble a reproducible example, such as is described at [1]. By doing

Re: [R] Handling "NA" in summation

2015-09-06 Thread ce
I use something like : dataframe[ is.na(dataframe) ] <- 0 dataframe[ is.nan(dataframe) ] <- 0 dataframe[ is.infinite(dataframe) ] <- 0 -Original Message- From: "Olu Ola via R-help" [r-help@r-project.org] Date: 09/06/2015 06:24 PM To: r-help@r-project.org Subject: [R] Handling "NA" in

[R] boxplots facets in ggplot, generated with two factors interaction mediane-ordered

2015-09-06 Thread Sergio Fonda
Sorry for repeating the message owing to previous uncorrect html version delivered (Thank you bert Gunter for the alert). Marc Schwartz enabled me to order a "two factors" interaction boxplot with median associated to one factor alone: thanks. I tried further to generate facets plot (3x2 boxplots

[R] Handling "NA" in summation

2015-09-06 Thread Olu Ola via R-help
Hello, I am currently working with a dataframe which has some missing values represented by "NA". whenever, I add two columns in which at least one of the pair of an observation is "NA", the sum returns zero. That is for the same observation, if dataframe$A = 20 dataframe$B = NA dataframe$A +

Re: [R] boxplots facets in ggplot, generated with two factors interaction mediane-ordered

2015-09-06 Thread Bert Gunter
Please stop posting in HTML and use dput() to provide data (as the posting guide requests). Cheers, Bert Gunter Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Sun, Sep 6, 2015 at 8:37 AM, Sergio Fonda wrote:

[R] dplyr question

2015-09-06 Thread Ragia Ibrahim
Dear group, I have the following data frame df Measure_id i j id value1 1 5 1 1 2.02 1 5 2 1 2.03 1 5 1 2 1.54 1 5 2 2 1.55 1 5 1 3 0.06 1 5 2 3 0.07 1 5 1 4 0.08 1 5 2 4 1.09 1

Re: [R] Is there a time series resampling function ?

2015-09-06 Thread Sergio Fonda
I insist: as a trial, apply function "resample" (package signal) I think it's worth doing a test ( it performs resampling through bandlimited interpolation) SF Il 06/set/2015 18:52, "Jeff Newmiller" ha scritto: > There are lots of them. You might be having trouble searching because you > don't kn

Re: [R] Is there a time series resampling function ?

2015-09-06 Thread Jeff Newmiller
There are lots of them. You might be having trouble searching because you don't know how to spell "interpolate". ?approx ?spline Also look at the Time Series task view on CRAN. --- Jeff NewmillerThe

Re: [R] Is there a time series resampling function ?

2015-09-06 Thread Sergio Fonda
Have you tried signal package? SF Il 06/set/2015 17:14, "AltShift" ha scritto: > I need a function for regularising the time base of electronically acquired > signals (i.e. vectors of samples with a nominally constant time base). > > For example, the accelerometer in my smartphone can deliver dat

[R] boxplots facets in ggplot, generated with two factors interaction mediane-ordered

2015-09-06 Thread Sergio Fonda
Thanks to Marc Schwartz I was able to order a "two factors" interaction boxplot with median associated to one factor alone. I tried further to generate facets plot (3x2 boxplots in ggplot2) for the dataframe reported at bottom and I'm not able to reach a correct plot. The dataframe is a simulation

Re: [R] extracting every nth character from a string...

2015-09-06 Thread Gabor Grothendieck
This uses a regular expression but is shorter: > gsub("(.).", "\\1", "ABCDEFG") [1] "ACEG" It replaces each successive pair of characters with the first of that pair. If there is an odd number of characters then the last character is not matched and therefore kept -- thus it works properly for b

[R] split.screen to draw graphs - ggplot2 and lattice (can't slip in 4 cells)

2015-09-06 Thread Rosa Oliveira
Dear all, I need your urgent help J I’m naïve, and I’m pretty sure my doubt is very simple to solve, but I’m not getting it. I used the following code to produce my research graphs, nonetheless, is this problem, I do not have 6 graphs (1 – 6), # 3 4 5 #2 #

[R] Is there a time series resampling function ?

2015-09-06 Thread AltShift
I need a function for regularising the time base of electronically acquired signals (i.e. vectors of samples with a nominally constant time base). For example, the accelerometer in my smartphone can deliver data at about 50 Hz, but the sampling rate varies by about 5% throughout a recording. I ha

[R] Predict method of J48 in RWeka (Urgent)

2015-09-06 Thread Priyanka Garg
hi, I am new to R using package RWeka.Currently i am using J48 classifier for classification and prediction. My doubt is after building tree using J48, when i use the same for prediction on my test set it gives the predicted class names. How could i calculate accuracy, precision, recall and also o

[R] extracting every nth character from a string...

2015-09-06 Thread Evan Cooch
Suppose I had the following string, which has length of integer multiple of some value n. So, say n=2, and the example string has a length of (2x4) = 8 characters. str <- "ABCDEFGH" What I'm trying to figure out is a simple, base-R coded way (which I heuristically call StrSubset in the follo

Re: [R] factor interaction boxplot ordering by median

2015-09-06 Thread Sergio Fonda
Thanks to Marc Schwartz I was able to order a "two factors" interaction boxplot with median associated to one factor alone. I tried further to generate facets plot (3x2 boxplots in ggplot2) for the dataframe reported at bottom and I'm not able to reach a correct plot. The dataframe is a simulation