Re: [R] Converting "day of year" to "year", "month" and "day"

2021-01-17 Thread Jibrin Alhassan
Hellow Rui, The code helped. I am very grateful. Jibrin On Mon, Jan 18, 2021 at 12:14 AM Rui Barradas wrote: > Hello, > > My code didn't produce only 6 rows, it displayed only 6 rows. But all > rows now have a date column. > > As for the first question, > > df2 <- df1[c("SWS", "date")] > > > sel

Re: [R] Summarizing select columns in a data frame

2021-01-17 Thread Bernard Comcast
Thanks David Bernard Sent from my iPhone so please excuse the spelling!" > On Jan 17, 2021, at 5:59 PM, David Winsemius wrote: > >  >> On 1/17/21 12:15 PM, Bernard McGarvey wrote: >> I have a data frame that consists of several factor columns say A, B, C, D, >> and E and several columns conta

Re: [R] Converting "day of year" to "year", "month" and "day"

2021-01-17 Thread Rui Barradas
Hello, My code didn't produce only 6 rows, it displayed only 6 rows. But all rows now have a date column. As for the first question, df2 <- df1[c("SWS", "date")] selects the columns with those names. I didn't rewrite the original df1, but if you want to, assign to df1, without creating df2

Re: [R] Summarizing select columns in a data frame

2021-01-17 Thread David Winsemius
On 1/17/21 12:15 PM, Bernard McGarvey wrote: I have a data frame that consists of several factor columns say A, B, C, D, and E and several columns containing numerical data, say X1, X2, X10. I would like to create statistics of some of the numerical columns by some of the factor columns

[R] How can we get median MAE in caret

2021-01-17 Thread Neha gupta
Hi, If I am using caret and MAE metric, how can we get median of MAE in easy manner. cart <-train(Result ~ ., data = tr, method = "rf", metric = "MAE", preProc = c("center", "scale", "nzv"), trControl = ctr) [[alternative HTML version deleted]] ___

Re: [R] Summarizing select columns in a data frame

2021-01-17 Thread Bernard Comcast
Thanks Bert Bernard Sent from my iPhone so please excuse the spelling!" > On Jan 17, 2021, at 3:48 PM, Bert Gunter wrote: > >  > There are literally tons of ways to do this sort of thing in R. > > In base R ?tapply and friends, especially ?ave and ?by that may be close to > what you want. >

Re: [R] A question regarding 749 R[21525:2855847] Warning

2021-01-17 Thread Maedeh Kamali
Dear Gregory Coast, Thanks for your reply. I searched so much regarding how to fix this problem. Unfortunately, it stems from Bug Sur 11.0.1 and we should wait for its new version in which the problem has been fixed. Best, Maedeh Kamali On Sat, 16 Jan 2021, 08:18 Gregory Coats, wrote: > I repo

Re: [R] Summarizing select columns in a data frame

2021-01-17 Thread Bert Gunter
There are literally tons of ways to do this sort of thing in R. In base R ?tapply and friends, especially ?ave and ?by that may be close to what you want. But there is a whole parallel universe -- the so-called "tidyverse set of packages -- that many folks prefer. This link takes you down that rab

[R] Summarizing select columns in a data frame

2021-01-17 Thread Bernard McGarvey
I have a data frame that consists of several factor columns say A, B, C, D, and E and several columns containing numerical data, say X1, X2, X10. I would like to create statistics of some of the numerical columns by some of the factor columns. For example, Calculate the mean, min, and max

Re: [R] Error in UseMethod("predict")

2021-01-17 Thread varin sacha via R-help
Eric, No problem. Let's see if somebody else has a solution. I have changed the smooth basis from P-splines ('ps') to thin plate ('tp'). It still does not work, but this time I get another error message. ## #Data y=c(34000,45000,19000,48900,65000,67000,78000,9,51000

Re: [R] Converting "day of year" to "year", "month" and "day"

2021-01-17 Thread Jeff Newmiller
This is an opportunity for you to think for yourself (r-help) instead of expecting solutions neatly wrapped and delivered (r-do-my-work-for-me). Remove the no-longer-needed columns once the desired columns are available. On January 17, 2021 7:12:28 AM PST, Jibrin Alhassan wrote: >Hi Barradas,

Re: [R] Converting "day of year" to "year", "month" and "day"

2021-01-17 Thread Jibrin Alhassan
Hi Barradas, Thanks for your assistance. It has brought me closer to what I am looking for. I tried your code as shown below: > df1 <- read.table("SWSdata_1998_2002", header = TRUE) > df1$date <- as.Date(paste(df1$year, df1$day),format = "%Y %j",origin = "1998-01-01") > head(df1) year day Hr SWS

Re: [R] Error in UseMethod("predict")

2021-01-17 Thread Eric Berger
Hi Sacha, I took a quick look. Sorry, I don't see immediately what is causing the problem. Maybe someone else can help. On Sun, Jan 17, 2021 at 3:22 PM varin sacha wrote: > Dear Eric, > > Many thanks, I correct your 2 points and now I get another error message > (Error in splineDesign(knots, x,

Re: [R] Error in UseMethod("predict")

2021-01-17 Thread varin sacha via R-help
Dear Eric, Many thanks, I correct your 2 points and now I get another error message (Error in splineDesign(knots, x, ord, derivs, outer.ok = outer.ok, sparse = sparse) :   empty 'derivs'). I have googleized and found some hints like (outer.ok=TRUE) but no one seems to work. https://r.789695.n4

Re: [R] Error in UseMethod("predict")

2021-01-17 Thread Eric Berger
Hi Sacha, I never used these packages before but I installed them and tried your code. I have a few observations that may help. 1. the statement ypred = predict(fit18,newdata=Testing) is wrong. Checkout the help page (?robustgam) which shows in the Examples section at the bottom to use so

[R] Error in UseMethod("predict")

2021-01-17 Thread varin sacha via R-help
Dear R-experts, Here below my reproducible R code. I get an error message (end of code) I can't solve. Many thanks for your help. ## #Data y=c(34000,45000,19000,48900,65000,67000,78000,9,51000,32000,54000,85000,38000,76345,87654,90990,78654,67894,56789,65432,18998,789