[R] problem with switching windows in RSelenium..

2021-12-22 Thread akshay kulkarni
dear Kim, Hope you are doing well. I am Akshay, from bengaluru, INDIA. I am stock trader and am using R for my research. More specifically, I am using RSelenium to scrape news articles. I am stuck in the problem related to RSelenium. I am not able to switch windows in Rselenium

Re: [R] able to estimate in the excel but not in R, any suggestion?

2021-12-22 Thread Marna Wagley
Dear Jim, Thank you very much for the help. The code seems to be right. Using this code, I got exactly the same value as the excel's value. This is great. Thanks MW On Wed, Dec 22, 2021 at 10:57 PM jim holtman wrote: > You need to use the 'ifelse' function. I think I copied down your > formula

Re: [R] able to estimate in the excel but not in R, any suggestion?

2021-12-22 Thread jim holtman
You need to use the 'ifelse' function. I think I copied down your formula and here is the output: > daT<-structure(list(sd = c(0.481, 0.682, 0.741, 0.394, 0.2, 0.655, 0.375), + mcd = c(51.305, 51.284, 51.249, 51.2, 51.137, 51.059, 50.968), ca = + c(49.313, 69.985, 75.914, 40.303, 20.493,

[R] able to estimate in the excel but not in R, any suggestion?

2021-12-22 Thread Marna Wagley
Hi R users, I was trying to estimate some values in r but could not figure out how to write the script in r. Although I was able to estimate it correctly in the excel. For example I have the following data set. daT<-structure(list(sd = c(0.481, 0.682, 0.741, 0.394, 0.2, 0.655, 0.375), mcd =

Re: [R] Speed up studentized confidence intervals ?

2021-12-22 Thread David Winsemius
I’m wondering if this is an X-Y problem. (A request to do X when the real problem should be doing Y. ) You haven’t explained the goals in natural or mathematical language which is leaving me to wonder why you are doing either sampling or replication (much less doing both within each iteration

Re: [R] Creating NA equivalent

2021-12-22 Thread John Dougherty via R-help
On Tue, 21 Dec 2021 05:41:31 +0100 Marc Girondot via R-help wrote: > Dear members, > > I work about dosage and some values are bellow the detection limit. I > would like create new "numbers" like LDL (to represent lower than > detection limit) and UDL (upper the detection limit) that behave

Re: [R] for loop question in R

2021-12-22 Thread Kai Yang via R-help
Hi Rui and Ivan,Thank you explain of the code for me in detail. This is very helpful. And the code works well now.Happy Holiday,Kai On Wednesday, December 22, 2021, 02:30:49 PM PST, Rui Barradas wrote: Hello, y[i] and c[i] are character strings, they are not variables of data set

Re: [R] for loop question in R

2021-12-22 Thread Rui Barradas
Hello, There's a stupid typo in my previous post. Inline Às 22:30 de 22/12/21, Rui Barradas escreveu: Hello, y[i] and c[i] are character strings, they are not variables of data set mpg. To get the variables, use, well, help("get"). Note that I have changed the temp dir to mine. So I

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Rui Barradas
Hello, The error is a simple typo, instead of the period after names(Data[,1]), it should be a comma. cat(format(names(Data[,1]), "\n", v1, justify = "right"), sep = "\n") (And the error message accurately points out where the error is, in these cases try to read the instruction more

Re: [R] for loop question in R

2021-12-22 Thread Rui Barradas
Hello, y[i] and c[i] are character strings, they are not variables of data set mpg. To get the variables, use, well, help("get"). Note that I have changed the temp dir to mine. So I created a variable to hold the value tmpdir <- "c:/temp/" for (i in seq(nrow(mac))){ mpg %>%

Re: [R] for loop question in R

2021-12-22 Thread Kai Yang via R-help
strange, I got error message when I run again: Error: unexpected symbol in: "    geom_point()   ggsave" > } Error: unexpected '}' in "}" On Wednesday, December 22, 2021, 10:18:56 AM PST, Kai Yang wrote: Hello Eric, Jim and Ivan, Many thanks all of your help. I'm a new one in R area.

Re: [R] for loop question in R

2021-12-22 Thread Kai Yang via R-help
Hello Eric, Jim and Ivan, Many thanks all of your help. I'm a new one in R area. I may not fully understand the idea from you.  I modified my code below, I can get the plots out with correct file name, but plots  are not using correct fields' name. it use y[i], and c[i] as variables' name,

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Stephen H. Dawson, DSL via R-help
Thanks. I am pondering label names, not set on one as of yet. I like your recommendation. > cat(format(names(Data[,1]). "\n", v1, justify = "right"), sep = "\n") Error: unexpected symbol in "cat(format(names(Data[,1])." > Your proposed syntax has an error. QUESTION Can you identify the

Re: [R] for loop question in R

2021-12-22 Thread Ivan Krylov
On Wed, 22 Dec 2021 16:58:18 + (UTC) Kai Yang via R-help wrote: > mpg %>%    filter(hwy <35) %>%     ggplot(aes(x = displ, y = y[i], > color = c[i])) +     geom_point() Your code relies on R's auto-printing, where each line of code executed at the top level (not in loops or functions) is

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Avi Gross via R-help
Stephen, Why should there be a column header when you take your data and reformat it? cat(format(v1, justify = "right"), sep = "\n") The above is no longer your original data structure and has specified what you want printed. Your column header and other names associated with your original

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Duncan Murdoch
On 22/12/2021 12:01 p.m., Stephen H. Dawson, DSL wrote: Data <- read.csv("./input/Source.csv", header=T) v1 <- sort(unique(Data[, 1])) cat(format(v1, justify = "right"), sep = "\n") OK, working with the options you presented. This is the combination where I gain the most benefit. However,

Re: [R] for loop question in R

2021-12-22 Thread jim holtman
You may have to add an explicit 'print' to ggplot library(ggplot2) library(tidyverse) y <- c("hwy","cty") c <- c("cyl","class") f <- c("hwy_cyl","cty_class") mac <- data.frame(y,c,f) for (i in nrow(mac)){ mpg %>%filter(hwy <35) %>% print(ggplot(aes(x = displ, y = y[i], color = c[i])) +

Re: [R] for loop question in R

2021-12-22 Thread Eric Berger
Try replacing "c:/temp/f[i].jpg" with paste0("c:/temp/",f[i],".jpg") On Wed, Dec 22, 2021 at 7:08 PM Kai Yang via R-help wrote: > Hello R team,I want to use for loop to generate multiple plots with 3 > parameter, (y is for y axis, c is for color and f is for file name in > output). I created a

Re: [R] for loop question in R

2021-12-22 Thread Andrew Simmons
nrow() is just the numbers of rows in your data frame, use seq_len(nrow()) or seq(nrow()) to loop through all row numbers On Wed, Dec 22, 2021, 12:08 Kai Yang via R-help wrote: > Hello R team,I want to use for loop to generate multiple plots with 3 > parameter, (y is for y axis, c is for color

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Stephen H. Dawson, DSL via R-help
Wow! Thanks. I need to process the logic you have presented next week when I have the time to focus. I now need to accomplish some productive work output based on what I have now for understandings. Kindest Regards, *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Stephen H. Dawson, DSL via R-help
Data <- read.csv("./input/Source.csv", header=T) v1 <- sort(unique(Data[, 1])) cat(format(v1, justify = "right"), sep = "\n") OK, working with the options you presented. This is the combination where I gain the most benefit. However, there is no listing of a column header with the output of

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Avi Gross via R-help
Stephen, Understanding a bit better where you are coming from, I come back to how people think about things. Languages like R often focus on doing things incrementally. I don't mean the language exactly as much as many of the people using the language. So it is perfectly normal to make

[R] for loop question in R

2021-12-22 Thread Kai Yang via R-help
Hello R team,I want to use for loop to generate multiple plots with 3 parameter, (y is for y axis, c is for color and f is for file name in output). I created a data frame to save the information and use the information in for loop. I use y[i], c[i] and f[i] in the loop, but it seems doesn't

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Rui Barradas
Hello, The problem is that the vectors of unique values in each column of the original data.frame Data need not be same length. And the output of sort(unique(.)) is a list of vectors of different lengths. And lists print "horizontally", each vector on its own. Like Duncan said, one of the

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Stephen H. Dawson, DSL via R-help
OK, now I get what you are suggesting. Much appreciated. Kindest Regards, *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865) 804-3454 http://www.shdawson.com On 12/22/21 11:08 AM, Duncan Murdoch wrote: On 22/12/2021 10:55 a.m.,

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Duncan Murdoch
On 22/12/2021 10:55 a.m., Stephen H. Dawson, DSL wrote: I see. So, we are talking taking the output into a new dataframe. I was hoping to have the output rendered on screen without another dataframe, but I can live with this option it if must occur. Am I correct the desired vertical output

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Stephen H. Dawson, DSL via R-help
I see. So, we are talking taking the output into a new dataframe. I was hoping to have the output rendered on screen without another dataframe, but I can live with this option it if must occur. Am I correct the desired vertical output must first go to a dataframe? *Stephen Dawson, DSL*

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Stephen H. Dawson, DSL via R-help
Avi, Thanks for the detailed reply. I am unable to reply with the same detail. Please do not take my lack of response depth as demonstrating a lack of appreciation. My intent was to post an open-ended question asking best process, not best practice, to amend sort to unique. I posted code

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Duncan Murdoch
On 22/12/2021 10:20 a.m., Stephen H. Dawson, DSL wrote: Thanks for the reply. Both syntax options work to render the correct (unique) output. However, the output is rendered as horizontal. What needs to happen to get the output to render vertical, please? The result of those expressions is a

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Stephen H. Dawson, DSL via R-help
Bert, Thanks for the reply. I did not think to put values back into the same column. This action would not make sense to me, as it would destroy data integrity. I guess adding to a new column in the same container, in this case a dataframe, is possible but again not probable with me.

Re: [R] Adding SORT to UNIQUE

2021-12-22 Thread Stephen H. Dawson, DSL via R-help
Thanks for the reply. Both syntax options work to render the correct (unique) output. However, the output is rendered as horizontal. What needs to happen to get the output to render vertical, please? *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865)

[R] visualizing CTM topic models in R...

2021-12-22 Thread akshay kulkarni
dear members, I am using topicmodels package in R to segregate some news articles related to stocks. I know that I can visualize LDA models with LDAvis package. But I have not stumbled upon any package or a base function(in the internet) to visualize the CTM model. Any