Displaying 20 results from an estimated 1000 matches similar to: "accessing a data frame with row names"
2009 Jun 13
3
How Can I insert another column data into the CSV file when I use FasterCSV?
Hi, All,
Suppose I have a CSV file, there is data in it.
* Column 1 Column2 Column 3 Column 4
Row1 a b c
Row2 a2 b2 c2*
You know, the column 4 is no data
Now, I would like to insert data to Column 4, after save, the CSV file will
be:
* Column 1
2004 Oct 25
2
Reading sections of data files based on pattern matching
I am about to write general functions to read the output of simulations
models.
These model generate output files with different sections which I want
to analyze plot etc.
Since this will be used many people at the department I wanted to make
sure that will do this in the best way.
For instance I want to read a snippets of data from a text that look
like this.
2009 Nov 26
3
barchart() {Lattice} help.
Hi R Users,
I'm trying to plot a stacked barplot. Here is data:
Sample Col1 Col2 Col3
Row1 -2 4 -1
Row2 3 -2 4
Row3 3 5 -2
Row4 4 1 -1
I'm using following R code:
library(lattice)
dta<-read.table("data.txt", header=TRUE, row.names="Sample")
barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
col=2:4,
2006 Mar 14
1
using a value in a column to "lookup" data in a certian column of a dataset?
I have a dataset with 20 columns and ~600,000 rows.
Column 1 has a number from 2-19. This number tells
me, for each row, which column has the ?applicable?
data. (i.e. the data that I wish to use for each
individual row)
I want to create a vector that contains the data from
the value in column 1.
e.g.
If column 1, row 1, has a value of ?6?, I want to
obtain the value in column 6, row1.
If
2009 Nov 13
3
sum(row1==y) if row2=x
Hi to all
is there any construct to sum
data=data.frame(row1=c(1,1,3,1,2,3,2,2,1,3,4,5,2,3,2,1) ,
row2=c(2,2,1,1,1,2,1,2,1,1,1,1,2,2,2,1) )
Means I would like to get all y of row1 if in row2 of the data.frame is
an x
f.e row1=3 and row2=2
so I would like to get 6
And is there another construct to get the count of pairs where
row1=3 and row2=2
means the result should be
2008 Dec 16
1
refer to next line within a data-frame an select cases
Hi,
I have a problem sorting and selecting entries within a data-frame and
I don't know if it is possible to solve it with R ... (probably yes,
but I have no idea how).
Following Data;
row1 row2
a 12
pos NA
a 3
neg NA
a 5
neg NA
a 11
pos NA
I want to extract the values in row 2 in the lines with an "a" in row1.
But I want to have two vectors: vector x with all
2008 Dec 16
2
converting a data-frame by a defined rule
Hi,
I have a data frame with several columns.
Now I want to transfer the data into a new variable (also a data
frame), but I only want a part of the data, defined by a rule ...
for example; I have following data frame:
row1 row2 row3
x 2 3
x 1 4
y 5 3
y 2 3
I know want a data frame, only with lines containing x in row1.
I know how to do that for one row (f <-
2009 Aug 27
1
generating multiple sequences in subsets of data
I'm running into a problem I can't seem to find a solution for. I'm
attempting to add sequences into an existing data set based on subsets
of the data. I've done this using a for loop with a small subset of
data, but attempting the same process using real data (200k rows) is
taking way too long.
Here is some sample data and my ultimate goal
>
2004 Nov 23
5
number of pairwise present data in matrix with missings
is there a smart way of determining the number of pairwise present data
in a data matrix with missings (maybe as a by-product of some
statistical function?)
so far, i used several loops like:
for (column1 in 1:99) {
for (column2 in 2:100) {
for (row in 1:500) {
if (!is.na(matrix[row,column1]) & !is.na(matrix[row,column2])) {
pairs[col1,col2] <- pairs[col1,col2]+1
2010 May 11
1
create a data.frame for aov
Hi R-experts,
I try to find a way to transfer a matrix to a data.frame that is used as input of aov.
can you give me advice for that?
>mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2"), c("Col1", "Col2", "Col3")))
>mdat
Col1 Col2 Col3
row1 1 2 3
row2 11 12 13
===>
2005 Nov 28
7
combine two columns
Hi,
I have an R programming problem and I havent found anything in the
documentation yet:
I have a data matrix, in which two neighbouring columns represent
replicates of the same experiment, e.g. something like this:
A A B B C C
row1 1 1 1 2 2 2
row2 1 1 1 1 1 2
I would like to test, if the values for the two replicates in a row
are the same or if they differ and generate a new
2012 Aug 03
3
embedding data frame in R code?
I would like to insert a few modest size data frames directly into my
R code. a short illustration example of what I want is
d <- read.csv( _END_, row.names=1 )
, "col1", "col2"
"row1",1,2
"row2",3,4
__END__
right now, the data sits in external files. I could put each column
into its own vector and then combine into a data frame, but this seems
2010 Mar 30
1
Adding RcppFrame to RcppResultSet causes segmentation fault
Hi,
I'm a bit puzzled. I uses exactly the same code in RcppExamples
package to try adding RcppFrame object to RcppResultSet. When running
it gives me segmentation fault problem. I'm using gcc 4.1.2 on redhat
64bit. I'm not sure if this is the cause of the problem. Any advice
would be greatly appreciated. Thank you.
Rob.
int numCol=4;
std::vector<std::string>
2009 May 14
2
Function to read a string as the variables as opposed to taking the string name as the variable
I am writing a custom function that uses an R-function from the
reshape package: cast. However, my question could be applicable to
any R function.
Normally one writes the arguments directly into a function, e.g.:
result=cast(table1, column1 + column2 + column3 ~ column4,
mean) (1)
I need to be able to write this statement as follows:
result=cast(table1, string_with_columns ~
2008 Feb 26
1
Split data.frames depeding values of a column
Hello to all
is there a function wich splits a data.frame (column1,column2,column3,....)
into
data1 <-(column1,column3....) #column2 = 1
data2 <-(column1,column3....) #column2 = 2
data3 <-(column1,column3....) #column2 = 3
...
Regards Knut
2010 Sep 10
4
for loop help please!
Hi Everyone,
I have a 2-dim data.matrix(e.g., table1) in which row1 specifies a range of
values. row2 - rown specify the number of times I want to replicate each
corresponding value in row1. I can do this with the following function:
rep(c(table1[1,]),c(table1[X,])) #where X would go from 2 - n.
Now, I can do this manually by changing the values of X and save each
resulting array/vector in
2006 Jun 07
4
Question: coding protected methods
Apologies first, because I need to ramp up on Ruby and coding Ruby in Rails,
however it''s my 3rd day with this beast :) so I''m asking :
When I added protected methods to the model before it was like:
protected
method....................
end
Would this be a valid way to write a protected method as well ?:
attr_protected :column1, :column2
Perhaps this particular call
2009 Jun 17
6
script help
Hi
?
I have a file. list.txt (two columns)
?
column1??? column2
name??????? address
?
?
I need to put in the letter file letter.txt eg:
?
Dear: Chloe
Address: CA
?
Can I use this
?
for i `cat list.txt` | sed 's/Chloe/$i.1; /CA/$i.2/g' $i.letter.txt
?
Thank you for your help
?
?
?
?
?
__________________________________________________________________
Looking for the perfect gift?
2024 Jun 06
2
R Shiny Help - Trouble passing user input columns to emmeans after ANOVA analysis
Hello everybody,
I have experience coding with R, but am brand new to R Shiny. I am trying
to produce an application that will allow users to upload their own
dataset, select columns they want an ANOVA analysis run on, and generate
graphs that will allow users to view their results. However, I am getting
the following error: *"Argument is of length zero."*
Being new to Shiny, I am
2009 Jun 15
2
Help with syntax error
Hi,
I have written boxplot commands of this form before, but I don''t quite understand why the function call is reporting a syntax error in this instance. All parameters passed to the function are strings.
Thanks in advance.
Payam
> simplevar <- function(wframe,column1,column2) {
+ tframe <- get(wframe)
+ x1 <- which(names(wframe)==column1)
+ x2 <-