Displaying 20 results from an estimated 1000 matches similar to: "How to "Pack" a matrix"
2006 Oct 13
3
multiply two matrixes with the different dimension column by column
Dear all,
I would like to multiply two matrixes with the different dimension column
by column. Let make an example:
If I have two matrixes "X" and "Y"as follow:
X<- matrix(1:12, nrow=4, ncol=3, dimnames=list(c("A","B","C","D"),
c("stage1","stage2","stage3")))
Y<- matrix(1:28, nrow=4, ncol=7,
2009 Feb 03
1
overlaying plots from a list of data frames
Hello R list,
I have a list of data frames, in the form (dump output for an example
list follows message):
$site1
year data
1 2000 0.03685042
2 2001 0.02583885
6 2005 0.02480015
7 2006 0.03458745
$site2
year data
1 2002 4.071134e-03
2 2003 -4.513524e-08
3 2004 8.336272e-08
4 2005 2.270803e-08
5 2006 1.263597e-02
6 2007 NaN
I would like to plot each
2007 Jul 07
2
random sampling with some limitive conditions?
I want to gain thousands of random sampling data by randomizing the
presence-absence data. Meantime, one important limition is that the row and
column sums must be fixed. For example, the data "tst" is following:
site1 site2 site3 site4 site5 site6 site7 site8 1 0 0 0 1 1 0 0 0 1 1 1 0
1 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 0
0 0 0 0 0 0 0 0 1 0 1 0
2006 Aug 29
1
Bootstraping for groups and subgroups and joing with other table
Dear R-experts,
I have a table with following collumns: State, SamplePlot, Species and BodySize. I sampled bird species at 34 SamplePlots and 5 States (regions) monthly during two years. On each bird record I measured bodysize and identified the species. So I have many records of each species (about 150 species) at each SamplePlot and each Region (State).
Now I would like bootstrap
2012 May 14
2
How to interpret an ANOVA result?
Hello all,
here's a real-world example: I'm measuring a quantity (d) at five
sites (site1 thru site5) on a silicon wafer. There is a clear
site-dependence of the measured value. To find out if this is a
measurement artifact I measured the wafer four times: twice in the
normal position (posN), and twice rotated by 180 degrees (posR). My
data looks like this (full, self-contained code at
2018 Apr 18
3
How to replace numeric value in the column contains Text (Factor)?
Hi R user,
Would you mind to help me on how I can change a value in a specific column
and row in a big table? but the column of the table is a factor (not
numeric).
Here is an example. I want to change dat[4:5,3]<-"20" but it generated NA>
do you have any suggestions for me?
dat<-structure(list(Sites = structure(1:5, .Label = c("Site1", "Site2",
2006 Oct 12
3
Cross two dataframe
Dear r-users!
I would like to cross two data frame which have the same row number but
different in the number of column. Can anybody help me for this case ?
Thanks a lot in advance
--------------------------------------------------------------------------------
Majid Iravani
PhD Student
Swiss Federal Research Institute WSL
Research Group of Vegetation Ecology
Z?rcherstrasse 111
2011 Nov 01
1
Multiple time series with zoo
Thanks for everyone's input so far, it is greatly appreciated. But I've got
one last task I could use some advice on
Here are the first few lines of my data set:
site,time_local,time_utc,reef_type_code,sensor_type,sensor_depth_m,temperature_c
06,2006-04-09 10:20:00,2006-04-09 20:20:00,BAK,sb39, 2, 29.63
06,2006-04-09 10:40:00,2006-04-09 20:40:00,BAK,sb39, 2, 29.56
06,2006-04-09
2005 Feb 09
4
subset
Dear all,
I am trying to extract rows from a data.frame based on the
rowSums != 0. I want to preserve rownames in the first column in the subset.
Does anyone know how to extract all species that don't have rowSums equal
to zero? Here it is:
# dataset
x <- data.frame(
species=c("sp.1","sp.2","sp.3","sp.4"),
site1=c(2,3,0,0),
site2=c(0,0,0,0),
2011 Feb 06
2
Subsampling out of site*abundance matrix
Hello,
How can I randomly sample individuals within a sites from a site (row) X
species abundance (column) data frame or matrix? As an example, the matrix
"abund2" made below.
##### (sorry, Im a newbie and this is the only way I know to get an example
on here)
abund1 <- c(150, 300, 0, 360, 150, 300, 0, 240, 150, 0, 60,
0, 150, 0, 540, 0, 0, 300, 0, 240, 300, 300,
2018 Apr 18
0
How to replace numeric value in the column contains Text (Factor)?
The simplest would be to convert precip to character and then back to a factor if you really want it to be a factor. This will also remove the levels that no longer exist.
str(dat)
# 'data.frame': 5 obs. of 3 variables:
# $ Sites : Factor w/ 5 levels "Site1","Site2",..: 1 2 3 4 5
# $ temp : num 14 15 12 12.5 17
# $ precip: Factor w/ 5 levels
2006 Aug 29
0
En: Bootstraping for groups (right data tables)
Dear R-friends,
Unfortunately the tables that I "past" on last email gone with bad visual structure. So I send it again. Sorry to do this so confuse.
Miltinho
====
Table1 - Bird records
State,SampleSite,Species,Bodysize
SaoPaulo,Site1,Spp01,4.39
SaoPaulo,Site1,Spp04,4.05
SaoPaulo,Site1,Spp01,2.75
SaoPaulo,Site1,Spp02,8.18
SaoPaulo,Site1,Spp02,0.80
2005 Jun 16
1
mu^2(1-mu)^2 variance function for GLM
Dear list,
I'm trying to mimic the analysis of Wedderburn (1974) as cited by
McCullagh and Nelder (1989) on p.328-332. This is the leaf-blotch on
barley example, and the data is available in the `faraway' package.
Wedderburn suggested using the variance function mu^2(1-mu)^2. This
variance function isn't readily available in R's `quasi' family object,
but it seems to me
2007 Aug 13
3
Very new - beginners questions
Dear all,
I have 4 sites and want to determine how different they are from each other. For this I have decided to use R though it seems a bit daunting to learn.
I have read data in from a CSV the structure is :
Species1 Species2 Species3
Site1 4 4 7
Site2 3 1 0
Site3 0 99 6
Site4 75 3 33
There are many more species than shown above this is just an example. Here are the
2006 May 24
5
Joining variables
Hello,
If I have two variables that are factors or characters and I want to
create a new variable that is the combination of both what function can
I use to accomplish this?
Ex.
Var1 Var2
SA100055113 19851113
And I want
NewVar
SA10005511319851113
Thanks in advance.
Cameron Guenther, Ph.D.
Associate Research Scientist
FWC/FWRI, Marine Fisheries Research
100 8th Avenue S.E.
St.
2011 Feb 03
3
R Data Manipulation - Transposing Data by a Given Column, Like User_ID
Hello,
I'd like to transpose data to create an analysis-friendly dataframe. See
below for an example, I was unable to use t(x) and I couldn't find a
function with options like PROC TRANSPOSE in SAS.
The ideal solution handles variable quantities of SITE - but beggars can't
be choosers. :-)
Thank you in advance,
Mike
## INPUT DATA
USER_ID<-c(1,1,1,2,2,2,3,3,4)
SITE
2005 Nov 03
4
merging dataframes
Dear List,
I often have to merge two or more data frames containing unique row
names but with some columns (names) common to the two data frames and
some columns not common. This toy example will explain the kind of setup
I am talking about:
mat1 <- as.data.frame(matrix(rnorm(20), nrow = 5))
mat2 <- as.data.frame(matrix(rnorm(20), nrow = 4))
rownames(mat1) <- paste("site",
2006 Oct 19
2
randomize a matrix
Hello everyone,
If I have an incidence matrix of 0 and 1's
P=[1 1 1 1 1 1
1 1 1 1 0 0
1 1 1 0 0 0
1 1 1 0 0 0
1 1 0 0 0 0]
I want to create a new uniform random matrix [a] that is filled with 0's
and 1's but constrained so that the row and column sums are the same as
in [P]. Does anyone know how to accomplish this?
Thanks in advance
Cameron Guenther, Ph.D.
2006 May 16
3
subset
Hello everyone,
I have a large dataset (x) with some rows that have duplicate variables
that I would like to remove. I find which rows are the duplicates with
X1<-which(duplicated(x)). That gives me the rows with duplicated
variables. Now, how can I remove just those rose from the original data
frame. I think I can create a new data frame without the duplicates
using subset. I have tried:
2006 May 10
3
Unique?
Hello,
I have sample data set that looks like:
YEAR MONTH DAY CONTINUE SPL TIMEFISH
TIMEUNIT AREA COUNTY DEPTH DEPUNIT GEAR TRIPID
CONVUNIT
1992 1 26 1 SP0073928 8
H 7 25 4 NA 1000000
02163399054 161
1992 1 26 1 SP0073928 8
H 7 25 4 NA 1000000
02163399054 8
1992 1 26 2 SP0004228 8
H 7 25 4 NA 1000000
02163399054 161
1992 1 26 2 SP0004228 8
H 7 25 4 NA 1000000
02163399054 8
1992