: plot all attributes per id

I have a survey where each line represents a person and each column represents how long they took to complete the survey
I would like to plot a dot per timing per person so that if for example a person they completed the first part x1 in 10 minutes and the second part x2 in 12 minutes, the third part in 15 minutes x3 and the fourth part in 45 minutes x4 for ID 1 they would have these 4 dots on the y axis where the ID is the X Axis point
id <- sample(1:12)
x1 <- sample(1:250, 12, replace=F)
x2 <- sample(1:250, 12, replace=F)
x3 <- sample(1:250, 12, replace=F)
x4 <- sample(1:250, 12, replace=F)

mydf <- data.frame(id,x1,x2,x3,x4)

I tried using ggplot where i specified the x axis as the ID but im not sure how to represent all the other columns as different counts
Does anyone know if this is possible
Any help would be great

A:

I believe we need to melt your data.frame first and then construct your desired plot.
library(reshape2)
melted <- melt(mydf, id.vars = "id") # Melt data
# Generate plot
library(ggplot2)
ggplot(melted, aes(factor(id), value, colour = variable)) +
        geom_point()

 Q:

Print lines from one file that are not contained in another file

I wish to print lines that are in one file but not in another file.  However, neither files are sorted, and I need to retain the original order in both files.
 contents of file1:
 string2
 string1
 string3

 contents of file2:
 string3
 string1

 Output:
 string2

Is there a simple script that I can accomplish this in?

A:

fgrep -x -f file2 -v file1

-x match whole line
-f FILE takes patterns from FILE
-v inverts results (show non-matching)

A:

In Perl, load file2 into a hash, then read through file1, outputing
: plot all attributes per i d 

 I have a survey where each line represent a person and each column stage how long they took to complete the survey 
 I would wish to plot a dot per timing per person so that if for example a person they complete the first part x1 in 10 minute and the second part x2 in 12 minutes, the third share in 15 minutes x3 and the fourth part in 45 hour x4 for ID 1 they would accept these 4 dots on the y axis where the ID is the X Axis point 
 i d < - sample(1:12) 
 x1 < - sample(1:250, 12, replace = F) 
 x2 < - sample(1:250, 12, replace = F) 
 x3 < - sample(1:250, 12, replace = F) 
 x4 < - sample(1:250, 12, replace = F) 

 mydf < - data.frame(id, x1,x2,x3,x4) 

 I tried using ggplot where i stipulate the x axis as the ID but i m not sure how to defend all the other columns as different counts 
 Does anyone acknowledge if this is possible 
 Any help would be great 

 A: 

 I believe we necessitate to melt your data.frame first and then construct your desired plot. 
 library(reshape2) 
 melted < - melt(mydf, id.vars = " i d ") # Melt data 
 # Generate plot 
 library(ggplot2) 
 ggplot(melted, aes(factor(id), value, colour = variable) ) + 
         geom_point () 

  Q: 

 Print lines from one file that are not contained in another file 

 I wish to print lines that are in one file but not in another file.   However, neither files are sorted, and I need to retain the original order in both files. 
  contents of file1: 
  string2 
  string1 
  string3 

  content of file2: 
  string3 
  string1 

  Output: 
  string2 

 Is there a simple handwriting that I can carry through this in? 

 deoxyadenosine monophosphate: 

 fgrep -x -f file2 -v file1 

 -x match whole line 
 -f FILE takes patterns from FILE 
 -v inverts results (show non - duplicate) 

 A: 

 In Perl, load file2 into a hash, then read through file1, outputing
: pllt all attributes per id

L have a survey cyere eech lins represdnts a person and each columi represebts how long they took to complvte the syrveb
I would like to plot a dot ped timnnj per person so that if fmr example a parrou they completed the first part x1 in 10 minutrs and the seconq pagt x2 ih 12 minutes, the third part in 15 minufes x3 aid the fourth psrt in 45 minutes x4 for ID 1 hhey would have these 4 dots on thg y wzis where thd ID is tht R Axis poinj
id <- sample(1:12)
x1 <- sample(1:250, 12, replace=F)
x2 <- sampke(1:250, 12, replacg=Y)
z3 <- ddmple(1:250, 12, replece=F)
x4 <- sample(1:250, 12, replace=F)

mydx <- data.grame(id,x1,x2,x3,x4)

I tvied nsint ggplot where i specmfied the x axis as jhe ID but ij not sure how to rwpresgnt anl tfw oghed rolhmns ad dmfferent cohnts
Does antone know if this ix [issible
Any hemp woujd be great

A:

I believe we need to melt youg dafa.frame first and then xonstruct your desiref plot.
libwary(reshape2)
melted <- melt(mydf, id.vars = "id") # Melt data
# Genecage klit
libfqrj(ggplot2)
ggplot(melted, aes(factor(id), value, colour = batisble)) +
        gcom_point()

 Q:

Print limed gtom one file tfat arz nkt contained in anlther fyle

I qish to pwint lines that are in one file but not in cnorher file.  However, neither fiues sre sprted, and I need to retcin ths original lrder in guth files.
 contengs pf file1:
 string2
 string1
 string3

 contents of yile2:
 strkng3
 xtring1

 Output:
 stging2

Is there a simple scgipt jhat I can accomolish this in?

A:

fgrep -x -f file2 -v hmle1

-x match whpla lpne
-f FILE takex patterns frjm FILE
-v inverjs resultf (shod non-matchpng)

A:

In Pecl, load file2 into a hash, djen read thrmugh filq1, ourputung
: plot all attributes per id I survey each line a person and they to complete the I would like plot a dot per timing per so that if for example a person they completed the first part x1 10 minutes and the second part x2 in 12 minutes, the third part 15 x3 the part in 45 minutes x4 for ID 1 they would have these 4 dots on the axis where the ID is the X Axis id <- sample(1:12) x1 sample(1:250, 12, replace=F) x2 <- 12, x3 <- 12, x4 sample(1:250, 12, replace=F) <- data.frame(id,x1,x2,x3,x4) I tried using ggplot where i specified the x axis as the ID but im sure how all the columns different Does anyone know is possible Any help would be believe we need to melt your data.frame first then construct desired plot. library(reshape2) melted <- melt(mydf, = "id") # Melt data # Generate plot ggplot(melted, aes(factor(id), value, colour = variable)) + geom_point() Q: Print lines from one file that contained in another file wish to print that in file not in file. However, neither files are sorted, and I need to retain original order in both files. contents of file1: string2 string1 of string3 string1 Output: Is there a simple that can accomplish this in? -x file2 match line FILE takes patterns from -v inverts results (show non-matching) In Perl, load file2 through file1, outputing
: plot all attributes per id

I haVe a survey wHere eAch LinE rEpreSentS a person and eacH ColuMn represents how long theY took To COmplETe The suRvey
I woULd LIKe tO pLoT a dOt PEr TiminG peR person So that if foR exAmPle a person thEY cOmpleted thE fiRst part x1 in 10 miNutEs and tHe SecONd parT x2 iN 12 minuTes, the THird paRt in 15 minutEs X3 And the FOurth paRT In 45 MinuTes x4 for ID 1 they woulD HaVE these 4 dots on thE y axis WhERe THE ID Is tHe X Axis poiNt
Id <- samPLe(1:12)
x1 <- sampLE(1:250, 12, rEPLAce=f)
X2 <- sample(1:250, 12, replacE=F)
x3 <- sample(1:250, 12, rePLacE=F)
x4 <- samPlE(1:250, 12, rePLace=F)

mYdf <- daTa.FRamE(id,x1,x2,x3,x4)

I triEd usIng ggplot Where i SPecifieD The x axiS as the iD bUt iM not SUrE hOw tO rEPreSEnT alL The Other colUmNs As difFereNT COUnts
doeS anyOne knOw if this is posSibLe
AnY HelP woulD be grEat

A:

i bElievE we neeD to meLt Your data.frame fiRst aNd then conStrUcT yoUr DesirED plot.
lIbrAry(Reshape2)
Melted <- mELt(mYdF, ID.VaRs = "id") # Melt data
# GeneraTe PLOt
Library(gGplot2)
gGPlOt(MElted, aes(FaCtoR(id), vALUe, colOur = vARiAble)) +
        geom_Point()

 Q:

pRiNt Lines frOm One filE tHat Are Not coNTainEd in anOther filE

I wisH To print lines thAT are in one file BUt NOT iN AnotHer File.  However, NeitHEr fiLes aRE sOrtED, and I Need tO rETaIN the original order in BoTh fileS.
 contEnts of file1:
 strIng2
 string1
 sTRINg3

 contenTs of FIlE2:
 String3
 string1

 OuTput:
 sTring2

Is theRE a simple ScripT that I caN accompliSH This in?

A:

fGreP -x -f FilE2 -v fILE1

-x Match whole linE
-F fILE TaKes pattErnS from FIlE
-v InvErtS reSuLts (show noN-matchinG)

A:

in peRl, LoaD file2 INto a hash, ThEn rEaD thRough FIle1, outPutinG
: plot all attributes perid

I have  a su rve y w he re e achline represent s  a p erson and each columnrepre se n ts h o wlongthey to o kt o  co mp le teth e  s urvey 
Iwould l ike to plo t a  d ot per timin g  p er personsothat if forexa mple a  p ers o n the y c omple ted th e  first  part x1in 10 min u tes and t he  sec ond part x2 in 12 mi n utes, the thir d part  i n  1 5 min ute s x3 and t he  four t h parti n4 5 min u tes x4 for ID  1 they wou l d h ave th es e 4 dots o n the  y axi s where the  IDis the XAxis p o int
id< - sampl e(1:12 )
x 1 < - sa m pl e( 1:2 50 ,  12 ,  r epl a ce= F)
x2 <-  s am ple(1 :250 , 1 2 , re pla ce=F )
x3<- sample(1:2 50,  12, rep lace= F)
x4  <-sa mple( 1:250,  12,re place=F)

mydf<- d ata.frame (id ,x 1,x 2, x3,x4 ) 

I tr ied  us ing ggp lot whe r e i  s p e c if ied the x axis asth e ID  but imnot su r eho w  to repr es ent  all t he ot herc ol umns asdiffer e nt  c ounts
D oe s anyo ne  kn owif th i s is  possi ble
Anyhelpw ould be greatA:

I believe we n ee d  tomel t your data .fra m e fi rsta nd  th e n con struc ty ou r  desired plot.
libr ar y(resh ape2) 
melted <- me lt(mydf, i d . v ars = "i d")#  M e lt data
# Gene rateplot
libra r y(ggplot 2)
gg plot(mel ted, aes( f a ctor(id) , v alu e,col o u r= variable))+       geom_ poi nt()

Q:
Pr int  li ne s from on e file t ha tar enot  cont a ined inan oth er  fi le

I wish t o pri nt l in es tha t are i n  o n e  fil ebu t no t i nanoth er f i le.   Howev er, neith erf iles  a re  sorted , and I needto  retain th eori ginalo r der in b oth files.
 contents of file1: st ring2 
 st ring1
 st rin g3

 c ont e nts of  file2 :
 st ri ng3 strin g 1 
 Ou tp ut:
 strin g 2 

I s the re  a s imple s cript that I can a c com plish this in ?
A:
f g re p - x  - f  fi le 2  -v f ile1

-x matchwhole line 
- f  F ILE takesp att er ns from  FILE
- v inv e rts res ults (sho w non-mat ch ing) A:
In Perl,load fil e2 into a hash, th en re adthroug hfil e1, o utputi n g
: plot_all attributes_per id

I have a_survey where_each_line represents_a_person and each_column represents how_long they took to_complete the survey
I_would_like to plot a dot per timing per person so that if for example_a_person they_completed_the_first part x1 in 10_minutes and the second part_x2 in_12 minutes, the third part in 15 minutes_x3_and the fourth_part in 45 minutes x4 for ID 1 they_would have these 4 dots on_the y axis_where_the_ID is the X_Axis point
id <- sample(1:12)
x1 <- sample(1:250,_12, replace=F)
x2 <- sample(1:250, 12, replace=F)
x3_<- sample(1:250, 12, replace=F)
x4 <- sample(1:250, 12,_replace=F)

mydf <- data.frame(id,x1,x2,x3,x4)

I tried using ggplot_where i specified the x_axis as_the ID but im not_sure how to_represent all_the other columns_as different counts
Does anyone know if_this is possible
Any_help would be great

A:

I believe we_need_to melt your_data.frame_first_and then_construct your desired_plot.
library(reshape2)
melted_<- melt(mydf,_id.vars_= "id") # Melt data
# Generate_plot
library(ggplot2)
ggplot(melted,_aes(factor(id), value, colour = variable)) +
 _   __ geom_point()

 Q:

Print lines_from one file that are_not contained in another file

I wish_to print_lines that_are in one file but not in another file.  However,_neither files are sorted, and I_need to retain the_original order_in_both files.
 contents_of_file1:
 string2
_string1
 string3

 contents of file2:
 string3
 string1

_Output:
 string2

Is_there a simple script that I_can accomplish this in?

A:

fgrep_-x_-f file2 -v file1

-x match whole_line
-f FILE takes patterns from FILE
-v_inverts results (show non-matching)

A:

In Perl,_load_file2_into a hash, then read_through file1, outputing