Categories
Mastering Development

Create new variable in df_a based on sample from df_b

I want to create a new variable “wz” in dataframe A (df_a) and assign a value to this variable that is drawn from the same variable in dataframe B (df_b). The value should be drawn randomly with a probability that is taken from the share of “wz”. The variable “wz_share” in df_b was calculated by […]

Categories
Mastering Development

How to bring model predict line in front of geom_rect

I am investigating the effect of time since fire on species diversity. I am attempting to make a graph that has different colours at different time since fire ages. However, putting the colours onto the graph has made the model prediction line fade away. I am wondering if there is some way to bring the […]

Categories
Mastering Development

How to bring model predict line in front of geom_rect

I am investigating the effect of time since fire on species diversity. I am attempting to make a graph that has different colours at different time since fire ages. However, putting the colours onto the graph has made the model prediction line fade away. I am wondering if there is some way to bring the […]

Categories
Mastering Development

dividing the values of data.table1 by data.table2 in R

I have created two fictional data.tables which summarise the cost and count of the items that contributed to the cost. I would like to calculate the average item cost = cost/count. How can i divide the values of the two data.tables ? combi_sum <- dcast(merge(mtcarsTOTAL[,.(cost, gear)], iris[, .N, .(carb, gear, gender, age)], by = “gear”), […]

Categories
Mastering Development

Is there a way to manually change label colors in nomogram drawn with the rms-package?

Please, find my data sample pp below. Question: is there a way to change the color of the encircled label text in the nomogram shown below? As you can see, I encircled three different parts which I would like to change manually. I have not found a solution by looking in the r-documentation My nomogram: […]

Categories
Mastering Development

Problems with shape files

I want to make a map with the coronavirus infected people by state in US . So the idea is to visualize a map with all states of US and see a range of infected people( i.e 500-2000 , etc) in all the map. This should be represented by different shades of one color. The […]

Categories
Development

R Creating a p-value matrix with missing values

I have a dataframe with many missing NAs. I want to create a correlation matrix with a p-value matrix as shown in this link: Link I created the correlation matrix like this: as.data.frame(round(cor(df, use = “pairwise.complete.obs”, method = c(“spearman”)), 1)) Now I am trying to create a matrix that shows the p-values for each correlation. […]

Categories
Development Linux

How to use cut to create a single file with required columns from multiple files in linux

I have estimate.tsv files in more than 100 directories. I want make a single file with all the information needed from all those tsv files in the 100 directories. The data in estimate.tsv file looks like below: here is the dput: structure(list(target_id = structure(c(4L, 3L, 8L, 12L, 7L, 6L, 11L, 2L, 5L, 10L, 14L, 9L, […]

Categories
Development Linux

How to use cut to create a single file with required columns from multiple files in linux

I have estimate.tsv files in more than 100 directories. I want make a single file with all the information needed from all those tsv files in the 100 directories. The data in estimate.tsv file looks like below: here is the dput: structure(list(target_id = structure(c(4L, 3L, 8L, 12L, 7L, 6L, 11L, 2L, 5L, 10L, 14L, 9L, […]

Categories
Development Linux

How to use cut to create a single file with required columns from multiple files in linux

I have estimate.tsv files in more than 100 directories. I want make a single file with all the information needed from all those tsv files in the 100 directories. The data in estimate.tsv file looks like below: here is the dput: structure(list(target_id = structure(c(4L, 3L, 8L, 12L, 7L, 6L, 11L, 2L, 5L, 10L, 14L, 9L, […]