Re: [R] Pruning a dendrogram based on frequencies

2018-05-08 Thread Jim Lemon
Hi Franklin, plot.dendrite was not designed to be pruned. I have had a look at the problem, and I may be able to suggest a way to drop values in the "dendrite" object that is the input to plot.dendrite. I'll let you know. Jim On Tue, May 8, 2018 at 11:46 PM, Franklin Mairura via R-help wrote: >

Re: [R] Adding Year-Month-Day to X axis

2018-05-08 Thread Gregory Coats
I do not see any difference between the x versus y plot drawn in blue, and the y only plot drawn in red. Is the correct? Greg y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066, 258.23166, 282.01816, 280.0

[R] NAs produced by integer overflow, but only some time ...

2018-05-08 Thread Stefan Th. Gries
I have problem with integer overflow that I cannot understand. I have a character vector curr.lemmas with the following properties: length(curr.lemmas) # 61224 length(unique(curr.lemmas)) # 2652 That vector is the input to the following function: yules.k1 <- function(input) { m1 <- length(in

Re: [R] Adding Year-Month-Day to X axis

2018-05-08 Thread Jim Lemon
Hi Greg, This is because both plots have equally spaced x values. To see the difference, try this: plot (x_mmdd, y_duration, type="l", xaxt="n", yaxt="n", ylim=range(240,480), xlab="", ylab="", col="blue") axis(1) plot (y_duration, type="l", xaxt="n", yaxt="n", ylim=range(240,480),

Re: [R] Average of results coming from B=100 repetitions (looping)

2018-05-08 Thread varin sacha via R-help
Many thanks for all of you for your responses. Best Regards, SV Le mardi 8 mai 2018 à 21:58:37 UTC+2, Daniel Nordlund a écrit : On 5/8/2018 12:26 PM, varin sacha via R-help wrote: > >  Dear R-experts, > > Here below the reproducible example. I am trying to get the average of the

[R] Revolutions blog roundup, April 2018

2018-05-08 Thread David Smith (CDA) via R-help
Since 2008, Microsoft staff and guests have written about R at the Revolutions blog (http://blog.revolutionanalytics.com) and every month I post a summary of articles from the previous month of particular interest to readers of r-help. In case you missed them, here are some articles related to R f

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread David Winsemius
> On May 8, 2018, at 10:08 AM, Evans, Richard K. (GRC-H000) > wrote: > > Hi David, .. I think I've got it :-) > Please let me know if you see anything glaringly wrong with this: > > library(RCurl) > zWebObj <- postForm("https://www.semantic-mediawiki.org/w/api.php";, > "action" = "ask", >

Re: [R] Average of results coming from B=100 repetitions (looping)

2018-05-08 Thread Daniel Nordlund
On 5/8/2018 12:26 PM, varin sacha via R-help wrote: Dear R-experts, Here below the reproducible example. I am trying to get the average of the 100 results coming from the "lst" function. I have tried lst$mean and mean(lst). It does not work. Any help would be highly appreciated > ##

Re: [R] Average of results coming from B=100 repetitions (looping)

2018-05-08 Thread Bert Gunter
mean(lst) ### See ?mean. A list cannot be an argument of mean. lst$mean ## nonsense! Don't guess -- read the docs. Here is an an example: > z <- list() > for(i in 1:5) z[i] <- i > z [[1]] [1] 1 [[2]] [1] 2 [[3]] [1] 3 [[4]] [1] 4 [[5]] [1] 5 > mean(z) [1] NA Warning message: In mean.default(

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread David Winsemius
> On May 8, 2018, at 10:08 AM, Evans, Richard K. (GRC-H000) > wrote: > > Hi David, .. I think I've got it :-) > Please let me know if you see anything glaringly wrong with this: > > library(RCurl) > zWebObj <- postForm("https://www.semantic-mediawiki.org/w/api.php";, > "action" = "ask", >

Re: [R] Average of results coming from B=100 repetitions (looping)

2018-05-08 Thread Eric Berger
mean(unlist(lst)) On Tue, May 8, 2018 at 10:26 PM, varin sacha via R-help < r-help@r-project.org> wrote: > > Dear R-experts, > > Here below the reproducible example. I am trying to get the average of the > 100 results coming from the "lst" function. I have tried lst$mean and > mean(lst). It doe

[R] Average of results coming from B=100 repetitions (looping)

2018-05-08 Thread varin sacha via R-help
Dear R-experts, Here below the reproducible example. I am trying to get the average of the 100 results coming from the "lst" function. I have tried lst$mean and mean(lst). It does not work. Any help would be highly appreciated.  ## R script for getting MedAe and MedAeSQ

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread Evans, Richard K. (GRC-H000)
Hi David, .. I think I've got it :-) Please let me know if you see anything glaringly wrong with this: library(RCurl) zWebObj <- postForm("https://www.semantic-mediawiki.org/w/api.php";, "action" = "ask", "query" = "[[Category:City]]|?Capital%20of|?Has%20area", "format" = "json" .opt

[R] plm(...,"within","twoways") extremely slow on unbalanced panel

2018-05-08 Thread Sheldon Du
I am using it on a big dataset. The estimation was done in hours. But summary() takes forever. Any suggestion is greatly appreciated! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see http

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread Evans, Richard K. (GRC-H000)
[non-tabular json data] -- ok.. so I think I need to figure out how to make it tabular. Thanks! [curl] -- I was hoping there was a cleaner way to do it.. using R to evoke cURL to get the data as text and then passing it into getJSON seems to be what I need to do. Do you by chance have an simpl

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread Evans, Richard K. (GRC-H000)
I can do it with cURL from the linux bash shell.. not in R -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Tuesday, May 08, 2018 12:25 PM To: Evans, Richard K. (GRC-H000) Cc: r-help@r-project.org Subject: Re: [R] help with json data from the web into data fr

Re: [R] Bilateral matrix

2018-05-08 Thread Bert Gunter
or in base R : ?xtabs?? as in: xtabs(~previous_location + current_location,data=x) (You can convert the 0s to NA's if you like) Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread David Winsemius
> On May 8, 2018, at 9:03 AM, Evans, Richard K. (GRC-H000) > wrote: > > That said, I have two issues to ask for help with: > > 1) how to ignore cert errors with a fromJSON call If you can do it with curl, then why aren't you doing one of a) a system call, b) installing and loading RCurl, c)

Re: [R] Bilateral matrix

2018-05-08 Thread Huzefa Khalil
Dear Miluji, If I understand correctly, this should get you what you need. temp1 <- structure(list(id = 101:115, current_location = structure(c(2L, 8L, 8L, 3L, 6L, 5L, 1L, 2L, 7L, 4L, 2L, 8L, 8L, 3L, 6L), .Label = c("Austin", "Boston", "Cambridge", "Durham", "Houston", "Lynn", "New Orleans", "New

[R] Bilateral matrix

2018-05-08 Thread Miluji Sb
I have data on current and previous location of individuals. I would like to have a matrix with bilateral movement between locations. I would like the final output to look like the second table below. I have tried using crosstab() from the ecodist but I do not have another variable to measure the

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread Evans, Richard K. (GRC-H000)
That said, I have two issues to ask for help with: 1) how to ignore cert errors with a fromJSON call And 2) why the json data from the example link doesn't convert to a data frame. As seen in the following example library("rjson") result <- fromJSON(file = "https://www.semantic-mediawiki.or

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread Evans, Richard K. (GRC-H000)
Right. I'm trying to access a server within my organization which has a cert error that I cannot fix. The example link I provided was to a site on the web that does not have the cert error. From the linux shell I use the "-k" switch with cURL to ignore cert errors.. is there an equivalent in

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread David Winsemius
> On May 8, 2018, at 8:36 AM, Evans, Richard K. (GRC-H000) > wrote: > > I’ve been tinkering and discovered that the link I need to read json data > from is ‘https’ and there is a certificate warning that I have to click > through from a browser. That might be my issue. Is there any way in the

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread Evans, Richard K. (GRC-H000)
I’ve been tinkering and discovered that the link I need to read json data from is ‘https’ and there is a certificate warning that I have to click through from a browser. That might be my issue. Is there any way in the json package to tell it to ignore self-signed cert errors in a url? -Rich Fr

Re: [R] help with json data from the web into data frame in R

2018-05-08 Thread Eric Berger
Hi Rich, Take a look at the function fromJSON found in the rjson package. Note that the Usage in the help page: ?fromJSON names the second argument 'file' but if you look at the description the argument can be a URL. HTH, Eric On Tue, May 8, 2018 at 6:16 PM, Evans, Richard K. (GRC-H000) < richar

[R] help with json data from the web into data frame in R

2018-05-08 Thread Evans, Richard K. (GRC-H000)
Hello I am able to construct a url that points to some data online in the JSON format. See an example at [0]. I would like to work with this data as a dataframe in R. I know that there is a package for handling json data [1] but it assumes the data is in a local file but It is not clear to me

Re: [R] Adding Year-Month-Day to X axis

2018-05-08 Thread Eric Berger
abline (v=x_mmdd, lty=3, lwd=1.0, col="blue") On Tue, May 8, 2018 at 5:23 PM, Gregory Coats wrote: > Since the horizontal axis side=1 is year-month-day, how do I issue an > abline command to draw dashed vertical lines, as a background grid, within > the graph’s border? Similar to the ablin

Re: [R] Adding Year-Month-Day to X axis

2018-05-08 Thread Gregory Coats
Since the horizontal axis side=1 is year-month-day, how do I issue an abline command to draw dashed vertical lines, as a background grid, within the graph’s border? Similar to the abline command I call below, in blue, for dashed horizontal lines, as a background grid. Greg y_duration <- c (301.

[R] Pruning a dendrogram based on frequencies

2018-05-08 Thread Franklin Mairura via R-help
How can one prune a dendrogram (plot.dendrite, plotrix) based on a minimum level of frequencies?. Franklin.  [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/l

Re: [R] a question about R script : "Can only modify plain character vectors."

2018-05-08 Thread Eric Berger
Can you create a small script that reproduces the problem? If you can, then please post it to the mailing list. On Tue, May 8, 2018 at 4:24 PM, Bogdan Tanasa wrote: > Dear all, > > would appreciate a suggestion about the following situation : I am running > a script in R, and shall i execute it

[R] a question about R script : "Can only modify plain character vectors."

2018-05-08 Thread Bogdan Tanasa
Dear all, would appreciate a suggestion about the following situation : I am running a script in R, and shall i execute it in the terminal, step by step, it works fine. however, if i do source ("script.R"), it does not complete and I am getting the error : "Can only modify plain character vector

Re: [R] Dinamic variables in loop

2018-05-08 Thread Thierry Onkelinx
Dear Laura, It looks like you want to remove all rows for which each column is NA. You can to that with the code below. na.matrix <- is.na(MyData) all.na.row <- apply(na.matrix, 1, all) MyData[!all.na.row, ] Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Gove

[R] Dinamic variables in loop

2018-05-08 Thread Laura Ringienė
Hello, I am a newbie in R and I have a problem. I want this line: newMyData <-MyData[!(is.na(col1)) | !(is.na(col2)) | !(is.na(col3)) | !( is.na(col4)) | !(is.na(col5)),] write in for loop. The number of col[number] may be different from 3 to 8 Is there any ideas? Thank you Laura [[al

Re: [R] Request for information

2018-05-08 Thread Bert Gunter
See here: https://cran.r-project.org/web/views/MachineLearning.html Also search! e.g. at rseek.org ... Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic st

[R] Request for information

2018-05-08 Thread aijaz qazi
Dear Developers, I am a data science student. I wish to implement Neuro fuzzy Classifier, Adaboost, MLkNN Multi label algorithms for web document classification. I could not find packages and steps for above mention algorithms in mlr

[R] Fitting problem for Cox model with Strata as interaction term

2018-05-08 Thread wong jane
Dear All, I got a warning message "X matrix deemed to be singular" in Cox model with a time dependent coefficient. In my analysis, the variable "SEX" is a categorical variable which violate the PH assumption in Cox. I first used the survSplit() function to break the data set into different time i