Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-11 Thread Daniel Nordlund
: no non-missing arguments to max; returning -Inf Hope this helps, Rui Barradas After playing with this for a little while, I realized that the problem with plotting the confidence limits is the addition of ylim(470, 500).  The confidence values are outside the ylim values.  Remove

Re: [R] free_port returning only one port...

2023-01-08 Thread Daniel Nordlund
on each invocation free_port(random=TRUE) Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA -- This email has been checked for viruses by Avast antivirus software. www.avast.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

Re: [R] Issues when trying to fit a curve when generating random deviates

2022-09-19 Thread Daniel Nordlund
see the code you used to generate the curve. What kind of curve are you trying to plot, and why are you trying to plot that curve? As Rui suggested, it typically doesn't make sense to use line plots to represent discrete data.  If you explain what your end goal is, someone may be able to provide

Re: [R] Date and Time

2022-07-17 Thread Daniel Nordlund
:28:10' > dt <- strptime(in_dt_str,'%Y-%m-%d %H:%M:%S') if the date and time are stored in different variables then paste them together before converting > in_dt <- '2022-01-01' > in_tm <- '7:28:10' > dtm <- strptime(paste(in_dt, in_tm, sep=' '),'%Y-%m-%d %H:%M:%S') Hope th

Re: [R] bootstrap CI of the difference between 2 Cramer's V

2022-06-05 Thread Daniel Nordlund
t;,"très important","pas important","pas important","important","important","très important","très important","pas important","pas important") statut2<-c("moyennement riche","pas riche&quo

Re: [R] Dates as headers causing confusion but needed to convert to Julian days for ANOVA

2021-10-25 Thread Daniel Nordlund
vot_longer(starts_with("X"), names_to = "chr_date", values_to = "LST") # now you can use various data functions to get your month, day, and year # for example data_long$month <- month(as.Date(data_long$chr_date,"X%d.%m.%Y")) You may want to read up on the va

Re: [R] How to plot dates

2021-03-16 Thread Daniel Nordlund
it="secs")) # plot event date by time grouped by date ggplot(myDat, aes(x=tme, y = dte, group = dte)) + geom_line() + geom_point() +    expand_limits(y=as.Date(c('20210301', '20210331'),'%Y%m%d')) If this doesn't help get you started, you need to p

Re: [R] ggplot2 + coord_cartesian + automatic ylim

2020-12-13 Thread Daniel Nordlund
)) AAPL %>%   ggplot(aes(x = date, y = close)) +   geom_line() +   labs(title = "AAPL", y = "Closing Price", x = "") +   coord_x_date(xlim=xminmax, ylim=yminmax) +   theme_tq() Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA

Re: [R] 回复: high-frequency data in R

2020-11-24 Thread Daniel Nordlund
tps://stat.ethz.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. You have the wrong format for your date conversion.  It should be format=

Re: [R] Export R outputs to SAS dataset

2020-08-24 Thread Daniel Nordlund
ed   median   lower   upper Q25 0.054000 0.054000 0.01525 0.11275 Q50 0.139275 0.139275 0.06140 0.31000 Q75 0.315000 0.315000 0.17300 0.45250 Quartiles of vac     observed  median   lower    upper Q25  0.01250 0.01250 0.00125 0.026000 Q50  0.02675 0.02675 0.01665 0.144575 Q75  0.14700 0.14700

Re: [R] Export R outputs to SAS dataset

2020-08-22 Thread Daniel Nordlund
the R-code you are running and the R "output" you want to get back in SAS?  It is difficult from way over here to know if you are wanting numerical results like means or regression coefficients ... or if you just want printed output in your SAS log or listing. Dan -- Daniel Nordlu

Re: [R] read.csv fails in R console in Ubuntu terminal but works in RStudio after R 3.6.3 upgrade to R 4.0.2?

2020-07-16 Thread Daniel Nordlund
elp@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://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Works fine in Windows 10 64-bit with R-4.0.2

Re: [R] Strange behavior when sampling rows of a data frame

2020-06-19 Thread Daniel Nordlund
nrow(df),3), 'treated'] <- TRUE Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA __ 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

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Daniel Nordlund
On 6/10/2020 1:20 AM, Luigi Marongiu wrote: isoDates = as.Date(oriDates, format = "%m/%d/%y") You need to use the format for European short dates. isoDates = as.Date(oriDates, format = "%d/%m/%y") Hope this is helpful, Dan -- Daniel Nordlund Po

Re: [R] Add Gauss normal curve ?

2020-04-11 Thread Daniel Nordlund
020-04-09","2020-04-10")) nc<-c(1,1,2,7,3,6,6,20,17,46,67,71,56,70,85,93,301,339,325,226,608,546,1069,1264,1340,813,608) plot(as.Date(mydates),nc,pch=16,type="o",col="blue",ylim=c(1,1400), xlim=c(min(as.Date(mydates)),max(as.Date(mydates x <- seq(mi

Re: [R] Capturing positive and negative changes using R

2019-07-21 Thread Daniel Nordlund
Here is one more option using the ave() function. Using Jim's data and naming convention fkdf$X1_change <- ave(fkdf[,'X1'], fkdf$Country, FUN=function(x) c(0,diff(x))) fkdf$X2_change <- ave(fkdf[,'X2'], fkdf$Country, FUN=function(x) c(0,diff(x))) hope this is helpful, Dan --

Re: [R] Nested structure data simulation

2019-05-18 Thread Daniel Nordlund
sense to include both in your model. Dan -- Daniel Nordlund Port Townsend, WA USA __ 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://www.R-project.

Re: [R] Downloading R Data

2019-04-14 Thread Daniel Nordlund
kspace. If you wish to do something else, you will need to be more specific about what you want. Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.e

Re: [R] Newton-RaphsonMethod

2019-02-24 Thread Daniel Nordlund
will leave the solution of the problem to you. Dan -- Daniel Nordlund Port Townsend, WA USA __ 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://w

Re: [R] seq() problem with chron

2018-09-06 Thread Daniel Nordlund
ptime("02/20/13 00:00:00", "%m/%d/%y %H:%M:%S") dt2 <- strptime("07/03/18 15:30:00", "%m/%d/%y %H:%M:%S") dt <- seq(from=dt1, to=dt2, by=900) dt[length(dt)] There might also be some useful functions in the lubridate package. Hope this is helpful,

Re: [R] Converting chr to num

2018-08-19 Thread Daniel Nordlund
%'. The pattern is more strict, and that could cause the conversion to fail if the process that created the strings resulted in trailing spaces. Without the '$' the conversion succeeds. df <- data.frame(variable = c("12.6% ", "30.9%", "61.4%")) as.numeric(su

Re: [R] Rendo and dataMultilevelIV

2018-08-03 Thread Daniel Nordlund
ink to above (which describes the dataMultilevelIV dataset)? Dan -- Daniel Nordlund Port Townsend, WA USA __ 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 gu

Re: [R] Help with transpose please.

2018-06-23 Thread Daniel Nordlund
(1, nrow(have)), have[,1:2], FUN = seq_along), sep='') # cast the data into wide format cast(cbind(have,dxnames), ClaimServiceID + ClaimID ~ dxnames, value='DiagnosisCode') Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA __

Re: [R] Cannot Load A Package

2018-06-02 Thread Daniel Nordlund
Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA __ 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://www.R-project.org/posting-gu

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Daniel Nordlund
ject does not have 3 rows, so you get an error and SlopeDiff is not created. You need to correct these problems, and any others, so that your code runs correctly when there are no data problems. Then you can worry about trapping errors in the case where there are data problems. Hope this i

Re: [R] Bootstrap and average median squared error

2018-05-22 Thread Daniel Nordlund
median squared error", shouldn't the final line of the function be median((y - ypred)^2) Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/

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

2018-05-08 Thread Daniel Nordlund
) lst[i] <- i mean(lst) # does not work The documentation for mean, ?mean, says that it is looking for a numeric or logical vector. To convert your list to a numeric vector you could unlist() it. mean(unlist(lst)) Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA _

Re: [R] Empirical density estimation

2018-03-11 Thread Daniel Nordlund
this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA On Mon, Mar 12, 2018 at 3:49 AM, Bert Gunter <bgunter.4...@gmail.com> wrote: You need to re-read ?density and perhaps think again -- or do some study -- about how a (kernel) density estimate works. The points at which the

Re: [R] How to turn off warnings about class name conflicts

2018-02-14 Thread Daniel Nordlund
essage you are getting. I suspect you have something in your workspace that is causing the problem. Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/list

Re: [R] command line fails

2018-02-02 Thread Daniel Nordlund
ile.r" I don't know how rscript handles the '\' character (i.e. as an escape or not) so I changed the '\' to '/' just to be safe. And note, the program pathname and the file being passed need to be quoted separately. Hope this helps, Dan -- Daniel N

Re: [R] Simulation based on runif to get mean

2018-01-30 Thread Daniel Nordlund
your real world task actually is. Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA __ 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 ht

Re: [R] Missing information in source()

2017-11-07 Thread Daniel Nordlund
On 11/7/2017 12:01 PM, Tom Backer Johnsen wrote: Dear R-help, I am running a Mac under Sierra, with R version 3.4.2 and RStudio 1.1.383. When running head () or tail () on an object in a script using source

Re: [R] Count non-zero values in excluding NA Values

2017-10-29 Thread Daniel Nordlund
looks like a good place for apply() apply(data,2,function(x) sum(x != 0, na.rm=TRUE)) Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailm

Re: [R] Help needed with aggregate or other solution

2017-10-26 Thread Daniel Nordlund
12-04-24 06:00:00", "2012-04-24 12:00:00", "2012-04-24 18:00:00", "2012-04-25 00:00:00", "2012-04-25 06:00:00", "2012-04-25 12:00:00", "2012-04-25 18:00:00", "2012-04-26 00:00:00", "2012-04-26 06:00:00", "2012-0

Re: [R] display double dot over character in plotmath?

2017-05-13 Thread Daniel Nordlund
he NUMLOCK key is on, hold down the alt key and press 0228 on the numeric keypad. Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/li

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

2017-03-08 Thread Daniel Nordlund
):1]) Hope this helps, Dan -- Daniel Nordlund Port Townsend, WA USA __ 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://www.R-project.org/post

Re: [R] [FORGED] how to draw the confidence interval

2017-03-06 Thread Daniel Nordlund
random samples, and then describe what you want, e.g. "plot sample means and standard errors estimated from the samples," we can play along at home. Then you may get some usable help. You could also Google something like "R plot means and standard errors". Dan --

Re: [R] [FORGED] Export Forecasted output to a table (excel)

2017-02-01 Thread Daniel Nordlund
T use Excel. Ever. See: http://www.stat.uiowa.edu/~jcryer/JSMTalk2001.pdf cheers, Rolf Turner Unfortunately, that link appears to be broken / does not exist anymore. Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing list -

Re: [R] package ‘Rccp’ is not available (for R version 3.3.2)

2016-12-09 Thread Daniel Nordlund
at.ethz.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. Should that be the Rcpp package and not Rccp? Dan -- Daniel Nordlund Port Townsen

Re: [R] reshaping a large dataframe in R

2016-11-28 Thread Daniel Nordlund
in advance, best Jean-Philippe I don't know about efficiency, but it looks like you could do something like this: y <- t(matrix(t(dataGaus),4)) Maybe someone will come along with something better, Dan -- Daniel Nordlund Port Townsend, WA

Re: [R] About reshape dataset

2016-10-22 Thread Daniel Nordlund
with this a bit and this is what I came up with. After running your code I ran DF2$site <- substr(as.character(DF2$variable),1,5) DF2$var <- substr(as.character(DF2$variable),7,10) DF3 <- cast(DF2,year + month + day + site ~ var ) Hope this is helpful, Dan -- Daniel Nordlu

Re: [R] Cannot install package write.xls

2016-10-08 Thread Daniel Nordlund
) What can I do? As far as I know, write.xls and write.table are not packages, they are functions. There is a write.xls function in the xlsx (and also the openxlsx) package and write.table is a built-in R function that exists in the util package. Dan -- Daniel Nordlund Port Townsend, WA USA

Re: [R] Bootstrapping in R

2016-10-01 Thread Daniel Nordlund
that shows you "getting the same answer." Someone may then be able to do more than guess at what the problem is. Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.e

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

2016-09-27 Thread Daniel Nordlund
ding about the "create" argument on page 13 of this linked document will help: https://cran.r-project.org/web/packages/xlsx/xlsx.pdf Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

Re: [R] Help with strftime error "character string is not in a standard unambiguous format"

2016-09-12 Thread Daniel Nordlund
trptime("Thu, 25 Aug 2016 6:34 PM",format="%a, %d %b %Y %I:%M %p") [1] "2016-08-25 18:34:00 PDT" works for me. Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing li

Re: [R] R bug when started in Windows 10

2016-08-14 Thread Daniel Nordlund
xample you did give of a directory with spaces. It looks like you were using single quotes (') around the path/filename. Windows requires that there be double quotes (") around any path/filename that contains spaces. If you provide a reproducible exam

Re: [R] SAS file

2016-08-08 Thread Daniel Nordlund
mat file, or have SAS available, or get some 3rd party software that will read SAS datasets. Dan -- Daniel Nordlund Port Townsend, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-he

Re: [R] how to expand the dataframe

2016-07-21 Thread Daniel Nordlund
"play along at home" (i.e. give us a reproducible example). Dan Daniel Nordlund Port Townsend, WA -- Daniel Noredlund Bothell, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo

Re: [R] Sampe numbers

2016-07-19 Thread Daniel Nordlund
Frederic, you need to be more clear about what you want to do. If you are sampling 100 numbers from 1:100 with replacement, the sum will always be greater than 50 (as has already been pointed out). In addition, you mention trying to eliminate zeros. If you are sampling from 1:100 there

Re: [R] dplyr's arrange function

2016-06-15 Thread Daniel Nordlund
quot; (in descending order). If you want the character value of line 7 to sort last, it would need to be "06.1 (0.61)" or " 6.1 (0.61)" (notice the leading space). Hope this is helpful, Dan Daniel Nordlund Port Townsend, WA USA __ R-help

Re: [R] break string at specified possitions

2016-05-11 Thread Daniel Nordlund
compute the beginning positions. begs <- function(x) c(0,x[-length(x)])+1 Then, then use that function in your call to str_sub str_sub(test_string,begs(ends),ends) %>% print Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA

[R] how to eliminate ggplot warning frrom "knitted" document

2015-11-16 Thread Daniel Nordlund
eate a pdf document and the warning is cluttering up my pdf document. Is there anyway to alter the plot statement to avoid the warning? If not, is there a way to get knitr not to print out the warning to the markdown document so that it doesn't end up in the pdf document? Thanks,

Re: [R] how to work with time of day (independent of date)

2015-10-30 Thread Daniel Nordlund
c("date", "value"), row.names = c(NA, -8L), class = "data.frame") print(f) f$dateandtimes <- as.chron(as.POSIXct(as.character(f$date),format = "%Y-%m-%d %H:%M:%S")) print(f) f$justtimes <- time

[R] how to work with time of day (independent of date)

2015-10-30 Thread Daniel Nordlund
015-10-30 00:50:00", "2015-10-30 09:30:00", "2015-10-30 21:10:00", "2015-10-31 00:50:00", "2015-10-31 10:30:00"), class = "factor"), value = c(88L, 17L, 80L, 28L, 23L, 39L, 82L, 79L)), .Names = c("date", "value"), row.nam

Re: [R] retaining characters in a csv file

2015-09-23 Thread Daniel Nordlund
In addition, if your files aren't as regular as I inferred, you can increase the number of rows to read in the first line to ensure getting the classes right. Hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mail

Re: [R] Connecting R to SAS SPDS through ODBC - no results.

2015-09-18 Thread Daniel Nordlund
ALSE, colQuote=NULL) Hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA __ 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://www.R-project.org

Re: [R] remove 0 and NA values

2015-07-14 Thread Daniel Nordlund
to zero! On Jul 13, 2015 5:31 PM, Daniel Nordlund djnordl...@frontier.com mailto:djnordl...@frontier.com wrote: On 7/13/2015 3:01 PM, Lida Zeighami wrote: Hi there, I have a matrix which its elements are 0, 1,2,NA I want to remove the columns which the colsums

Re: [R] sampling rows with values never sampled before

2015-06-22 Thread Daniel Nordlund
. Hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA __ 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://www.R-project.org/posting-guide.html

Re: [R] Combining multiple probability weights for the sample() function.

2015-06-03 Thread Daniel Nordlund
the first and third letters match 50% of the time you must select rows 2 and 4 each with probability=.25. Those probabilities sum to 1, so you can never select any of the other rows. Am I missing something? Dan -- Daniel Nordlund Bothell, WA USA __ R

Re: [R] Getting a cdf equal to 1 from a variable kernel density estimation

2015-05-27 Thread Daniel Nordlund
){ difference = t(t(df) - x)/h W = sum(apply(difference, 1, ker)) / (nrow(df)*h) } If you are wanting to do density estimation for real world work, I would get help from someone in your local area. Hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA

Re: [R] Vincentizing Reaction Time data in R

2015-05-20 Thread Daniel Nordlund
for binning decile - as.numeric(cut(rt, quantile(rt,0:10)/10),include.lowest=TRUE)) # collect into a dataframe (not really necessary) df - data.frame(rt=rt, decile=decile) #compute the bin means aggregate(rt,list(decile),mean,data=df) This should give you a start, Dan -- Daniel Nordlund Bothell, WA

Re: [R] dotplot

2015-05-16 Thread Daniel Nordlund
On 5/16/2015 1:19 PM, Daniel Nordlund wrote: On 5/16/2015 12:32 PM, li li wrote: Hi all, I wrote the following code and have two questions: (1) As you can see, I would like different colors for different types. It does not come out that way in the graph from this code. Anyone know how

Re: [R] dotplot

2015-05-16 Thread Daniel Nordlund
it (if it is possible). color=c(blue, red, green) dotplot(val ~ lot, tmp, ylab = values, xlab=lot, scales=list(rot=30), aspect=1, pch=tmp$sybm, col=color) Hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA __ R-help@r

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

2015-04-13 Thread Daniel Nordlund
/ errors that you get. I got something different. Dan -- Daniel Nordlund Bothell, WA USA __ 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://www.R

Re: [R] generating phi using function()

2015-03-31 Thread Daniel Nordlund
fmls function your formula does not include the fmls() function, it uses mls(). So I think your problem may have to do with how you are calling the midas_r function, and how the parameters are created and passed to phi(). Unfortunately, I can't be of much more help, Dan -- Daniel Nordlund

Re: [R] generating phi using function()

2015-03-30 Thread Daniel Nordlund
/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more

Re: [R] Sampling

2015-03-30 Thread Daniel Nordlund
, and assuming you want to sample without replacement. Generalizing it to other data structures is left as an exercise for the reader. replicate(100,mean(sample(yourdata,30, replace=FALSE))) hope this is helpful, Dan -- Daniel Nordlund Bothell, WA USA __ R

Re: [R] SAS equivalent for R's signif function?

2015-02-09 Thread Daniel Nordlund
contact me offline and I will send you a PROC FCMP implementation. Dan -- Daniel Nordlund Bothell, WA USA __ 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

Re: [R] Getting the most recent dates in a new column from dates in four columns using the dplyr package (mutate verb)

2014-11-09 Thread Daniel Nordlund
. I am not familiar with the mutate() function from dplyr, but you can get your wanted results as follows: data2 - within(data1, oidflag - apply(data1[,-1], 1, max, na.rm=TRUE)) Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help

Re: [R] Getting the most recent dates in a new column from dates in four columns using the dplyr package (mutate verb)

2014-11-09 Thread Daniel Nordlund
NA NA 2011-11-04 2011-11-04 Pradip K. Muhuri, PhD SAMHSA/CBHSQ 1 Choke Cherry Road, Room 2-1071 Rockville, MD 20857 Tel: 240-276-1070 Fax: 240-276-1260 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Daniel Nordlund Sent

Re: [R] loops in R

2014-11-05 Thread Daniel Nordlund
(Population), mean)) with(your_data_frame,aggregate(R,list(Population), var)) hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] Custom sampling method in R XXXX

2014-06-23 Thread Daniel Nordlund
) } new_sample(x) Daniel Nordlund Bothell, WA USA -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dan Abner Sent: Monday, June 23, 2014 3:19 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] Custom sampling method

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Daniel Nordlund
- 0 cmb - combn(r,m) repeat { n - n+1 tbl - table(map-cmb[,sample(1:choose(r,m),k)]) if(min(tbl) == max(tbl)-1) break if(n max_iter) break } return(t(map)) } a - assignment(10,7,3) Dan Daniel Nordlund Bothell, WA USA

Re: [R] A combinatorial assignment problem

2014-05-01 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Daniel Nordlund Sent: Thursday, May 01, 2014 1:10 AM To: r-help@r-project.org Subject: Re: [R] A combinatorial assignment problem -Original Message- From: r-help

Re: [R] system()

2014-04-14 Thread Daniel Nordlund
) freezes R on my Win 7 Pro x64 box using either 64-bit R-3.0.3 or R-3.1.0. You might try switching to shell() instead of system() command - paste(aa, fnm) shell(command) However, it all depends on what programs you are trying to run and what behavior you expect. Dan Daniel Nordlund

Re: [R] stratified sampling

2014-03-07 Thread Daniel Nordlund
with an example that works with a single variable with your data. Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

Re: [R] ISwR Plotting Issue

2014-02-19 Thread Daniel Nordlund
a clean session? Since the example worked for me, there is not much else I can help with. Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] Difference between two datetimes

2014-01-28 Thread Daniel Nordlund
2010 I get a difference of 1.5 hours: as.POSIXct(2010-04-04 03:00:00)- as.POSIXct(2010-04-04 02:30:00) Time difference of 1.5 hours Any suggestions? Thanks, David Fox. Daylight savings time change in Australia? Dan Daniel Nordlund Bothell, WA USA

Re: [R] Select 5 identical numbers

2014-01-20 Thread Daniel Nordlund
read up on ?sample Dan Daniel Nordlund Bothell, WA USA -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Alaios Sent: Monday, January 20, 2014 10:12 PM To: Alaios; R-help@r-project.org Subject: Re: [R] Select 5 identical

Re: [R] Wrong date fromat?

2013-12-06 Thread Daniel Nordlund
first example specified. Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] Randomize two categories testing a specific condition R version 3.0.2 windows 32 bit

2013-11-23 Thread Daniel Nordlund
2) p - .8 } } If this doesn't do what you want, then write back to R-help describing what your ultimate goal is (i.e., what this method of randomization is supposed to accomplish), and someone may be able to give you better advice. Hope this is helpful, Dan Daniel Nordlund Bothell

Re: [R] Cannot read XPT file using foreign package

2013-10-04 Thread Daniel Nordlund
, read.xport will not be able to read it. read.xport only reads files written using the XPORT engine. If you don't have access to SAS you will need to get whomever created the file to re-create it. Dan Daniel Nordlund Bothell, WA USA -Original Message- From: r-help-boun...@r

Re: [R] multilevel analysis

2013-09-30 Thread Daniel Nordlund
http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius Alameda, CA, USA Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] How to rebuild an R package that has been removed from CRAN?

2013-08-19 Thread Daniel Nordlund
info requested in the posting guide. It would also help if you told us what package you are trying to install. Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] How to rebuild an R package that has been removed from CRAN?

2013-08-19 Thread Daniel Nordlund
Nordlund Bothell, WA USA _ From: Shang Zuofeng [mailto:zuofengsh...@gmail.com] Sent: Monday, August 19, 2013 2:16 PM To: Daniel Nordlund Cc: r-help@r-project.org Subject: Re: [R] How to rebuild an R package that has been removed from CRAN? Thanks, Dan! The package is assist which can

Re: [R] Appropriateness of R functions for multicore

2013-08-19 Thread Daniel Nordlund
The R high performance computing sig might be useful for some of these questions. https://stat.ethz.ch/mailman/listinfo/r-sig-hpc Dan Daniel Nordlund Bothell, WA USA -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff

Re: [R] How to rebuild an R package that has been removed from CRAN?

2013-08-19 Thread Daniel Nordlund
Yeah, I tried building the package and got essentially the same warnings and decided that further assistance required someone above my pay grade. :-) Daniel Nordlund Bothell, WA USA -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org

Re: [R] changing colnames

2013-08-14 Thread Daniel Nordlund
- read.table(c:/tmp/temp.txt, header=TRUE, skip=1) and got this dat1 age race stat 1 122 35 2 176 55 Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA From: farnoosh sheikhi farnoosh...@yahoo.com To: smartpink

Re: [R] Fwd: Problem with ODBC connection

2013-06-10 Thread Daniel Nordlund
. You could install and load the sos package and runthe following function findFn('xls') and you will get all sorts of suggestions. Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] R does not subset

2013-05-03 Thread Daniel Nordlund
of the value you were comparing (apparently the factor was defined with a space). with). Try the following (and notice the space at the end of Infected . RECinf-subset(REC2, INFECTION==Infected ) David's suggestion worked because you did include a space there. Dan Daniel Nordlund Bothell, WA

Re: [R] expanding a presence only dataset into presence/absence

2013-04-29 Thread Daniel Nordlund
someone will be able to help. Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented

Re: [R] How to read a *.csv file in R?

2013-03-13 Thread Daniel Nordlund
for your help? The data appear to be tab delimited with the decimal point being a comma (','). So, try read.csv2() heisenberg - read.csv2(file=comprice.csv, header=TRUE, sep=\t) Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R

Re: [R] Random number generator used in 'runif'

2013-02-18 Thread Daniel Nordlund
below. kind is partially matched to this list. The default is Mersenne-Twister. Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] sweave question

2013-02-13 Thread Daniel Nordlund
{figure}\n) @ If I have got any of this wrong, I am sure someone will come along and correct me. Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Leeds Sent

Re: [R] How to construct a valid seed for l'Ecuyer's method withgiven .Random.seed?

2013-01-23 Thread Daniel Nordlund
on .Random.seed Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

Re: [R] setting off-diagonals to zero

2013-01-23 Thread Daniel Nordlund
created by 731:1095. But the vector 731:1095 has length 365, so no elements are removed because the smallest value in SEQ is 731 and there are not many elements in the vector. Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r

Re: [R] random sampling matrix

2012-12-18 Thread Daniel Nordlund
, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.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

Re: [R] remove last row of a data frame

2012-12-11 Thread Daniel Nordlund
, then now is the time. hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] Ceiling function gives me wrong answer

2012-11-28 Thread Daniel Nordlund
] 0.1483 b - 1000^(1/3) print(b, digits=20) [1] 9.9982236 Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] Getting information encoded in a SAS, SPSS or Stata command file into R.

2012-11-14 Thread Daniel Nordlund
what it is doing. Dan Daniel Nordlund Bothell, WA USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self

  1   2   3   >