Displaying 20 results from an estimated 600 matches similar to: "Count number of zeros in a collumn"
2010 Aug 04
4
Adding collumn to existing data frame
Hi experts,
I am trying to write a very flexible method that allows me to add a
new column to an existing data frame. This is what I have so far:
add.column <- function(df, new.col, name) {
n.row <- dim(df)[1]
length(new.col) <- n.row
names(new.col) <- name
return(cbind(df, new.col))
}
df <- NULL
df <- data.frame(a=c(1,2,3))
df
# corect: added NA to new collumn
df <-
2011 Apr 20
2
'Record' row values every time the binary value in a collumn changes
My question is twofold.
Part 1:
My data looks like this:
(example set, real data has 2*10^6 rows)
binary<-c(1,1,1,0,0,0,1,1,1,0,0)
Chromosome<-c(1,1,1,1,1,1,2,2,2,2,2)
start<-c(12,17,18,20,25,36,12,15,16,17,19)
Table<-cbind(Chromosome,start,binary)
Chromosome start binary
[1,] 1 12 1
[2,] 1 17 1
[3,] 1 18 1
[4,] 1
2009 Sep 23
1
BLUP with missing data
hello guys, I need to do a BLUP in the simplest model
y = Xm + Zg + e
however I have missing data in the analysis which I can?t consider as
0(zero). So I need to generate the matrix X'Z, Z'X and Z'Z step by step; I
can?t use
crossprod(x) #neither
X'X <- t(x)%*%x
because I should skip the elements with missing data in the matrix
I?ll try to be more clear,
supposing
a matrix x
2010 Jul 30
1
Unique rows in data frame (with condition)
I have to deal with data frames that contain multiple entries of the
same (based on an identifying collumn 'id'). The second collumn is
mostly corresponding to the the id collumn which means that double
entries can be eliminated with ?unique.
a <- unique(data.frame(timestamp=c(3,3,3,5,8), mylabel=c("a","a","a","b","c")))
However
2009 Nov 05
4
collumn error when exporting to Excel
Dear all,
I am attempting to export my results (data.frame) created with the help of a number of you to Excel.
In the procedure my column structure is however lost and all results are placed together into the first Excel column.
I have tried: write(), write.table(), write.matrix(), export() and have the same results. I Have checked the import/export FAQ and did a Google search to no avail.
Any
2012 Jan 05
1
match matrices of different lengths
was trying to match different matrices of different lengths with in
the first collumn date and time info (yearmonthdayhourminute). the
routine needs to return NA?s where data of either of the matrices is
non existent.
have been trying the following:
####
x <- c(200112030003, 200112030004, 200112030005, 200112030006)
y <- c(0.1, 1, 1.1, 1.5)
a <- c(200112030004, 200112030005,
2005 May 24
4
Table Help
Reply to sender Reply to all Reply to folder Forward Move/Copy Delete
Read previous item Read next item Get help information on the current
window
From: McMurtry, Benjamin G.
To: 'r-help-request at stat.math.ethz.ch'
Cc:
Subject: Table Help
Sent: 5/24/2005 4:33 PM
Importance: Normal
I have a very large table that I want to add some of the certain rows.
The table is
2008 Sep 29
3
replicating dataframe rows
Dear all,
I have a data.frame like the sample below, and I would
like to expand my data.frame using "population" variable.
So, for each line of my data.frame I would like that
the new data.frame have many rows as the population collumn.
place<-c("place1", "place2", "place3", "place4", "place5")
population<-c(100,200,300,50,30)
2005 Oct 20
1
having scaling problems with a histogram
Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
I would like to create a histogram from a data collumn consisting of 4 classes (0; 0.05;0.5;25;75). Due to the difference in scale the classes 0;0.05 and 0.5 are displayed within one combined bin by default with the code:Hist(x, scale="percent",
2010 Jul 14
1
Arrange values on a timeline
I have a set of labels arranged along a timeframe in a. Each label has
a timestamp and marks a state until the next label. The dataframe a
contains 5 such timestamps and 5 associated labels. This means, on a
continious scale between 1-100, there are 5 markers. E.g. 'abc' marks
the timestampls between 10 and 19, 'def' marks the timestamps between
20 and 32, and so on.
a <-
2014 Nov 12
4
Problem with build and check
I am getting failure of build and check, for an Rd file that has a long argument list.
Guess diagnosis: a quoted string beyond a certain point in the argument list is fatal.
Example: Use the function below, create an Rd file for it with prompt(). Move the .Rd
file to the man directory (no need to edit it) and try building
dart.control <- function(server=c("production",
2012 Nov 13
1
help formatting data for clustering
Hi,
I'm a R beginner. I have data of this form:
user_id, brand_id1, brand_id2, .....
for example:
1 , 45 , 32, 45, 23
2 , 34
4, 11, 43, 45
I'm looking for the right procedure to be able to cluster users. I am
especially interested to know which functions to use at each step.
I am currently able to load the data in a data frame, each row's name being
the user id.
#extract user
2013 May 25
3
When creating a data frame with data.frame() transforms "integers" into "factors"
Hello
I am novice to R and i was learning how to do a scatter plot with R using
an example from a website.
My setup is iMac with Mac OS X 10.8.3, with R 3.0.1, default install,
without additional packages loaded
I created a .csv file in vim with the following content
userID,user,posts
1,user1,581
2,user2,281
3,user3,196
4,user4,150
5,user5,282
6,user6,184
7,user7,90
8,user8,74
9,user9,45
2015 May 15
2
Installation error with R-devel
I have a local library with functions that interrogates an institution-specific web API,
so is not of interest to anyone outside of Mayo. For some reason the R CMD INSTALL
command fails. See below:
Build the library, then install it.
tmt-local2127% R CMD build dart
* checking for file ?dart/DESCRIPTION? ... OK
* preparing ?dart?:
* checking DESCRIPTION meta-information ... OK
* installing
2015 Jul 09
4
R CMD build failure
I have a local library 'dart' that imports "httr". It has routines that access central
patient data such as birth date, so it is heavily used locally but of no interest to
anyone else.
The httr library (and 300 others) are in a shared directory, referenced by everyone in the
biostatistics group via adding this location to the .libPaths in their default .Rprofile.
2009 Sep 13
2
(no subject)
How would I make a histogram using R from a table in excel that has 4
variables, but I only want to use 2 of the columns to make the histogram?
[[alternative HTML version deleted]]
2012 May 07
7
How to build Samba4 using static linked libraries
Hi All:
I am building the torture/smbtorture for samba-4.0.0alpha17. After build, I am running the test in another environment.
I not only need to copy the binary smbtorture, I also need to copy the shared libraries. This is HUGE inconvenient for us.
Could somebody tell me how to build the binary using static linked libraries?
Thanks very much
Peixing
libpthread.so.0 =>
2008 Aug 27
1
How to create additional columns?
I do have some data of dim 100*3 (i.e 100 rows and 3 columns ) stored in a
txt file. I want to read the data into R, Perform the same operation in
each row and store the result in a forth column( that I should create).
I do not know how I can create a forth column to store the result of the
operation for each row?
--
View this message in context:
2019 Sep 30
2
Proposal for llvm.experimental.gc intrinsics for inttoptr and ptrtoint
Hi All,
I'm working on a project converting Dart to llvm. Dart uses a relocating GC
but additionally uses pointer tagging. The first bit of a pointer is a tag.
For integers a '0' bit is used and for pointers to objects a '1' bit is
used. V8 apparently uses a similar technique. Generated code may need to
check which bit is used when this information isn't statically known.
2005 Nov 16
4
Promoting Samba BDC to PDC
Hi All,
Has any one got an idea of how to make clients automatically
find the BDC when the PDC is stopped. Both PDC and BDC are running by
Samba authenticating again a LDAPSAM backend replicated on both the PDC
with master LDAP database and BDC with replicated LDAP database. But
when I stop PDC the clients are not detecting the BDC broadcast. I can
see that the replication is of