Displaying 20 results from an estimated 400 matches similar to: "reshaping data.frame question"
2006 Jun 02
4
function environment
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
how can I automatically access the functions that I loaded into a
separate environment?
> save(A,B,file="myfun.r")
> load("myfun.r",envir=(ENV<-new.env()))
> ls(ENV)
[1] "A" "B"
?"[" turned up that I can access the functions via
> ENV$A
function ()
{
}
> ENV$A()
NULL
Now, how
2006 Jul 12
2
plot.ts panel function
How can I set the ylim in individual panels of a "multiple" plot.ts?
The panels are all scaled to fully fit the series inside. But I need
specific scales, and colors ....
Here is an example:
plot.ts(cbind(1:10,1:10/10),ylim=c(0,3)) # ylim has no effect
Can someone more knowledgable please explain how to use the panel=
option correctly, thanks!
Cheers, m
2006 Aug 18
3
Query: how to modify the plot of acf
I need to modify the graph of the autocorrelation. I tried to do it through plot.acf but with no success.
1. I would like to get rid of the lag zero
2. I would like to have numbers on the x-axis only at lags 12, 24, 36, 48, 60, ...
Could anybody help me in this?
Any help will be appreciated
Thank you for your attention
Stefano
[[alternative HTML version deleted]]
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
2004 Feb 12
3
hardware question
I recently asked this question, but I didn't get an answer on this part
of my question:
What hardware would be able to do this with ease:
I must install a samba server as PDC for my school. The server would
authenticate users using openldap (on the same server). And if possible,
I would also run an intranet on it (apache, php, mysql).
There would be about a hundred (maybe 150 later on)
2009 Nov 15
1
Help with unstack() function
Hi Everyone,
I am trying to understand the unstack() function but after struggling for
two days, I have given up. More specifically, I am trying the exercises at
the end of Chapter 1 of Data Analysis and Graphics Using R by Maindonald
and Braun, 2nd ed. Exercise 18 (p. 41) asks to unstack the Rabbit data frame
from the MASS package to get a certain data frame that is shown in the
exercise.
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
2016 Sep 30
2
GSSAPI - Server not found errors
Ok I'll try that in the morning and will get back with the resilt.
On 30 September 2016 at 21:22, Rowland Penny via samba <
samba at lists.samba.org> wrote:
> On Fri, 30 Sep 2016 20:24:45 +0100
> "Maton, Brett" <matonb at ltresources.co.uk> wrote:
>
> > Thanks for the suggestion Rowland, I had already tried that though
> > and both secondary
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",
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
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
2009 Oct 02
3
Tabulating using arbitrary numbers of factors
Dear R-help,
First of all, thank you VERY much for any help you have time to offer. I
greatly appreciate it.
I would like to write a function that, given an arbitrary number of factors
from a data frame, tabulates the number of occurrences of each unique
combination of the factors. Cleary, this works:
> table(horse,date,surface)
<SNIP>
, , surface = TURF
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)
2005 Oct 22
0
Getting univariate information from a multivariate data set
A quick question that I've had only partial success in answering. I
have a multivariate dataset, and would like to extract some simple
univariate information from it grouped by treatments, etc. I am
encountering two problems however
Note: I am importing my data with
my_data <- read.csv("/path/data.csv")
1) Scoping of unstack
If I attempt
sorted_data <- unstack(response,
2010 Jul 21
2
Issues reshaping data
Hello All,
I'm having some trouble reshaping my data from wide to long format. I have
tried using both the reshape function and package. Although I haven't worked
much with the reshape function, I have found the reshape package useful and
intuitive for reshaping data from long to wide format. However, going the
other way has me stumped with this type of data. My data is set up, roughly,
2012 Jun 09
2
Reshaping columns
Dear all,
I have a data frame with 2 columns and 102500 rows. The data looks like
below
V1 V2
8098 110000.......
9099 001100.......
0023 110011.......
6545 111111.......
. .
. .
. .
. .
. .
I want to split the colums like this ;
V1 V2 V3 V4 V5 V6 v7
8098 1 1 0 0 0 0 ......
9099
2012 Nov 17
3
Reshaping a dataframe
Seems like this should be easy but I'm struggling a bit. How do I rearrange a
data frame to go from the first one to the second shown below ?
State Date lbs
TX 200701 400
TX 200702 650
TX 200703 950
TX 200704 1000
FL 200701 200
FL 200702 300
FL 200703 500
FL 200704 333
NJ 200701 409
NJ 200702 308
NJ 200703 300
NJ 200704 800
Date TX FL NJ
200701 400 200 409
200702 650
2011 Feb 24
1
reshaping list into a contingency table
Hi all,
I have been struggling with this problem for a few days.
I have a data table like this:
gene rpkm1 diff1 rpkm2 diff2
gene1 23 50 13 120
gene2 111 220 827 1200
gene3 75 998 71 910
And I want to re-format it so that, for each gene, I have a 2x2 contingency
table, such as:
gene rpkm diff
gene1 23 50
gene1 13 120
gene2 111 220
gene2 827
2003 Oct 30
1
Trouble reshaping some data
I would appreciate some advice on the following task. I have
some data that currently looks like this:
t1 <- data.frame(id=c(1,1,2,2),
aspect=c("A","B","A","B"), score=c(10,9,11,12))
I'd like it to look like this:
id A B
1 10 9
2 11 12
reshape() looks like a good candidate for this job but I'm
not really sure about the roles of
2012 Mar 13
1
reshaping a dataset for a network
dear all,
apologizes for bothering with a probably stupid question but I really
don' t know how to proceed.
I have a dataset which look like df
a <- c(1,2,3,4,4,4,5,5)
b <- c(11,7,4,9,8,3,12,4)
df <-cbind(a,b)
I would like to have one which looks like this:
a
1 11
2 7
3 4
4 9 8 3
5 12 4
a are vertex of a network, b the edges. In the data the lenght of a is
about 50000
I read