Displaying 20 results from an estimated 400 matches similar to: "extract all numbers from a string"
2011 May 19
5
identical function names from 2 packages
Hi,
If I load 2 packages that have a function with the same
name, how do I tell R to run one or the other?
(Instead of having R automatically use the first- or
last-loaded one, whichever it is. (Which is it, by the way.))
Cheers!
Nick
--
====================================================
Nicholas J. Matzke
Ph.D. Candidate, Graduate Student Researcher
Huelsenbeck Lab
Center for
2012 Feb 19
1
parse .ps files with R?
Hi,
Is there a way to parse a postscript (*.ps) file with R (or
perhaps with some other command-line utility)?
E.g., I have a map in postscript format with lots of
features, but I just want to extract the coastline and it's
coordinates.
Any help very much appreciated! Cheers!
Nick
--
====================================================
Nicholas J. Matzke
Ph.D. Candidate, Graduate
2011 Feb 03
3
how to check if an attribute exists
I am dealing with an object that sometimes has a certain
attribute, sometimes doesn't. How do I check for this?
"exists" doesn't work...
=======================
> z=c()
> z$a = c("c", "d", "f")
> z
$a
[1] "c" "d" "f"
> exists("z")
[1] TRUE
> exists("z$a")
[1] FALSE
2011 Feb 01
2
how to check if a library is loaded, from a function
Hi,
I've written a function which I load with a source command.
The function requires a certain library, phangorn, to work.
I would like the function to check if phangorn is loaded as
a library before running. For some reason, just putting
require(phangorn) into the sourced function doesn't do anything.
This must be simple, but I can't figure it out! Any help
appreciated...
2010 Jun 05
2
380x380 dataframe to list
Hi,
This can't be hard, but I can't find the solution. I have a
380x380 data frame of numbers. I would like to turn it into
a single column so I can do e.g. hist and mean on it without
writing my own function. There must be a simple function
for this, but I'm stumped -- reshape, dim, etc. don't seem
to do it...
Help appreciated!
Thanks!!
Nick
--
2010 Sep 10
8
convert "1", "10", and "100" to "0001", "0010", "0100" etc.
Hi,
Is there an easy way to convert numbers into a form such
that they all have the same number of digits?
e.g.:
"1", "10", and "100"
...become...
"0001", "0010", "0100" etc.
I ask because I am producing a large number of files that
need to sort consistently by filename. Currently I get this
kind of sorting:
filename1
filename10
2010 Apr 03
2
histogram-like barplot? (or reverse?)
Hi,
I have a simple task I can't figure out. I'd like to take
some measurements I made, e.g.:
year (y-axis)
1
2
3
4
5
6
counts (x-axis)
10
10
20
30
40
50
And then, make a barplot with the x-axis ticks (representing
the borders between years) between the bars.
However, barplot seems to force you to make the x-axis
arbitrary categories. I want it to be continuous (as in a
2009 Jan 29
2
tab characters
Hi all,
Working at the R command line, how do I get strings to display e.g. tab
or newline characters as they should be displayed, rather than as e.g.
\n or \t?
e.g.:
> x="\t"
> x="\t"
> x
[1] "\t"
> print(x)
[1] "\t"
--
====================================================
Nicholas J. Matzke
Ph.D. student, Graduate Student Researcher
2009 Jan 23
3
last result
Hi,
Let's say one has just run a command line command that took an hour and
produced a huge matrix as an output. However, one forgot to store the
output in a variable.
Is there a hidden variable somewhere that stores the result, so that one
doesn't have to re-run the analysis for an hour?
E.g., x <- whatever_the_last_output_was
Thanks!
Nick
--
2010 Jun 19
1
weird error: Coercing LHS to a list
Hi all! I'm trying to build a simple class, but I'm getting
a weird error.
E.g. if I do:
==========
gregion = setClass("gregion", contains = "data.frame",
representation(name = "character", poly.x = "numeric",
poly.y = "numeric" ))
gregion$name = "North America"
==========
Then I get this message:
Warning message:
In
2009 Sep 15
2
R console line-wrapping
Hi all, a quick question I couldn't find the answer to in the usual places:
Is there a way to turn off line-wrapping in the R console? Or set the
line width-before-wrapping manually? Currently it looks like the
console linewraps after about 70 characters, this occurs even if I
increase the window size.
(I want to output some simple tables to screen for students in a
computer lab
2009 Jan 27
2
sorting matrix to match an ordered list
Hi all,
This can't be very hard, but it is sticking me because I am a beginner.
Setup:
x = rbind(c(0,1,1), c(2,3,1), c(4,5,1))
y = as.matrix(x)
rownames(y) = c("a","b","c")
colnames(y) = c("a","b","c")
ordered_list = c("b", "c", "a")
How do I produce a new matrix, z, with the rows and columns both
2009 Sep 19
3
eval(expr) without printing to screen?
Hi,
I have a script which I source, which evaluates a changing expression
call hundreds of times. It works, but it prints to screen each time,
which is annoying. There must be simple way to suppress this, or to use
a slightly different set of commands, which will be obvious to those
wiser than I...
Here is a simpler mockup which shows the issue:
x = data.frame(rbind(c(1,2,3),c(1,2,3)))
2013 Jan 20
1
How to check if R.app is running?
Hi, here's an obscure question someone can hopefully help with.
I have some R code that uses stuff from parallel (now a part
of the R core in 2.15 I believe), especially clusterApply.
However, this seems to cause problems in R.app, and I've
seen advice to not use these multicore functions, e.g. doMC,
in R.app.
So, I want to make this optional. How can have a program
check whether
2011 Oct 28
1
"file name too long" error during R CMD INSTALL
Hi all,
I am attempting to install a package called phylobase from
source directory. It all seems to work until the end, at
which point it looks like the last compile command fails
because the line is too long...perhaps because the g++
command line also includes "Loading ~/.Rprofile...", like this:
============================
g++ -arch i386 -dynamiclib
2012 Feb 02
1
knncat broken on R 2.14?
Hi,
Until recently I was using the knncat classifier function of
knncat on an old computer (2.12, Mac OS X 10.4), and
everything worked great.
However, now that I have updated to R 2.14.1 (on Mac OS X
10.7), knncat seems broken. Problems:
1. It seems to output verbose output by default, and
regardless of whether I put 0 or 1 into the verbose option.
2. It seems to just predict
2011 Mar 16
0
limited number of graphs in Quartz window
Hi all,
I'm using the R GUI on a Mac. It is easy to produce a
number of plots and put them into a Quartz window, and then
use Command-left or Command-right to flip between them.
However, Quartz seems to hold a maximum of about 15 plots,
and then discards anything plotted before that.
This is pretty annoying, does anyone know of way to change
this default setting?
Cheers,
Nick
--
2011 Oct 25
0
Installing rgeos on Mac OS X 10.4 (was Re: "package 'stringr' does not have a name space"
I figured it out, at least enough to get rgeos's gSimplify
function to work, which was my original goal; the stringr
problem was with 0.2, however I got stringr 0.5 to install
by changing the minimum version in DESCRIPTION from R2.11 to
R 2.10. ...
Thanks for the help!
#############
# This is how I got rgeos to install in R GUI on my Intel
Mac OS X 10.4:
#############
# stringr
2009 Feb 23
1
running multiple commands in one system() call
Hi all,
I'm on Mac OS X 10.4...
So I've got a small python script I need to run from R. However, to get
the python script working, I need to have the shell that R calls get
settings from my .bash_profile file, which apparently it doesn't
currently (the shell R calls uses an older version of python, and also
this older version of python can't see various python modules I have
2017 Apr 02
2
vfs_shadow_copy2 delimiter not working
Hi
I could not get a custom "shadow:delimiter" for the vfs shadow_copy2
module to work successfully for me with Samba 4.6.2. I did not try
previous versions. Based on my testing it seems that an additional line
of code is needed in vfs_shadow_copy2.c as shown in the patch below
(some comment updates are included too for code readability).
Without the below patch, previous versions