Re: [R] Question about dotwhisker

2020-12-19 Thread Dan Bolser
Fri, 18 Dec 2020 at 13:47, Dan Bolser wrote: > Hello, > > I'm reading this and one part is confusing me (the most ;-) > > library(dotwhisker) > library(broom) > library(dplyr) > > m1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars) > > # Please compare:

[R] Question about dotwhisker

2020-12-19 Thread Dan Bolser
0.006944-0.490445 Sorry if I'm being stupid, but the latter looks right while the former looks wrong (i.e. I can't work out what the former is actually plotting). Many thanks, Dan. [[alternative HTML version deleted]] __ R-help@r-projec

Re: [R] R-help Digest, Vol 212, Issue 12

2020-10-14 Thread Dan Ryan
Dear Frauke, Thank you very much for taking the time to respond. You explanation was very helpful, and I now have that part figured out! Best Wishes, Dan Frauke Message: 3 Date: Mon, 12 Oct 2020 08:33:44 +0200 (CEST) From: =?UTF-8?Q?Frauke_G=C3=BCnther?= To: "r-help@r-project.org

Re: [R] Help using the exclude option in the neuralnet package

2020-10-09 Thread Dan Ryan
constant.weights vectors. Question: Can someone point me to an example where exclude and contant.weights are used. I have search the R help archive, and haven't found any examples which use these on the web. Thank you in advance for any help. Sincerely Dan [[alternative

[R] Help with for loops and if statements

2020-09-24 Thread Dan Bosio
Hi there I am in an intro to R course and the professor has not been much help. One of the questions on the latest homework has me stumped. The question is below, along with my answers so far. 8. [15 points] Given the following code, # # x <- rnorm(10) # # Do the following. # # (1) create a cou

[R] Searching for Enumerated Items using str_count() from the stringr package

2017-09-28 Thread Dan Abner
words<-c(paste(0:9,"\\)"),paste(0:9,"\\)",sep=""), paste(0:9,"."),paste(0:9,".",sep=""),"-","*")} keywords Count<-str_count(text3,keywords) === I am looking for Count<-c(3,0) Any suggestions? Thanks! Dan

[R] Efficient Binning

2017-07-14 Thread Dan Abner
., easier) way to go about this? boundaries<-(0:16)/16 rand<-runif(1) Which bin number (1:16) does rand fall in? Thanks, Dan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] For loop

2017-06-22 Thread Nordlund, Dan (DSHS/RDA)
For a reproducible example, you need to give us some example data, at least dput(head(leafbiom97)) dput(head(Litterfall_Ahmed97)) dput(head(GPP_Ahmed13)) Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Departmen

Re: [R] rmarkdown and font size

2017-06-08 Thread Nordlund, Dan (DSHS/RDA)
Here is some normal text. It is a 12-point font. The table is in 8-point . ```{r example, echo=FALSE, results='asis'} tmp <- data.frame(a=1:5, b=letters[1:5]) print( knitr::kable(tmp, row.names=FALSE)) ``` Hope this is helpful, Dan Daniel Nordlund, PhD Research and Data Ana

Re: [R] Force argument to have quotes

2017-06-06 Thread Nordlund, Dan (DSHS/RDA)
lse(Class=='character',shQuote(Value), Value), sep = '=', collapse = ",")) Hope this helps, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -

Re: [R] Counting enumerated items in each element of a character vector

2017-04-26 Thread Dan Abner
h blah blah 1. 2. blah blah blah. blah blah blah.") text1 Thank you in advance for your suggestions and/or guidance. Best, Dan On Wed, Apr 26, 2017 at 12:52 AM, Michael Hannon wrote: > Thanks, Ista. I thought there might be a "tidy" way to do this, but I > hadn

[R] Counting enumerated items in each element of a character vector

2017-04-25 Thread Dan Abner
, then I expect that will be easy enough to differentiate sentences ending with a number from enumerated items. However, I imagine it would be much more difficult to differentiate the two for example 4. Any suggestions are appreciated. Best, Dan [[alternative HTML version deleted]] __

Re: [R] Interesting quirk with fractions and rounding

2017-04-20 Thread Nordlund, Dan (DSHS/RDA)
igits=20) [1] 57.5 > Your example with all.equal evaluates TRUE because all.equal uses a 'fuzz factor'. From the all.equal man page "all.equal(x, y) is a utility to compare R objects x and y testing 'near equality'." Hope this is helpful, Dan Daniel Nordlun

Re: [R] Quantmod cant download data

2017-04-18 Thread Nordlund, Dan (DSHS/RDA)
mp;z=SPY&x=.csv' Content type 'text/csv' length unknown downloaded 187 KB done. [1] "SPY" > Hope this is useful, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Socia

Re: [R] Getting unexpected extra rows (continued)

2017-03-30 Thread Nordlund, Dan (DSHS/RDA)
This is pretty basic stuff which suggests you need to (re)read the intro to R that comes with your R installation. One approach would be : xFrame <- data.frame(x=x, Transits=NA) hope this is helpful, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise

Re: [R] Splitting on metacharacters

2017-03-28 Thread Nordlund, Dan (DSHS/RDA)
7;) . s <- "{\"Q0\":\"37\",\"Q1\":\"f\"}" s cat(s,'\n') '"'# single quote, double quote, single quote strsplit(s, '"') Hope this is helpful, Dan Daniel Nordlund, PhD Research and Data An

Re: [R] Problem with greek characters in R

2017-03-09 Thread Nordlund, Dan (DSHS/RDA)
t, and describe in more detail what you are trying to do with it, someone may be able to offer a solution. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services On March 9, 2017 2:

Re: [R] Reverse the scoring of some Columns of a Data Set

2017-03-09 Thread Nordlund, Dan (DSHS/RDA)
Another alternative (which didn't work last night when I was tired and obviously doing something wrong) is to use the built-in function, rev(): df[,1:3] <- apply(df[,1:3], 2, rev) Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Ad

Re: [R] Coefficient of Partial Determination

2017-03-01 Thread Nordlund, Dan (DSHS/RDA)
The rms and Hmisc packages can be found on CRAN. Just run install packages from the console menu. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original

Re: [R] Error with "compiler" and "caret" packages

2017-01-26 Thread Nordlund, Dan (DSHS/RDA)
The compiler package may be installed on your computer, but did you load it with library(compiler) Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original

Re: [R] Match ISO 8601 week-of-year numbers to month-of-year numbers on Windows with German locale

2017-01-12 Thread Nordlund, Dan (DSHS/RDA)
year_week_day, format = "%Y-%U-%u")) > ## [1] "2015-12-21 PST" "2015-12-28 PST" NA "2016-01-04 PST" Why do you say it works fine on Ubuntu? The date "2016-01-01" is in week 0 of 2016. There is no Monday in week 0. So I would argue t

[R] Generating a Special Histogram

2017-01-05 Thread Dan Abner
these for different samples of n=25, so the manual approach would be very painful... Thanks, Dan hist1.pdf Description: Adobe PDF document __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help

[R] Extracting non-matching elements of one vector from another

2016-12-31 Thread Dan Abner
Hi all, I have 2 vectors and need to extract only the elements from v2 that do not appear in v1. What is the most efficient way to do this? In the example below, I need to extract "var1". v1<-"b0" v2<-c("b0","var1") Thanks, D

Re: [R] Generating Heavy and Light Tailed Normal Variates

2016-12-16 Thread Dan Abner
Hi Bert, Thank you for the response. Let me re-phrase: What is the most efficient way to generate variates from a unimodal symmetric distribution that are leptokurtic or platykurtic in R? There does not appear to be a kurtosis parameter for rnorm(). Thanks all, Dan On Fri, Dec 16, 2016 at 10

[R] Generating Heavy and Light Tailed Normal Variates

2016-12-16 Thread Dan Abner
Hi all, I need to generate heavy and light-tailed normal variates separately for demonstration purposes. I figure for the heavy-tailed, I will just generate variates from a t distribution with low degrees of freedom. How does one generate light-tailed normal variates? Thanks, Dan

Re: [R] R & MongoDB

2016-12-01 Thread Nordlund, Dan (DSHS/RDA)
://stat.ethz.ch/mailman/listinfo/r-sig-db Good luck! Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > From: R-help [mailto:r-help-boun...@r-proje

Re: [R] bzip2

2016-10-31 Thread Nordlund, Dan (DSHS/RDA)
I don't know what version Linux or other OS you are using, but have you installed the bzip2 development package? It would be named something like libbz2-dev (that is what it is in Ubuntu, I believe). Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterpris

Re: [R] function ave() with seq_along returning char sequence instead of numeric

2016-10-31 Thread Nordlund, Dan (DSHS/RDA)
ead in the help pages. But you are right, using any numeric vector of appropriate size as the first argument does what I need. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Service

[R] function ave() with seq_along returning char sequence instead of numeric

2016-10-31 Thread Nordlund, Dan (DSHS/RDA)
ot;2" "3" "1" "2" "3" "4" I was expecting to get a numeric vector back. I apparently have missed something in the documentation. If vector v is character, then the numeric sequence is converted to character before returning. I can work ar

Re: [R] using read.csv2()

2016-09-29 Thread Nordlund, Dan (DSHS/RDA)
Or, you can just use read.csv with sep=';' read.csv("test.csv", sep=';') -> don Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -

Re: [R] Writing data onto xlsx file without cell formatting

2016-09-27 Thread Nordlund, Dan (DSHS/RDA)
value if you don't want to start writing in the first row of the cell block region. I didn't look around much to see if the addDataFrame() function could be used with a cell block region. You can play with the various functions and parameters to decide if the xlsx package will meet you

Re: [R] Problem Mixstock in R

2016-09-21 Thread Nordlund, Dan (DSHS/RDA)
he maintainer of the package directly with your questions. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > From: R-help [mailto:r-help-boun.

Re: [R] Need help with use of ROCK algorithm in R for binary data

2016-08-16 Thread Nordlund, Dan (DSHS/RDA)
If you want to "predict" what clusters NEW data would fall into, then use predict(). It is not surprising that predict() used on the original data would predict the fitted results. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support A

Re: [R] Date Time in R

2016-07-26 Thread Nordlund, Dan (DSHS/RDA)
You still seem to be having problems, so where is the promised reproducible example? Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > Fr

Re: [R] Selecting 1st and last dates from a set of dates

2016-07-14 Thread Nordlund, Dan (DSHS/RDA)
eturn one row per minimum and maximum date in the month. My approach would return all rows where d$Date was equal to the minimum or maximum dates in a month. Which to use depends on what the OP needs. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Suppo

Re: [R] Selecting 1st and last dates from a set of dates

2016-07-14 Thread Nordlund, Dan (DSHS/RDA)
Using William Dunlap's data, here is another alternative: library(zoo) aggregate(d$Date,list(as.yearmon(d$Date)),min) aggregate(d$Date,list(as.yearmon(d$Date)),max) Hope this is helpful, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Admin

[R] GAMS, std errors and confidence intervals

2016-07-04 Thread Dan Jaffe
Can anyone help me calculating CIs from a GAM analysis? I have calculated a GAM fit (m3) and the associated std errors using predict.gam I assume that the 95% CI around each fit value would be 1.96 times the se.But when I do this both on the original and a test dataset, I find the CI's only en

Re: [R] Non-negative matrix factorization for term documnt matrix

2016-06-09 Thread Nordlund, Dan (DSHS/RDA)
A quick Google search suggests that the package, NMF, might be of help. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > From: R-help

Re: [R] problem: the id of the data set

2016-06-09 Thread Nordlund, Dan (DSHS/RDA)
We really need a reproducible example. Otherwise, we can only guess what the starting point was, how the merge was done, what the expected result was, and how the obtained result differed from the expected result. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services

Re: [R] Regression and Sub-Groups Analysis in Metafor

2016-05-31 Thread Dan Kolubinski
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, May 31, 2016 at 11:32 AM, Dan Kolubinski > wrote: > > That makes perfect sense. Thank you, Michael. I take your point about > not > > chasing the data and definitely see th

Re: [R] Regression and Sub-Groups Analysis in Metafor

2016-05-31 Thread Dan Kolubinski
the dataset to make sure that there are not any errors and will report the results as we see them. I much appreciate you taking the time! Best wishes, Dan On Tue, May 31, 2016 at 12:02 PM, Michael Dewey wrote: > In-line > > On 30/05/2016 19:27, Dan Kolubinski wrote: > >> I am

[R] Regression and Sub-Groups Analysis in Metafor

2016-05-30 Thread Dan Kolubinski
moderators instead of four? Much appreciated, Dan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://ww

Re: [R] rollapply and difftime

2016-05-26 Thread Nordlund, Dan (DSHS/RDA)
Another option Daily$tmdiff <- with(Daily, c(NA, diff(Date, units='days'))) Hope this is helpful, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -

Re: [R] Sprintf to call data frame from environment

2016-05-24 Thread Nordlund, Dan (DSHS/RDA)
omputing on the language" in R, but I can't help but think you are going about your task in the wrong way. If you provide more detail about what you are trying to do, someone will probably be able to provide you a solution where you don't need to do it this way. Hope this is helpf

Re: [R] identify duplicate entries in data frame and calculate mean

2016-05-24 Thread Nordlund, Dan (DSHS/RDA)
)) Hope this is helpful, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf

Re: [R] Creating a data frame from scratch

2016-05-24 Thread Nordlund, Dan (DSHS/RDA)
ly(dataset[,variable_list], 1, function(x) sum(is.na(x))) } Hope this is helpful, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > From: R-he

[R] Equivalent in R of the Contains operator in SAS

2016-04-16 Thread Dan Abner
Hi all, I want to select all variables in the data.frame with a name that includes are certain string. Something like the following: merge3[,names(merge3) %in% c("Email","Email.x")] But there are too many variations on the Email variable names to list them all. Can anyone a

Re: [R] Regression with factor having1 level

2016-03-10 Thread Nordlund, Dan (DSHS/RDA)
.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > I agree that what is wanted

Re: [R] R related issue

2016-03-10 Thread Nordlund, Dan (DSHS/RDA)
ssages did you receive? Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Santan

Re: [R] how to split and use notation fro stacked data

2016-02-24 Thread Nordlund, Dan (DSHS/RDA)
I will suggest that you read the documentation on t.test. ?t.test Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > From: R-help [mai

Re: [R] R Software Program Help

2016-02-23 Thread Nordlund, Dan (DSHS/RDA)
If you google "R Statistical Programming software" you will find all the information you could possibly want. In particular, for your purposes you should probably start with https://www.r-project.org/ and read the "About" section. Then follow other links as needed.

Re: [R] Confidence Interval for R-squared

2016-01-26 Thread Nordlund, Dan (DSHS/RDA)
A Google search suggested the use of the boot package to bootstrap a confidence interval for R-squared. http://www.statmethods.net/advstats/bootstrapping.html Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Depart

Re: [R] package broom

2016-01-06 Thread Nordlund, Dan (DSHS/RDA)
So, you need to download and install the mnormt package. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > From: R-help [mailto:r-help

Re: [R] vjust unresponsive (ggplot2)

2015-12-22 Thread Nordlund, Dan (DSHS/RDA)
Ista, You are correct, I was not at the latest release of ggplot2. I updated to the latest version and am now seeing the same result as you and the OP. So it does look like an issue with the latest version of ggplot2. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services

Re: [R] vjust unresponsive (ggplot2)

2015-12-22 Thread Nordlund, Dan (DSHS/RDA)
title very much so it may not be real noticeable. Try a value like 2 or 3, just to make sure you easily see the change in position before concluding that nothing is happening. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington St

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-16 Thread Nordlund, Dan (DSHS/RDA)
Which is why England and the United States have been described as two countries divided by a common language. (Could probably throw Scotland and Australia, and others, into the mix as well ... notice the parethenses, or nice round brackets, or ? :-} ) Dan Daniel Nordlund, PhD Research

[R] Simple DLNM in R

2015-12-06 Thread Dan Vecellio
Hello, first time poster so forgive any mistakes. I have limited familiarity with R, but am working on a project to find the relative risk of mortality due to changes in diurnal temperature range. What I am trying to do is find the relative risk of mortality at the 10th, 50th and 90th percentiles

Re: [R] Compute Regressions with R-Function

2015-11-12 Thread Nordlund, Dan (DSHS/RDA)
se of the names CO2 and logTrop_Aerosol as the function arguments. Those arguments don't refer to variables in the global environment. Function parameters have local scope in the function. Trend <- function(x,CO2,logTrop_Aerosol) { lm(x ~ CO2 + logTrop_Aerosol)} Dan Daniel Nor

Re: [R] cannot install RWinEdt

2015-11-06 Thread Nordlund, Dan (DSHS/RDA)
ces? So, I find the package listed on CRAN but there appears to be only source there, not a binary. I tried a few different mirrors with the same result. What have I missed? Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washingto

Re: [R] cannot install RWinEdt

2015-11-05 Thread Nordlund, Dan (DSHS/RDA)
You might want to upgrade to R-3.2.2 as there appears to be a RWinEdt binary available for it. Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services -Original Message- Fro

Re: [R] #2 (Thanks) → Consultation about reading hdf files from nsidc

2015-10-29 Thread Nordlund, Dan (DSHS/RDA)
“Program Files” directory, or . > > What do you think I am doing wrong? > > Thanks again, > > Jorge You need to wrap paths that contain spaces with double quotes. Given the way the lines are broken in the email I can only guess you might want something like this "C

[R] tcltk table properties

2015-10-01 Thread Dan D
I have a tkwidget table (say, tbl1) that may be reconfigured at various times depending on user input. Is there an easy way to later extract table properties? Something like... nrow<-tkgetproperties(tbl1, rows) Muchas thanks in advance. -Dan -- View this message in context: http://r.789

[R] vector manipulations -- differences

2015-09-21 Thread Dan D
c(0, 3, 7, 20) junk<-outer(x, x, '-') junk[junk>0] # yields: c(3, 7, 20, 4, 17, 13) as needed, but it has to go through junk # [,1] [,2] [,3] [,4] #[1,]0 -3 -7 -20 #[2,]30 -4 -17 #[3,]740 -13 #[4,] 20 17 13 0 Anyone have a better idea? -Dan

Re: [R] c(1:n, 1:(n-1), 1:(n-2), ... , 1)

2015-09-17 Thread Dan D
Very nice variety of solutions to create c(1:n, 1:(n-1), 1:(n-2), ... , 1) #Testing the methods with n=1000 (microbenchmark) n<-1000 # by far the nicest-looking, easiest to follow, and fastest is Frank Schwidom's: # it also requires the minimum amount of memory (as do several of the others) # 2.7

[R] c(1:n, 1:(n-1), 1:(n-2), ... , 1)

2015-09-17 Thread Dan D
Can anyone think of a slick way to create an array that looks like c(1:n, 1:(n-1), 1:(n-2), ... , 1)? The following works, but it's inefficient and a little hard to follow: n<-5 junk<-array(1:n,dim=c(n,n)) junk[((lower.tri(t(junk),diag=T)))[n:1,]] Any help would be greatly appreci

Re: [R] R WRONG CALCULATIONS - Please Help

2015-09-14 Thread Nordlund, Dan (DSHS/RDA)
Another option is apply(X,2,function(x) x-mean(x)) Hope this is helpful, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services -Original Message- From: R-help [mailto:r-

Re: [R] Help with vectors!

2015-09-09 Thread Dan D
VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") c(factor(VAS)) # to give integer indexing to the colors --- This is very nice, Frank. And it can be easily adjusted to match the original criterion that the numbers match the order of appearance of the colors

Re: [R] Help with vectors!

2015-09-08 Thread Dan D
Great! -- View this message in context: http://r.789695.n4.nabble.com/Help-with-vectors-tp4711801p4712023.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.

Re: [R] Counting number of rain

2015-09-08 Thread Dan D
k[junk[,1]==yrs[yi] & junk[,2]==mi,4]>0.01) # count the rainy days by # first subsetting the junk array by rows that match the given year and month and sum } } Does that help? - Dan -- View this message in context: http://r.789695.n4.nabble.com/Counting-number-of-rain-tp4712007p4712011

Re: [R] extracting every nth character from a string...

2015-09-07 Thread Dan D
# as a complete function StrSubset<-function(junk,n){ ifelse(n==1,junk, paste(strsplit(junk,split=NULL)[[1]][(1:nchar(junk))%%n==1],collapse='')) } -- View this message in context: http://r.789695.n4.nabble.com/extracting-every-nth-character-from-a-string-tp4711908p4711963.html Sent from th

Re: [R] extracting every nth character from a string...

2015-09-07 Thread Dan D
# or: strsplit("junk",split=NULL)[[1]][(1:nchar("junk"))%%2==1] strsplit("junk",split=NULL)[[1]][(1:nchar("junk"))%%2==0] -- View this message in context: http://r.789695.n4.nabble.com/extracting-every-nth-character-from-a-string-tp4711908p4711962.html Sent from the R help mailing list archiv

Re: [R] Help

2015-09-07 Thread Dan D
press ESC. You may have entered a command that was missing a parenthesis or something else that R needs before it can make sense out of your code (e.g., entering "sum(X" without the closing paren will give you that pattern). ESC brings back the command line and you can try ag

Re: [R] Handling "NA" in summation

2015-09-06 Thread Dan D
# it's not clear what your question is, but here's a stab in the dark at a solution! ind<- !is.na(dataframe$A) & !is.na(dataframe$B) dataframe$A[ind] + dataframe$B[ind] - Dan P.S. I'm sure there are ways to do this using one of R's functions for automatically rem

[R] Exporting column names with spaces with write.csv() XXXX

2015-09-05 Thread Dan Abner
Hi all, I have a number of columns with spaces in the column names exactly as I want them in R. When I go to export the data table to csv using write.csv(), the fn adds periods in place of the spaces. Is there a way to suppress the addition of the periods? Thanks, Dan

Re: [R] [Bayesian Methods] Riemann Sums for Posterior expected loss

2015-09-05 Thread Dan D
. [Note: I used cx as the parameter name rather than c because 'c' has a special meaning in R.] -Dan -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-Methods-Riemann-Sums-for-Posterior-expected-loss-tp4711900p4711901.html Sent from the R help maili

Re: [R] Plots Help

2015-09-05 Thread Dan D
length(post) is 1 (i.e., it is just a single function), but length(post(t)) == length(t) -- View this message in context: http://r.789695.n4.nabble.com/Plots-Help-tp4711894p4711897.html Sent from the R help mailing list archive at Nabble.com. __ R-he

Re: [R] Plots Help

2015-09-05 Thread Dan D
As written, the code does not run because you are trying to plot post vs. t. Try instead: plot(t, post(t)), or, more simply, plot(t, dbeta(t,1.05,30)) -Dan -- View this message in context: http://r.789695.n4.nabble.com/Plots-Help-tp4711894p4711896.html Sent from the R help mailing list

Re: [R] Help with vectors!

2015-09-05 Thread Dan D
# your data VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") # declare the new vector New_Vector<-numeric(length(VAS)) # brute force: New_Vector[VAS=="White"]<-1 New_Vector[VAS=="Yellow"]<-2 New_Vector[VAS=="Green"]<-3 New_Vector[VAS=="Black"]<-4 # a litt

Re: [R] For Loops please help!!

2015-09-05 Thread Dan D
ays, the difference can easily be a few seconds vs. an hour or more. And if many such arrays need to be run, the difference is between "difficult" and "not feasible". -Dan -- View this message in context: http://r.789695.n4.nabble.com/For-Loops-please-help-tp4711882p4711887

Re: [R] For Loops please help!!

2015-09-05 Thread Dan D
d(1:30,log(infectrate))# display -Dan -- View this message in context: http://r.789695.n4.nabble.com/For-Loops-please-help-tp4711882p4711885.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUB

Re: [R] For Loops please help!!

2015-09-05 Thread Dan D
The code has an error so it won't run as written. Instead of: infectrate[n]= (400)(1.1)^(n); try: infectrate[n]= 400*1.1^n; What I get after making this change looks right. -- View this message in context: http://r.789695.n4.nabble.com/For-Loops-please-help-tp4711882p4711884.html Sent from

Re: [R] Gamma count

2015-09-04 Thread Dan D
Pick the mean (mu) and variance (sig2) you want. Then, shape = mu^2/sig2 and scale = sig2/mu. This should work fine if your mean is large enough so that p(x = 0 or 1) is small. -- View this message in context: http://r.789695.n4.nabble.com/Gamma-count-tp4711845p4711853.html Sent from the R help

[R] edit GUI preferences for current session?

2015-09-03 Thread Dan D
I'd like to edit the GUI preferences for the current (Windows) session via command line rather than the Edit|GUI preferences menu. In particular, is there a way to change the pagerstyle to singlewindow without using the menu or editing the RConsole file? Any ideas? Thanks! -Dan -- View

[R] file.show cleanup

2015-09-03 Thread Dan D
The file.show() function seems to be exactly what I'm needing for displaying file contents for users, but I need something like "file.close()" to close the "R Information" window to clean up afterwards. Does anyone know if there is such a thing? -Dan -- View this mess

Re: [R] Convert character Variables to numeric

2015-08-26 Thread Nordlund, Dan (DSHS/RDA)
Or to provide data without using an attachment, use dput() and cut-n-paste the result into an email. dput(Mac[1:10,]) Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Serv

[R] Windows: URL associations do not work in scheduled tasks

2015-08-17 Thread Dan Tenenbaum
true false false true false true true false false false P3D 7 C:\biocbld\bbs-3.2-bioc\R\bin\R.exe -f test.R > out 2>&1 c:\biocbld\bbs-3.2-bioc\meat Thanks in advance for any help, Dan

Re: [R] Two conditions selection

2015-08-04 Thread Nordlund, Dan (DSHS/RDA)
,2),rep("blue",2),rep("green",2),rep("blue",2),rep("green",2)) > values=c(1:12) > values[col==blue & cycle==1] Or save the data frame and return the rows that you want like this > df <- data.frame(cycle,col,values) > df[df$col==blue &am

Re: [R] Environmental Data Connector v1.3

2015-08-03 Thread Nordlund, Dan (DSHS/RDA)
Why are you using paste() ? Why not just setwd(Sys.getenv("EDC_HOME")) Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services -Original Message- From: R-help

Re: [R] Reading data with two rows of variable names using read.zoo

2015-07-28 Thread Nordlund, Dan (DSHS/RDA)
7;-' df$V1 <- as.yearqtr(substr(df$V1,1,6)) df$A <- rowSums(df[,c(2,4)]) df$B <- rowSums(df[,c(3,5)]) want <- as.zoo(df[,-c(2:5)]) want Hope this is helpful, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington

Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R

2015-07-02 Thread Nordlund, Dan (DSHS/RDA)
*atan(bc(1))) in R and got this result "262537412640768743.2500725971981856888793538563373369908627075374103782106479101186073116295306145602054347" I don't know if this is helpful, but ... Dan Daniel Nordlund, PhD Research and Data Analysis Division Services

[R] spacetime stConstruct gives wrong dimensions for long table

2015-06-24 Thread Bebber, Dan
l dimensions and 31 timepoints. What am I doing wrong? Thanks, Dan Dr Dan Bebber Senior Research Fellow Biosciences University of Exeter __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-he

Re: [R] Find and replace backslashes XXXX

2015-05-27 Thread Dan Abner
simply change the backslash to a forward slash and therefore not need gsub at all... Thanks, Dan On Tue, May 26, 2015 at 9:56 PM, Ista Zahn wrote: > Escape the backslash with another backslash, i.e., > > gsub("\\","/","X:\\Classes\\TT\\Automation", fixed =

[R] Find and replace backslashes XXXX

2015-05-26 Thread Dan Abner
Hi all, I realize that the backslash is an escape character in R, therefore, I am trying to replace it with a forward slash. Can someone please suggest how to get this code to work? > lib<-gsub("\","/","X:\Classes\TT\Automation") Error: unexpected symbol in &

Re: [R] Convert csv to xpt file in R?

2015-05-07 Thread Nordlund, Dan (DSHS/RDA)
de above runs without error and produces an xport file on my Win7 64-bit system running R-3.2.0. You haven't told us anything about your OS, version of R, and packages loaded. Have you tried running the code from a fresh start of R after only loading the SASxport package? Dan Daniel J. No

Re: [R] update.packages() ask for mirror several times

2015-05-05 Thread Nordlund, Dan (DSHS/RDA)
Thanks, I will do that. Dan Daniel J. Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services > -Original Message- > From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] >

[R] update.packages() ask for mirror several times

2015-05-05 Thread Nordlund, Dan (DSHS/RDA)
loaded 12.8 MB followed by the rest of the packages which need updating. Dan Daniel J. Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington State Department of Social and Health Services ___

Re: [R] 'Installation of package had non-zero exit status' on R-3.2.0 (RStudio Version 0.98.1103) on Ubuntu 12.04 OS

2015-04-30 Thread Nordlund, Dan (DSHS/RDA)
to ask about on an Ubuntu forum, > not R-help. Once you get the library installed so that the curl-config > command works for you (outside of R), you should be able to install the > RCurl package in R. > > Duncan Murdoch > <<>> Or maybe even better, the r-s

Re: [R] BIG difficulties in Using boot.ci (bot package)

2015-04-13 Thread Nordlund, Dan (DSHS/RDA)
That is probably the number one reason for requesting a reproducible example when writing to R-help. In the proce3ss of working that out, you often solve your own problem. Best of luck with your bootstrapping, Dan Daniel J. Nordlund, PhD Research and Data Analysis Division Services

Re: [R] Randomly interleaving data frames while preserving order

2015-03-31 Thread Nordlund, Dan (DSHS/RDA)
can Murdoch > > > > Thanks Duncan. > > Once you see the solution it is indeed obvious. > > Kevin > > -- > Kevin E. Thorpe > Head of Biostatistics, Applied Health Research Centre (AHRC) > Li Ka Shing Knowledge Institute of St. Michael's > Assistant P

Re: [R] Best Mac for R

2015-02-25 Thread Dan Murphy
ation, etc. And for hard core (no pun intended) analysis, a multi-core machine won't be fully utilized without parallel implementation of some type. Thanks all for your advice. Just what I was looking for. Dan On Wed, Feb 25, 2015 at 2:53 PM, Karim Mezhoud wrote: > Hi, > It is not so

  1   2   3   4   5   6   7   8   >