You should not really have worry about the internal structure of such a
thing - just treat it like a matrix. E.g.,
> train$data[1:3,1:3] # dots mean 0's
3 x 3 sparse Matrix of class "dgCMatrix"
cap-shape=bell cap-shape=conical cap-shape=convex
[1,] . .
Either change your script by adding print(...) calls where you want to see
something printed or change the call to source() by adding print.eval=TRUE
or echo=TRUE. E.g.,
> cat(file = tf <- tempfile(), "head(10:1)\ntail(letters)\nx <-
gamma(0:4)\nx\n")
> source(tf)
Warning message:
In gamma(0:4)
Use table(factor(x, levels=your3values))
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Nov 10, 2017 at 1:32 AM, Allaisone 1 wrote:
>
>
> Thank you for your effort Bert..,
>
>
> I knew what is the problem now, the values (1,2,3) were only an example.
> The values I have are 0 , 1, 2 . Tab
> I see everything about the Rseve author...except for a way
> to contact him (unless I somehow missed that.)
Look at the BugReports and Maintainer components of
packageDescription("Rserve").
Use the former if it exists - it is typically a URL. The latter is also
given by
maintainer("Rserve").
O
Your lapply is making the call
runif(n=3, min=i)
for i in 1:3. That runif's 3 argument is 'max', with default value 1
so that is equivalent to calling
runif(n=3, min=i, max=1)
When i>max, outside the domain of the family of uniform distributions,
runif returns NaN's.
Bill Dunlap
TIBCO Soft
I think the '[<-' function for atomic types doesn't pay attention
to the class of the right hand side, only to its mode. It strips all
the attributes of the RHS, including the class.
> f <- function(x) { x[2] <- factor("z", levels=letters) ; x }
> f(101:103)
[1] 101 26 103
> f(c("One","Two","Thr
dplyr may have something for this, but in base R I think the following does
what you want. I've shortened the name of your data set to 'd'.
i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
69 B
> 36 two 70 B
> 37 two 71 B
> 38 two 72 B
> 39 two 73 B
> 40 two 74 B
> 41 two 75 B
> 42 two 76 B
> 43 two 77 B
> 44 two 78 B
> 45 two 79 B
> 46
Note that in
for (year in 2000:2007){
varname <- paste0("aa_",year)
assign(paste0(varname), as.vector(eval(as.name(varname
}
the paste0(varname) is redundant - varname was just computed as the return
value of paste0().
People are trying to steer you towards making a lis
By the way, R 'vectors' are not the equivalents of mathematical 'vectors'.
In R, a vector is something that can have arbitrary length and which has
no 'attributes', other than perhaps element names. Vectors can be numeric,
character,
complex, lists, etc. Functions, names, and NULL are not vector
Landau's function gives the maximum cycle length of a permutation.
See.,e.g.,
http://mathworld.wolfram.com/LandausFunction.html.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Dec 7, 2017 at 9:34 PM, Eric Berger wrote:
> Hi Boris,
> Do a search on "the order of elements of the symmetric g
You could make numeric vectors, named by the group identifier, of the
contraints
and subscript it by group name:
> DM <- read.table( text='GR x y
+ A 25 125
+ A 23 135
+ A 14 145
+ A 35 230
+ B 45 321
+ B 47 512
+ B 53 123
+ B 55 451
+ C 61 521
+ C 68 235
+ C 85 258
+ C 80 654',header = TRUE, stri
Try using stats::filter (not the unfortunately named dplyr::filter, which
is entirely different).
state>elev is a logical vector, but filter(), like most numerical
functions, treats TRUEs as 1s
and FALSEs as 0s.
E.g.,
> str( stats::filter( x=examp$stage>elev1, filter=rep(1,7),
method="convolution
Without recycling you would get:
u <- c(10, 20, 30)
u + 1
#[1] 11 20 30
which would be pretty inconvenient.
(Note that the recycling rule has to make a special case for when one
argument has length zero - the output then has length zero as well.)
Bill Dunlap
TIBCO Software
wdunlap ti
Use the stringsAsFactors=FALSE argument to read.table when
making your data.frame - factors are getting in your way here.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Wed, Dec 13, 2017 at 3:02 PM, Val wrote:
> Thank you Rui,
> I did not get the desired result. Here is the output from your sc
Try the following (which won't work with factors):
> i <- match(tdat$B, tdat$A)
> newColumns <- tdat[i, c("B", "C")]
> newColumns[is.na(newColumns)] <- "0"
> transform(tdat, D=newColumns[["B"]], E=newColumns[["C"]])
A B CY D E
1 A12 B03 C04 0.70 0 0
2 A23 B05 C06 0.05 0 0
3
Your code contains the lines
stopifnot(!(any(data1$norm_sd >= 1)))
if(!(any(data1$norm_sd >= 1))) {
df1 <- dat1
return(df1)
}
stop() "throws an error", causing the current function and all functions in
the call
stack to abort and return n
recursive_funlp <- function(dataset = dat1, func = funlp2) {
...
if (!(any(data1$norm_sd >= 1))) {
df1 <- dat1
return(df1)
}
else {
df2 <- recursive_funlp() # GIVE SOME ARGUMENTS HERE
return(df2)
}
}
Whe
You can see if your function uses R's random number generator with
the following function.
isRandom <- function(expr) {
randomSeedBefore <- get0(".Random.seed")
force(expr)
!identical(randomSeedBefore, get0(".Random.seed"))
}
isRandom(1:10)
#[1] FALSE
isRandom(runif(3)>.4)
#[1] TRUE
I
You can suppress all messages from that command with
junk <- suppressMessages(httr::content(r1))
If you only want to suppress that specific message you can use
withCallingHandlers:
junk <- withCallingHandlers(
httr::content(r1),
message=function(e){
if (grepl("P
I don't get exactly that error message,
> ifelse(is.na(z$Value),z$Value[!is.na(z$Value)][1],z$Value)z})
Error: unexpected symbol in "ifelse(is.na(z$Value),z$Value[!is.na
(z$Value)][1],z$Value)z"
The 'symbol' in "unexpected symbol" refers to a "name" ('z' in this case).
The problem is usually at
> .expand_R_libs_env_var("poof/%p/%v")
[1] "poof/x86_64-w64-mingw32/3.4"
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Jan 12, 2018 at 4:49 AM, Loris Bennett
wrote:
> Hi,
>
> When I install a package as a non-root user, it gets saved in a path
> such as
>
> ~/R/x86_64-unknown-linux-g
All three results give the same collection of triangles. They
don't all agree on whether the points in a triangle are in clockwise
or counterclockwise order. If the orientation matters, it is a simple
matter to reverse the order of points in those that described in
the "wrong" orientation.
Bill
I just looked at the data at the URL you posted and it looks like it
consists
of all the points in a rectangular grid. When you triangulate a rectangle
it is
arbitrary whether you use the SW-NE or the SE-NW diagonal and that looks
like the only difference between the various algorithms.
Bill Dun
If your two objects have class "data.frame" (look at class(objectName)) and
they
both have the same number of columns and the same order of columns and the
column types match closely enough (use all.equal(x1, x2) for that), then
you can try
which( rowSums( x1 != x2 ) > 0)
E.g.,
> x1 <- data.fr
I assume you are using the qcc package's qcc function.
example(qcc) gives an example of adding abline's to its plot:
# add warning limits at 2 std. deviations
q <- qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,],
plot=FALSE)
(warn.limits <- limits.xbar(q$center, q$std.dev, q$sizes,
I like to use complex numbers for 2-dimensional geometry. E.g.,
> polyAngles2
function (xV, yV)
{
stopifnot((length(xV) == length(yV)) && (length(xV) >= 3))
z <- complex(re = xV, im = yV)
c(NA, diff(Arg(diff(z))), NA) # radians, positive is counter-clockwise
}
> x <- c(0:3)
> y <- c(0
Don't use aggregate's simplify=TRUE when FUN() produces return
values of various dimensions. In your case, the shape of table(subset)'s
return value depends on the number of levels in the factor 'subset'.
If you make B a factor before splitting it by C, each split will have the
same number of leve
testit<-function(x,...){
paste0('this is x: ',x)->y
return(y)
catf("++test=",...)
}
You return from the function before calling catf(). Remove the 'return(y)'
and make 'y' the last expression in the function.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On We
Does substitute(...()) do what you want?
> myFunc <- function(x, ...) substitute(...())
> myFunc(y=1/(1:10), x=sin(3:1), z=stop("Oops"), "untagged arg")
$y
1/(1:10)
$z
stop("Oops")
[[3]]
[1] "untagged arg"
> names(.Last.value)
[1] "y" "z" ""
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tu
Does setting the environment variable TMPDIR, before starting R,
to a directory on a bigger file system help? On Linux I get
% mkdir /tmp/RTMP-BILL
% env TMPDIR=/tmp/RTMP-BILL R --quiet --vanilla
> tempdir()
[1] "/tmp/RTMP-BILL/Rtmppgowz4"
> tempfile()
[1] "/tmp/RTMP-BILL/Rtmppgowz4/f
x1 = rbind(unique(preval),mydat)
x2 <- x1[is.na(x1)] <- 0
x2 # gives 0
Why introduce the 'x2'? x1[...] <- 0 alters x1 in place and I think that
altered x1 is what you want.
You asked why x2 was zero. The value of the expression
f(a) <- b
and assignments are processed right to left
chr [1:2] "C" "E"
'
> x1 <- (2:5) + 1i * (5:2)
> x2 <- x1[ Mod(x1) == 5 ] <- c(17L, 19L)
> str(x1)
cplx [1:4] 2+5i 17+0i 19+0i ...
> str(x2)
int [1:2] 17 19
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sat, Feb 24, 2018 at 3:04 PM, Dunc
In the R expression
x[1] + x[2]
the result must be stored as a double precision number,
because that is what R "numerics" are. sum() does not
have to keep its intermediate results as doubles, but
can use quad precision or Kahan's summation algorithm
(both methods involve more than a simple doub
If your computations involve the parallel package then set.seed(seed)
may not produce repeatable results. E.g.,
> cl <- parallel::makeCluster(3) # Create cluster with 3 nodes on local
host
> set.seed(100); runif(2)
[1] 0.3077661 0.2576725
> parallel::parSapply(cl, 101:103, function(i)runif(2, i,
You can do this with ave():
gene <- c("a","b","c","d","c","d","c","f")
ave(gene, gene, FUN=function(x)if(length(x)>1)paste(x,seq_along(x),sep="-")
else x)
# [1] "a" "b" "c-1" "d-1" "c-2" "d-2" "c-3" "f"
You can probably speed it up a bit by pulling the paste() out of FUN
and doing it later.
You can capture warnings by using withCallingHandlers. Here is an example,
its help file has more information.
dataList <- list(
A = data.frame(y=c(TRUE,TRUE,TRUE,FALSE,FALSE), x=1:5),
B = data.frame(y=c(TRUE,TRUE,FALSE,TRUE,FALSE), x=1:5),
C = data.frame(y=c(FALSE,FALSE,TRUE,TRUE,TRUE)
tryCatch() is good for catching errors but not so good for warnings, as
it does not let you resume evaluating the expression that emitted
the warning. withCallingHandlers(), with its companion invokeRestart(),
lets you collect the warnings while letting the evaluation run to
completion.
Bill Dunl
1- mixedorder does not work in a "do.call(mixedorder, mydataframe)"
call like the order function does
This is tangential, but do.call(order, mydataframe) is not safe to use in a
general purpose function either - you need to remove the names from
the second argument:
> d <- data.frame(meth
Why don't you use
stopifnot( all(m1 == m2) )
?
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Mar 12, 2018 at 8:15 AM, Stepan Kasal wrote:
> Hello,
> I stumbled over a problem:
>stopifnot(m1 == m2)
>
> It works with vector or matrix, but does not work for classes from Matrix
> pack
Wouldn't that change how simplify='array' is handled?
> str(sapply(1:3, function(x)diag(x,5,2), simplify="array"))
int [1:5, 1:2, 1:3] 1 0 0 0 0 0 1 0 0 0 ...
> str(sapply(1:3, function(x)diag(x,5,2), simplify=TRUE))
int [1:10, 1:3] 1 0 0 0 0 0 1 0 0 0 ...
> str(sapply(1:3, function(x)diag(x,
Could your code use vapply instead of sapply? vapply forces you to declare
the type and dimensions
of FUN's output and stops if any call to FUN does not match the
declaration. It can use much less
memory and time than sapply because it fills in the output array as it goes
instead of calling lappl
Use rowSums(is.na(d))==ncol(d) to pick out the rows will no good values.
E.g.,
> d <- data.frame(x1=c(NA,2:4), x2=c(NA,NA,13:14), x3=c(NA,NA,NA,44))
> d
x1 x2 x3
1 NA NA NA
2 2 NA NA
3 3 13 NA
4 4 14 44
> s <- rowSums(d, na.rm=TRUE)
> s
[1] 0 2 16 62
> s[ rowSums(is.na(d))==ncol(d) ] <- NA
You haven't given much context, but these error message can come from
load() when loading a *.RData file that contains objects reference packages
not installed in the current installation of R. When R starts it will load
a ".RData" file if one exists, this file is typically created when R shuts
do
Find the .RData file and rename it to anything else.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Mar 22, 2018 at 7:09 PM, Haida wrote:
> Previously, the R software was perfectly run without error and I am not
> sure why this happens. I have not installed any new R. If the *RData file
>
Or use cut():
> Num <- c(2.2, 2.4, 3.5, 5, 7)
> cut(Num, breaks=c(0,2,4,6), labels=c("Low","Medium","High"))
[1] Medium Medium Medium High
Levels: Low Medium High
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Apr 9, 2018 at 10:00 AM, Bert Gunter wrote:
> Just cast it!
>
> ?factor
>
stats::spectrum for starters.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Apr 10, 2018 at 5:49 AM, Danniel Lafeta Machado <
danniel.laf...@bcb.gov.br> wrote:
> Dear all,
> Is there any spectral analisys functionality available for R version 3.4.3?
> Series() functionality doesn't work i
I get the seg-fault on exiting R after loading WGCNA into R-3.4.3 on
Linux. Valdgrind
shows the problem occurs when tearing down an Rstreambuf object:
% R --debugger valgrind --vanilla --quiet
==30889== Memcheck, a memory error detector
==30889== Copyright (C) 2002-2015, and GNU GPL'd, by Julian
You can record the time to evaluate each line by wrapping each line in a
call to system.time(). E.g.,
expressions <- quote({
# paste your commands here, or put them into a file and use exprs <-
parse("thatFile")
d.dir <- '/Users/darshanpandya/xx'
FNAME <- 'my_data.csv'
d.input <- fre
Does read.xport read both version 5 and version 8 xpt files? This link to
the Library of Congress can get you started on how to interpret the
header. (It states that Version 8 was introduced in 2012 but was not in
wide use as of early 2017.)
https://www.loc.gov/preservation/digital/formats/fdd/f
> When I look at the SASxport::read.xport function code, it is in fact,
_not_ the
> same function. But it does have the R statement about what it thinks
> qualifies as a SAS xprot file:
>
> xport.file.header <- "HEADER RECORD***LIBRARY HEADER
> RECORD!!!00
"
>
The ts method for plot() is quirky. You can use the default method:
plot(as.vector(time(ttt)), as.vector(ttt), type = "p", col=ifelse(ttt<8,
"black", "red"))
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, May 1, 2018 at 1:17 PM, Christopher W Ryan
wrote:
> How would I color points con
> x1 <- do.call(rbind, c(x, list(make.row.names=FALSE)))
> x2 <- cbind(type=rep(names(x), vapply(x, nrow, 0)), x1)
> str(x2)
'data.frame': 4 obs. of 3 variables:
$ type: Factor w/ 2 levels "A","B": 1 1 2 2
$ x : int 1 2 5 6
$ y : int 3 4 7 8
Bill Dunlap
TIBCO Software
wdunlap tibco.co
If you require that the 'type' column be a factor with a level for each
element of the input list, then you need to do that after calling
dplyr::bind_rows(), just as with the base-R solutions.
> l <- list( A = data.frame(X=1:2, Y=11:12), B = data.frame(X=integer(),
Y=integer()), C = data.frame(X=3
Printing a number does not show whether it is stored
as a 32-bit integer or as a 64-bit floating point value.
Use. e.g., str() or class() to see.
> str(length(runif(3)))
int 3
> str(length(runif(3)) + 1)
num 4
> str(length(runif(3)) + 1L)
int 4
> str( 3L * 3L )
int 9
> str( 3
Make current_location and previous_location factors with the same set of
levels. The levels could be the union of the values in the two columns or
a predetermined list. E.g.,
> x <- data.frame(previous_location=c("Mount Vernon","Burlington"),
current_location=c("Sedro Woolley","Burlington"))
> a
install.packages("/polycor_0.7-8.tar.gz", repos=NULL, type="source")
The initial slash would be a problem - it means to find
poglycor_0.7.8.tar.gz in the root directory.
Remove the slash, find where the tar.gz file was put, and try using that
location. Recall the destdir
setting you used in
I think it is simpler to use !grepl() instead of -grep() here, since
subscripting with logicals works properly when there are no matches.
Also, since mat is a matrix, add the argument drop=FALSE so the
result is a matrix when all but one rows are omitted. E.g.,
> mat <- matrix(1:6, nrow=3, ncol=2
It looks like your data has class "factor". If you call factor() on a
factor variable, without supplying an explicit 'levels' argument it
produces a new factor variable without any levels not present in the input
factor. E.g.,
> fOrig <- factor(c(NA,"A","B","D",NA,"D"), levels=c("D","C","B","A")
One way is
values <- lapply(lis, get)
You can do
names(values) <- lis
to attach the object names to the values in the list returned by lapply.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Jun 1, 2018 at 7:25 AM, Christian wrote:
> Hi,
>
> I have searched the documentations of eva
Does
polygon(c(x,rev(x)), c(y, rev(z)), col="orange")
do what you want?
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Jun 11, 2018 at 12:35 PM, L... L... wrote:
> Dear All, I know this is a trivial question .. but .. I want to shade the
> area between 2 curves. For example:
>
> x <- 1:
Use functions calling functions instead of scripts invoking scripts. Put
all your
functions in a 'package'. Then your scripts would be very small, just
passing
command line arguments to R functions.
(It is possible to call scripts from scripts, but I think it quickly leads
to headaches.)
Bill D
>Thanks!
>Why have to add “x” at the end of function, which was what I missed.
You can see for yourself with some tests:
f1 <- function(x) { x[1] <- 10 }
f2 <- function(x) { x[1] <- 10 ; x }
print(f1(1:3)) # 10
print(f2(1:3)) # 10 2 3
An assignment returns the value of its right hand side but
Each call to system() starts and finishes a new shell so your approach will
not work.
Does the following do what you need?
> system('Xvfb :10 -ac &')
> Sys.setenv(DISPLAY=":10")
> x11()
Warning message:
In x11() : cairo-based types may only work correctly on TrueColor visuals
Bill Dunlap
TIBCO
> args(parallel::mclapply)
function (X, FUN, ..., mc.preschedule = TRUE, mc.set.seed = TRUE,
mc.silent = FALSE, mc.cores = 1L, mc.cleanup = TRUE, mc.allow.recursive
= TRUE)
You gave it 'fun=forecast' instead of 'FUN=forecast'. Case matters in R.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
Do you have a ".RData" file in your home directory or the current working
directory? If so, R will load it at startup. It can be made by you
answering 'yes' to the 'Save workspace image?' question when you quit R.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Jul 2, 2018 at 5:02 AM, Mor
One way to test the new ggplot2 is to make a new directory to use as an R
library and to install the new ggplot2 there.
newLibrary <- "C:/tmp/newRLibrary"
dir.create(newLibrary)
install.packages("ggplot2", lib=newLibrary)
Then you can run two R sessions at once, starting one with
.libPa
>I tried something like read.csv(write.csv(df,row.names=FALSE)) but got
the error
>
> Error in read.table(file = file, header = header, sep = sep, quote =
quote, :
> 'file' must be a character string or connection
To diagnose this without reading the help(write.csv) look at the return
value of
What the OP is doing looks fine to me.
The environment holding the data vectors is not necessary, but it helps
organize things - you know where to look for this sort of data vector.
I would avoid the *.rda file, since it is not text, hence not readily
editable
or trackable with most source contro
The problem occurs because no commonly used format works on
all your date strings. If you give as.POSIXlt the format you want to
use then items that don't match the format will be treated as NA's.
Use is.na() to find them.
> d <- c("2017-12-25", "2018-01-01", "10/31/2018")
> as.POSIXlt(d)
Error i
Which format did you use when you used is.na on the output of
as.POSIXlt(strings, format=someFormat)
and found none? Did the resulting dates look OK? Perhaps
all is well.
Note the the common American format month/day/year is not
one that is tested when you don't supply a format - xx/yy/
i
> And each dataframe row has this format:
>2015-10-01,00:00,90.6689
>2015-10-01,01:00,90.6506
>2015-10-01,02:00,90.6719
>2015-10-01,03:00,90.6506
You mean each line in the file, not row in data.frame, has the form
"year-month-day,hour:min,numericValue". Try the following, where tfile
names your
To find the lines in the file, tfile, with bogus dates, try
readLines(tfile)[ is.na(dataFrame$DateTime) ]
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Jul 20, 2018 at 1:30 PM, Rich Shepard
wrote:
> On Fri, 20 Jul 2018, David Winsemius wrote:
>
> I don't think you read Bill's message
If you need to make a list of long but unknown length you can save time by
adding the items to an environment, with names giving the order, then
converting the environment to a list when you are done filling the
environment. E.g.,
> makeData
function (container, n)
{
for (i in seq_len(n)) con
If Sys.which("grep") says that grep is available then system("grep -n ...")
will do it.
> cat(c("One","Two","Three","Four"),sep="\n",file=tf<-tempfile())
> system(paste("grep --line-number", shQuote("^T"), shQuote(tf)),
intern=TRUE)
[1] "2:Two" "3:Three"
> as.integer(sub(":.*$", "", .Last.value)
> dat <- data.frame(Group=LETTERS[1:5], X=1:5, Y=11:15)
> pos <- c(2,3)
> rbind(dat, Sum=lapply(seq_len(ncol(dat)), function(i) if (i %in% pos)
> sum(dat[,i]) else NA_real_))
Group X Y
1 A 1 11
2 B 2 12
3 C 3 13
4 D 4 14
5 E 5 15
Sum 15 65
> str(.Last.val
Starting R with the --vanilla flag will cause it to ignore startup
files. This is usually a quicker way to rule out such issues than
tracking down where the startup files are stored. 'R --help' tells
about other command line arguments that help home in on which file may
be the problem.
--no-en
Does R work if started with the --vanilla flag?
(Add it after ...\Rgui.exe in the Target line of
the Windows shortcut or on the command line.)
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Apr 4, 2017 at 1:53 PM, John wrote:
> On Mon, 3 Apr 2017 18:06:06 +0100
> "Vineet Gupta" wrote:
>
>
Does one of the objects in pkg/data (or pkg/R) include a function made
by one of the functions in package:colorspace? Such a function would
have the environment getNamespace("colorspace").
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Apr 11, 2017 at 2:47 PM, stephen sefick wrote:
> I am
I think the site-specific R profile should be, using R syntax
file.path(R.home("etc"), "Rprofile.site") # no dot before the capital R
The personal R profile will be
file.path(Sys.getenv("HOME"), ".Rprofile") # there is a dot before capital R
but if a local R profile,
file.path(getwd(), ".R
I believe someone already mentioned it, but notepad makes it hard to
save a file without the ".txt" extension to its name. R does not do
anything with .Rprofile.txt, only .Rprofile, so you must figure out a
way to work around notepad's mangling of the file name.
Bill Dunlap
TIBCO Software
wdunlap
Use the R command
dir(c(".", Sys.getenv("HOME"), R.home("etc")), pattern="Rprofile")
to see if there are any file names with the unwanted ".txt" and use
file.rename() to fix them up.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Apr 17, 2017 at 8:06 AM, William Dunlap wrote:
> I believe
Not file exention ".R" - no file exention at all.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Apr 17, 2017 at 8:13 AM, BR_email wrote:
> Bill:
> I did workaround. I created the Rprofile files with file type R, not txt.
> Bruce
>
>
>
> William Dunlap wrote:
>>
>> I believe someone alread
I should haved added full.names=TRUE to the dir() call. I you add
that I'd expect that you would see ".../etc/Rprofile.site". What do
you see when you do
writeLines(readLines(".../etc/Rprofile.site")
and
source(echo=TRUE, ".../etc/Rprofile.site")
(replace the ellipsis by whatever dir
Use another editor or go to file explorer, turn on the 'show file
extensions' option and rename the file so it does not have the .R
extension.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Apr 17, 2017 at 8:26 AM, BR_email wrote:
> I used not extension, but R extension shows up.
>
> Bruce
No calls please. Just show the group what .../etc/Rprofile-site contained.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Apr 17, 2017 at 8:36 AM, BR_email wrote:
> Bill:
> I feel you are nailing it for me.
> Can I please call you, but I am getting a little lost, and losing your
> valuabl
A long time ago (before the mid-1990's?) with S or S+
ff <- function(n){ for(i in 1:n) (i+1)
op <- ff(3)
would result in 'op' being 4, since a for-loop's value
was the value of the last expression executed in the
body of the loop. The presence of a 'next' or 'break'
in the loop body would af
I've attached data.restore4.txt, containing the function
data.restore4(), which has the same argument list as
foreign::data.restore() and is mean to be called by the latter if the
first line of the file is "## Dump S Version 4 Dump". It can read
version 4 of the 'S data dump' format, which for wh
Use all.equal(tolerance=0, aa, bb) to check for exact equality:
> aa <- 100*(23/40)
> bb <- (100*23)/40
> all.equal(aa,bb)
[1] TRUE
> all.equal(aa,bb,tolerance=0)
[1] "Mean relative difference: 1.235726e-16"
> aa < bb
[1] TRUE
The numbers there are rounded to 52 binary dig
> z <- as.POSIXct("01-01-2016T14:02:23.325", format="%d-%m-%YT%H:%M:%OS")
> dput(z)
structure(1451685743.325, class = c("POSIXct", "POSIXt"), tzone = "")
> z
[1] "2016-01-01 14:02:23 PST"
> format(z, "%H:%M:%OS3 on %b %d, %Y")
[1] "14:02:23.325 on Jan 01, 2016"
(Don't separate the date and time pa
ifelse's vectorization messes this up.
You could replace your original
if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
p3p <- list(...)
with
p3p <- if (class(try(list(...), silent=TRUE))=="try-error") list() else
list(...)
instead of using ifelse, since the return value
>
> 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 strip )
>
>
> On Fri, Apr 28, 2017 at 8:34 AM, William Dunlap v
Perhaps R does what S+ does with par("crt"). S+'s help(par) says:
crt=x
character rotation in degrees measured counterclockwise from
horizontal.
When srt is set, crt is automatically set to the same value,
unless crt
appears later in the command than srt. Many graphi
Use Google: a search for "R Reporter package" shows that the package is
named "ReporteRs".
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, May 5, 2017 at 2:50 PM, BR_email wrote:
> Jeff:
> I cannot install the ReporteR package. Is there a work-around, or is the
> error message correct?
> T
Does the following do what you want?
> plot(log2(1:40), sin(1:40))
> yTickPositions <- axTicks(2)
> axis(side=4, at=yTickPositions, lab=format(yTickPositions*3.5))
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sat, May 6, 2017 at 2:50 PM, Antonio Silva wrote:
> Hello
>
> I want to make a pl
This is a minor problem with the print method for "survdiff" objects. It
acts like it computes the p-value with
1 - pchisq( chisq, df)
instead of
pchisq( chisq, df, lower.tail = FALSE)
The former will give zero when the latter gives a number less than about
10^-16.
Most people would accept
Try using a more recent version of R - 3.4.0 is the current version and
3.1.0 is considered pretty old now. 'R_DoubleColonSymbol' is in
RHOME/include/Rinternals.h in R-3.3.0 but not in R-2.15.0. I don't know
exactly when it was added.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, May 19,
merge() may be useful here:
> merge(OriginalData[1:3], TargetValue, by.x="AA1", by.y="AA",
sort=FALSE)[-1]
Value1 Value2 BB Value
1 1 11 B 7
2 3 13 B 7
3 11 21 B 7
4 2 12 B25
5 12 22 B25
6 9 19 B25
7 10
Do not compute the log likelihood as the log of the product of
probabilities. Instead compute it as the sum of logs of probabilities.
The latter is less likely to underflow (go below c. 0^-309).
Most (all?) of the built-in probability density functions have a 'log'
argument; when log=TRUE you get
Check for leading or trailing spaces in the strings in your data.
dput(dataset) would show them.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Jun 1, 2017 at 8:49 AM, Ulrik Stervbo
wrote:
> Hi Tara,
>
> It seems that you categorise and count for each category. Could it be that
> the met
1 - 100 of 485 matches
Mail list logo