Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
Now we're getting somewhere. I suspect that each Excel sheet looks something like this: YearTongaSamoaFiji 200821.2 32.0 18.7 ... 201723.7 31.9 19.3 # in the above there are three columns (countries) and ten rows # import this sheet as "MPG3" nrows<-nrow(M

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread PIKAL Petr
Hi When I do multiple plots of similar data I usually put the plots into the multipage pdf file pdf("somename.pdf") for (i in columns) { p<-ggplot(something) print(p+geom_point(size=4)+stat_smooth(se=F, span=0.5, size=1.3)+ facet_grid(al2o3~teplota, labeller="label_both")) or plot(something)

Re: [R] system solver in R

2018-11-20 Thread Engin Yılmaz
Yes, it works for me. Eik Vettorazzi , 21 Kas 2018 Çar, 00:19 tarihinde şunu yazdı: > How about this: > > library(rootSolve) > f1<-function(x)5/((1+x)^1) + 5/((1+x)^2) + 5/((1+x)^3) + 105/((1+x)^4) -105 > uniroot.all( f1,c(-1e6,1e6)) > > [1] -1.9881665 0.0363435 > > Cheers > > > Am 20.11.2018 um

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
For your first question, yes, you will need to adjust the number of "x" values to match the number of "y" values. You can use the "nrow" function to get that number. I don't really know what the abscissa scale is on your plots, I just made up the data I used. If you are comparing countries, you ma

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Subhamitra Patra
Hello Sir, Thank you very much. I will try it out and will let you the result. The no. of rows varies per sheet by a different number of observations. Due to different no. of rows or observations, I separated the columns in different sheets. *Will a different number of rows create a problem for

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
I assume that you are importing the Excel sheets separately. When you import a sheet, you can get the number of columns with this: ncol() Using the data frame "mpg" that I created: ncolumns<-ncol(mpg) ncolumns [1] 38 You can then substitute "ncolumns" each time you import another sheet. How you

Re: [R] Predict follow up time using parametric model in r

2018-11-20 Thread Israel Ortiz
You are right. Specifically, I need to predict the mean and median time to failure from a coxph model and several parametric models using new data. Thanks. El lun., 5 nov. 2018 a las 7:11, Therneau, Terry M., Ph.D. (< thern...@mayo.edu>) escribió: > First, type='expected' gives the expected cumu

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Subhamitra Patra
Hello Sir, Thanks, now I understood and will check them out. One more thing I want to ask that I have 1 excel file with multiple (i.e. 12 sheets). Each sheet contains different number of columns, for instance, 1st sheet contains 38 columns, 2nd sheet contains 10 columns, Third 2 columns, 4th 1 co

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
Hi Subhamitra, 1. Here I manufacture some data so that the example is "reproducible", that is anyone can run the code and get the same output that I do. Yes, veh1...veh38 are the names of the variables. 2. Here I join the 38 variables I created into a data frame, which I think is the input for yo

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Subhamitra Patra
Hello Sir, Thanks, I'll check them out. But, I am not understanding 2 points of your suggestion. 1. In the line,* "*for(i in 1:38) assign(paste0("veh",i),rep(sam ple(10:35,1),10)+runif(10,-4,*4))", *what veh, rep(sample(10:35,1),10) +runif(10,-4,4)) indicate? Here veh indicates columns right? *2

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
Hi Subhamitra, As Bert noted, you are mixing base and grid graphics. Here is a simple way to get a plot like what you described. It will probably take more work to find what you actually do want and discover how to get it. for(i in 1:38) assign(paste0("veh",i),rep(sample(10:35,1),10)+runif(10,-4,4

Re: [R] system solver in R

2018-11-20 Thread Eik Vettorazzi
How about this: library(rootSolve) f1<-function(x)5/((1+x)^1) + 5/((1+x)^2) + 5/((1+x)^3) + 105/((1+x)^4) -105 uniroot.all( f1,c(-1e6,1e6)) [1] -1.9881665 0.0363435 Cheers Am 20.11.2018 um 13:09 schrieb Engin Yılmaz: Dea(R) I try to solve one equation but this program did not give me real r

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Bert Gunter
You need to do some studying! ggplot is built on the grid graphics system, which is separate from the base graphics system. The par() function is part of the *base* graphics system and so ignored by ggplot. Others may offer you solutions using the "faceting" functionality of ggplot. But you really

[R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Subhamitra Patra
Dear R users, I have one excel file with 5 sheets. The no. of columns vary for each sheet. The 1st sheet consists of 38 columns. So, I want to plot 38 separate line charts and arrange them in par(mfrow = c(4, 10)) order. Please suggest me how to do this. I have tried with the following code by run

Re: [R] system solver in R

2018-11-20 Thread J C Nash
A bit pedestrian, but you might try pf <- function(x){5/((1+x)^1) + 5/((1+x)^2) + 5/((1+x)^3) + 105/((1+x)^4) -105} uniroot(pf,c(-10,10)) curve(pf, c(-10,10)) require(pracma) tryn <- newton(pf, 0) tryn pf(0) pf(0.03634399) yc <- c(-105, 5,5,5,105) rooty <- polyroot(yc) rooty rootx <- 1/rooty - 1 r

Re: [R] system solver in R

2018-11-20 Thread Engin Yılmaz
Dea(R) I try to solve one equation but this program did not give me real roots for example yacas("Solve( 5/((1+x)^1) + 5/((1+x)^2) + 5/((1+x)^3) + 105/((1+x)^4) -105 ==0, x)") gave me following results How can I find real roots? expression(list(x == complex_cartesian((1/42 - ((1/63 - ((root(733945

Re: [R] time mathematics

2018-11-20 Thread Bjørn-Helge Mevik
Well, this is not an elegant (or robust) solution, but this would work for the example you give, at least: starttime <- as.POSIXct("2018-11-20 23:01:18") # Just pick a random date format(starttime + c(0:4), format = "%T") There are probably better ways. :) -- Regards, Bjørn-Helge Mevik signat

Re: [R] time mathematics

2018-11-20 Thread Enrico Schumann
On Tue, 20 Nov 2018, Knut Krueger writes: > I have an dataframe from with a given time format: > > "23:01:19" > > to change some given data: > > x=data.frame > ("Y"=c(1:5),"TIME"=c("23:01:18","23:01:18","23:01:18","23:01:18","23:01:18")) > > I need to change the time increasing in seconds > > x=d

Re: [R] system solver in R

2018-11-20 Thread Engin Yılmaz
Thanks a lot! Berend Hasselman , 20 Kas 2018 Sal, 12:02 tarihinde şunu yazdı: > > > R package Ryacas may be what you want. > > Berend > > > > On 20 Nov 2018, at 09:42, Engin Yılmaz wrote: > > > > Dea(R) > > > > Do you know any system solver in R ? > > > > For example, in matlab, is very easy > >

[R] [R-pkgs] New package: collateral 0.4.2 on CRAN

2018-11-20 Thread James Goldie
Hi everyone, Collateral is now available on CRAN. If you've used purrr's side effect capturing functions before, you'll love collateral: it provides you with map variants that automatically wrap your mapped function in safely() or quietly() and provide nicely printed output, allowing you to quickl

[R] time mathematics

2018-11-20 Thread Knut Krueger
I have an dataframe from with a given time format: "23:01:19" to change some given data: x=data.frame ("Y"=c(1:5),"TIME"=c("23:01:18","23:01:18","23:01:18","23:01:18","23:01:18")) I need to change the time increasing in seconds x=data.frame ("Y"=c(1:5),"TIME"=c("23:01:18","23:01:19","23

Re: [R] system solver in R

2018-11-20 Thread Berend Hasselman
R package Ryacas may be what you want. Berend > On 20 Nov 2018, at 09:42, Engin Yılmaz wrote: > > Dea(R) > > Do you know any system solver in R ? > > For example, in matlab, is very easy > > syms a b c x eqn = a*x^2 + b*x + c == 0; sol = solve(eqn) > > How can I find this type code in

[R] system solver in R

2018-11-20 Thread Engin Yılmaz
Dea(R) Do you know any system solver in R ? For example, in matlab, is very easy syms a b c x eqn = a*x^2 + b*x + c == 0; sol = solve(eqn) How can I find this type code in R (or directly solver)? *Since(R)ely* Engin YILMAZ [[alternative HTML version deleted]] ___