In [5]:
fname = "primerArchivo.txt"
# do cierra automáticamente el archivo cuando acaba de hacer operaciones con el.
# La opción w sirve para sobreescribir el archivo
open(fname,"w") do file
    write(file,"Hola mundo")
    write(file,"\n")
end


Out[5]:
1

In [8]:
# La opción a sirve para agregar al archivo
open(fname,"a") do file
    write(file,"Hola mundo 2")
    write(file,"\n")
end


Out[8]:
1

In [14]:
fname1 = "archivo.cvs"

open(fname1,"w") do file
    for i in 1:10
        cadena = "Nombre,$i,$(i*2),$(i*i)"
        write(file,string(cadena))
        write(file,"\n")
    end
end

In [60]:
data_demo = readcsv(fname1)


Out[60]:
10×4 Array{Any,2}:
 "Nombre"   1   2    1
 "Nombre"   2   4    4
 "Nombre"   3   6    9
 "Nombre"   4   8   16
 "Nombre"   5  10   25
 "Nombre"   6  12   36
 "Nombre"   7  14   49
 "Nombre"   8  16   64
 "Nombre"   9  18   81
 "Nombre"  10  20  100

In [61]:
using Plots
pyplot()
plot(1:10,data_demo[:,2:4])


Out[61]:

In [62]:
writedlm("nuevoCSV.csv",data_demo[:,2:4])

In [24]:
download("http://www.cofax.org/site/docs/sample-web.xml","archivoDescargado.xml")


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15762  100 15762    0     0  56752      0 --:--:-- --:--:-- --:--:-- 59033
Out[24]:
"archivoDescargado.xml"

In [26]:
Pkg.add("DataArrays")
using DataArrays


INFO: Cloning cache of DataArrays from https://github.com/JuliaStats/DataArrays.jl.git
INFO: Installing DataArrays v0.6.2
INFO: Building SpecialFunctions
INFO: Package database updated
INFO: Precompiling module DataArrays.
WARNING: using DataArrays.data in module Main conflicts with an existing identifier.

In [27]:
darr = @data([7.1,3.0,NA,5.02,8.32])


Out[27]:
5-element DataArrays.DataArray{Float64,1}:
 7.1 
 3.0 
  NA 
 5.02
 8.32

In [28]:
# Hay un problema cuando tiene valores faltantes e intentas hacer operaciones en el array
sum(darr)


Out[28]:
NA

In [29]:
# Una solución es quitar todos los valores faltantes
sum(dropna(darr))


Out[29]:
23.439999999999998

In [65]:
Pkg.add("DataFrames")


INFO: Cloning cache of DataFrames from https://github.com/JuliaData/DataFrames.jl.git
INFO: Cloning cache of FileIO from https://github.com/JuliaIO/FileIO.jl.git
INFO: Cloning cache of GZip from https://github.com/JuliaIO/GZip.jl.git
INFO: Cloning cache of SortingAlgorithms from https://github.com/JuliaCollections/SortingAlgorithms.jl.git
INFO: Installing DataFrames v0.10.1
INFO: Installing FileIO v0.5.2
INFO: Installing GZip v0.3.0
INFO: Installing SortingAlgorithms v0.2.0
INFO: Building SpecialFunctions
INFO: Package database updated

In [104]:
using DataFrames
dframe = DataFrame()
dframe = convert(DataFrame,data_demo[:,2:4])
rename!(dframe,:x1,:numero_inicial)
rename!(dframe,:x3,:numero_cuadrado)
rename!(dframe,:x2,:doble_numero)


Out[104]:
numero_inicialdoble_numeronumero_cuadrado
1121
2244
3369
44816
551025
661236
771449
881664
991881
101020100

In [108]:
#Crear dataFrame a través de archivos
fname_dataFrame = "wikidataEdit.csv"
data_frame_archivo = readtable(fname_dataFrame,separator = ',')
data_frame_archivo[:,2]


Out[108]:
53-element DataArrays.DataArray{Int64,1}:
 28634
 28635
 28607
 28539
 28476
 28454
 28388
 28295
 28220
 28147
 28073
 27952
 27929
     ⋮
  1835
  1437
  1201
   982
   779
   528
   309
   260
   239
   176
   130
    49

In [ ]:


In [ ]:


In [ ]: