Re: [R] Option "-shared" not being passed to gcc when installing packages

2023-09-21 Thread Simon Knapp
apt package repo)? Thanks again, Simon On Thu, 21 Sept 2023 at 17:09, Ivan Krylov wrote: > On Thu, 21 Sep 2023 10:09:56 +1000 > Simon Knapp wrote: > > > I am using R version 4.3.1 (2023-06-16) -- "Beagle Scouts" on ubuntu > > 20.04 > > > gcc -std

[R] Option "-shared" not being passed to gcc when installing packages

2023-09-20 Thread Simon Knapp
ce to `main' collect2: error: ld returned 1 exit status make: *** [/usr/share/R/share/make/shlib.mk:10: mgcv.so] Error 1 ERROR: compilation failed for package ‘mgcv’ * removing ‘/home//R/x86_64-pc-linux-gnu-library/4.3/mgcv’ The downloaded source packages are in ‘/tmp/RtmpI7uMoa/downloaded_pac

[R] Problem reading from NetCDF.

2013-05-24 Thread Simon Knapp
.var.ncdf(nc, var.def, i + j*10 + k*100, c(i, j, k), rep(1, 3)) nc }) the following do not work: get.var.ncdf(combined.ncdf) get.var.ncdf(combined.ncdf, varid='Data') get.var.ncdf(combined.ncdf, varid=4) all of which I thought would be equivalent and would give me the same as: get.var.ncdf(comb

[R] Question on callNextMethod

2012-11-06 Thread Simon Knapp
)) setMethod('test', signature(x='Base'), function(x) print('base called')) setMethod('test', signature(x='Derived'), function(x) {print('derived called'); callNextMethod()}) d = new('Derived') test(d) Produces the output: [1]

Re: [R] Logistic regression/Cut point? predict ??

2012-10-20 Thread Simon Knapp
What do you mean by "at x equal zero"? On Sun, Oct 21, 2012 at 8:37 AM, Adel Powell wrote: > I am new to R and I am trying to do a monte carlo simulation where I > generate data and interject error then test various cut points; however, my > output was garbage (at x equal zero, I did not get .50)

Re: [R] vectors comparison

2012-10-16 Thread Simon Knapp
Your question does not seem to make sense - there is no value of -500 in Y (did you mean -10?). Anyway, I think this might work: which(y==-10 & (x==1 | c(0, x[-length(x)]) == 1 | c(x[-1], 0) == 1)) ... though one would think there is a more elegant way On Wed, Oct 17, 2012 at 10:07 AM, Francesc

Re: [R] time extraction and normalization

2012-10-16 Thread Simon Knapp
in as.POSIXct(d, format = format.string, tz = tz) : > #object 'd' not found > > A.K. > > > > > - Original Message - > From: Simon Knapp > To: Jeff Newmiller > Cc: r-help@r-project.org; york8866 > Sent: Tuesday, October 16, 2012 1:32 AM

Re: [R] time extraction and normalization

2012-10-15 Thread Simon Knapp
toDaySecond <- function(date.string, format.string='%d%b%Y:%T', tz='') { d <- as.POSIXct(d, format=format.string, tz=tz) sum(mapply(function(f, l) as.numeric(format(d, format=f)) * l, c('%H', '%M', '%S'), c(3600, 60, 1))) } toDaySecond('04MAY2011:08:19:00') Will calculate the second of th

Re: [R] Building a package with an existing dll

2012-10-15 Thread Simon Knapp
Anything you put in the folder 'inst' of a package gets copied, as is, to the installed package once 'everything else' is done (see section 1.1.3 of "Writing R Extensions" - which you read for caveats). Hence you can create inst/libs//libs/.dll where: - is either 'x64' or 'i386' (or both if you

Re: [R] Calling R from C (Windows)

2012-10-15 Thread Simon Knapp
Yes. Your looking at R_HOME (the installation directory), not the "directory of the sources". On Tue, Oct 16, 2012 at 10:08 AM, BayesForever wrote: > > I am trying to follow the instructions in section 8.2.2 of "Writing R > extensions", to learn how to call R from C. In this manual and at other

Re: [R] warning message

2012-10-15 Thread Simon Knapp
The second and third arguments to ifelse are evaluated for all elements of x (producing your warnings), then the appropriate elements of each result are combined based on the (logical) values of the first argument to ifelse. On Tue, Oct 16, 2012 at 10:08 AM, Shi, Tao wrote: > Hi list, > > Can som

Re: [R] rJava install - "%1 is not a valid Win32 application."

2012-10-15 Thread Simon Knapp
My guess would be that your running the 32 bit version of R - and rJava is looking for the 64 bit dll. I'd suggest starting the 64 bit version of R explicitly (e.g. the 64 bit version of Rgui lives at /bin/x64/Rgui.exe, whereas the 32 bit version lives at /bin/i386/Rgui.exe). On Tue, Oct 16, 2012

Re: [R] Keep rows in a dataset if one value in a column is duplicated

2012-09-27 Thread Simon Knapp
frame(Pairid=PairID, Pairiddups=PairIDDuplicates) #Note that there is a fair bit of redundancy throughout #your code. A neater way of subsetting your original #data, for instance, would be: PairIDdup <- unique(PairID[duplicated(PairID)]) Health2[PairID %in% PairIDdup,] Have Fun! Simon Knapp

[R] combining numeric vector and column in a data frame

2012-07-10 Thread Simon Knapp
combined <- data.frame(mnv=my.numeric.vec[df1$fileName], type=df1$type) sorted <- combined[order(rownames(combined)),] On Wed, Jul 11, 2012 at 8:38 AM, Adrian Johnson wrote: > Hi: > I am trying to map column names of a matrix to another data frame and > get values in a different column of data

Re: [R] Fractional Factorial - Wrong values using lm-function

2012-06-25 Thread Simon Knapp
y(e), b=thingy(b) ) ) lm5 <- lm(Distance ~ .^2, data = dat2) summary(lm5) On Tue, Jun 26, 2012 at 12:35 AM, Simon Knapp wrote: > ... but this is tantalisingly close: > > dat1 <- with(data.catapult, >    data.frame( >        Distance, >        h=C(h, poly, 1),

Re: [R] Fractional Factorial - Wrong values using lm-function

2012-06-25 Thread Simon Knapp
wish I knew what it meant. On Tue, Jun 26, 2012 at 12:18 AM, Simon Knapp wrote: > They are coding the variables as factors and using orthogonal > polynomial contrasts. This: > > data.catapult <- data.frame(data.catapult$Distance, > do.call(data.frame, lapply(data.catapul

Re: [R] Fractional Factorial - Wrong values using lm-function

2012-06-25 Thread Simon Knapp
m not even sure why the results to look like they do (interaction terms like "a*b" not "a:b" and one level for each interaction). Hope that helps, Simon Knapp __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] Q - scatterplot, plot function & trellis linear regressions???

2012-05-19 Thread Simon Knapp
I presume you mean car::scatterplot A1) plot is a generic function for plotting 'things' and scatterplot is a specific tool provided by that library A2) from the documentation one infers that 1) the straight line is a regression line 2) the other lines are produced using loess

Re: [R] converting csv to image file

2012-05-19 Thread Simon Knapp
provided you get the call to read.table (or perhaps read.csv) right and presuming that file contains only the image data, you should be able to say: r <- raster(as.matrix(read.csv("file.csv"))) extent(r) <- extent(xmin, xmax, ymin, ymax) and not worry about the projection (if it is plain old deci

Re: [R] Loop Help

2012-05-19 Thread Simon Knapp
First, what was going wrong: #this creates a character vector, not an object containing your data sets TOWERS <- c("TOWER1","TOWER2","TOWER3","TOWER4","TOWER5","TOWER6","TOWER7") for(i in 1:7){ # this creates a variable named "TOWER.i" (not "TOWER.1, TOWER.2, ..., TOWER.7) # which will ge

[R] Fwd: Help please

2011-07-20 Thread Simon Knapp
Hi All, This is not really an R question but a statistical one. If someone could either give me the brief explanation or point me to a reference that might help, I'd appreciate it. I want to estimate the mean of a log-normal distribution, given the (log scale normal) parameters mu and sigma squar

Re: [R] RWinEdt problem

2011-07-03 Thread Simon Knapp
... I just tried fiddling with the appearance settings, and when I uncheck "Custom Colors" under "Document Tabs", the file names reappear, though I don't get the coloring I am used to (red for modified, green for unmodified). Thanks again, Simon Knapp On Mon, Jul 4, 201

[R] RWinEdt problem

2011-07-03 Thread Simon Knapp
any advice on this? Thanks in advance, Simon Knapp OS: windows7 Arch: 64 bit R version: 2.13.0 (2011-04-13) WinEdt version: 5.14 (build 20050701) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch

[R] lapply and list indexing basics (after realizing I wasn't previously subscribed...sorry)

2010-03-07 Thread Simon Knapp
library(MASS) dat <- data.frame( col1=as.factor(sample(1:4, 100, T)), col2=as.factor(sample(1:4, 100, T)), col3=as.factor(sample(1:4, 100, T)), isi=rnorm(100) ) dat <- split(dat, as.factor(sample(1:3, 100, T))) lapply(dat, function(x, densfun) fitdistr(x$isi, densfun), 'normal')

Re: [R] change codes into loops

2010-01-18 Thread Simon Knapp
for(k in 1:3) { eval(do.call('substitute', list(expr=thingy, env=list(A=as.symbol(paste('b_', k, sep='')) } } } # would have also worked, but it does not. Can someone please explain why not? Simon Knapp On Tue, Jan 19, 2010 at 1:41

Re: [R] Sub-matrixes that are linked to the "Base matrix"

2010-01-18 Thread Simon Knapp
ef(2:3, 2:3) b[1,1] <- 42 # equivalent to b$set.vals(1,1,42) b[1:2,2] <- 43 a[1,1] <- 44 a[rep(4, 2), 2:3] <- 45 b # print the sub matrix a # print the matrix #test passing sub-matrix to a function test <- function(x) x[2,1] <- 46 test(b) a # print the matrix again (it is as we

Re: [R] coplots with missing values

2010-01-17 Thread Simon Knapp
Never used coplot, but why not try removing the rows with missing variables? Perhaps with: dat <- cbind(E2=resid(baea.ancova6, type = "normalized"), year, population) coplot(E2~year|population, data=dat[apply(dat, 1, function(x) !any(is.na (x))),]) Regards, Simon Knapp On Mon, Jan

Re: [R] Help using Cast (Text) Version

2010-01-17 Thread Simon Knapp
byrow=T, ncol=6)) # I think this line of code gives what you want (number of rows that contain at least 1 non-na value). sum(apply(data[,-1], 1, function(x) any(!is.na(x # to produce the line "(all)" in your original output (assuming that this line counts the number of non-na entries

Re: [R] Recommended visualization for hierarchical data

2010-01-12 Thread Simon Knapp
apply(function(y, height, x, width) rect(x, y, x+width, y+height), cum.heights, heights, MoreArgs=list(cum.tot, width)) text(cum.tot + width/2, heights/2 + cum.heights, x$County) }, split.dat, cum.widths, widths) axis(1, (widths / 2 + cum.widths), names(split.dat)) Hope this helps, Simon Kn

Re: [R] Calculate the percentages of the "numbers" in every column.

2010-01-12 Thread Simon Knapp
ould do it (but I bet there is a more elegant way). Regards, Simon Knapp On Wed, Jan 13, 2010 at 5:25 AM, Kelvin <6kelv...@gmail.com> wrote: > Dear friends, > > I have a table like this, I have A B C D ... levels, the first column > you see is just the index, and there are

Re: [R] some help regarding combining columns from different files

2010-01-12 Thread Simon Knapp
t(any(apply(temp1, 1, function(x, y) x['geneDescription'] %in% y, temp2['geneDescription'])), '\n') } } A tip - there are trailing and/or leading whitespace on the variables 'geneDescription' and 'orgSymbol'. (in the latter case " RG "

[R] proto question

2009-01-07 Thread Simon Knapp
p*" not found" Which I think occurs because the last two lines in 'setup' only create references to their respective environments which disappear on exit of 'setup'. Any ideas? Regards, Simon Knapp. [[alternative HTML version deleted]]

Re: [R] How do I generate one vector for every row of a data frame?

2008-12-18 Thread Simon Knapp
... actually, the scaling of the weights was not required as it is done by sample anyway. On Fri, Dec 19, 2008 at 5:16 PM, Simon Knapp wrote: > Your code will always generate the same number of samples from each of > the normals specified on every call, where the number of samples from >

Re: [R] How do I generate one vector for every row of a data frame?

2008-12-18 Thread Simon Knapp
t; tol) { warning("data$weight does not sum to 1 - rescaling") data$weight/sum(data$weight) } else data$weight rows <- sample(1:nrow(data), n, T, wgts) rnorm(n, data$mean[rows], data$sd[rows]) } Regards, Simon Knapp. On Fri, Dec 19, 2008 at 4:14 PM, Bill

Re: [R] using jackknife in linear models

2008-12-18 Thread Simon Knapp
mplify=F) and call it like: results <- jackknife.apply(1:n, DF, c("(Intercept)", "V1", "V2", "V3")) which would give you a list with the jackknife output for each coefficient. note that you don't need to attach DF for your code to work :-) Regar

Re: [R] Fwd: Categorial Response Questions

2008-10-17 Thread Simon Knapp
Not the same data your using but... # get something like a reasonable # age dist for dummy data: data('mw.ages', package='UsingR') mw.age <- mw.ages[2:80,] # size of dummy dataset n.obs <- 1000 #pr of survival pr.s <- 0.80 # dummy data dat <- data.frame( pclass=sample(c('1st', '2nd', '3rd')

Re: [R] R script from Python

2008-10-17 Thread Simon Knapp
'Rterm --help' shows the usage as: Rterm [options] [< infile] [>outfile] [EnvVars] just in case you didn't understand what the angle brackets meant: the term "[< infile]" means "read input from 'infile'", and the term "[> outfile]" means "write output to 'outfile'". Though your code works at th

Re: [R] Join data by minimum distance

2008-09-14 Thread Simon Knapp
> I am wondering if there is a function which will do a join between 2 > data.frames by minimum distance, as it is done in ArcGIS for example. For > people who are not familiar with ArcGIS here it is an explanation: > > Suppose you have a data.frame with x, y, coordinates called track, and a > s

Re: [R] Problem with misclass function on tree classification

2008-09-14 Thread Simon Knapp
Did you say: library("tree") at the top of your script? On Sun, Sep 14, 2008 at 5:47 PM, Meir Preiszler <[EMAIL PROTECTED]> wrote: > > I am working through Tom Minka's lectures on Data Mining and am now on Day > 32. The following > is the link: > http://alumni.media.mit.edu/~tpminka/courses/36

Re: [R] Please help me in Converting this from C# to R

2008-09-14 Thread Simon Knapp
# bit hard to provide a simple conversion without definitions of the class 'Node', the template 'DirectedGraph' and the function 'Writed'! # I've used the package 'igraph' as a drop in - hope it is still clear. # # by the way: # - your curly braces don't match, # - not all elements of P are initial

[R] Question on substitute.

2008-03-11 Thread Simon Knapp
is is prettier, but I'm trying to come to grips with substitute/do.call/calls/expressions/...). I guess that argument names are a different beast to argument values in expressions. My question (finally) is: is there a way of achieving 'desired result'