Re: [R] Help post

2021-02-27 Thread Bert Gunter
Using search term "knn classification" on rseek.org brought up many relevant hits. Among them, the knn() function in package "class" seems relevant -- but there are others, as you will see. Your second question is about statistics and is largely off topic here. Per the posting guide (linked belo

[R] Help post

2021-02-27 Thread Bijesh Mishra
I have pathogen (1/0) as a dependent variable and total (count) as independent variable. I have to get 1) KNN on total and 2) get the training error and training TPR and FPR for k = 5 nearest neighbors using total as a predictor. and 3) get a plot of training error vs. k for k = 1, 2, ..., 10 with

Re: [R] help post

2021-01-20 Thread Jeff Newmiller
I think Parrot is a distribution of Linux, which would likely use the bash command shell. The saved workspace would be in a file named ".RData" in whatever the current directory was when you quit R. Many experienced users of R avoid creating such files as mistakes from old sessions can come bac

Re: [R] help post

2021-01-20 Thread David Winsemius
On 1/20/21 8:00 AM, Imran Shimanto wrote: Dear Sir, How can i find the save workplace what i was practiced on parrot os terminal? # execute at your console ?save.image How can i save program on parrot terminal and how i can find the saved file ?? You should contact the people who mainta

[R] help post

2021-01-20 Thread Imran Shimanto
Dear Sir, How can i find the save workplace what i was practiced on parrot os terminal? How can i save program on parrot terminal and how i can find the saved file ?? I am learning R from W3schools.com and i am enjoying that. After that how can i learn advance R ? [[alternative HTML versio

Re: [R] Conditions in R (Help Post)

2019-10-23 Thread David Winsemius
On 10/22/19 10:19 PM, Yeasmin Alea wrote: Thank you. Can you please have a look the below data sets, script and question? *Dataset-1: Pen* *YEAR DAY X Y Sig phase * * * *1 1981 9 -0.213 1.08 1.10 Phase-7* *2 198110 0.065 1.05 1.05 Phase-6* *Dataset-

Re: [R] Conditions in R (Help Post)

2019-10-23 Thread Yeasmin Alea
Thank you. Can you please have a look the below data sets, script and question? *Dataset-1: Pen* *YEAR DAY X Y Sig phase * * * *1 1981 9 -0.213 1.08 1.10 Phase-7* *2 198110 0.065 1.05 1.05 Phase-6* *Dataset-2: Book* *YEAR Time * *1 1981 1

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread Jim Lemon
Hi Yeasmin, I suspect that you didn't intend to have conditions like: a<0 && b>0 && b 0 && abs(b) < abs(a) If this is the case, the following function seems to return the values of phase that you want: assign_phase<-function(x,y) { phase<-c(1,2,7,8,3,4,6,5) phase_index<-4 * (x > 0) + 2 * (y >

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread Bert Gunter
Both your syntax and semantics are wrong. This indicates to me that you should spend more time with some basic R tutorials before proceeding. That said, here are some of the errors: 1) You are not using sapply correctly. Moreover, no R level iteration is needed anyway (sapply() iterates over colu

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread jim holtman
Here is another way of doing it by computing the index based on the conditions > input <- read_delim(" YEAR DAY X Y Sig + 1981 9 -0.213 1.08 1.10 + 198110 0.065 1.05 1.05", delim = ' ', trim_ws = TRUE) > > input <- mutate(input, + phase = case_when(X < 0 & Y < 0 & Y

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread jim holtman
Had the condition for phase=2 incorrect: library(tidyverse) input <- read_delim(" YEAR DAY X Y Sig 1981 9 -0.213 1.08 1.10 198110 0.065 1.05 1.05", delim = ' ', trim_ws = TRUE) input <- mutate(input, phase = case_when(X < 0 & Y < 0 & Y < X ~ 'phase=1',

Re: [R] Conditions in R (Help Post)

2019-10-22 Thread jim holtman
Here is one way of doing it; I think the output you show is wrong: library(tidyverse) input <- read_delim(" YEAR DAY X Y Sig 1981 9 -0.213 1.08 1.10 198110 0.065 1.05 1.05", delim = ' ', trim_ws = TRUE) input <- mutate(input, phase = case_when(X < 0 & Y < 0 & Y < X

[R] Conditions in R (Help Post)

2019-10-22 Thread Yeasmin Alea
Hello Team I would like to add a new column (for example-Phase) from the below data set based on the conditions YEAR DAY X Y Sig 1 1981 9 -0.213 1.08 1.10 2 198110 0.065 1.05 1.05 *Conditions* D$Phase=sapply(D,function(a,b) { a <-D$X b<-D$Y if (a<0 &

[R] R-help post Bayesian CART

2013-01-07 Thread Rachel Plewes
Hi, I have explored many of the R packages that construct Bayesian trees including the tgp, bart, BMA and maptree packages. I have also searched through some other packages but they do not seem to be suitable for the type of analysis I need to do. I need to construct Bayesian CART that have ter