Displaying 20 results from an estimated 60000 matches similar to: "data formatting"
2009 Jun 29
5
Select values at random by id value
All,
I have data that looks like below. For each id there may be more than one
value per day. I want to select a random value for that day for that id.
The end result would hopefully be a matrix with the id as rows, date as
columns and populated by the random hab value. Thanks to someone on here
(Jim) I know how to do the matrix, but now realize I need to randomly select
some of my values.
2010 Sep 15
1
Format Data Issue??
R Users,
I am new to R and have tried to figure out how to automate this
process instead of using excel. I have read in this dataframe into r
with read.table. I need to reshape the data from the first table into
the format of the second table.
TractID StandID Species CruiseDate DBHClass TreesPerAcre
Carbon Stand 1 Loblolly Pine 5/20/2010 10 1.2
Carbon Stand 1 Loblolly Pine
2008 Dec 10
4
tapply within a data.frame: a simpler alternative?
Dear list,
I have a data.frame with x, y values and a 3-level factor "group",
say. I want to create a new column in this data.frame with the values
of y scaled to 1 by group. Perhaps the example below describes it best:
> x <- seq(0, 10, len=100)
> my.df <- data.frame(x = rep(x, 3), y=c(3*sin(x), 2*cos(x),
> cos(2*x)), # note how the y values have a different
2012 Jul 07
4
replacement has length zero
I have been working on the following code but keep getting an err message. My
current thinking is that the problem is on the indexing but do not know how
to fix it. Any help please?
ungulate <- read.csv("Ungulate.csv",row.names=1)
ungulate <-
as.matrix(ungulate);colnames(ungulate)<-NULL;rownames(ungulate)<-NULL
habitat <- read.csv("Ungulate_vegetation.csv")
2009 Apr 04
2
data.frame, converting row data to columns
I have a data frame something like:
name wrist
nLevel emot
1 4094 3.34 1
frustrated
2 4094 3.94 1
frustrated
3 4094 NA 1
frustrated
4 4094 3.51
2009 Dec 05
2
plot data from tapply
i have three data, x coordinate, y coordinate and signal strength
i use tapply() function to get the average ss in the give x,y location
x=c(1,2,3,1)
y=c(1,2,3,1)
ss=c(55,NA,55,88)
ss_byxy_test=tapply( ss, list( x, y), mean)
and I get this table
1 2 3
1 71.5 NA NA
2 NA NA NA
3 NA NA 55
but i don't know how to plot different the ss with the xy location,
can anyone help me
--
2009 May 31
2
Problem with reshaping of data
Hi,
i have to reshape a dataset. my data have the following format:
ID; x1; x2; x3; x4; v1; ... v20
1; 0.1; 0.3; 0.4; 0.2; 2; ... 3
2; 0.3; 0.7; 0.1; 0.2; 1; ... 4
...
999; 0.9; 0.6; 0.3; 0.1; 4; ... 2
1000; 0.2; 0.6; 0.7; 0.8; 1; ... 5
ID is the number of persons (here 1000 persons)
x are descriptive variables
and v1-v20 are values of satisfaction on holidays for 20 days
and now i
2009 Dec 13
2
Reshape a data set
I am trying to reshape a data set. Could someone please help me with the
reshape, cast, and melt functions? I am new to R and I have tried reading
up on how to use the reshape package, but I am very confused. Here is an
example of what I am trying to do:
subject coder score time
[1,] 1 1 20 5
[2,] 1 2 30 4
[3,] 2 3 10 10
[4,] 2 2
2012 Oct 26
1
Openbugs- Array Index
Hi,
I'm working on the codes below however every time I run them when they get
to OpenBUGS I keep getting the error message: array index is greater than
array upper bound for hab.
Any help would be greatly appreciated,
Suzie
Codes:
ungulate <- read.csv(file.choose ()) #ungulate
ungulate <-
as.matrix(ungulate);colnames(ungulate)<-NULL;rownames(ungulate)<-NULL
2009 Jul 07
1
ReShape to create Time from Observations?
Here is a couple of very simple data.frames:
X<-data.frame(A=1:10, B=0, C=1, Ob1=1:10, Ob2=2:11, Ob3=3:12,
Ob4=4:13, Ob5=3:12, Ob6=2:11)
Y<-data.frame(A=1:20, B=0, C=1, D=5, Ob1=1:10, Ob2=2:11, Ob3=3:12,
Ob4=4:13, Ob5=3:12, Ob6=2:11, Ob7=5:9)
Z<-data.frame(A=1:30, B=0, C=1, D=6, E=1:2, Ob1=1:10, Ob2=2:11,
Ob3=3:12, Ob4=4:13, Ob5=3:12, Ob6=2:11, Ob7=1:10, Ob8=3:12)
Each row in the
2008 Jul 15
3
Melt (reshape) question
Dear all,
I
have a grid of 720 columns by 360 rows of global population density
values, and hope to convert this to column format using the 'melt' command in the 'reshape' package. I'm not receiving
any errors as such, but when the code has finished running, my output
looks like this:
> head(PopDens.long)
Latitude Longitude PopDensity
1 -84.75 V1 0
2
2008 Feb 20
3
reshaping data frame
Dear all,
I'm having a few problems trying to reshape a data frame. I tried with
reshape{stats} and melt{reshape} but I was missing something. Any help is
very welcome. Please find details below:
#################################
# data in its original shape:
indiv <- rep(c("A","B"),c(10,10))
level.1 <- rpois(20, lambda=3)
covar.1 <- rlnorm(20, 3, 1)
level.2
2009 Jul 20
2
data frame from list of lists with unequal lengths
Hello,
I have a dataset with multiple entries in one field separated by "/"
characters. (The true dataset has long names, 20-odd variables, and
hundreds of observations.)
v1 v2
1 A L
2 A/B M
3 C N
4 D/E/F O
5 A P
6 C L
What I would like is to have a dataset that looks like this instead:
> my.df
v1 v2
1 A L
2 A M
3 B M
4 C N
5 D O
6 E O
2010 Jul 19
3
Reshaping data
Dear All,
I have some data in the following shape:
ID begin_t1 end_t1 begin_t2 end_t2
Thomas 11/03/04 13/05/06 04/02/07 16/05/08
... ... ... ... ...
Jens 24/01/02 23/05/03 07/06/03 14/11/05
I would like to reshape this data to have the following form:
ID Begin_Time End_Time
Thomas 11/03/04 13/05/06
Thomas 04/02/07 16/05/08
... ... ...
Jens 24/01/02 23/05/03
Jens
2010 Dec 10
1
melt causes errors when characters and values are used
Hello,
I am finding that the melt function from the reshape library causes
errors when applied to a data.frame that contains numeric and character
columns. For example,
melt(id.vars="ID",data.frame(ID=1:3,date=c("a","b","c"),value=c(1,4,5)))
ID variable value
1 1 date a
2 2 date b
3 3 date c
4 1 value <NA>
5 2
2011 Sep 07
1
reshaping data
I have the following data (see RawData using dput below)
How do I get it in the following 3 column format (CO2 measurements are the
elements of the original data frame). I'm sure the package reshape is where
I should look, but I haven't figured out how.
Thanks ahead of time
Month Year CO2
J 1958
F 1958
M 1958 315.71
A 1958 317.45
M.1 1958 317.5
J.1 1958
J.2 1958 315.86
A.1 1958
2012 Sep 13
1
problem creating an array
Hello,
I am having trouble creating a (1000,3,201) array in R from a data set
created within the same script. My problem is that I want to take a matrix
that is 1000x603
(called "landmat") and separate this into 201 separate (1000x3) matrices.
My problem is when I try to do particular combinations of the columns. I
want to take the first 3 columns of "landmat" and create
2011 Aug 11
2
Extract values from a data frame
Hi everyone,
I have a data frame that looks *sort of* like this:
name <- letters[1:5]
signal.1 <- c("12", "bad signal", "noise", "10", "X")
length.signal.1 <- 5:9
intensity.signal.1 <- 3:7
signal.2 <- c("13", "noise", "19.2", "X", "V")
length.signal.2 <- 2:6
intensity.signal.2
2009 Feb 22
2
How to reshape this data frame from long to wide ?
I tried cast and melt in reshape package, but still can't convert this data
frame m
m
[,1] [,2]
[1,] "A" "1"
[2,] "A" "2"
[3,] "B" "3"
to this form.
m1
[,1] [,2]
[1,] "A" "B"
[2,] "1" "3"
[3,] "2" NA
Please help.
[[alternative HTML version deleted]]
2010 Dec 17
4
How to arrange the data
Dear R helpers
I have one data as given below.
date value1 value2 value3
30-Nov-2010 100 40 61
25-Nov-2010 108 31 88
14-Sep-2010 11 180 56
I want the following output
date name amount
30-Nov-2010 value1