very helpful, thanks a lot !
On Thu, Nov 1, 2018 at 9:59 PM William Michels
wrote:
> Perhaps one of the following two methods:
>
> > zgene = data.frame( TTT=c(0,1,0,0),
> +TTA=c(0,1,1,0),
> + ATA=c(1,0,0,0),
> + ATT=c(0,0,0,0),
> +
Perhaps one of the following two methods:
> zgene = data.frame( TTT=c(0,1,0,0),
+TTA=c(0,1,1,0),
+ ATA=c(1,0,0,0),
+ ATT=c(0,0,0,0),
+ row.names=c("gene1", "gene2", "gene3", "gene4"))
> zgene
TTT TTA ATA ATT
gene1 0 0 1
Dear Bill, and Bill,
many thanks for taking the time to advice, and for your suggestions. I
believe that I shall rephrase a bit my question, with a better example :
thank you again in advance for your help.
Let's assume that we start from a data frame :
x = data.frame( TTT=c(0,1,0,0),
Hi Bogdan,
Are you saying you want to drop columns that sum to zero? If so, I'm
not sure you've given us a good example dataframe, since all your
numeric columns give non-zero sums.
Otherwise, what you're asking for is trivial. Below is an example
dataframe ("ygene") with an example "AGA" column
This would be a bit simpler if 'gene' were the rownames of the data.frame.
The '-4' is to remove the gene column from the calculations.
> x[ x[,"gene"]=="gene2",]
TTT TTA ATA gene
2 1 1 0 gene2
> colnames(x)[-4][ 1 == x[ x[,"gene"]=="gene2",-4] ]
[1] "TTT" "TTA"
> colnames(x)[-4][ 1 == x[
Dear all, please may I ask for a suggestion :
considering a dataframe that contains the numerical values for gene
expression, for example :
x = data.frame(TTT=c(0,1,0,0),
TTA=c(0,1,1,0),
ATA=c(1,0,0,0),
gene=c("gene1", "gene2", "gene3", "gene4"))
ho
As Don suggests, looking for ways to do the whole calculation at once is a
big efficiency booster. Also, avoiding unnecessary calculations (e.g. mean
of 1:n is (n+1)/2 and mean(x+a) where a is a constant is mean(x)+a.
Reproducible example:
#library(tictoc)
library(microben
## reminder on how the levels= argument to factor works
mydata <- matrix(1:8, nrow=4, ncol=2, dimnames=list(letters[1:4],
LETTERS[1:2]))
dput(mydata)
Factor.wrong <- factor(c("mm", "cm", "m", "km"))
levels(Factor.wrong) ## alphabetical order, not meaning order
Factor.right <- factor(c("mm", "cm
Without more study, I can only give some general pointers.
The as.vector() in X1 <- as.vector(coord[1]) is almost certainly not needed. It
will add a little bit to your execution time.
Converting the output of func() to a one row matrix is almost certainly not
needed. Just return c(res1, res2).
Say your dataframe is named prb.df:
oldnames<-names(prb.df)
ncol<-ncols(prb.df)
names(prb.df)<-paste0("Q",1:ncol)
barplot(...,names.arg=oldnames,...)
Jim
On Fri, Nov 2, 2018 at 1:56 AM P. Roberto Bakker
wrote:
>
> Yes, that is an good idea, only then I loose the original column lables which
>
Hello,
I have a input data frame with multiple rows. For each row, I want to apply a
function. The input data frame has 1,000,000+ rows. How can I speed up my code
? I would like to keep the function "func".
Here is a reproducible example with a simple function:
library(tictoc)
library
Windows
sessionInfo() #R version 3.5.1 (2018-07-02)
Hi I am following along (using my own data) the processes described by
"glmulti: An R Package for Easy Automated Model Selection with ( Generalized )
Linear Models"
Journal of Statistical Software
May 2010, Volume 34, Issue 12. http://www.js
Yes, that is an good idea, only then I loose the original column lables
which I need in my barplot. Isn't it?
Op do 1 nov. 2018 om 11:03 schreef Jim Lemon :
> I would use the "names" or "colnames" functions to change them to Q1,
> Q2, ... as I did.
>
> Jim
>
> On Thu, Nov 1, 2018 at 9:01 PM P. Ro
You should probably contact the packages maintainer about this.
maintainer("WaveletComp") # Notice capitalization
[1] Angi Roesch
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352
-Original Message-
It would be much better if you had pasted the original .csv file into your
message or read the file in R and used dput() to send us the result. It looks
like you have a lower triangular matrix and I had to do a little editing to get
it to work. I am showing the steps, but commenting them out sin
Below a similar example, using sf and leaflet; plotting the trajectory
on a background map.
library(leaflet)
library(sf)
library(dplyr)
# Generate example data
gen_data <- function(id, n) {
data.frame(
id = id,
date = 1:n,
lat = runif(10, min = -90, max = 90),
lon = runif(10,
Dear Members,
Can anybody help me to solve the errors in R-script. I am plotting wavelet
image using waveletcomp library . I am trying define maximum and minimum
(range) of the color scale.
*command is*:
wt.image(my.w, color.key = "interval", n.levels = 250,
legend.params = list(lab =
Hello,
The following uses ggplot2.
First, make up a dataset, since you have not posted one.
lat0 <- 38.736946
lon0 <- -9.142685
n <- 10
set.seed(1)
Date <- seq(Sys.Date() - n + 1, Sys.Date(), by = "days")
Lat <- lat0 + cumsum(c(0, runif(n - 1)))
Lon <- lon0 + cumsum(c(0, runif(n - 1)))
Place
I would use the "names" or "colnames" functions to change them to Q1,
Q2, ... as I did.
Jim
On Thu, Nov 1, 2018 at 9:01 PM P. Roberto Bakker
wrote:
>
> Hi Jim,
>
> Thank you for your quick reply. It is a great procedure.
> The response options in my data.frame are (fortunately) similar in all
>
Hi Jim,
Thank you for your quick reply. It is a great procedure.
The response options in my data.frame are (fortunately) similar in all
columns.
It would be nice if I could use your procedure in all columns at once
instead of each column.
My data.frame contains 48 columns, each with long column na
Hi Roberto,
What I suggested is a brute force method of translating response
options into ordinal numbers. Fortunately for me, the Barratt
Impulsivity Scale has relatively short and constant response options.
As I programmed the test myself, I already had the questions in plain
text, so I simply ad
Hi Jim,
Thank you.
An additional question: as I have many columns to change in numeric, and
the columns are long sentences, what is an efficient way to do this?
I checked in StackOverflow but could not find the right answer
Best Roberto
Op do 1 nov. 2018 om 00:25 schreef Jim Lemon :
> Hi Robert
> Rui Barradas
> on Thu, 1 Nov 2018 07:05:54 + writes:
> Hello, This has nothing to do with R-help and I apologize
> in advance but this is really, really strange.
> A SO user is still using R 1.0.1:
>
https://stackoverflow.com/questions/53096176/how-do-i-change
On Wed, 31-Oct-2018 at 07:30PM +0100, peter dalgaard wrote:
|> Hm, a source install to r-devel gave me
|>
|> Peter-Dalgaards-MacBook-Air:BUILD pd$ ls -l library/pkgconfig/R/pkgconfig.rdb
|> -rw-r--r-- 1 pd staff 4515 Oct 31 19:15 library/pkgconfig/R/pkgconfig.rdb
|> Peter-Dalgaards-MacBook-Ai
:-)
On Thu, Nov 1, 2018 at 9:06 AM Rui Barradas wrote:
> Hello,
>
> This has nothing to do with R-help and I apologize in advance but this
> is really, really strange.
>
> A SO user is still using R 1.0.1:
>
>
> https://stackoverflow.com/questions/53096176/how-do-i-change-the-str-of-my-diff-time
Hello,
This has nothing to do with R-help and I apologize in advance but this
is really, really strange.
A SO user is still using R 1.0.1:
https://stackoverflow.com/questions/53096176/how-do-i-change-the-str-of-my-diff-time-from-atomic-to-num#comment93089103_53096176
Imagine if R wasn't for
26 matches
Mail list logo