Displaying 20 results from an estimated 5000 matches similar to: "Help with unstack() function"
2011 Mar 12
1
Column order in stacking/unstacking
Dear R users,
I'm having some problems with the stack() and unstack() functions, and
wondered if you could help.
I have a large data frame (400 rows x 2000 columns), which I need to reduce
to a single column of values (and therefore 800000 rows), so that I can use
it in other operations (e.g., generating predictions from a GLM object).
However, the problem I'm having can be reproduced
2000 May 16
4
How do I add fitted curves to coplots?
G''day
I''ve been performing an analysis of some data by a follow the leader
method (Bad I know but it seems to work and I think I understand all the
steps now) and I''ve run into a problem. The analysis is for all practical
purposes identical to the non-linear mixed effects analysis performed on
Ludbrooks Rabbit data in the second edition of Venables & Ripley (page
2004 Mar 19
2
using "unstack" inside my function: that old scope problem again
I've been reading the R mail archives and I've found a lot of messages
with this same kind of problem, but I can't understand the answers. Can
one of you try to explain this to me?
Here's my example. Given a regression model and a variable, I want to
use unstack() on the vector of residuals and make some magic with the
result. But unstack hates me.
PCSE <- function
2008 Jun 19
4
Controlling the length of line with abline(lm())
Hi
I just realized that when I use linear regression to draw a line through my
data points with something like the following:
abline(lm(y ~ x))
the length of the line is infinite, i.e., the line goes beyond the smallest
and the largest data values. This seems not very right to me (not to mention
it looks unaesthetic). I do not mean to imply that the straight-line
behavior of my system is
2008 Jun 10
3
Plotting multiple continuous lines with symbols
Hi,
I am trying to plot multiple lines on one plot such that all lines are of
the same color (black) and continuous. I need to distinguish these multiple
plots from each other by using different symbols (I am using pch=). However,
all my lines are broken on both sides of the symbols. This unfortunate (and
unsightly) behavior seems to be the default. In my search of the help
archives for R over
2010 Oct 18
1
questions on unstack()
Folks,
I have the following dataframe:
> x <- structure(list(name = c("EU B", "EU B", "EU B", "EU B", "EU B",
"EU B", "AU A", "AU A", "AU A", "AU A", "AU A", "AU A"), date = c("2010-10-11",
"2010-10-12", "2010-10-13",
2009 Dec 05
1
R packages and assess to data in packages
Hi Everyone,
I have two very basic questions and would appreciate your help.
1. I would like to see/access the data that comes with a given R package by
using a function like read.table(). For example, I just installed car
package from CRAN. I know that somewhere within the package, there is
Duncan.txt file. I would not only like to look at it from file browser (or
using ls command in shell) but
2016 Jun 27
1
stack problem
One would normally want the original order that so that one can stack
a list, operate on the result and then unstack it back with the
unstacked result having the same ordering as the original.
LL <- list(z = 1:3, a = list())
# since we can't do s <- stack(LL,. drop = FALSE) do this instead:
s <- transform(stack(LL), ind = factor(as.character(ind), levels = names(LL)))
unstack(s)
2008 Jun 04
2
Superscript/Subscript in main title
I have been trying to figure out how to get superscript/subscript in the
main title for a plot. I have tried various approaches and suggestions but
none of them work. I am trying to get the following as the main title of my
plot:
Emission of CO2 with time
(but note that 2 is subscript.)
I have tried
plot(main="Emission of C"expression(O[2]) "with time")
and I get error
2008 Jun 18
1
Help with axis labels
Hi
I have patched together (from various sources) the following code to get
semi-logarithmic plot. Unfortunately, my labels come out also at
intermediate places between 10^2, 10^3, 10^4 etc. Since I put the code
together from various sources and do not understand fully how the code is
working, I have not been able to get rid of the labels like 10^1.69897,
10^2.69897 etc. I would appreciate if
2011 Sep 26
1
Restructuring data - unstack, reshape?
Hi all,
I'm having a problem restructuring my data the way I'd like it. I have data
that look like this:
Candidate.ID Specialty Office Score
110002 C London 47
110002 C East 48
110003 RM West 45
110003 RM
2010 Oct 04
1
Error message with scan() function
Hi Everyone,
I am new R user and am trying to learn by reading the online manual "An
Introduction to R" from the R web site. I am trying to practice using the
scan() function as explained in the manual. For this I first created three
vectors (one a character vector and two numeric one) and saved file
"input.dat" in my working directory as:
> label <- c("Bill",
2009 Oct 25
2
Help with history() in Emacs/ESS
Hi Everyone,
I am a beginner running R 2.9.2 under Ubuntu and typically use Emacs w/ESS.
However, I am confused with history() command. When I issue command
history() in Emacs within an R session, this is what get:
> history()
Error in savehistory(file) : no history available to save
Similarly, history(max=10) command gives the same error message.
However, there is this In/Out Menu in the
2008 Jun 16
1
Specifying fonts in R
Hi
I am a novice user of R. I got hold of "R Graphics" by P. Murrell the other
day and am trying to follow examples in the book. In chapter 3, the section
on font specification gives 16 "basic" font families and face combinations
available in R (Figure 3.9). However, the book also warns that even if a
font specification is given, it does not mean that the font will always be
2005 Nov 19
3
Permissions problem I don't understand
I am try to use rsync from my windows box (under cygwin) to back up "My
Documents" on to a debian server (known on my home network as roo.home)
running rsyncd from inetd where it is run as root.
my rsyncd.conf file sets the gid and uid to user backup.backup thusly:-
syslog facility = daemon
uid = backup
gid = backup
hosts allow = 192.168.0.0/24
hosts deny = 0.0.0.0/0
timeout = 600
2009 May 18
1
error in importing text files
Hello All:
I am very new to R and am trying to import some (107) text files into R while simultaneously manipulating the data into a structure that I can use. Below is a description of what I am trying to ultimately accomplish. However, I find that I am unable to even read one file into R using the read.table function. I get the following error:
> test<-read.table("test4.txt")
2008 Jul 16
1
Help Updating and Installing R Packages
Hi Everyone,
I have a few fairly basic questions about upgrading and installing R
packages. First off, I am using Ubuntu Hardy Heron and have R 2.7.1
installed and working perfectly. I usually access R via Emacs ESS interface
which I am still trying to get the hang of. My questions and issues are as
follows:
Question 1: I started R and wanted to upgrade the installed R packages. So,
I issue the
2016 Jun 27
2
stack problem
stack() seems to drop empty levels. Perhaps there could be a
drop=FALSE argument if one wanted all the original levels. In the
example below, we may wish to retain level "b" in s$ind even though
component LL$b has length 0.
> LL <- list(a = 1:3, b = list())
> s <- stack(LL)
> str(s)
'data.frame': 3 obs. of 2 variables:
$ values: int 1 2 3
$ ind : Factor
2012 Mar 20
2
Reshaping data from long to wide without a "timevar"
Hello All,
I was wondering if it's possible to reshape data from long to wide in R without using a "timevar". I've pasted some sample data below along with some code. The data are sorted by Subject and Drug. I want to transpose the Drug variable into multiple columns in alphabetical order.
My data have a variable called "RowNo" that functions almost like a
2007 Jul 15
1
Restructuring data
Hi folks,
I am new to the list and relatively new to R. I am trying to unstack data
"arraywise" and could not find a convenient solution yet. I tried to find a
solution for the problem on help archives. I also tried to use the reshape
command in R and the reshape package but could not get result. I will
illustrate the case below, but the real dataset is quite large so that I
would