similar to: Shape manipulation

Displaying 20 results from an estimated 20000 matches similar to: "Shape manipulation"

2023 Apr 03
4
Simple Stacking of Two Columns
Hi R-Helpers, Sorry to bother you, but I have a simple task that I can't figure out how to do. For example, I have some names in two columns NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly")) and I simply want to get a single column
2023 Apr 04
1
Simple Stacking of Two Columns
Just to repeat: you have NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly")) and you want NamesLong<-data.frame(Names=c("Tom","Dick","Larry","Curly")) There must be something I am missing, because NamesLong <- data.frame(Names = c(NamesWide$Name1, NamesWide$Name2)) appears to
2023 Apr 03
1
Simple Stacking of Two Columns
Hi, You were on the right track using stack(), but you just pass the entire data frame as a single object, not the separate columns: > stack(NamesWide) ? values ? ind 1 ? ?Tom Name1 2 ? Dick Name1 3 ?Larry Name2 4 ?Curly Name2 Note that stack also returns the index (second column of 'ind' values), which tells you which column in the source data frame the stacked values originated
2023 Apr 04
1
Simple Stacking of Two Columns
I may be missing something but using the plain old c() combine function seems to work fine: df <- data.frame(left = 1:5, right = 6:10) df.combined <- data.frame(comb = c(df$left, df$right)) df left right 1 1 6 2 2 7 3 3 8 4 4 9 5 5 10 df.combined comb 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 -----Original
2013 Feb 17
6
histogram
HI Elisa, You could use ?cut() vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45) label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2012 Jun 03
2
merging single column from different dataframe
Hi all, probably really simple to solve, but having no background in programming I haven't been able to figure this out: I have two dataframes like df1 <- data.frame(names1=c('aa','ab', 'ac', 'ad'), var1=c(1,5,7,12)) df2 <- data.frame(names2=c('aa', 'ab', 'ac', 'ad', 'ae'), var2=c(3,6,9,12,15)) Now I want merge
2013 Jan 15
2
Need some help on Text manipulation.
Dear all, Let say I have following data-frame: Dat <- structure(list(dat = c(-0.387795842956327, -0.23270882099043, -0.89528973290562, 0.95857175595512, 1.61680582493783, -1.17738110289352, 0.210601060411423, -0.827369747447338, -0.36896112964414, 0.440288648776096, 1.28018410608809, -0.897113649961341, 0.342216546981718, -1.17288066266219, -1.57994101992621, -0.913655547602414,
2004 Jun 25
3
String manipulation
Hi, let's see, if someone can help my with this one: I have the string as follows: > str<-("one","two","three") Now I want to concatenate the items to one string, seperateted by space or something else, >str >"one, two, three" If possible without a loop. My actual goal ist to create string like >str.names >"female = names1, male
2013 Mar 04
3
A problem with text manipulation
Hello again, Let say I have following vector: set.seed(1) Vec <- sample(LETTERS[1:5], 10, replace = TRUE) Vec Now with each repeated letter, I like to add suffix programatically. Therefore I want to get following vector: c("B", "B1", "C", "E", "B2", "E1", "E2", "D", "D1", "A") Can somebody
2012 Dec 06
1
Can somebody help me with following data manipulation?
Dear all, let say I have following data: dat <- structure(list(V1 = structure(c(1L, 4L, 5L, 3L, 3L, 5L, 6L, 6L, 4L, 3L, 5L, 6L, 5L, 5L, 4L, 4L, 6L, 2L, 3L, 4L, 3L, 3L, 2L, 5L, 3L, 6L, 3L, 3L, 6L, 3L, 6L, 1L, 6L, 5L, 2L, 2L), .Label = c("C", "G", "I", "O", "R", "T"), class = "factor"), V2 = c(0L, 0L, 0L, 1L, 1L, 1L, 1L, 0L,
2020 Jul 23
5
Off Topic bash question
I have a simple script: #!/bin/bash # index=0 total=0 names=() ip=() while read -r LINE do NODENAME=` echo $LINE | cut -f 1 -d ','` IP=` echo $LINE | cut -f 2 -d ','` names[index]="$NODENAME" ip[index]="$IP" index=`expr index+1` total=`expr total+1` done <<< $(cat list.txt) simple file: more list.txt name1,ip1 name2,ip2 name3,ip3 output when
2001 May 23
1
Passing a string variable to Surv
Hi, I am trying to write a function to automate multiple graph generation. My data looks like: Table of numeric values with the following headers: timeM1 statusM1 xM1 timeM2 statusM2 xM2 timeM3 statusM3 xM3 1 2 3 4 5 6 Where M1,M2, M3 hve no similarity except they have a max string length of 7. Examples are mcw0045, adl0003, lei0101. Now, what I want to do is Function(M1, M2,
2006 Dec 13
2
(no subject)
Hi, Let us suppose I have a list x = list () x $ name1 = 1 x $ name2 = 'a' in the work environment. Let us suppose that in the body of a function I want to acces to a component of x by using its name as argument of that function. How can this by done? For instance, I was expecting f = function ( name ) x $ name to output 1 ( that is, x $ name1 ) when I command f ( name1 ) or f (
2006 Jan 20
3
Selecting data frame components by name - do you know a shorter way?
Hi! I suspect there must be an easy way to access components of a data frame by name, i.e. the input should look like "name1 name2 name3 ..." and the output be a data frame of those components with the corresponding names. I ´ve been trying for hours, but only found the long way to do it (which is not feasible, since I have lots of components to select):
2017 Jul 16
3
Arranging column data to create plots
Dear All, I need some help arranging data that was imported. The imported data frame looks something like this (the actual file is huge, so this is example data) DF: IDKey X1 Y1 X2 Y2 X3 Y3 X4 Y4 Name1 21 15 25 10 Name2 15 18 35 24 27 45 Name3 17 21 30 22 15 40 32 55 I would like to create a new data frame with the following NewDF: IDKey X Y Name1 21 15 Name1
2017 Jul 16
0
Arranging column data to create plots
On Sat, 15 Jul 2017, Michael Reed via R-help wrote: > Dear All, > > I need some help arranging data that was imported. It would be helpful if you were to use dput to give us the sample data since you say you have already imported it. > The imported data frame looks something like this (the actual file is > huge, so this is example data) > > DF: > IDKey X1 Y1 X2 Y2
2009 Jul 31
1
function problem
I have a series of columns that need to be evaluated in various tables. I need to apply a function in the following manner somers2(name1,name2). name1 is a vector of x inputs for the function which correspond to a vector of y inputs in name2. y<-rep(c(3,4,5,8),6) z<-rep(c(23,24,25,26,27,28),4) name1<-sprintf("Pred_pres_%s_indpdt[,%s,,]",x,y)
2012 Dec 14
5
A question on list and lapply
Dear all, let say I have following list: Dat <- vector("list", length = 26) names(Dat) <- LETTERS My_Function <- function(x) return(rnorm(5)) Dat1 <- lapply(Dat, My_Function) However I want to apply my function 'My_Function' for all elements of 'Dat' except the elements having 'names(Dat) == "P"'. Here I have specified the name
2000 Oct 16
2
renaming an object
Say I have a file called exp.batch which contains 2 cols The first col contains names of R objects the user would like to use. The second col contains the file names which will be read in using read.table i.e. exp.batch may look like this..... name1 complex/filename/path1.txt name2 complex/filename/path2.txt name3 complex/filename/path3.txt name4 complex/filename/path4.txt I want to have a
2009 Sep 04
2
transforming a badly organized data base into a list of data frames
Dear R-ers! I have a badly organized data base in Excel. Once I read it into R it looks like this (all variables become factors because of many spaces and other characters in Excel):