Displaying 20 results from an estimated 100 matches similar to: "Inserting a new row in a matrix"
2010 Oct 07
2
using a package function inside another function
Hello all,
I am trying to use the micEcon 'insertRow' function inside a function
I have written. For example:
insert_row_test <- function(m){
insertRow(m,nrow(m)+1,v=0,rName="test")
}
However, when I try to call the 'insert_row_test' function (after
loading the micEcon package), it does not insert a row into the matrix
I pass in. When I call the insertRow
2006 Jul 21
1
insert insertRow?
Dear all,
In the search for a command to insert a row between other rows in a data
frame I found that there seems to be no such command in the base R
package. There is however a very simple function insertRow in the
micEcon package, that makes use of rbind. I wondered if it would not be
possible to include the following micEcon functions in the base package:
insertRow
insertCol
Since the
2006 Jul 21
1
insert insertRow?
Dear all,
In the search for a command to insert a row between other rows in a data
frame I found that there seems to be no such command in the base R
package. There is however a very simple function insertRow in the
micEcon package, that makes use of rbind. I wondered if it would not be
possible to include the following micEcon functions in the base package:
insertRow
insertCol
Since the
2008 Jan 22
3
dynamic table/adding rows in IE using 'new Element("tr")'
I''m trying to create a few menus using prototype.js "insert" function.
I create a table using ''new Element("table")'', insert it in DIV and
then add links - one row per link (or the other way round - create a
full table, then insert it).
I initially wrote a code that worked fine in Firefox, but did not in
IE (currently testing with 6.0):
function
2008 Oct 23
3
Fuctions help!
Hi everyone,
I have a question about functions. I have two functions:
Sampling=function(fname,Total,nSample,nPatient){......return(list(Gmean,Gsd))}
Power=function(alfa,m1,m2,s1,s2,n1,n2){....return(powe)}
I want to use "Gmean" and "Gsd" which are the returned values from
"Sampling" function, in "Power" function.
i.e. when I call "power" I want
2008 Oct 20
2
calculating mean for samples
Hi everyone,
> does any one knows how can I calculate mean for different samples
> i.e. I have a data like this:
>
> s1 s2 s3 s4
> 1 0 0 0 1
> 2 1 0 1 0
> 3 0 0 0 0
> 4 0 0 0 0
> 5 0 1 0 1
> 6 1 0 0 0
> 7 0 0 0 0
> 8 0 0 0 0
> 9 0 0 0 0
> 10 0 0 0 1
>
> I need to make 5 different sample with 5
2008 Oct 15
3
Standard deviation for rows
Hi everyone,
I have just started using R, and I have a simple question.
How can I get the Standard deviation for rows. basically I am looking for
something like "rowMeans()"
but for Standard deviation (I tried "rowSds()" didn't exist)
Thanks,
--
View this message in context: http://www.nabble.com/Standard-deviation-for-rows-tp19998106p19998106.html
Sent from the R
2008 Oct 15
2
Help Help with sampling
Hi everyone,
I have a dataset(named "Mydata") which includes 4 different variables named;
s1,s2,s3,s4 .Each variable(symptom) has 14 patients.
I need to use random sampling to make, 5 different samples from my data with
5 patients in each sample. i.e. using all 4 variables I need to make 5
different samples by changing patients(with 5 patients in each sample).
X8 X9 X10 X102 X110
2008 Oct 16
2
saving result of a "for" loop
Hi everyone,
I have dataset which I take random samples of it 5 times. each time I get
the mean for rows for each sample.
at the end I need to calculate the Average of all means for each sample and
each row. to clear it up I give an example:
say this is my dataset.
X8 X9X10X12 X13 X14 X15 X16X17X18X19 X20 X21 X22
s1 0 1 0 0 0 1 0 0 0 0 0 0 0 0
s2 0 0 0
2010 Aug 13
1
loop for inserting rows in a matrix
Dear R friends,
I have a matrix with 2060 rows and 41 columns. One column is Date, another is Transect, and another is Segment. I want to ensure that there are 9 Transects (1 to 9) for each Date, and 8 Segments (1 to 8) for each Transect in the matrix, by inserting rows where these are missing.
I am new to coding, but am trying to write a loop which checks if each of the transects already
2008 Oct 17
2
function help
Hi everyone,
I have dataset which I make a sample of it couple of times and each time I
get the mean and standard deviation of each row for each sample. I have a
function for that, which takes the name of the file and number of times to
sample and then returns the mean and standard deviation for each row in each
sample.
Sample=function(name, n){
2008 Oct 10
1
Sampling
Hi Guys,
I am in desperate need with sampling. I am suppose to sample from a dataset.
I use the following code:
> for(i in 1:5){temp[i]<-sample(T2,40,replace=F)
+ show(temp)}
but all the samples are the same, but I want them to be different.any
suggestion?
Thanks
--
View this message in context: http://www.nabble.com/Sampling-tp19923768p19923768.html
Sent from the R help mailing list
2008 Oct 21
1
Error in sample(colnames(B), 10) : invalid 'x' argument
HI,
I have a file named "s1"(which has 14 rows and 4 columns) which is in csv
format. I import and call it "A" the file using:
A <- read.csv(file="s1.csv",head=TRUE,sep=",")
then I transpose it and call it "B"(which will have 4 rows and 14 columns)
using:
B=t(A)
when I want to make 5 samples from "B" (choosing 10 columns) using:
2008 Oct 29
1
Help with Plots
Hi there,
I am trying to have a connectivity graph (two plots at once) in R:
this is an example:
x1=sin((0:100)*2*pi/100)
y1=cos((0:100)*2*pi/100)
plot(x1,y1)
will draw a circle and
x2=c(1,9,3,4,8,4,2,0)
y2=c(3,6,8,2,4,1,9,6)
plot(x2,y2,type="b")
will draw a graph with corresponding x's and y's and connects the point.
I want to have a circle with these points connected to
2008 Nov 07
1
Help With Graphs
Hi guys,
I am truing to draw a circle and choose 10 points on the circle and put a
number from 1 to 10 above each point. I don't have a problem with drawing a
circle and choosing 10 points. my problem is with numbering . is it even
possible to put a number above each chosen point? if so any idea how to do
it?
ps: the circle has red dots and the selected points are in black.
here is my code:
2008 Dec 01
1
Error: "subscript out of bounds"
Hi All,
I am trying to replace the "NA" values in a matrix by using the following
function:
it gets a "name" of the matrix or list or vector and turns it to a matrix
called "m".
then checks the elements of the matrix and if any of them is "NA" replace
them with "0".
rep=function(name){
m=as.matrix(name)
for(i in 1:length(m)){
for(j in
2008 Oct 22
2
Help with functions
Hi there,
I have a the following function which takes a name(fname), total number of
rows (Total), number of times to make a sample(nSample), number of
records/rows to be included in each sample(nPatient). then it generates
required samples and calculates the mean and standard deviation of the
columns for each sample and finally in calculates the grand mean and
standard deviation.
The problem
2009 Jul 20
3
Write in file matrices of sifferent size
Hi list,
How to save a list content into a text file?
Please consider example below, I have two numeric matrices that I bundle into a list & give each list element a name
Example:
> matrixA <- matrix(0,5,4)
> matrixB <- matrix(1,7,13)
> matrixList <- list(matrixA,matrixB)
> names <- c("Matrix A","Matrix B")
> names <-
2006 Jul 27
4
inserting rows into a matrix
Hi
I have a little vector function that takes a vector A of strictly
positive integers
and outputs a matrix M each of whose columns is the vector, modified in
a complicated combinatorical way.
Now I want to generalize the function so that A can include zeroes.
Given A,
I want to strip out the zeroes, pass it to my function, and pad M
with rows at positions corresponding to the zeroes
2006 Oct 18
2
Multiple histograms in one plot
Hi all,
I'm trying to plot multiple histograms in one plot (cross-validation
values of model parameters), but I cannot seem to reduce the margins
enough to fit as many of them in as I would like.
I'm using split.screen to divide the window into a 5x4 grid, then
plotting with hist. I've tried explicitly reducing the margins with
par(mar=c(1,1,1,1)), but it doesn't seem to have