Displaying 20 results from an estimated 600 matches similar to: "weird error: Coercing LHS to a list"
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
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
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
--
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...
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
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
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 Jun 16
2
extract all numbers from a string
Hi all,
I have been beating my head against this problem for a bit,
but I can't figure it out.
I have a series of strings of variable length, and each will
have one or more numbers, of varying format. E.g., I might
have:
tmpstr = "The first number is: 32. Another one is: 32.1.
Here's a number in scientific format, 0.3523e10, and
another, 0.3523e-10, and a negative,
2010 Jul 26
0
Switch Enter and Return in R.app?
Hi all,
I googled this but no luck.
I am using R.app 2.10.1 on Mac OSX 10.4.
Here's the problem:
When I type at the R.app command line and hit the carriage
return "Enter" (right pinky, "Return" on some keyboards), it
just adds a blank line.
To actually get the command to execute, I have to go all the
way over to the number-keypad and hit "Enter" there.
2010 Nov 18
0
plist file?
Hi all,
I am running R.app on Mac OS X 10.4. I am trying to figure
out if there is a .plist file of some sort, or a similar
parameter file, that will let me turn on and off e.g.
line-wrapping in the R.app GUI console.
The only hint I could find online is this:
https://stat.ethz.ch/pipermail/r-sig-mac/2010-April/007264.html
...but it doesn't seem to specify where to find the file in
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
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 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
--
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 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