Re: [R] about data manipulation

2016-11-30 Thread Jim Lemon
Hi lily, If you want to use aggregate, supply the name of the function: aggregate(flow~year, data=df, "sum") You can also use "by" like this by(df$flow,df$year,FUN=sum) I assume that you don't have to worry about missing months in a year. Jim : On Thu, Dec 1, 2016 at 3:06 PM, lily li

Re: [R] about data manipulation

2016-11-30 Thread Berend Hasselman
> On 1 Dec 2016, at 05:06, lily li wrote: > > Hi R users, > > I'm trying to manipulate dataset, but met some difficulties. > > df > year month flow > 2006 33.5 > 2006 43.8 > 2006 521 > 2006 632 > 2007 34.1 >

Re: [R] Command for simple effects following 2 way anova with interaction

2016-11-30 Thread Richard M. Heiberger
## Use the split argument to summary.aov ## This tests the levels of tension within each level of wool using a common ## Residuals sum of squares. sapply(warpbreaks, levels) model2 <- aov(breaks ~ wool/tension, data = warpbreaks) colnames(model.matrix(model2)) ## [1] "(Intercept)""woolB"

[R] about data manipulation

2016-11-30 Thread lily li
Hi R users, I'm trying to manipulate dataset, but met some difficulties. df year month flow 2006 33.5 2006 43.8 2006 521 2006 632 2007 34.1 2007 44.4 ... I want to calculate total flow for each year, and use the code

[R] Command for simple effects following 2 way anova with interaction

2016-11-30 Thread Ashim Kapoor
Dear All, Suppose I do :- head(warpbreaks) model1<- aov(breaks ~ wool*tension,data = warpbreaks) summary(model1) There is significant interaction. So I need to test for simple effects of wool at each level of tension and vice versa. I can do a subset and then do a one way anova for each level

[R] Complex Survey MSE for prediction with ML

2016-11-30 Thread Ganz, Carl
Hello, I have been toying with the survey package's withReplicates function, which lets users easily extend the survey package to support any weighted statistic. There are a number of ML algorithms in various packages that accept weights, and it is fairly easy to use them with withReplicates.

Re: [R] transpose rows and columns for large data

2016-11-30 Thread John Dougherty
On Tue, 29 Nov 2016 17:22:47 + (UTC) Elham - via R-help wrote: > Is there another way (I prefer a way with Excel)? Search on "friends don't let friends use excel for statistics." Spreadsheets are an inherently perilous way to do statistics and Excel specifically is

Re: [R] stringi behaves differently in 2 similar situations

2016-11-30 Thread Sarah Goslee
A dot is treated differently if it has a number on no, one, or both sides. > stri_extract_all_words("me.com", simplify = TRUE) [,1] [1,] "me.com" > stri_extract_all_words("me1.com", simplify = TRUE) [,1] [,2] [1,] "me1" "com" > stri_extract_all_words("me1.2com", simplify = TRUE)

[R] stringi behaves differently in 2 similar situations

2016-11-30 Thread Dimitri Liakhovitski
Hello! library(stringi) stri_extract_all_words("me.com", simplify = TRUE) # returns with a dot stri_extract_all_words("watch32.com", simplify = TRUE) # removes the dot Why is the dot removed only in the second case? How is it possible to ask it NOT to remove the dot in the second case?

[R] Question regarding Naive Bayes

2016-11-30 Thread PHILIP GLADWIN
Hello,   I am working with the naïve bayes function inlibrary(e1071).   The function calls are: transactions.train.nb = naiveBayes(as.factor(DealerID) ~    as.factor(Manufacturer)     + as.factor(RangeDesc)    

[R] Meta-Analysis using RVE (robumeta)

2016-11-30 Thread Janina Steinert
Hello, I'm runnig a meta-analysis, correcting for clustering of standard errors with the robumetacommand. R gives the following warning: If df < 4, do not trust the results In some cases my df is in fact <4. What does this tell me then? Does it simply mean that the number of included studies is

[R] Improve performance of RConnection and Rserve

2016-11-30 Thread Ranjana Girish
Hi all, If we execute an R script directly in R prompt in Linux environment, it takes around 30 mins to complete. The same R script if we execute from java using RConnection, eval and Rserve for each line it takes thrice the time. Basically the performance is very bad. And in most of the

Re: [R] Breaking down a list into a table

2016-11-30 Thread Jeff Newmiller
The tidyr::separate function modifies data frames. You did not give it a data frame. Re-read your preferred R introductory material on what a data frame is (R comes with "Introduction to R"). You also did not give a reproducible example... e.g. does not execute as-is in a clean R work space.

Re: [R] Breaking down a list into a table

2016-11-30 Thread Bert Gunter
Well, if i understand correctly, there's really no need to use special packages for such simple tasks. The strsplit() function in base R does nicely (see ?strplit): Here is a reproducible example, --which you did not provide; please do so in future: > testdat <-

Re: [R] Breaking down a list into a table

2016-11-30 Thread Ferri Leberl
Thank to Ulrik for the hint. However, I don't comprehend the function until now: For example I made up an array "input": input kop [1,] "w;d;e;f" [2,] "w;d;e;f" [3,] "w;d;e;f" [4,] "w;d;e;f" [5,] "w;d;e;f" and tried to break it into four cols with commmand: